@odoo/o-spreadsheet 19.3.3 → 19.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/o_spreadsheet.cjs +944 -865
- package/dist/o_spreadsheet.css +3 -3
- package/dist/o_spreadsheet.esm.js +944 -865
- package/dist/o_spreadsheet.iife.js +946 -867
- package/dist/o_spreadsheet.min.iife.js +387 -387
- package/dist/o_spreadsheet.xml +6 -5
- package/dist/types/components/menu/menu.d.ts +5 -0
- package/dist/types/components/side_panel/chart/chart_type_picker/chart_type_picker.d.ts +3 -1
- package/dist/types/helpers/figures/chart.d.ts +1 -2
- package/dist/types/helpers/pivot/pivot_composer_helpers.d.ts +4 -0
- package/dist/types/plugins/ui_core_views/pivot_ui.d.ts +17 -8
- package/package.json +17 -17
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 19.3.
|
|
6
|
-
* @date 2026-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 19.3.5
|
|
6
|
+
* @date 2026-05-27T06:08:23.138Z
|
|
7
|
+
* @hash 0cf1540
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { App, Component, blockDom, markRaw, onMounted, onPatched, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, whenReady, xml } from "@odoo/owl";
|
|
@@ -16,7 +16,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
16
16
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17
17
|
var __getProtoOf = Object.getPrototypeOf;
|
|
18
18
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
20
20
|
var __exportAll = (all, no_symbols) => {
|
|
21
21
|
let target = {};
|
|
22
22
|
for (var name in all) {
|
|
@@ -461,13 +461,6 @@ const borderStyles = [
|
|
|
461
461
|
function isMatrix(x) {
|
|
462
462
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
463
463
|
}
|
|
464
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
465
|
-
DIRECTION["UP"] = "up";
|
|
466
|
-
DIRECTION["DOWN"] = "down";
|
|
467
|
-
DIRECTION["LEFT"] = "left";
|
|
468
|
-
DIRECTION["RIGHT"] = "right";
|
|
469
|
-
return DIRECTION;
|
|
470
|
-
}({});
|
|
471
464
|
|
|
472
465
|
//#endregion
|
|
473
466
|
//#region src/helpers/misc.ts
|
|
@@ -924,7 +917,8 @@ var TokenizingChars = class {
|
|
|
924
917
|
}
|
|
925
918
|
shift() {
|
|
926
919
|
const current = this.current;
|
|
927
|
-
|
|
920
|
+
const next = this.text[++this.currentIndex];
|
|
921
|
+
this.current = next;
|
|
928
922
|
return current;
|
|
929
923
|
}
|
|
930
924
|
advanceBy(length) {
|
|
@@ -2112,6 +2106,7 @@ var DependencyContainer = class extends EventBus {
|
|
|
2112
2106
|
}
|
|
2113
2107
|
};
|
|
2114
2108
|
var StoreFactory = class {
|
|
2109
|
+
get;
|
|
2115
2110
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
2116
2111
|
constructor(get) {
|
|
2117
2112
|
this.get = get;
|
|
@@ -2156,6 +2151,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
2156
2151
|
return MetaStore;
|
|
2157
2152
|
}
|
|
2158
2153
|
var DisposableStore = class {
|
|
2154
|
+
get;
|
|
2159
2155
|
disposeCallbacks = [];
|
|
2160
2156
|
constructor(get) {
|
|
2161
2157
|
this.get = get;
|
|
@@ -2259,6 +2255,7 @@ function addRenderingLayer(layer, priority) {
|
|
|
2259
2255
|
//#endregion
|
|
2260
2256
|
//#region src/stores/renderer_store.ts
|
|
2261
2257
|
var RendererStore = class {
|
|
2258
|
+
layers;
|
|
2262
2259
|
mutators = [
|
|
2263
2260
|
"register",
|
|
2264
2261
|
"unRegister",
|
|
@@ -2913,6 +2910,7 @@ function getAlternatingColorsPalette(quantity) {
|
|
|
2913
2910
|
else return ALTERNATING_COLORS_XL;
|
|
2914
2911
|
}
|
|
2915
2912
|
var ColorGenerator = class {
|
|
2913
|
+
preferredColors;
|
|
2916
2914
|
currentColorIndex = 0;
|
|
2917
2915
|
palette;
|
|
2918
2916
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -3309,6 +3307,7 @@ const _t = function(s, ...values) {
|
|
|
3309
3307
|
return sprintf(_translate(s), ...values);
|
|
3310
3308
|
};
|
|
3311
3309
|
var LazyTranslatedString = class extends String {
|
|
3310
|
+
values;
|
|
3312
3311
|
constructor(str, values) {
|
|
3313
3312
|
super(str);
|
|
3314
3313
|
this.values = values;
|
|
@@ -3338,6 +3337,8 @@ const CellErrorType = {
|
|
|
3338
3337
|
};
|
|
3339
3338
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3340
3339
|
var EvaluationError = class {
|
|
3340
|
+
message;
|
|
3341
|
+
value;
|
|
3341
3342
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3342
3343
|
this.message = message;
|
|
3343
3344
|
this.value = value;
|
|
@@ -3370,6 +3371,7 @@ var UnknownFunctionError = class extends EvaluationError {
|
|
|
3370
3371
|
}
|
|
3371
3372
|
};
|
|
3372
3373
|
var SplillBlockedError = class extends EvaluationError {
|
|
3374
|
+
errorOriginPosition;
|
|
3373
3375
|
constructor(message = _t("Spill range is not empty"), errorOriginPosition) {
|
|
3374
3376
|
super(message, CellErrorType.SpilledBlocked);
|
|
3375
3377
|
this.errorOriginPosition = errorOriginPosition;
|
|
@@ -5052,46 +5054,6 @@ function tokenizeInvalidRange(chars) {
|
|
|
5052
5054
|
|
|
5053
5055
|
//#endregion
|
|
5054
5056
|
//#region src/formulas/range_tokenizer.ts
|
|
5055
|
-
var State = /* @__PURE__ */ function(State) {
|
|
5056
|
-
/**
|
|
5057
|
-
* Initial state.
|
|
5058
|
-
* Expecting any reference for the left part of a range
|
|
5059
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5060
|
-
*/
|
|
5061
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
5062
|
-
/**
|
|
5063
|
-
* Expecting any reference for the right part of a range
|
|
5064
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
5065
|
-
*/
|
|
5066
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
5067
|
-
/**
|
|
5068
|
-
* Expecting the separator without any constraint on the right part
|
|
5069
|
-
*/
|
|
5070
|
-
State[State["Separator"] = 2] = "Separator";
|
|
5071
|
-
/**
|
|
5072
|
-
* Expecting the separator for a full column range
|
|
5073
|
-
*/
|
|
5074
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
5075
|
-
/**
|
|
5076
|
-
* Expecting the separator for a full row range
|
|
5077
|
-
*/
|
|
5078
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
5079
|
-
/**
|
|
5080
|
-
* Expecting the right part of a full column range
|
|
5081
|
-
* e.g. "1", "A1"
|
|
5082
|
-
*/
|
|
5083
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
5084
|
-
/**
|
|
5085
|
-
* Expecting the right part of a full row range
|
|
5086
|
-
* e.g. "A", "A1"
|
|
5087
|
-
*/
|
|
5088
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
5089
|
-
/**
|
|
5090
|
-
* Final state. A range has been matched
|
|
5091
|
-
*/
|
|
5092
|
-
State[State["Found"] = 7] = "Found";
|
|
5093
|
-
return State;
|
|
5094
|
-
}(State || {});
|
|
5095
5057
|
const goTo = (state, guard = () => true) => [{
|
|
5096
5058
|
goTo: state,
|
|
5097
5059
|
guard
|
|
@@ -5101,41 +5063,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
5101
5063
|
guard
|
|
5102
5064
|
});
|
|
5103
5065
|
const machine = {
|
|
5104
|
-
[
|
|
5105
|
-
REFERENCE: goTo(
|
|
5106
|
-
NUMBER: goTo(
|
|
5107
|
-
SYMBOL: [goToMulti(
|
|
5108
|
-
},
|
|
5109
|
-
[
|
|
5110
|
-
SPACE: goTo(
|
|
5111
|
-
OPERATOR: goTo(
|
|
5112
|
-
},
|
|
5113
|
-
[
|
|
5114
|
-
SPACE: goTo(
|
|
5115
|
-
OPERATOR: goTo(
|
|
5116
|
-
},
|
|
5117
|
-
[
|
|
5118
|
-
SPACE: goTo(
|
|
5119
|
-
OPERATOR: goTo(
|
|
5120
|
-
},
|
|
5121
|
-
[
|
|
5122
|
-
SPACE: goTo(
|
|
5123
|
-
NUMBER: goTo(
|
|
5124
|
-
REFERENCE: goTo(
|
|
5125
|
-
SYMBOL: goTo(
|
|
5126
|
-
},
|
|
5127
|
-
[
|
|
5128
|
-
SPACE: goTo(
|
|
5129
|
-
SYMBOL: goTo(
|
|
5130
|
-
REFERENCE: goTo(
|
|
5131
|
-
},
|
|
5132
|
-
[
|
|
5133
|
-
SPACE: goTo(
|
|
5134
|
-
NUMBER: goTo(
|
|
5135
|
-
REFERENCE: goTo(
|
|
5136
|
-
SYMBOL: goTo(
|
|
5137
|
-
},
|
|
5138
|
-
[
|
|
5066
|
+
[0]: {
|
|
5067
|
+
REFERENCE: goTo(2),
|
|
5068
|
+
NUMBER: goTo(4),
|
|
5069
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
5070
|
+
},
|
|
5071
|
+
[3]: {
|
|
5072
|
+
SPACE: goTo(3),
|
|
5073
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
5074
|
+
},
|
|
5075
|
+
[4]: {
|
|
5076
|
+
SPACE: goTo(4),
|
|
5077
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
5078
|
+
},
|
|
5079
|
+
[2]: {
|
|
5080
|
+
SPACE: goTo(2),
|
|
5081
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
5082
|
+
},
|
|
5083
|
+
[1]: {
|
|
5084
|
+
SPACE: goTo(1),
|
|
5085
|
+
NUMBER: goTo(7),
|
|
5086
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5087
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
5088
|
+
},
|
|
5089
|
+
[5]: {
|
|
5090
|
+
SPACE: goTo(5),
|
|
5091
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
5092
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
5093
|
+
},
|
|
5094
|
+
[6]: {
|
|
5095
|
+
SPACE: goTo(6),
|
|
5096
|
+
NUMBER: goTo(7),
|
|
5097
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
5098
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
5099
|
+
},
|
|
5100
|
+
[7]: {}
|
|
5139
5101
|
};
|
|
5140
5102
|
/**
|
|
5141
5103
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -5145,7 +5107,7 @@ const machine = {
|
|
|
5145
5107
|
*/
|
|
5146
5108
|
function matchReference(tokens) {
|
|
5147
5109
|
let head = 0;
|
|
5148
|
-
let transitions = machine[
|
|
5110
|
+
let transitions = machine[0];
|
|
5149
5111
|
let matchedTokens = "";
|
|
5150
5112
|
while (transitions !== void 0) {
|
|
5151
5113
|
const token = tokens[head++];
|
|
@@ -5154,7 +5116,7 @@ function matchReference(tokens) {
|
|
|
5154
5116
|
const nextState = transition ? transition.goTo : void 0;
|
|
5155
5117
|
switch (nextState) {
|
|
5156
5118
|
case void 0: return null;
|
|
5157
|
-
case
|
|
5119
|
+
case 7:
|
|
5158
5120
|
matchedTokens += token.value;
|
|
5159
5121
|
tokens.splice(0, head);
|
|
5160
5122
|
return {
|
|
@@ -5853,8 +5815,13 @@ function getApplyRangeChangeAddColRow(cmd) {
|
|
|
5853
5815
|
changeType: "NONE",
|
|
5854
5816
|
range
|
|
5855
5817
|
};
|
|
5818
|
+
const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
|
|
5819
|
+
if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
|
|
5820
|
+
changeType: "RESIZE",
|
|
5821
|
+
range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
|
|
5822
|
+
};
|
|
5856
5823
|
if (cmd.position === "after") {
|
|
5857
|
-
if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
|
|
5824
|
+
if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
|
|
5858
5825
|
changeType: "RESIZE",
|
|
5859
5826
|
range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
|
|
5860
5827
|
};
|
|
@@ -6101,6 +6068,7 @@ function getRange(sheetXC, sheetId) {
|
|
|
6101
6068
|
//#endregion
|
|
6102
6069
|
//#region src/formulas/code_builder.ts
|
|
6103
6070
|
var FunctionCodeBuilder = class {
|
|
6071
|
+
scope;
|
|
6104
6072
|
code = "";
|
|
6105
6073
|
constructor(scope = new Scope()) {
|
|
6106
6074
|
this.scope = scope;
|
|
@@ -6116,6 +6084,8 @@ var FunctionCodeBuilder = class {
|
|
|
6116
6084
|
}
|
|
6117
6085
|
};
|
|
6118
6086
|
var FunctionCodeImpl = class {
|
|
6087
|
+
scope;
|
|
6088
|
+
returnExpression;
|
|
6119
6089
|
code;
|
|
6120
6090
|
constructor(scope, code, returnExpression) {
|
|
6121
6091
|
this.scope = scope;
|
|
@@ -6198,6 +6168,13 @@ const collator = new Intl.Collator("en", { sensitivity: "accent" });
|
|
|
6198
6168
|
* without recompiling it (for example when the formula is copied to another cell, or when we want to replace literal values but keep the same structure).
|
|
6199
6169
|
* */
|
|
6200
6170
|
var CompiledFormula = class CompiledFormula {
|
|
6171
|
+
sheetId;
|
|
6172
|
+
tokens;
|
|
6173
|
+
literalValues;
|
|
6174
|
+
symbols;
|
|
6175
|
+
isBadExpression;
|
|
6176
|
+
normalizedFormula;
|
|
6177
|
+
execute;
|
|
6201
6178
|
rangeDependencies;
|
|
6202
6179
|
hasDependencies;
|
|
6203
6180
|
constructor(sheetId, tokens, literalValues, symbols, dependencies, isBadExpression, normalizedFormula, execute) {
|
|
@@ -7803,7 +7780,7 @@ var DispatchResult = class {
|
|
|
7803
7780
|
constructor(results = []) {
|
|
7804
7781
|
if (!Array.isArray(results)) results = [results];
|
|
7805
7782
|
results = [...new Set(results)];
|
|
7806
|
-
this.reasons = results.filter((result) => result !==
|
|
7783
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
7807
7784
|
}
|
|
7808
7785
|
/**
|
|
7809
7786
|
* Static helper which returns a successful DispatchResult
|
|
@@ -8001,7 +7978,7 @@ urlRegistry.add("sheet_URL", {
|
|
|
8001
7978
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
8002
7979
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
8003
7980
|
sheetIdTo: sheetId
|
|
8004
|
-
}).isCancelledBecause(
|
|
7981
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
8005
7982
|
type: "warning",
|
|
8006
7983
|
sticky: false,
|
|
8007
7984
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -8135,22 +8112,22 @@ function _createEvaluatedCell(functionResult, locale, position, cell) {
|
|
|
8135
8112
|
return textCell(value, format, formattedValue, position);
|
|
8136
8113
|
}
|
|
8137
8114
|
function isNumberResult(result) {
|
|
8138
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8115
|
+
return !!result && getEvaluatedCellType(result) === "number";
|
|
8139
8116
|
}
|
|
8140
8117
|
function isTextResult(result) {
|
|
8141
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8118
|
+
return !!result && getEvaluatedCellType(result) === "text";
|
|
8142
8119
|
}
|
|
8143
8120
|
function isErrorResult(result) {
|
|
8144
|
-
return !!result && getEvaluatedCellType(result) ===
|
|
8121
|
+
return !!result && getEvaluatedCellType(result) === "error";
|
|
8145
8122
|
}
|
|
8146
8123
|
function getEvaluatedCellType({ value, format }) {
|
|
8147
|
-
if (value === null) return
|
|
8148
|
-
else if (isEvaluationError(value)) return
|
|
8149
|
-
else if (isTextFormat(format)) return
|
|
8124
|
+
if (value === null) return "empty";
|
|
8125
|
+
else if (isEvaluationError(value)) return "error";
|
|
8126
|
+
else if (isTextFormat(format)) return "text";
|
|
8150
8127
|
switch (typeof value) {
|
|
8151
|
-
case "number": return
|
|
8152
|
-
case "boolean": return
|
|
8153
|
-
case "string": return
|
|
8128
|
+
case "number": return "number";
|
|
8129
|
+
case "boolean": return "boolean";
|
|
8130
|
+
case "string": return "text";
|
|
8154
8131
|
}
|
|
8155
8132
|
}
|
|
8156
8133
|
function textCell(value, format, formattedValue, position) {
|
|
@@ -8159,7 +8136,7 @@ function textCell(value, format, formattedValue, position) {
|
|
|
8159
8136
|
format,
|
|
8160
8137
|
formattedValue,
|
|
8161
8138
|
position,
|
|
8162
|
-
type:
|
|
8139
|
+
type: "text",
|
|
8163
8140
|
isAutoSummable: true,
|
|
8164
8141
|
defaultAlign: "left"
|
|
8165
8142
|
};
|
|
@@ -8170,7 +8147,7 @@ function numberCell(value, format, formattedValue, position) {
|
|
|
8170
8147
|
format,
|
|
8171
8148
|
formattedValue,
|
|
8172
8149
|
position,
|
|
8173
|
-
type:
|
|
8150
|
+
type: "number",
|
|
8174
8151
|
isAutoSummable: true,
|
|
8175
8152
|
defaultAlign: "right"
|
|
8176
8153
|
};
|
|
@@ -8180,7 +8157,7 @@ const emptyCell = memoize(function emptyCell(format) {
|
|
|
8180
8157
|
value: null,
|
|
8181
8158
|
format,
|
|
8182
8159
|
formattedValue: "",
|
|
8183
|
-
type:
|
|
8160
|
+
type: "empty",
|
|
8184
8161
|
isAutoSummable: true,
|
|
8185
8162
|
defaultAlign: "left"
|
|
8186
8163
|
};
|
|
@@ -8191,7 +8168,7 @@ function dateTimeCell(value, format, formattedValue, position) {
|
|
|
8191
8168
|
format,
|
|
8192
8169
|
formattedValue,
|
|
8193
8170
|
position,
|
|
8194
|
-
type:
|
|
8171
|
+
type: "number",
|
|
8195
8172
|
isAutoSummable: false,
|
|
8196
8173
|
defaultAlign: "right"
|
|
8197
8174
|
};
|
|
@@ -8202,7 +8179,7 @@ function booleanCell(value, format, formattedValue, position) {
|
|
|
8202
8179
|
format,
|
|
8203
8180
|
formattedValue,
|
|
8204
8181
|
position,
|
|
8205
|
-
type:
|
|
8182
|
+
type: "boolean",
|
|
8206
8183
|
isAutoSummable: false,
|
|
8207
8184
|
defaultAlign: "center"
|
|
8208
8185
|
};
|
|
@@ -8213,7 +8190,7 @@ function errorCell(value, message, position, errorOriginPosition) {
|
|
|
8213
8190
|
formattedValue: value,
|
|
8214
8191
|
message,
|
|
8215
8192
|
position,
|
|
8216
|
-
type:
|
|
8193
|
+
type: "error",
|
|
8217
8194
|
isAutoSummable: false,
|
|
8218
8195
|
defaultAlign: "center",
|
|
8219
8196
|
errorOriginPosition
|
|
@@ -9145,6 +9122,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
|
9145
9122
|
ROUNDDOWN: [{
|
|
9146
9123
|
type: "NUMBER",
|
|
9147
9124
|
value: 0
|
|
9125
|
+
}],
|
|
9126
|
+
IFERROR: [{
|
|
9127
|
+
type: "NUMBER",
|
|
9128
|
+
value: 0
|
|
9148
9129
|
}]
|
|
9149
9130
|
};
|
|
9150
9131
|
/**
|
|
@@ -9456,15 +9437,15 @@ function chartMutedFontColor(backgroundColor) {
|
|
|
9456
9437
|
return relativeLuminance(backgroundColor) < .3 ? "#C8C8C8" : "#666666";
|
|
9457
9438
|
}
|
|
9458
9439
|
function checkDataset(dataSource) {
|
|
9459
|
-
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
9460
|
-
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
9461
|
-
return
|
|
9440
|
+
if (dataSource.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
9441
|
+
if (dataSource.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
9442
|
+
return "Success";
|
|
9462
9443
|
}
|
|
9463
9444
|
function checkLabelRange(dataSource) {
|
|
9464
9445
|
if (dataSource.labelRange) {
|
|
9465
|
-
if (!rangeReference.test(dataSource.labelRange || "")) return
|
|
9446
|
+
if (!rangeReference.test(dataSource.labelRange || "")) return "InvalidLabelRange";
|
|
9466
9447
|
}
|
|
9467
|
-
return
|
|
9448
|
+
return "Success";
|
|
9468
9449
|
}
|
|
9469
9450
|
function shouldRemoveFirstLabel(numberOfLabels, numberOfDataPoints, dataSetsHaveTitle) {
|
|
9470
9451
|
return dataSetsHaveTitle && !!numberOfDataPoints && numberOfLabels >= numberOfDataPoints;
|
|
@@ -11129,7 +11110,7 @@ var AbstractChart = class {
|
|
|
11129
11110
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
11130
11111
|
function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
|
|
11131
11112
|
if (!baseline) return "";
|
|
11132
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
11113
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
11133
11114
|
if (humanizeNumbers) return humanizeNumber(baseline, locale);
|
|
11134
11115
|
return baseline.formattedValue;
|
|
11135
11116
|
}
|
|
@@ -11158,23 +11139,23 @@ function getKeyValueText(keyValueCell, humanizeNumbers, locale) {
|
|
|
11158
11139
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
11159
11140
|
}
|
|
11160
11141
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
11161
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
11142
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
11162
11143
|
const diff = keyValue.value - baseline.value;
|
|
11163
11144
|
if (diff > 0) return colorUp;
|
|
11164
11145
|
else if (diff < 0) return colorDown;
|
|
11165
11146
|
}
|
|
11166
11147
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
11167
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
11148
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
11168
11149
|
const diff = keyValue.value - baseline.value;
|
|
11169
11150
|
if (diff > 0) return "up";
|
|
11170
11151
|
else if (diff < 0) return "down";
|
|
11171
11152
|
return "neutral";
|
|
11172
11153
|
}
|
|
11173
11154
|
function checkKeyValue(definition) {
|
|
11174
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
11155
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
11175
11156
|
}
|
|
11176
11157
|
function checkBaseline(definition) {
|
|
11177
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
11158
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
11178
11159
|
}
|
|
11179
11160
|
const Path2DConstructor = globalThis.Path2D;
|
|
11180
11161
|
const arrowDownPath = Path2DConstructor && new Path2DConstructor("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
|
|
@@ -11433,6 +11414,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
11433
11414
|
}, runtime).computeDesign();
|
|
11434
11415
|
}
|
|
11435
11416
|
var ScorecardChartConfigBuilder = class {
|
|
11417
|
+
runtime;
|
|
11436
11418
|
context;
|
|
11437
11419
|
width;
|
|
11438
11420
|
height;
|
|
@@ -12760,15 +12742,6 @@ function schemeToColorScale(scheme) {
|
|
|
12760
12742
|
};
|
|
12761
12743
|
}
|
|
12762
12744
|
|
|
12763
|
-
//#endregion
|
|
12764
|
-
//#region src/types/clipboard.ts
|
|
12765
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
12766
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
12767
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
12768
|
-
ClipboardMIMEType["Image"] = "image";
|
|
12769
|
-
return ClipboardMIMEType;
|
|
12770
|
-
}({});
|
|
12771
|
-
|
|
12772
12745
|
//#endregion
|
|
12773
12746
|
//#region src/types/conditional_formatting.ts
|
|
12774
12747
|
const cfOperators = [
|
|
@@ -15076,7 +15049,7 @@ const BarChart = {
|
|
|
15076
15049
|
copyInSheetId: (definition) => definition,
|
|
15077
15050
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15078
15051
|
transformDefinition: (definition) => definition,
|
|
15079
|
-
validateDefinition: () =>
|
|
15052
|
+
validateDefinition: () => "Success",
|
|
15080
15053
|
updateRanges: (definition) => definition,
|
|
15081
15054
|
getContextCreation: (definition) => definition,
|
|
15082
15055
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15141,42 +15114,42 @@ const BarChart = {
|
|
|
15141
15114
|
//#endregion
|
|
15142
15115
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
15143
15116
|
function isDataRangeValid(definition) {
|
|
15144
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
15117
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
15145
15118
|
}
|
|
15146
15119
|
function checkRangeLimits(check, batchValidations) {
|
|
15147
15120
|
return batchValidations((definition) => {
|
|
15148
15121
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
15149
|
-
return
|
|
15122
|
+
return "Success";
|
|
15150
15123
|
}, (definition) => {
|
|
15151
15124
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
15152
|
-
return
|
|
15125
|
+
return "Success";
|
|
15153
15126
|
});
|
|
15154
15127
|
}
|
|
15155
15128
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
15156
15129
|
return batchValidations((definition) => {
|
|
15157
15130
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
15158
|
-
return
|
|
15131
|
+
return "Success";
|
|
15159
15132
|
}, (definition) => {
|
|
15160
15133
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
15161
|
-
return
|
|
15134
|
+
return "Success";
|
|
15162
15135
|
});
|
|
15163
15136
|
}
|
|
15164
15137
|
function checkEmpty(value, valueName) {
|
|
15165
15138
|
if (value === "") switch (valueName) {
|
|
15166
|
-
case "rangeMin": return
|
|
15167
|
-
case "rangeMax": return
|
|
15139
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
15140
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
15168
15141
|
}
|
|
15169
|
-
return
|
|
15142
|
+
return "Success";
|
|
15170
15143
|
}
|
|
15171
15144
|
function checkValueIsNumberOrFormula(value, valueName) {
|
|
15172
|
-
if (value.startsWith("=")) return
|
|
15145
|
+
if (value.startsWith("=")) return "Success";
|
|
15173
15146
|
if (isNaN(value)) switch (valueName) {
|
|
15174
|
-
case "rangeMin": return
|
|
15175
|
-
case "rangeMax": return
|
|
15176
|
-
case "lowerInflectionPointValue": return
|
|
15177
|
-
case "upperInflectionPointValue": return
|
|
15147
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
15148
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
15149
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
15150
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
15178
15151
|
}
|
|
15179
|
-
return
|
|
15152
|
+
return "Success";
|
|
15180
15153
|
}
|
|
15181
15154
|
const GaugeChart = {
|
|
15182
15155
|
sequence: 50,
|
|
@@ -15298,7 +15271,7 @@ const GaugeChart = {
|
|
|
15298
15271
|
col: dataRange.zone.left,
|
|
15299
15272
|
row: dataRange.zone.top
|
|
15300
15273
|
});
|
|
15301
|
-
if (cell.type ===
|
|
15274
|
+
if (cell.type === "number") {
|
|
15302
15275
|
gaugeValue = cell.value;
|
|
15303
15276
|
formattedValue = cell.formattedValue;
|
|
15304
15277
|
format = cell.format;
|
|
@@ -15432,7 +15405,7 @@ const LineChart = {
|
|
|
15432
15405
|
copyInSheetId: (definition) => definition,
|
|
15433
15406
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15434
15407
|
transformDefinition: (definition) => definition,
|
|
15435
|
-
validateDefinition: () =>
|
|
15408
|
+
validateDefinition: () => "Success",
|
|
15436
15409
|
updateRanges: (definition) => definition,
|
|
15437
15410
|
getContextCreation: (definition) => definition,
|
|
15438
15411
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15516,7 +15489,7 @@ const PieChart = {
|
|
|
15516
15489
|
copyInSheetId: (definition) => definition,
|
|
15517
15490
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15518
15491
|
transformDefinition: (definition) => definition,
|
|
15519
|
-
validateDefinition: () =>
|
|
15492
|
+
validateDefinition: () => "Success",
|
|
15520
15493
|
updateRanges: (definition) => definition,
|
|
15521
15494
|
getContextCreation: (definition) => definition,
|
|
15522
15495
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -15595,7 +15568,7 @@ const WaterfallChart = {
|
|
|
15595
15568
|
copyInSheetId: (definition) => definition,
|
|
15596
15569
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
15597
15570
|
transformDefinition: (definition) => definition,
|
|
15598
|
-
validateDefinition: () =>
|
|
15571
|
+
validateDefinition: () => "Success",
|
|
15599
15572
|
updateRanges: (definition) => definition,
|
|
15600
15573
|
getContextCreation: (definition) => definition,
|
|
15601
15574
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -16907,6 +16880,10 @@ var GaugeChartComponent = class extends Component {
|
|
|
16907
16880
|
* Animation interpolating values using the ease-out quartic curve function (chartJS default easing)
|
|
16908
16881
|
*/
|
|
16909
16882
|
var Animation = class {
|
|
16883
|
+
startValue;
|
|
16884
|
+
endValue;
|
|
16885
|
+
duration;
|
|
16886
|
+
callback;
|
|
16910
16887
|
startTime = void 0;
|
|
16911
16888
|
animationFrameId = null;
|
|
16912
16889
|
constructor(startValue, endValue, duration, callback) {
|
|
@@ -17135,6 +17112,10 @@ var Menu = class extends Component {
|
|
|
17135
17112
|
onKeyDown: {
|
|
17136
17113
|
type: Function,
|
|
17137
17114
|
optional: true
|
|
17115
|
+
},
|
|
17116
|
+
disableKeyboardNavigation: {
|
|
17117
|
+
type: Boolean,
|
|
17118
|
+
optional: true
|
|
17138
17119
|
}
|
|
17139
17120
|
};
|
|
17140
17121
|
static components = {};
|
|
@@ -17142,7 +17123,7 @@ var Menu = class extends Component {
|
|
|
17142
17123
|
menuRef = useRef("menu");
|
|
17143
17124
|
setup() {
|
|
17144
17125
|
useEffect(() => {
|
|
17145
|
-
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el) {
|
|
17126
|
+
if (this.props.hoveredMenuId && this.props.isHoveredMenuFocused && this.menuRef.el && !this.props.disableKeyboardNavigation) {
|
|
17146
17127
|
const selector = `[data-name='${this.props.hoveredMenuId}']`;
|
|
17147
17128
|
this.menuRef.el.querySelector(selector)?.focus();
|
|
17148
17129
|
}
|
|
@@ -17377,6 +17358,11 @@ var Popover = class extends Component {
|
|
|
17377
17358
|
}
|
|
17378
17359
|
};
|
|
17379
17360
|
var PopoverPositionContext = class {
|
|
17361
|
+
anchorRect;
|
|
17362
|
+
containerRect;
|
|
17363
|
+
propsMaxSize;
|
|
17364
|
+
spreadsheetOffset;
|
|
17365
|
+
lastPosition;
|
|
17380
17366
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset, lastPosition) {
|
|
17381
17367
|
this.anchorRect = anchorRect;
|
|
17382
17368
|
this.containerRect = containerRect;
|
|
@@ -17571,7 +17557,8 @@ var MenuPopover = class MenuPopover extends Component {
|
|
|
17571
17557
|
onScroll: this.onScroll.bind(this),
|
|
17572
17558
|
onKeyDown: this.onKeydown.bind(this),
|
|
17573
17559
|
hoveredMenuId,
|
|
17574
|
-
isHoveredMenuFocused: !this.subMenu.isOpen
|
|
17560
|
+
isHoveredMenuFocused: !this.subMenu.isOpen,
|
|
17561
|
+
disableKeyboardNavigation: this.props.disableKeyboardNavigation
|
|
17575
17562
|
};
|
|
17576
17563
|
}
|
|
17577
17564
|
get subMenuAnchorRect() {
|
|
@@ -18430,26 +18417,26 @@ var DelayedHoveredCellStore = class extends SpreadsheetStore {
|
|
|
18430
18417
|
//#region src/components/translations_terms.ts
|
|
18431
18418
|
const CfTerms = {
|
|
18432
18419
|
Errors: {
|
|
18433
|
-
[
|
|
18434
|
-
[
|
|
18435
|
-
[
|
|
18436
|
-
[
|
|
18437
|
-
[
|
|
18438
|
-
[
|
|
18439
|
-
[
|
|
18440
|
-
[
|
|
18441
|
-
[
|
|
18442
|
-
[
|
|
18443
|
-
[
|
|
18444
|
-
[
|
|
18445
|
-
[
|
|
18446
|
-
[
|
|
18447
|
-
[
|
|
18448
|
-
[
|
|
18449
|
-
[
|
|
18450
|
-
[
|
|
18451
|
-
[
|
|
18452
|
-
[
|
|
18420
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18421
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
18422
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
18423
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
18424
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
18425
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
18426
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
18427
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
18428
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
18429
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
18430
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
18431
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
18432
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
18433
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
18434
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
18435
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
18436
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
18437
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
18438
|
+
["EmptyTarget"]: _t("Target must contain at least one zone"),
|
|
18439
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
18453
18440
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
18454
18441
|
},
|
|
18455
18442
|
ColorScale: _t("Color scale"),
|
|
@@ -18468,17 +18455,17 @@ const ChartTerms = {
|
|
|
18468
18455
|
AggregatedChart: _t("Aggregate"),
|
|
18469
18456
|
Errors: {
|
|
18470
18457
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
18471
|
-
[
|
|
18472
|
-
[
|
|
18473
|
-
[
|
|
18474
|
-
[
|
|
18475
|
-
[
|
|
18476
|
-
[
|
|
18477
|
-
[
|
|
18478
|
-
[
|
|
18479
|
-
[
|
|
18480
|
-
[
|
|
18481
|
-
[
|
|
18458
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
18459
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
18460
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
18461
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
18462
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
18463
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
18464
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
18465
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
18466
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
18467
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
18468
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
18482
18469
|
},
|
|
18483
18470
|
ColorScales: {
|
|
18484
18471
|
blues: _t("Blues"),
|
|
@@ -18498,16 +18485,16 @@ const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerg
|
|
|
18498
18485
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
18499
18486
|
const SplitToColumnsTerms = { Errors: {
|
|
18500
18487
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
18501
|
-
[
|
|
18502
|
-
[
|
|
18503
|
-
[
|
|
18488
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
18489
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
18490
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
18504
18491
|
} };
|
|
18505
18492
|
const RemoveDuplicateTerms = { Errors: {
|
|
18506
18493
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
18507
|
-
[
|
|
18508
|
-
[
|
|
18509
|
-
[
|
|
18510
|
-
[
|
|
18494
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
18495
|
+
["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
|
|
18496
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
18497
|
+
["WillRemoveExistingMerge"]: _t("This operation is not possible due to a merge. Please remove the merges first than try again.")
|
|
18511
18498
|
} };
|
|
18512
18499
|
const DVTerms = {
|
|
18513
18500
|
DateIs: {
|
|
@@ -18535,19 +18522,19 @@ const DVTerms = {
|
|
|
18535
18522
|
positiveNumber: _t("The value must be a positive number")
|
|
18536
18523
|
},
|
|
18537
18524
|
Errors: {
|
|
18538
|
-
[
|
|
18539
|
-
[
|
|
18540
|
-
[
|
|
18525
|
+
["InvalidRange"]: _t("The range is invalid."),
|
|
18526
|
+
["InvalidDataValidationCriterionValue"]: _t("One or more of the provided criteria values are invalid. Please review and correct them."),
|
|
18527
|
+
["InvalidNumberOfCriterionValues"]: _t("One or more of the provided criteria values are missing."),
|
|
18541
18528
|
Unexpected: _t("The rule is invalid for an unknown reason.")
|
|
18542
18529
|
}
|
|
18543
18530
|
};
|
|
18544
18531
|
const TableTerms = {
|
|
18545
18532
|
Errors: {
|
|
18546
18533
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
18547
|
-
[
|
|
18548
|
-
[
|
|
18549
|
-
[
|
|
18550
|
-
[
|
|
18534
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
18535
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
18536
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
18537
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
18551
18538
|
},
|
|
18552
18539
|
Checkboxes: {
|
|
18553
18540
|
hasFilters: _t("Filter button"),
|
|
@@ -18871,6 +18858,7 @@ function getDateTimeFormat(locale) {
|
|
|
18871
18858
|
* Represent a raw XML string
|
|
18872
18859
|
*/
|
|
18873
18860
|
var XMLString = class {
|
|
18861
|
+
xmlString;
|
|
18874
18862
|
/**
|
|
18875
18863
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
18876
18864
|
*/
|
|
@@ -19221,30 +19209,6 @@ function prefixFormulaWithEqual(formula) {
|
|
|
19221
19209
|
|
|
19222
19210
|
//#endregion
|
|
19223
19211
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
19224
|
-
/**
|
|
19225
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
19226
|
-
*/
|
|
19227
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
19228
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
19229
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
19230
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
19231
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
19232
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
19233
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
19234
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
19235
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
19236
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
19237
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
19238
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
19239
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
19240
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
19241
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
19242
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
19243
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
19244
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
19245
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
19246
|
-
return WarningTypes;
|
|
19247
|
-
}({});
|
|
19248
19212
|
var XLSXImportWarningManager = class {
|
|
19249
19213
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
19250
19214
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -20004,7 +19968,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
20004
19968
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
20005
19969
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
20006
19970
|
} catch (e) {}
|
|
20007
|
-
warningManager.generateNotSupportedWarning(
|
|
19971
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
20008
19972
|
}
|
|
20009
19973
|
function isFormatSupported(format) {
|
|
20010
19974
|
try {
|
|
@@ -20089,20 +20053,20 @@ function convertFormats(data, warningManager) {
|
|
|
20089
20053
|
return arrayToObject(formats, 1);
|
|
20090
20054
|
}
|
|
20091
20055
|
function addStyleWarnings(font, fill, warningManager) {
|
|
20092
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
20093
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
20056
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
20057
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
20094
20058
|
}
|
|
20095
20059
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
20096
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
20060
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
20097
20061
|
}
|
|
20098
20062
|
function addBorderWarnings(border, warningManager) {
|
|
20099
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
20063
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
20100
20064
|
}
|
|
20101
20065
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
20102
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20066
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
20103
20067
|
}
|
|
20104
20068
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
20105
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
20069
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
20106
20070
|
}
|
|
20107
20071
|
|
|
20108
20072
|
//#endregion
|
|
@@ -20271,7 +20235,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
20271
20235
|
lower: icons.upper
|
|
20272
20236
|
};
|
|
20273
20237
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
20274
|
-
warningManager.generateNotSupportedWarning(
|
|
20238
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
20275
20239
|
switch (key) {
|
|
20276
20240
|
case "upper":
|
|
20277
20241
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -20307,13 +20271,13 @@ function convertIcons(xlsxIconSet, index) {
|
|
|
20307
20271
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
20308
20272
|
}
|
|
20309
20273
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
20310
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
20311
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
20274
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
20275
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
20312
20276
|
if (cf.cfRules[0].dxfId) {
|
|
20313
20277
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
20314
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
20315
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
20316
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
20278
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
20279
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
20280
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
20317
20281
|
}
|
|
20318
20282
|
}
|
|
20319
20283
|
|
|
@@ -20479,13 +20443,13 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20479
20443
|
if (!dv) continue;
|
|
20480
20444
|
switch (dv.type) {
|
|
20481
20445
|
case "time":
|
|
20482
|
-
warningManager.generateNotSupportedWarning(
|
|
20446
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
20483
20447
|
break;
|
|
20484
20448
|
case "textLength":
|
|
20485
|
-
warningManager.generateNotSupportedWarning(
|
|
20449
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
20486
20450
|
break;
|
|
20487
20451
|
case "whole":
|
|
20488
|
-
warningManager.generateNotSupportedWarning(
|
|
20452
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
20489
20453
|
break;
|
|
20490
20454
|
case "decimal":
|
|
20491
20455
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -20497,7 +20461,7 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
20497
20461
|
break;
|
|
20498
20462
|
case "date":
|
|
20499
20463
|
if (dv.operator === "notEqual") {
|
|
20500
|
-
warningManager.generateNotSupportedWarning(
|
|
20464
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
20501
20465
|
break;
|
|
20502
20466
|
}
|
|
20503
20467
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -20794,7 +20758,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
20794
20758
|
}
|
|
20795
20759
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
20796
20760
|
const label = link.display || cellValue;
|
|
20797
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
20761
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
20798
20762
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
20799
20763
|
}
|
|
20800
20764
|
function getSheetDims(sheet) {
|
|
@@ -23998,7 +23962,7 @@ function createEmptyExcelWorkbookData() {
|
|
|
23998
23962
|
//#endregion
|
|
23999
23963
|
//#region src/helpers/ui/paste_interactive.ts
|
|
24000
23964
|
const handleCopyPasteResult = (env, command) => {
|
|
24001
|
-
if (env.model.dispatch(command.type).isCancelledBecause(
|
|
23965
|
+
if (env.model.dispatch(command.type).isCancelledBecause("WillRemoveExistingMerge")) env.raiseError(MergeErrorMessage);
|
|
24002
23966
|
};
|
|
24003
23967
|
const PasteInteractiveContent = {
|
|
24004
23968
|
wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
|
|
@@ -24008,10 +23972,10 @@ const PasteInteractiveContent = {
|
|
|
24008
23972
|
};
|
|
24009
23973
|
function handlePasteResult(env, result) {
|
|
24010
23974
|
if (!result.isSuccessful) {
|
|
24011
|
-
if (result.reasons.includes(
|
|
24012
|
-
else if (result.reasons.includes(
|
|
24013
|
-
else if (result.reasons.includes(
|
|
24014
|
-
else if (result.reasons.includes(
|
|
23975
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
23976
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
23977
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
23978
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
24015
23979
|
}
|
|
24016
23980
|
}
|
|
24017
23981
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -24199,7 +24163,7 @@ var ErrorToolTip = class extends Component {
|
|
|
24199
24163
|
};
|
|
24200
24164
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
24201
24165
|
const cell = getters.getEvaluatedCell(position);
|
|
24202
|
-
if (cell.type ===
|
|
24166
|
+
if (cell.type === "error" && !!cell.message || getters.getInvalidDataValidationMessage(position)) return {
|
|
24203
24167
|
isOpen: true,
|
|
24204
24168
|
props: { cellPosition: position },
|
|
24205
24169
|
Component: ErrorToolTip,
|
|
@@ -24248,7 +24212,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24248
24212
|
sortDirection,
|
|
24249
24213
|
sortOptions
|
|
24250
24214
|
});
|
|
24251
|
-
if (result.isCancelledBecause(
|
|
24215
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
24252
24216
|
const { col, row } = anchor;
|
|
24253
24217
|
env.model.selection.selectZone({
|
|
24254
24218
|
cell: {
|
|
@@ -24259,7 +24223,7 @@ function interactiveSort(env, sheetId, anchor, zone, sortDirection, sortOptions)
|
|
|
24259
24223
|
});
|
|
24260
24224
|
env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
24261
24225
|
}
|
|
24262
|
-
if (result.isCancelledBecause(
|
|
24226
|
+
if (result.isCancelledBecause("SortZoneWithArrayFormulas")) {
|
|
24263
24227
|
const { col, row } = anchor;
|
|
24264
24228
|
env.model.selection.selectZone({
|
|
24265
24229
|
cell: {
|
|
@@ -26910,6 +26874,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
26910
26874
|
//#endregion
|
|
26911
26875
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
26912
26876
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
26877
|
+
args;
|
|
26913
26878
|
constructor(get, args) {
|
|
26914
26879
|
super(get);
|
|
26915
26880
|
this.args = args;
|
|
@@ -27813,6 +27778,7 @@ var DOMDndHelper = class {
|
|
|
27813
27778
|
}
|
|
27814
27779
|
};
|
|
27815
27780
|
var ContainerWrapper = class {
|
|
27781
|
+
el;
|
|
27816
27782
|
constructor(el) {
|
|
27817
27783
|
this.el = el;
|
|
27818
27784
|
}
|
|
@@ -27884,6 +27850,10 @@ var FocusStore = class {
|
|
|
27884
27850
|
* This plugin handles this internal state.
|
|
27885
27851
|
*/
|
|
27886
27852
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
27853
|
+
initialRanges;
|
|
27854
|
+
inputHasSingleRange;
|
|
27855
|
+
colors;
|
|
27856
|
+
disabledRanges;
|
|
27887
27857
|
mutators = [
|
|
27888
27858
|
"resetWithRanges",
|
|
27889
27859
|
"focusById",
|
|
@@ -29006,8 +28976,8 @@ var FilterMenu = class extends Component {
|
|
|
29006
28976
|
row,
|
|
29007
28977
|
col: position.col
|
|
29008
28978
|
});
|
|
29009
|
-
if (cell.type ===
|
|
29010
|
-
else if (cell.type ===
|
|
28979
|
+
if (cell.type === "text" || cell.type === "boolean") cellTypesCount.text++;
|
|
28980
|
+
else if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) cellTypesCount.date++;
|
|
29011
28981
|
else cellTypesCount.number++;
|
|
29012
28982
|
}
|
|
29013
28983
|
const max = Math.max(cellTypesCount.text, cellTypesCount.number, cellTypesCount.date);
|
|
@@ -29368,8 +29338,8 @@ function getPasteZones(target, content) {
|
|
|
29368
29338
|
}
|
|
29369
29339
|
function parseOSClipboardContent(content) {
|
|
29370
29340
|
let spreadsheetContent = void 0;
|
|
29371
|
-
if (content[
|
|
29372
|
-
const textContent = content[
|
|
29341
|
+
if (content["text/html"]) spreadsheetContent = getOSheetDataFromHTML(new DOMParser().parseFromString(content["text/html"], "text/html"));
|
|
29342
|
+
const textContent = content["text/plain"] || "";
|
|
29373
29343
|
let imageBlob = void 0;
|
|
29374
29344
|
if (!textContent.trim()) {
|
|
29375
29345
|
for (const type of AllowedImageMimeTypes) if (content[type]) {
|
|
@@ -29496,10 +29466,10 @@ function detectColumnType(cells) {
|
|
|
29496
29466
|
let detectedType = "empty";
|
|
29497
29467
|
for (const cell of cells) {
|
|
29498
29468
|
let type = null;
|
|
29499
|
-
if (cell.type ===
|
|
29469
|
+
if (cell.type === "number") if (cell.format && isDateTimeFormat(cell.format)) type = "date";
|
|
29500
29470
|
else if (cell.format?.includes("%")) type = "percentage";
|
|
29501
29471
|
else type = "number";
|
|
29502
|
-
else if (cell.type ===
|
|
29472
|
+
else if (cell.type === "text") type = "text";
|
|
29503
29473
|
if (type) {
|
|
29504
29474
|
const newCount = ++counts[type];
|
|
29505
29475
|
if (newCount > max) {
|
|
@@ -29534,7 +29504,7 @@ function isDatasetTitled(getters, column) {
|
|
|
29534
29504
|
col: column.zone.left,
|
|
29535
29505
|
row: column.zone.top
|
|
29536
29506
|
});
|
|
29537
|
-
return ![
|
|
29507
|
+
return !["number", "empty"].includes(titleCell.type);
|
|
29538
29508
|
}
|
|
29539
29509
|
/**
|
|
29540
29510
|
* Builds a chart definition for a single column selection. The logic to detect the chart type is as follows:
|
|
@@ -29857,8 +29827,8 @@ function interactiveCreateTable(env, sheetId, tableConfig = DEFAULT_TABLE_CONFIG
|
|
|
29857
29827
|
config: tableConfig,
|
|
29858
29828
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29859
29829
|
});
|
|
29860
|
-
if (result.isCancelledBecause(
|
|
29861
|
-
else if (result.isCancelledBecause(
|
|
29830
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29831
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29862
29832
|
return result;
|
|
29863
29833
|
}
|
|
29864
29834
|
|
|
@@ -29886,9 +29856,9 @@ async function paste$1(env, pasteOption) {
|
|
|
29886
29856
|
case "ok":
|
|
29887
29857
|
const clipboardId = env.model.getters.getClipboardId();
|
|
29888
29858
|
const target = env.model.getters.getSelectedZones();
|
|
29889
|
-
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
29859
|
+
if (clipboardId === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(env, target, pasteOption);
|
|
29890
29860
|
else await interactivePasteFromOS(env, target, parseOSClipboardContent(osClipboard.content), pasteOption);
|
|
29891
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29861
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29892
29862
|
break;
|
|
29893
29863
|
case "notImplemented":
|
|
29894
29864
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -32433,13 +32403,13 @@ var ChartRangeDataSourceComponent = class extends Component {
|
|
|
32433
32403
|
if (this.props.dataSource.type === "range") this.datasetOrientation = this.computeDatasetOrientation();
|
|
32434
32404
|
}
|
|
32435
32405
|
get errorMessages() {
|
|
32436
|
-
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
32406
|
+
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32437
32407
|
}
|
|
32438
32408
|
get isDatasetInvalid() {
|
|
32439
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32409
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32440
32410
|
}
|
|
32441
32411
|
get isLabelInvalid() {
|
|
32442
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32412
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32443
32413
|
}
|
|
32444
32414
|
get dataSetsHaveTitleLabel() {
|
|
32445
32415
|
return this.datasetOrientation === "rows" ? _t("Use col %(column_name)s as headers", { column_name: numberToLetters(this.calculateHeaderPosition() || 0) }) : _t("Use row %(row_position)s as headers", { row_position: this.calculateHeaderPosition() || "" });
|
|
@@ -32771,6 +32741,11 @@ var ChartRangeDataSourceComponent = class extends Component {
|
|
|
32771
32741
|
//#endregion
|
|
32772
32742
|
//#region src/helpers/figures/chart.ts
|
|
32773
32743
|
var SpreadsheetChart = class SpreadsheetChart {
|
|
32744
|
+
getters;
|
|
32745
|
+
sheetId;
|
|
32746
|
+
definition;
|
|
32747
|
+
chartTypeBuilder;
|
|
32748
|
+
dataSourceBuilder;
|
|
32774
32749
|
dataSource;
|
|
32775
32750
|
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
32776
32751
|
this.getters = getters;
|
|
@@ -32808,9 +32783,6 @@ var SpreadsheetChart = class SpreadsheetChart {
|
|
|
32808
32783
|
dataSource: newDataSource
|
|
32809
32784
|
};
|
|
32810
32785
|
}
|
|
32811
|
-
getSupportedChartTypes() {
|
|
32812
|
-
return new Set(this.dataSourceBuilder.supportedChartTypes);
|
|
32813
|
-
}
|
|
32814
32786
|
getRangeDefinition() {
|
|
32815
32787
|
return {
|
|
32816
32788
|
...this.definition,
|
|
@@ -32910,11 +32882,12 @@ const ChartRangeDataSourceHandler = {
|
|
|
32910
32882
|
type: "range",
|
|
32911
32883
|
dataSets: [],
|
|
32912
32884
|
dataSetsHaveTitle: false,
|
|
32885
|
+
labelRange: context.auxiliaryRange,
|
|
32913
32886
|
...context.dataSource
|
|
32914
32887
|
};
|
|
32915
32888
|
},
|
|
32916
32889
|
fromHierarchicalContextCreation(context) {
|
|
32917
|
-
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource
|
|
32890
|
+
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
|
|
32918
32891
|
type: "range",
|
|
32919
32892
|
dataSets: [],
|
|
32920
32893
|
dataSetsHaveTitle: false
|
|
@@ -33009,6 +32982,10 @@ const ChartRangeDataSourceHandler = {
|
|
|
33009
32982
|
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
33010
32983
|
};
|
|
33011
32984
|
},
|
|
32985
|
+
/**
|
|
32986
|
+
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
32987
|
+
* sheetIdTo.
|
|
32988
|
+
*/
|
|
33012
32989
|
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
33013
32990
|
return {
|
|
33014
32991
|
...dataSource,
|
|
@@ -33162,7 +33139,7 @@ const ChartNeverDataSourceHandler = {
|
|
|
33162
33139
|
fromExternalDefinition: () => ({ type: "none" }),
|
|
33163
33140
|
fromContextCreation: () => ({ type: "none" }),
|
|
33164
33141
|
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
33165
|
-
validate: () =>
|
|
33142
|
+
validate: () => "Success",
|
|
33166
33143
|
transform: () => ({ type: "none" }),
|
|
33167
33144
|
extractData: () => ({
|
|
33168
33145
|
dataSetsValues: [],
|
|
@@ -33497,10 +33474,10 @@ var GaugeChartConfigPanel = class extends Component {
|
|
|
33497
33474
|
state = useState({ dataRangeDispatchResult: void 0 });
|
|
33498
33475
|
dataRange = this.props.definition.dataRange;
|
|
33499
33476
|
get configurationErrorMessages() {
|
|
33500
|
-
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33477
|
+
return [...this.state.dataRangeDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33501
33478
|
}
|
|
33502
33479
|
get isDataRangeInvalid() {
|
|
33503
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33480
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33504
33481
|
}
|
|
33505
33482
|
onDataRangeChanged(ranges) {
|
|
33506
33483
|
this.dataRange = ranges[0];
|
|
@@ -33537,19 +33514,19 @@ var GaugeChartDesignPanel = class extends Component {
|
|
|
33537
33514
|
});
|
|
33538
33515
|
}
|
|
33539
33516
|
get designErrorMessages() {
|
|
33540
|
-
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !==
|
|
33517
|
+
return [...this.state.sectionRuleCancelledReasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33541
33518
|
}
|
|
33542
33519
|
get isRangeMinInvalid() {
|
|
33543
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33520
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMin") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMinNaN"));
|
|
33544
33521
|
}
|
|
33545
33522
|
get isRangeMaxInvalid() {
|
|
33546
|
-
return !!(this.state.sectionRuleCancelledReasons?.has(
|
|
33523
|
+
return !!(this.state.sectionRuleCancelledReasons?.has("EmptyGaugeRangeMax") || this.state.sectionRuleCancelledReasons?.has("GaugeRangeMaxNaN"));
|
|
33547
33524
|
}
|
|
33548
33525
|
get isLowerInflectionPointInvalid() {
|
|
33549
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33526
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeLowerInflectionPointNaN");
|
|
33550
33527
|
}
|
|
33551
33528
|
get isUpperInflectionPointInvalid() {
|
|
33552
|
-
return !!this.state.sectionRuleCancelledReasons?.has(
|
|
33529
|
+
return !!this.state.sectionRuleCancelledReasons?.has("GaugeUpperInflectionPointNaN");
|
|
33553
33530
|
}
|
|
33554
33531
|
updateSectionColor(target, color) {
|
|
33555
33532
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33613,10 +33590,10 @@ var GaugeChartDesignPanel = class extends Component {
|
|
|
33613
33590
|
}
|
|
33614
33591
|
checkSectionRuleFormulasAreValid(sectionRule) {
|
|
33615
33592
|
const reasons = /* @__PURE__ */ new Set();
|
|
33616
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add(
|
|
33617
|
-
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add(
|
|
33618
|
-
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add(
|
|
33619
|
-
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add(
|
|
33593
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMin)) reasons.add("GaugeRangeMinNaN");
|
|
33594
|
+
if (!this.valueIsValidNumber(sectionRule.rangeMax)) reasons.add("GaugeRangeMaxNaN");
|
|
33595
|
+
if (!this.valueIsValidNumber(sectionRule.lowerInflectionPoint.value)) reasons.add("GaugeLowerInflectionPointNaN");
|
|
33596
|
+
if (!this.valueIsValidNumber(sectionRule.upperInflectionPoint.value)) reasons.add("GaugeUpperInflectionPointNaN");
|
|
33620
33597
|
return reasons;
|
|
33621
33598
|
}
|
|
33622
33599
|
valueIsValidNumber(value) {
|
|
@@ -33956,13 +33933,13 @@ var ScorecardChartConfigPanel = class extends Component {
|
|
|
33956
33933
|
keyValue = this.props.definition.keyValue;
|
|
33957
33934
|
baseline = this.props.definition.baseline;
|
|
33958
33935
|
get errorMessages() {
|
|
33959
|
-
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !==
|
|
33936
|
+
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33960
33937
|
}
|
|
33961
33938
|
get isKeyValueInvalid() {
|
|
33962
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33939
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
33963
33940
|
}
|
|
33964
33941
|
get isBaselineInvalid() {
|
|
33965
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33942
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
33966
33943
|
}
|
|
33967
33944
|
onKeyValueRangeChanged(ranges) {
|
|
33968
33945
|
this.keyValue = ranges[0];
|
|
@@ -34396,13 +34373,23 @@ var ChartTypePicker = class extends Component {
|
|
|
34396
34373
|
});
|
|
34397
34374
|
setup() {
|
|
34398
34375
|
useExternalListener(window, "pointerdown", this.onExternalClick, { capture: true });
|
|
34399
|
-
const
|
|
34376
|
+
const definition = this.env.model.getters.getChartDefinition(this.props.chartId);
|
|
34377
|
+
const supportedTypes = this.getSupportedChartTypes(definition);
|
|
34400
34378
|
for (const subtypeProperties of chartSubtypeRegistry.getAll()) {
|
|
34401
34379
|
if (!supportedTypes.has(subtypeProperties.chartType)) continue;
|
|
34402
34380
|
if (this.chartTypeByCategories[subtypeProperties.category]) this.chartTypeByCategories[subtypeProperties.category].push(subtypeProperties);
|
|
34403
34381
|
else this.chartTypeByCategories[subtypeProperties.category] = [subtypeProperties];
|
|
34404
34382
|
}
|
|
34405
34383
|
}
|
|
34384
|
+
getSupportedChartTypes(definition) {
|
|
34385
|
+
let supportedTypes;
|
|
34386
|
+
if (definition.dataSource) {
|
|
34387
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource.type);
|
|
34388
|
+
supportedTypes = new Set(dataSourceBuilder.supportedChartTypes);
|
|
34389
|
+
} else if (!definition.dataSource && (definition.type === "scorecard" || definition.type === "gauge")) supportedTypes = new Set(CHART_TYPES);
|
|
34390
|
+
else throw new Error("Missing chart data source for a chart type that requires it");
|
|
34391
|
+
return supportedTypes;
|
|
34392
|
+
}
|
|
34406
34393
|
onExternalClick(ev) {
|
|
34407
34394
|
if (isChildEvent(this.popoverRef.el?.parentElement, ev) || isChildEvent(this.selectRef.el, ev)) return;
|
|
34408
34395
|
this.closePopover();
|
|
@@ -34696,10 +34683,10 @@ const columnStatisticFunctions = [
|
|
|
34696
34683
|
{
|
|
34697
34684
|
name: _t("Unique values"),
|
|
34698
34685
|
types: [
|
|
34699
|
-
|
|
34700
|
-
|
|
34701
|
-
|
|
34702
|
-
|
|
34686
|
+
"number",
|
|
34687
|
+
"text",
|
|
34688
|
+
"boolean",
|
|
34689
|
+
"error"
|
|
34703
34690
|
],
|
|
34704
34691
|
compute: (values, locale) => {
|
|
34705
34692
|
const uniqueValues = /* @__PURE__ */ new Set();
|
|
@@ -34710,27 +34697,27 @@ const columnStatisticFunctions = [
|
|
|
34710
34697
|
},
|
|
34711
34698
|
{
|
|
34712
34699
|
name: _t("Sum"),
|
|
34713
|
-
types: [
|
|
34700
|
+
types: ["number"],
|
|
34714
34701
|
compute: (values, locale) => sum([[values]], locale)
|
|
34715
34702
|
},
|
|
34716
34703
|
{
|
|
34717
34704
|
name: _t("Average"),
|
|
34718
|
-
types: [
|
|
34705
|
+
types: ["number"],
|
|
34719
34706
|
compute: (values, locale) => average([[values]], locale)
|
|
34720
34707
|
},
|
|
34721
34708
|
{
|
|
34722
34709
|
name: _t("Median"),
|
|
34723
|
-
types: [
|
|
34710
|
+
types: ["number"],
|
|
34724
34711
|
compute: (values, locale) => median([[values]], locale) ?? ""
|
|
34725
34712
|
},
|
|
34726
34713
|
{
|
|
34727
34714
|
name: _t("Minimum value"),
|
|
34728
|
-
types: [
|
|
34715
|
+
types: ["number"],
|
|
34729
34716
|
compute: (values, locale) => min([[values]], locale).value
|
|
34730
34717
|
},
|
|
34731
34718
|
{
|
|
34732
34719
|
name: _t("Maximum value"),
|
|
34733
|
-
types: [
|
|
34720
|
+
types: ["number"],
|
|
34734
34721
|
compute: (values, locale) => max([[values]], locale).value
|
|
34735
34722
|
}
|
|
34736
34723
|
];
|
|
@@ -34877,12 +34864,13 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34877
34864
|
}
|
|
34878
34865
|
const { sheetId, col } = getters.getActivePosition();
|
|
34879
34866
|
this.selectedColumn = col;
|
|
34880
|
-
|
|
34867
|
+
const formatsInDataset = getters.getEvaluatedCellsInZone(sheetId, {
|
|
34881
34868
|
top: 0,
|
|
34882
34869
|
left: col,
|
|
34883
34870
|
bottom: getters.getNumberRows(sheetId) - 1,
|
|
34884
34871
|
right: col
|
|
34885
|
-
}).map((cell) => cell.format)
|
|
34872
|
+
}).map((cell) => cell.format);
|
|
34873
|
+
this.dataFormat = formatsInDataset.find(isDefined) ?? "0.00";
|
|
34886
34874
|
const numberOfRows = getters.getNumberRows(sheetId);
|
|
34887
34875
|
const cells = [];
|
|
34888
34876
|
const numericValues = [];
|
|
@@ -34900,20 +34888,21 @@ var ColumnStatisticsStore = class extends SpreadsheetStore {
|
|
|
34900
34888
|
row
|
|
34901
34889
|
});
|
|
34902
34890
|
cells.push(evaluatedCell);
|
|
34903
|
-
if (evaluatedCell.type !==
|
|
34891
|
+
if (evaluatedCell.type !== "empty" && evaluatedCell.type !== "error") {
|
|
34904
34892
|
values.push({
|
|
34905
34893
|
row,
|
|
34906
34894
|
col,
|
|
34907
34895
|
value: evaluatedCell.value
|
|
34908
34896
|
});
|
|
34909
|
-
if (evaluatedCell.type ===
|
|
34897
|
+
if (evaluatedCell.type === "number") numericValues.push({
|
|
34910
34898
|
row,
|
|
34911
34899
|
col,
|
|
34912
34900
|
value: evaluatedCell.value
|
|
34913
34901
|
});
|
|
34914
34902
|
}
|
|
34915
34903
|
}
|
|
34916
|
-
|
|
34904
|
+
const locale = getters.getLocale();
|
|
34905
|
+
this.statisticFnResults = computeStatisticFnResults(columnStatisticFunctions, cells, locale);
|
|
34917
34906
|
this.numericValues = numericValues;
|
|
34918
34907
|
this.values = values;
|
|
34919
34908
|
this.countChartData = this.computeCountChartData();
|
|
@@ -35247,7 +35236,7 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35247
35236
|
updateConditionalFormat(newCf) {
|
|
35248
35237
|
const ranges = newCf.ranges || this.state.ranges;
|
|
35249
35238
|
if (this.state.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35250
|
-
if (!newCf.suppressErrors) this.state.errors = [
|
|
35239
|
+
if (!newCf.suppressErrors) this.state.errors = ["InvalidRange"];
|
|
35251
35240
|
return;
|
|
35252
35241
|
}
|
|
35253
35242
|
const sheetId = this.model.getters.getActiveSheetId();
|
|
@@ -35262,11 +35251,11 @@ var ConditionalFormattingEditorStore = class extends SpreadsheetStore {
|
|
|
35262
35251
|
sheetId
|
|
35263
35252
|
});
|
|
35264
35253
|
if (result.isSuccessful) this.state.hasEditedCf = true;
|
|
35265
|
-
const reasons = result.reasons.filter((r) => r !==
|
|
35254
|
+
const reasons = result.reasons.filter((r) => r !== "NoChanges");
|
|
35266
35255
|
if (!newCf.suppressErrors) this.state.errors = reasons;
|
|
35267
35256
|
}
|
|
35268
35257
|
get isRangeValid() {
|
|
35269
|
-
return this.state.errors.includes(
|
|
35258
|
+
return this.state.errors.includes("EmptyRange");
|
|
35270
35259
|
}
|
|
35271
35260
|
get errorMessages() {
|
|
35272
35261
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35520,9 +35509,9 @@ var ColorScaleRuleEditorThreshold = class extends Component {
|
|
|
35520
35509
|
isValueInvalid() {
|
|
35521
35510
|
const errors = this.props.store.state.errors;
|
|
35522
35511
|
switch (this.props.thresholdType) {
|
|
35523
|
-
case "minimum": return errors.includes(
|
|
35524
|
-
case "midpoint": return errors.includes(
|
|
35525
|
-
case "maximum": return errors.includes(
|
|
35512
|
+
case "minimum": return errors.includes("MinInvalidFormula") || errors.includes("MinBiggerThanMid") || errors.includes("MinBiggerThanMax") || errors.includes("MinNaN");
|
|
35513
|
+
case "midpoint": return errors.includes("MidInvalidFormula") || errors.includes("MidNaN") || errors.includes("MidBiggerThanMax");
|
|
35514
|
+
case "maximum": return errors.includes("MaxInvalidFormula") || errors.includes("MaxNaN");
|
|
35526
35515
|
default: return false;
|
|
35527
35516
|
}
|
|
35528
35517
|
}
|
|
@@ -35630,8 +35619,8 @@ var IconSetRuleEditor = class extends Component {
|
|
|
35630
35619
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35631
35620
|
const errors = this.props.store.state.errors;
|
|
35632
35621
|
switch (inflectionPoint) {
|
|
35633
|
-
case "lowerInflectionPoint": return errors.includes(
|
|
35634
|
-
case "upperInflectionPoint": return errors.includes(
|
|
35622
|
+
case "lowerInflectionPoint": return errors.includes("ValueLowerInflectionNaN") || errors.includes("ValueLowerInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35623
|
+
case "upperInflectionPoint": return errors.includes("ValueUpperInflectionNaN") || errors.includes("ValueUpperInvalidFormula") || errors.includes("LowerBiggerThanUpper");
|
|
35635
35624
|
default: return true;
|
|
35636
35625
|
}
|
|
35637
35626
|
}
|
|
@@ -36048,12 +36037,6 @@ var DataValidationEditor = class extends Component {
|
|
|
36048
36037
|
//#endregion
|
|
36049
36038
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
36050
36039
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
36051
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
36052
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
36053
|
-
Direction[Direction["current"] = 0] = "current";
|
|
36054
|
-
Direction[Direction["next"] = 1] = "next";
|
|
36055
|
-
return Direction;
|
|
36056
|
-
}(Direction || {});
|
|
36057
36040
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
36058
36041
|
mutators = [
|
|
36059
36042
|
"updateSearchOptions",
|
|
@@ -36115,13 +36098,13 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36115
36098
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
36116
36099
|
}
|
|
36117
36100
|
selectPreviousMatch() {
|
|
36118
|
-
this.selectNextCell(
|
|
36101
|
+
this.selectNextCell(-1, {
|
|
36119
36102
|
jumpToMatchSheet: true,
|
|
36120
36103
|
updateSelection: true
|
|
36121
36104
|
});
|
|
36122
36105
|
}
|
|
36123
36106
|
selectNextMatch() {
|
|
36124
|
-
this.selectNextCell(
|
|
36107
|
+
this.selectNextCell(1, {
|
|
36125
36108
|
jumpToMatchSheet: true,
|
|
36126
36109
|
updateSelection: true
|
|
36127
36110
|
});
|
|
@@ -36204,7 +36187,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
36204
36187
|
refreshSearch(options) {
|
|
36205
36188
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
36206
36189
|
this.findMatches();
|
|
36207
|
-
this.selectNextCell(
|
|
36190
|
+
this.selectNextCell(0, options);
|
|
36208
36191
|
}
|
|
36209
36192
|
getSheetsInSearchOrder() {
|
|
36210
36193
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37288,10 +37271,10 @@ function interactiveUpdateNamedRange(env, payload) {
|
|
|
37288
37271
|
}
|
|
37289
37272
|
function handleResult(env, result) {
|
|
37290
37273
|
if (!result.isSuccessful) {
|
|
37291
|
-
if (result.isCancelledBecause(
|
|
37292
|
-
else if (result.isCancelledBecause(
|
|
37293
|
-
else if (result.isCancelledBecause(
|
|
37294
|
-
else if (result.isCancelledBecause(
|
|
37274
|
+
if (result.isCancelledBecause("NamedRangeNameAlreadyExists")) env.raiseError(_t("A named range with this name already exists."));
|
|
37275
|
+
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."));
|
|
37276
|
+
else if (result.isCancelledBecause("NamedRangeNameLooksLikeCellReference")) env.raiseError(_t("A named range name cannot resemble a cell reference."));
|
|
37277
|
+
else if (result.isCancelledBecause("NamedRangeNotFound")) env.raiseError(_t("The named range to update was not found."));
|
|
37295
37278
|
}
|
|
37296
37279
|
}
|
|
37297
37280
|
|
|
@@ -37378,6 +37361,8 @@ var NamedRangesPanel = class extends Component {
|
|
|
37378
37361
|
//#endregion
|
|
37379
37362
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37380
37363
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37364
|
+
pivotId;
|
|
37365
|
+
initialMeasure;
|
|
37381
37366
|
mutators = [
|
|
37382
37367
|
"cancelMeasureDisplayEdition",
|
|
37383
37368
|
"updateMeasureDisplayType",
|
|
@@ -37569,7 +37554,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
|
|
|
37569
37554
|
col,
|
|
37570
37555
|
row
|
|
37571
37556
|
};
|
|
37572
|
-
if (
|
|
37557
|
+
if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
|
|
37573
37558
|
}
|
|
37574
37559
|
return positions;
|
|
37575
37560
|
}
|
|
@@ -38320,7 +38305,7 @@ var PivotTitleSection = class extends Component {
|
|
|
38320
38305
|
});
|
|
38321
38306
|
let text;
|
|
38322
38307
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38323
|
-
else if (result.isCancelledBecause(
|
|
38308
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38324
38309
|
else text = _t("Pivot duplication failed.");
|
|
38325
38310
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38326
38311
|
this.env.notifyUser({
|
|
@@ -38397,13 +38382,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38397
38382
|
break;
|
|
38398
38383
|
}
|
|
38399
38384
|
return {
|
|
38385
|
+
/**
|
|
38386
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38387
|
+
*/
|
|
38400
38388
|
id: measure.id,
|
|
38389
|
+
/**
|
|
38390
|
+
* Display name of the measure
|
|
38391
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38392
|
+
*/
|
|
38401
38393
|
get displayName() {
|
|
38402
38394
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38403
38395
|
},
|
|
38404
38396
|
userDefinedName: measure.userDefinedName,
|
|
38397
|
+
/**
|
|
38398
|
+
* Get the name of the field of the measure
|
|
38399
|
+
*/
|
|
38405
38400
|
fieldName,
|
|
38401
|
+
/**
|
|
38402
|
+
* Get the aggregator of the measure
|
|
38403
|
+
*/
|
|
38406
38404
|
aggregator,
|
|
38405
|
+
/**
|
|
38406
|
+
* Get the type of the measure field
|
|
38407
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38408
|
+
*/
|
|
38407
38409
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38408
38410
|
isValid,
|
|
38409
38411
|
isHidden: measure.isHidden,
|
|
@@ -38417,10 +38419,30 @@ var PivotRuntimeDefinition = class {
|
|
|
38417
38419
|
const type = field?.type ?? "integer";
|
|
38418
38420
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38419
38421
|
return {
|
|
38422
|
+
/**
|
|
38423
|
+
* Get the display name of the dimension
|
|
38424
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38425
|
+
*/
|
|
38420
38426
|
displayName: field?.string ?? dimension.fieldName,
|
|
38427
|
+
/**
|
|
38428
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38429
|
+
* e.g. "stage_id", "create_date:month"
|
|
38430
|
+
*/
|
|
38421
38431
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38432
|
+
/**
|
|
38433
|
+
* Get the name of the field of the dimension
|
|
38434
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38435
|
+
*/
|
|
38422
38436
|
fieldName: dimension.fieldName,
|
|
38437
|
+
/**
|
|
38438
|
+
* Get the aggregate operator of the dimension
|
|
38439
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38440
|
+
*/
|
|
38423
38441
|
granularity,
|
|
38442
|
+
/**
|
|
38443
|
+
* Get the type of the field of the dimension
|
|
38444
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38445
|
+
*/
|
|
38424
38446
|
type: field?.isCustomField ? "custom" : type,
|
|
38425
38447
|
order: dimension.order,
|
|
38426
38448
|
isValid: !!field,
|
|
@@ -39180,14 +39202,6 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
39180
39202
|
|
|
39181
39203
|
//#endregion
|
|
39182
39204
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39183
|
-
var ReloadType = /* @__PURE__ */ function(ReloadType) {
|
|
39184
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39185
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39186
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39187
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39188
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39189
|
-
return ReloadType;
|
|
39190
|
-
}(ReloadType || {});
|
|
39191
39205
|
/**
|
|
39192
39206
|
* This class represents a pivot table that is created from a range of cells.
|
|
39193
39207
|
* It will extract the fields from the first row of the range and the data from
|
|
@@ -39230,15 +39244,15 @@ var SpreadsheetPivot = class {
|
|
|
39230
39244
|
}
|
|
39231
39245
|
init(params = {}) {
|
|
39232
39246
|
if (!this._definition || params.reload) {
|
|
39233
|
-
this.reload(
|
|
39247
|
+
this.reload(4);
|
|
39234
39248
|
this.needsReevaluation = false;
|
|
39235
39249
|
}
|
|
39236
39250
|
}
|
|
39237
39251
|
reload(type) {
|
|
39238
|
-
if (type ===
|
|
39239
|
-
if (type >=
|
|
39240
|
-
if (type >=
|
|
39241
|
-
if (type >=
|
|
39252
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39253
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39254
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39255
|
+
if (type >= 1) {
|
|
39242
39256
|
this.collapsedTable = void 0;
|
|
39243
39257
|
this.expandedTable = void 0;
|
|
39244
39258
|
}
|
|
@@ -39247,13 +39261,13 @@ var SpreadsheetPivot = class {
|
|
|
39247
39261
|
const actualDefinition = this.coreDefinition;
|
|
39248
39262
|
this.coreDefinition = nextDefinition;
|
|
39249
39263
|
if (this._definition) {
|
|
39250
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39264
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39251
39265
|
this.reload(reloadType);
|
|
39252
39266
|
}
|
|
39253
39267
|
}
|
|
39254
39268
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39255
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39256
|
-
return
|
|
39269
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39270
|
+
return 4;
|
|
39257
39271
|
}
|
|
39258
39272
|
get isInvalidRange() {
|
|
39259
39273
|
return !!this.invalidRangeError;
|
|
@@ -39326,7 +39340,7 @@ var SpreadsheetPivot = class {
|
|
|
39326
39340
|
if (dataEntries.length === 0) return { value: "" };
|
|
39327
39341
|
const measure = this.getMeasure(measureId);
|
|
39328
39342
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39329
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39343
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39330
39344
|
const aggregator = measure.aggregator;
|
|
39331
39345
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39332
39346
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39428,16 +39442,16 @@ var SpreadsheetPivot = class {
|
|
|
39428
39442
|
return this.definition.getDimension(nameWithGranularity);
|
|
39429
39443
|
}
|
|
39430
39444
|
getTypeFromZone(sheetId, zone) {
|
|
39431
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39445
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39432
39446
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39433
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39434
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39435
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39447
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39448
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39449
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39436
39450
|
return "char";
|
|
39437
39451
|
}
|
|
39438
39452
|
assertCellIsValidField(col, row, cell) {
|
|
39439
|
-
if (cell.type ===
|
|
39440
|
-
if (cell.type ===
|
|
39453
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39454
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39441
39455
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39442
39456
|
}
|
|
39443
39457
|
/**
|
|
@@ -39496,7 +39510,7 @@ var SpreadsheetPivot = class {
|
|
|
39496
39510
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39497
39511
|
if (cell.value === "") entry[field.name] = {
|
|
39498
39512
|
value: null,
|
|
39499
|
-
type:
|
|
39513
|
+
type: "empty",
|
|
39500
39514
|
formattedValue: ""
|
|
39501
39515
|
};
|
|
39502
39516
|
else entry[field.name] = cell;
|
|
@@ -39509,7 +39523,7 @@ var SpreadsheetPivot = class {
|
|
|
39509
39523
|
if (!baseValue || !parentField) {
|
|
39510
39524
|
entry[customFieldName] = {
|
|
39511
39525
|
value: null,
|
|
39512
|
-
type:
|
|
39526
|
+
type: "empty",
|
|
39513
39527
|
formattedValue: ""
|
|
39514
39528
|
};
|
|
39515
39529
|
continue;
|
|
@@ -39522,7 +39536,7 @@ var SpreadsheetPivot = class {
|
|
|
39522
39536
|
}
|
|
39523
39537
|
entry["__count"] = {
|
|
39524
39538
|
value: 1,
|
|
39525
|
-
type:
|
|
39539
|
+
type: "number",
|
|
39526
39540
|
formattedValue: "1"
|
|
39527
39541
|
};
|
|
39528
39542
|
dataEntries.push(entry);
|
|
@@ -39535,7 +39549,7 @@ var SpreadsheetPivot = class {
|
|
|
39535
39549
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39536
39550
|
entry[dimension.nameWithGranularity] = {
|
|
39537
39551
|
value,
|
|
39538
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39552
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39539
39553
|
format: entry[dimension.fieldName]?.format,
|
|
39540
39554
|
formattedValue: formatValue(valueToFormat, {
|
|
39541
39555
|
locale,
|
|
@@ -39614,6 +39628,9 @@ const PIVOT_FUNCTIONS = [
|
|
|
39614
39628
|
function getFirstPivotFunction(compiledFormula, getters) {
|
|
39615
39629
|
return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
|
|
39616
39630
|
}
|
|
39631
|
+
function getPivotFunctions(compiledFormula, getters) {
|
|
39632
|
+
return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
|
|
39633
|
+
}
|
|
39617
39634
|
/**
|
|
39618
39635
|
* Parse a spreadsheet formula and detect the number of PIVOT functions that are
|
|
39619
39636
|
* present in the given formula.
|
|
@@ -39690,6 +39707,8 @@ function extractFormulaIdFromToken(tokenAtCursor) {
|
|
|
39690
39707
|
//#endregion
|
|
39691
39708
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39692
39709
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39710
|
+
pivotId;
|
|
39711
|
+
updateMode;
|
|
39693
39712
|
mutators = [
|
|
39694
39713
|
"reset",
|
|
39695
39714
|
"deferUpdates",
|
|
@@ -39851,7 +39870,8 @@ var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
|
39851
39870
|
};
|
|
39852
39871
|
}
|
|
39853
39872
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39854
|
-
|
|
39873
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39874
|
+
this.draft = cleanedWithGranularity;
|
|
39855
39875
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39856
39876
|
}
|
|
39857
39877
|
/**
|
|
@@ -41607,7 +41627,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
41607
41627
|
separator,
|
|
41608
41628
|
addNewColumns
|
|
41609
41629
|
});
|
|
41610
|
-
if (result.isCancelledBecause(
|
|
41630
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
41611
41631
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
41612
41632
|
separator,
|
|
41613
41633
|
addNewColumns,
|
|
@@ -41689,8 +41709,8 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
41689
41709
|
}).reasons;
|
|
41690
41710
|
const errors = /* @__PURE__ */ new Set();
|
|
41691
41711
|
for (const reason of cancelledReasons) switch (reason) {
|
|
41692
|
-
case
|
|
41693
|
-
case
|
|
41712
|
+
case "SplitWillOverwriteContent":
|
|
41713
|
+
case "EmptySplitSeparator": break;
|
|
41694
41714
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
41695
41715
|
}
|
|
41696
41716
|
return Array.from(errors);
|
|
@@ -41701,7 +41721,7 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
41701
41721
|
separator: this.separatorValue,
|
|
41702
41722
|
addNewColumns: this.state.addNewColumns,
|
|
41703
41723
|
force: false
|
|
41704
|
-
}).reasons.includes(
|
|
41724
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
41705
41725
|
return warnings;
|
|
41706
41726
|
}
|
|
41707
41727
|
get separatorValue() {
|
|
@@ -42332,7 +42352,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
42332
42352
|
if (env.model.dispatch(cmd, {
|
|
42333
42353
|
sheetId,
|
|
42334
42354
|
quantity: base
|
|
42335
|
-
}).isCancelledBecause(
|
|
42355
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
42336
42356
|
}
|
|
42337
42357
|
|
|
42338
42358
|
//#endregion
|
|
@@ -42512,11 +42532,11 @@ var FormulaFingerprintStore = class extends SpreadsheetStore {
|
|
|
42512
42532
|
}
|
|
42513
42533
|
getLiteralFingerprint(position) {
|
|
42514
42534
|
switch (this.getters.getEvaluatedCell(position).type) {
|
|
42515
|
-
case
|
|
42516
|
-
case
|
|
42517
|
-
case
|
|
42518
|
-
case
|
|
42519
|
-
case
|
|
42535
|
+
case "number":
|
|
42536
|
+
case "boolean": return DATA_FINGERPRINT;
|
|
42537
|
+
case "text":
|
|
42538
|
+
case "empty":
|
|
42539
|
+
case "error": return;
|
|
42520
42540
|
}
|
|
42521
42541
|
}
|
|
42522
42542
|
};
|
|
@@ -42800,7 +42820,7 @@ const togglePinPanel = {
|
|
|
42800
42820
|
function interactiveCut(env) {
|
|
42801
42821
|
const result = env.model.dispatch("CUT");
|
|
42802
42822
|
if (!result.isSuccessful) {
|
|
42803
|
-
if (result.isCancelledBecause(
|
|
42823
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
42804
42824
|
}
|
|
42805
42825
|
}
|
|
42806
42826
|
|
|
@@ -42871,8 +42891,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
42871
42891
|
sheetId,
|
|
42872
42892
|
target
|
|
42873
42893
|
});
|
|
42874
|
-
if (result.isCancelledBecause(
|
|
42875
|
-
else if (result.isCancelledBecause(
|
|
42894
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
42895
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
42876
42896
|
env.model.dispatch("ADD_MERGE", {
|
|
42877
42897
|
sheetId,
|
|
42878
42898
|
target,
|
|
@@ -43109,7 +43129,7 @@ const FIX_FORMULAS = {
|
|
|
43109
43129
|
if (!pivotId) return false;
|
|
43110
43130
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
43111
43131
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
43112
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
43132
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
43113
43133
|
},
|
|
43114
43134
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
43115
43135
|
};
|
|
@@ -43750,7 +43770,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
43750
43770
|
end: group.end
|
|
43751
43771
|
});
|
|
43752
43772
|
if (!result.isSuccessful) {
|
|
43753
|
-
if (result.isCancelledBecause(
|
|
43773
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
43754
43774
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
43755
43775
|
env.raiseError(errorMessage);
|
|
43756
43776
|
}
|
|
@@ -44705,11 +44725,11 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44705
44725
|
if (cell?.content.startsWith("'")) return { text: cell.content };
|
|
44706
44726
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
44707
44727
|
switch (type) {
|
|
44708
|
-
case
|
|
44709
|
-
case
|
|
44710
|
-
case
|
|
44711
|
-
case
|
|
44712
|
-
case
|
|
44728
|
+
case "empty": return { text: "" };
|
|
44729
|
+
case "text":
|
|
44730
|
+
case "error": return { text: value };
|
|
44731
|
+
case "boolean": return { text: formattedValue };
|
|
44732
|
+
case "number":
|
|
44713
44733
|
if (format && isDateTimeFormat(format)) {
|
|
44714
44734
|
if (parseDateTime(formattedValue, locale) !== null) return { text: formattedValue };
|
|
44715
44735
|
return { text: formatValue(value, {
|
|
@@ -44766,7 +44786,7 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
44766
44786
|
startEdition(text, selection) {
|
|
44767
44787
|
if (this.getters.isCurrentSheetLocked()) {
|
|
44768
44788
|
this.model.trigger("command-rejected", {
|
|
44769
|
-
result: new DispatchResult(
|
|
44789
|
+
result: new DispatchResult("SheetLocked"),
|
|
44770
44790
|
command: { sheetId: this.getters.getActiveSheetId() }
|
|
44771
44791
|
});
|
|
44772
44792
|
return "NoStateChange";
|
|
@@ -46391,7 +46411,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
46391
46411
|
elements,
|
|
46392
46412
|
position: this.state.position
|
|
46393
46413
|
});
|
|
46394
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
46414
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46395
46415
|
}
|
|
46396
46416
|
_selectElement(index, addDistinctHeader) {
|
|
46397
46417
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -46528,8 +46548,8 @@ var RowResizer = class extends AbstractResizer {
|
|
|
46528
46548
|
position: this.state.position
|
|
46529
46549
|
});
|
|
46530
46550
|
if (!result.isSuccessful) {
|
|
46531
|
-
if (result.reasons.includes(
|
|
46532
|
-
else if (result.reasons.includes(
|
|
46551
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
46552
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
46533
46553
|
}
|
|
46534
46554
|
}
|
|
46535
46555
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -46606,6 +46626,7 @@ var HeadersOverlay = class extends Component {
|
|
|
46606
46626
|
//#region src/stores/grid_renderer_store.ts
|
|
46607
46627
|
const CELL_ANIMATION_DURATION = 200;
|
|
46608
46628
|
var GridRenderer = class extends DisposableStore {
|
|
46629
|
+
renderer;
|
|
46609
46630
|
fingerprints;
|
|
46610
46631
|
hoveredTables;
|
|
46611
46632
|
hoveredIcon;
|
|
@@ -47090,7 +47111,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47090
47111
|
const nextCell = this.getters.getEvaluatedCell(position);
|
|
47091
47112
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
47092
47113
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47093
|
-
if (nextCell.type !==
|
|
47114
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || doesCellHaveGridIcon) return col;
|
|
47094
47115
|
col++;
|
|
47095
47116
|
}
|
|
47096
47117
|
return col;
|
|
@@ -47106,7 +47127,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47106
47127
|
const previousCell = this.getters.getEvaluatedCell(position);
|
|
47107
47128
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
47108
47129
|
const doesCellHaveGridIcon = this.getters.doesCellHaveGridIcon(position);
|
|
47109
|
-
if (previousCell.type !==
|
|
47130
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || doesCellHaveGridIcon) return col;
|
|
47110
47131
|
col--;
|
|
47111
47132
|
}
|
|
47112
47133
|
return col;
|
|
@@ -47116,7 +47137,7 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47116
47137
|
const { align } = this.getters.getCellStyle(position);
|
|
47117
47138
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
47118
47139
|
if (!align && formatHasRepeatedChar(evaluatedCell.value, evaluatedCell.format)) return "left";
|
|
47119
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
47140
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
47120
47141
|
return align || evaluatedCell.defaultAlign;
|
|
47121
47142
|
}
|
|
47122
47143
|
createZoneBox(viewports, sheetId, zone, viewport) {
|
|
@@ -47161,12 +47182,12 @@ var GridRenderer = class extends DisposableStore {
|
|
|
47161
47182
|
style,
|
|
47162
47183
|
dataBarFill,
|
|
47163
47184
|
overlayColor: this.hoveredTables.overlayColors.get(position),
|
|
47164
|
-
isError: cell.type ===
|
|
47185
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position),
|
|
47165
47186
|
icons: cellIcons,
|
|
47166
47187
|
disabledAnimation: this.zonesWithPreventedAnimationsInNextFrame[sheetId]?.some((z) => isZoneInside(zone, z) || overlap(zone, z))
|
|
47167
47188
|
};
|
|
47168
47189
|
const fontSizePX = computeTextFontSizeInPixels(box.style);
|
|
47169
|
-
if (cell.type ===
|
|
47190
|
+
if (cell.type === "empty" || box.icons.center) return box;
|
|
47170
47191
|
/** Content */
|
|
47171
47192
|
const wrapping = style.wrapping || "overflow";
|
|
47172
47193
|
const wrapText = wrapping === "wrap" && !showFormula;
|
|
@@ -48342,7 +48363,7 @@ var Grid = class extends Component {
|
|
|
48342
48363
|
"Alt+Shift+ArrowDown": () => this.processHeaderGroupingKey("down")
|
|
48343
48364
|
};
|
|
48344
48365
|
focusComposerFromActiveCell() {
|
|
48345
|
-
this.env.model.getters.getActiveCell().type ===
|
|
48366
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
48346
48367
|
}
|
|
48347
48368
|
editOrMoveInSelection(direction) {
|
|
48348
48369
|
if (this.isSingleCellOrMergeSelection()) {
|
|
@@ -48467,7 +48488,7 @@ var Grid = class extends Component {
|
|
|
48467
48488
|
sheetId,
|
|
48468
48489
|
col,
|
|
48469
48490
|
row
|
|
48470
|
-
}).type ===
|
|
48491
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
48471
48492
|
else this.onComposerContentFocused();
|
|
48472
48493
|
}
|
|
48473
48494
|
processArrows(ev) {
|
|
@@ -48548,18 +48569,18 @@ var Grid = class extends Component {
|
|
|
48548
48569
|
if (!clipboardData) return;
|
|
48549
48570
|
const image = [...clipboardData.files]?.find((file) => AllowedImageMimeTypes.includes(file.type));
|
|
48550
48571
|
const osClipboard = { content: {
|
|
48551
|
-
[
|
|
48552
|
-
[
|
|
48572
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
48573
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
48553
48574
|
} };
|
|
48554
48575
|
if (image) osClipboard.content[image.type] = image;
|
|
48555
48576
|
const target = this.env.model.getters.getSelectedZones();
|
|
48556
48577
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
48557
|
-
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content[
|
|
48578
|
+
if (this.env.model.getters.getClipboardId() === getOSheetClipboardIdFromHTML(osClipboard.content["text/html"])) interactivePaste(this.env, target);
|
|
48558
48579
|
else {
|
|
48559
48580
|
const osClipboardContent = parseOSClipboardContent(osClipboard.content);
|
|
48560
48581
|
await interactivePasteFromOS(this.env, target, osClipboardContent);
|
|
48561
48582
|
}
|
|
48562
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
48583
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
48563
48584
|
}
|
|
48564
48585
|
clearFormatting() {
|
|
48565
48586
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -49046,7 +49067,7 @@ var BasePlugin = class {
|
|
|
49046
49067
|
* There should not be any side effects in this method.
|
|
49047
49068
|
*/
|
|
49048
49069
|
allowDispatch(command) {
|
|
49049
|
-
return
|
|
49070
|
+
return "Success";
|
|
49050
49071
|
}
|
|
49051
49072
|
/**
|
|
49052
49073
|
* This method is useful when a plugin needs to perform some action before a
|
|
@@ -49082,10 +49103,10 @@ var BasePlugin = class {
|
|
|
49082
49103
|
for (const validation of validations) {
|
|
49083
49104
|
let results = validation.call(this, toValidate);
|
|
49084
49105
|
if (!Array.isArray(results)) results = [results];
|
|
49085
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
49106
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
49086
49107
|
if (cancelledReasons.length) return cancelledReasons;
|
|
49087
49108
|
}
|
|
49088
|
-
return
|
|
49109
|
+
return "Success";
|
|
49089
49110
|
};
|
|
49090
49111
|
}
|
|
49091
49112
|
checkValidations(command, ...validations) {
|
|
@@ -49142,7 +49163,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49142
49163
|
allowDispatch(cmd) {
|
|
49143
49164
|
switch (cmd.type) {
|
|
49144
49165
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
49145
|
-
default: return
|
|
49166
|
+
default: return "Success";
|
|
49146
49167
|
}
|
|
49147
49168
|
}
|
|
49148
49169
|
handle(cmd) {
|
|
@@ -49556,8 +49577,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
49556
49577
|
checkBordersUnchanged(cmd) {
|
|
49557
49578
|
const currentBorder = this.getCellBorder(cmd);
|
|
49558
49579
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
49559
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
49560
|
-
return
|
|
49580
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
49581
|
+
return "Success";
|
|
49561
49582
|
}
|
|
49562
49583
|
import(data) {
|
|
49563
49584
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const [position, borderId] of iterateItemIdsPositions(sheet.id, sheet.borders)) {
|
|
@@ -49605,13 +49626,13 @@ var CarouselPlugin = class extends CorePlugin {
|
|
|
49605
49626
|
allowDispatch(cmd) {
|
|
49606
49627
|
switch (cmd.type) {
|
|
49607
49628
|
case "CREATE_CAROUSEL":
|
|
49608
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
49609
|
-
return
|
|
49629
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "DuplicatedFigureId";
|
|
49630
|
+
return "Success";
|
|
49610
49631
|
case "UPDATE_CAROUSEL":
|
|
49611
|
-
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return
|
|
49612
|
-
return
|
|
49632
|
+
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
|
|
49633
|
+
return "Success";
|
|
49613
49634
|
}
|
|
49614
|
-
return
|
|
49635
|
+
return "Success";
|
|
49615
49636
|
}
|
|
49616
49637
|
handle(cmd) {
|
|
49617
49638
|
switch (cmd.type) {
|
|
@@ -50231,9 +50252,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50231
50252
|
switch (cmd.type) {
|
|
50232
50253
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
50233
50254
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
50234
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
50255
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
50235
50256
|
case "SET_FORMATTING": return this.checkUselessSetFormatting(cmd);
|
|
50236
|
-
default: return
|
|
50257
|
+
default: return "Success";
|
|
50237
50258
|
}
|
|
50238
50259
|
}
|
|
50239
50260
|
handle(cmd) {
|
|
@@ -50589,28 +50610,28 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50589
50610
|
}
|
|
50590
50611
|
checkCellOutOfSheet(cmd) {
|
|
50591
50612
|
const { sheetId, col, row } = cmd;
|
|
50592
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50593
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
50613
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50614
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
50594
50615
|
}
|
|
50595
50616
|
checkUselessClearCell(cmd) {
|
|
50596
50617
|
const cell = this.getters.getCell(cmd);
|
|
50597
|
-
if (!cell) return
|
|
50598
|
-
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return
|
|
50599
|
-
return
|
|
50618
|
+
if (!cell) return "NoChanges";
|
|
50619
|
+
if (!cell.isFormula && !cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
50620
|
+
return "Success";
|
|
50600
50621
|
}
|
|
50601
50622
|
checkUselessUpdateCell(cmd) {
|
|
50602
50623
|
const cell = this.getters.getCell(cmd);
|
|
50603
50624
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
50604
50625
|
const hasStyle = "style" in cmd;
|
|
50605
50626
|
const hasFormat = "format" in cmd;
|
|
50606
|
-
if ((!hasContent || cell?.isFormula && cell.compiledFormula.toFormulaString(this.getters) === cmd.content || !cell?.isFormula && cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
50607
|
-
return
|
|
50627
|
+
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";
|
|
50628
|
+
return "Success";
|
|
50608
50629
|
}
|
|
50609
50630
|
checkUselessSetFormatting(cmd) {
|
|
50610
50631
|
const { sheetId, target } = cmd;
|
|
50611
50632
|
const hasStyle = "style" in cmd;
|
|
50612
50633
|
const hasFormat = "format" in cmd;
|
|
50613
|
-
if (!hasStyle && !hasFormat) return
|
|
50634
|
+
if (!hasStyle && !hasFormat) return "NoChanges";
|
|
50614
50635
|
for (const zone of recomputeZones(target)) for (let col = zone.left; col <= zone.right; col++) for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50615
50636
|
const position = {
|
|
50616
50637
|
sheetId,
|
|
@@ -50618,9 +50639,9 @@ var CellPlugin = class extends CorePlugin {
|
|
|
50618
50639
|
row
|
|
50619
50640
|
};
|
|
50620
50641
|
const cell = this.getters.getCell(position);
|
|
50621
|
-
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return
|
|
50642
|
+
if (hasStyle && !deepEquals(cell?.style, cmd.style) || hasFormat && cell?.format !== cmd.format) return "Success";
|
|
50622
50643
|
}
|
|
50623
|
-
return
|
|
50644
|
+
return "NoChanges";
|
|
50624
50645
|
}
|
|
50625
50646
|
};
|
|
50626
50647
|
|
|
@@ -50651,8 +50672,8 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50651
50672
|
switch (cmd.type) {
|
|
50652
50673
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkFigureArguments, this.checkChartDefinition, this.checkChartDuplicate));
|
|
50653
50674
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.checkChartDefinition, this.checkChartExists, this.checkChartChanged));
|
|
50654
|
-
case "DELETE_CHART": return
|
|
50655
|
-
default: return
|
|
50675
|
+
case "DELETE_CHART": return "SubCommandOnly";
|
|
50676
|
+
default: return "Success";
|
|
50656
50677
|
}
|
|
50657
50678
|
}
|
|
50658
50679
|
handle(cmd) {
|
|
@@ -50811,22 +50832,22 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
50811
50832
|
}
|
|
50812
50833
|
}
|
|
50813
50834
|
checkChartDuplicate(cmd) {
|
|
50814
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50835
|
+
return this.isChartDefined(cmd.chartId) ? "DuplicatedChartId" : "Success";
|
|
50815
50836
|
}
|
|
50816
50837
|
checkChartDefinition(cmd) {
|
|
50817
50838
|
return SpreadsheetChart.validate(this, cmd.definition);
|
|
50818
50839
|
}
|
|
50819
50840
|
checkChartExists(cmd) {
|
|
50820
|
-
return this.isChartDefined(cmd.chartId) ?
|
|
50841
|
+
return this.isChartDefined(cmd.chartId) ? "Success" : "ChartDoesNotExist";
|
|
50821
50842
|
}
|
|
50822
50843
|
checkChartChanged(cmd) {
|
|
50823
|
-
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return
|
|
50824
|
-
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ?
|
|
50844
|
+
if (cmd.figureId !== this.charts[cmd.chartId]?.figureId) return "Success";
|
|
50845
|
+
return deepEquals(this.getChartDefinition(cmd.chartId), cmd.definition) ? "NoChanges" : "Success";
|
|
50825
50846
|
}
|
|
50826
50847
|
/** If the command is meant to create a new figure, the position & offset argument need to be defined in the command */
|
|
50827
50848
|
checkFigureArguments(cmd) {
|
|
50828
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
50829
|
-
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ?
|
|
50849
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "Success";
|
|
50850
|
+
return cmd.offset !== void 0 && cmd.col !== void 0 && cmd.row !== void 0 ? "Success" : "MissingFigureArguments";
|
|
50830
50851
|
}
|
|
50831
50852
|
};
|
|
50832
50853
|
|
|
@@ -50893,11 +50914,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
50893
50914
|
allowDispatch(cmd) {
|
|
50894
50915
|
switch (cmd.type) {
|
|
50895
50916
|
case "ADD_CONDITIONAL_FORMAT":
|
|
50896
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
50917
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
50897
50918
|
return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange, this.checkCFHasChanged);
|
|
50898
50919
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
50899
50920
|
}
|
|
50900
|
-
return
|
|
50921
|
+
return "Success";
|
|
50901
50922
|
}
|
|
50902
50923
|
handle(cmd) {
|
|
50903
50924
|
switch (cmd.type) {
|
|
@@ -51030,27 +51051,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51030
51051
|
this.history.update("cfRules", sheet, currentCF);
|
|
51031
51052
|
}
|
|
51032
51053
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
51033
|
-
if (!this.cfRules[sheetId]) return
|
|
51054
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
51034
51055
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
51035
|
-
if (ruleIndex === -1) return
|
|
51056
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
51036
51057
|
const cfIndex2 = ruleIndex - delta;
|
|
51037
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
51038
|
-
return
|
|
51058
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
51059
|
+
return "Success";
|
|
51039
51060
|
}
|
|
51040
51061
|
checkEmptyRange(cmd) {
|
|
51041
|
-
return cmd.ranges.length ?
|
|
51062
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51042
51063
|
}
|
|
51043
51064
|
checkCFRule(cmd) {
|
|
51044
51065
|
const rule = cmd.cf.rule;
|
|
51045
51066
|
switch (rule.type) {
|
|
51046
51067
|
case "CellIsRule":
|
|
51047
|
-
if (!availableConditionalFormatOperators.has(rule.operator)) return
|
|
51068
|
+
if (!availableConditionalFormatOperators.has(rule.operator)) return "InvalidConditionalFormatType";
|
|
51048
51069
|
return this.checkValidations(rule, this.checkOperatorArgsNumber, this.checkCFValues);
|
|
51049
51070
|
case "ColorScaleRule": return this.checkValidations(rule, this.chainValidations(this.checkThresholds(this.checkFormulaCompilation)), this.chainValidations(this.checkThresholds(this.checkNaN), this.batchValidations(this.checkMinBiggerThanMax, this.checkMinBiggerThanMid, this.checkMidBiggerThanMax)));
|
|
51050
51071
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
51051
|
-
case "DataBarRule": return
|
|
51072
|
+
case "DataBarRule": return "Success";
|
|
51052
51073
|
}
|
|
51053
|
-
return
|
|
51074
|
+
return "InvalidConditionalFormatType";
|
|
51054
51075
|
}
|
|
51055
51076
|
checkCFHasChanged(cmd) {
|
|
51056
51077
|
const newCF = this.mapToConditionalFormatInternal(cmd.sheetId, {
|
|
@@ -51058,8 +51079,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51058
51079
|
ranges: cmd.ranges.map((rangeData) => this.getters.getRangeString(this.getters.getRangeFromRangeData(rangeData), cmd.sheetId))
|
|
51059
51080
|
});
|
|
51060
51081
|
const currentCF = this.cfRules[cmd.sheetId]?.find((cf) => cf.id === cmd.cf.id);
|
|
51061
|
-
if (currentCF && deepEquals(newCF, currentCF)) return
|
|
51062
|
-
return
|
|
51082
|
+
if (currentCF && deepEquals(newCF, currentCF)) return "NoChanges";
|
|
51083
|
+
return "Success";
|
|
51063
51084
|
}
|
|
51064
51085
|
checkOperatorArgsNumber(rule) {
|
|
51065
51086
|
const expectedNumber = criterionEvaluatorRegistry.get(rule.operator).numberOfValues({
|
|
@@ -51069,9 +51090,9 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51069
51090
|
if (expectedNumber === void 0 || expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
51070
51091
|
const errors = [];
|
|
51071
51092
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
51072
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
51073
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
51074
|
-
return errors.length ? errors :
|
|
51093
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
51094
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
51095
|
+
return errors.length ? errors : "Success";
|
|
51075
51096
|
}
|
|
51076
51097
|
checkNaN(threshold, thresholdName) {
|
|
51077
51098
|
if ([
|
|
@@ -51079,27 +51100,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51079
51100
|
"percentage",
|
|
51080
51101
|
"percentile"
|
|
51081
51102
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
51082
|
-
case "min": return
|
|
51083
|
-
case "max": return
|
|
51084
|
-
case "mid": return
|
|
51085
|
-
case "upperInflectionPoint": return
|
|
51086
|
-
case "lowerInflectionPoint": return
|
|
51103
|
+
case "min": return "MinNaN";
|
|
51104
|
+
case "max": return "MaxNaN";
|
|
51105
|
+
case "mid": return "MidNaN";
|
|
51106
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
51107
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
51087
51108
|
}
|
|
51088
|
-
return
|
|
51109
|
+
return "Success";
|
|
51089
51110
|
}
|
|
51090
51111
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
51091
|
-
if (threshold.type !== "formula") return
|
|
51112
|
+
if (threshold.type !== "formula") return "Success";
|
|
51092
51113
|
if (CompiledFormula.IsBadExpression(threshold.value || "")) switch (thresholdName) {
|
|
51093
|
-
case "min": return
|
|
51094
|
-
case "max": return
|
|
51095
|
-
case "mid": return
|
|
51096
|
-
case "upperInflectionPoint": return
|
|
51097
|
-
case "lowerInflectionPoint": return
|
|
51114
|
+
case "min": return "MinInvalidFormula";
|
|
51115
|
+
case "max": return "MaxInvalidFormula";
|
|
51116
|
+
case "mid": return "MidInvalidFormula";
|
|
51117
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
51118
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
51098
51119
|
}
|
|
51099
|
-
return
|
|
51120
|
+
return "Success";
|
|
51100
51121
|
}
|
|
51101
51122
|
checkThresholds(check) {
|
|
51102
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
51123
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
51103
51124
|
}
|
|
51104
51125
|
checkInflectionPoints(check) {
|
|
51105
51126
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -51111,8 +51132,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51111
51132
|
"number",
|
|
51112
51133
|
"percentage",
|
|
51113
51134
|
"percentile"
|
|
51114
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
51115
|
-
return
|
|
51135
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
51136
|
+
return "Success";
|
|
51116
51137
|
}
|
|
51117
51138
|
checkMinBiggerThanMax(rule) {
|
|
51118
51139
|
const minValue = rule.minimum.value;
|
|
@@ -51121,8 +51142,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51121
51142
|
"number",
|
|
51122
51143
|
"percentage",
|
|
51123
51144
|
"percentile"
|
|
51124
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
51125
|
-
return
|
|
51145
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
51146
|
+
return "Success";
|
|
51126
51147
|
}
|
|
51127
51148
|
checkMidBiggerThanMax(rule) {
|
|
51128
51149
|
const midValue = rule.midpoint?.value;
|
|
@@ -51131,8 +51152,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51131
51152
|
"number",
|
|
51132
51153
|
"percentage",
|
|
51133
51154
|
"percentile"
|
|
51134
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
51135
|
-
return
|
|
51155
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
51156
|
+
return "Success";
|
|
51136
51157
|
}
|
|
51137
51158
|
checkMinBiggerThanMid(rule) {
|
|
51138
51159
|
const minValue = rule.minimum.value;
|
|
@@ -51141,15 +51162,15 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
51141
51162
|
"number",
|
|
51142
51163
|
"percentage",
|
|
51143
51164
|
"percentile"
|
|
51144
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
51145
|
-
return
|
|
51165
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
51166
|
+
return "Success";
|
|
51146
51167
|
}
|
|
51147
51168
|
checkCFValues(rule) {
|
|
51148
51169
|
for (const value of rule.values) {
|
|
51149
51170
|
if (!value.startsWith("=")) continue;
|
|
51150
|
-
if (CompiledFormula.IsBadExpression(value)) return
|
|
51171
|
+
if (CompiledFormula.IsBadExpression(value)) return "ValueCellIsInvalidFormula";
|
|
51151
51172
|
}
|
|
51152
|
-
return
|
|
51173
|
+
return "Success";
|
|
51153
51174
|
}
|
|
51154
51175
|
removeConditionalFormatting(id, sheet) {
|
|
51155
51176
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -51224,15 +51245,15 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51224
51245
|
allowDispatch(cmd) {
|
|
51225
51246
|
switch (cmd.type) {
|
|
51226
51247
|
case "ADD_DATA_VALIDATION_RULE":
|
|
51227
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51228
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
51248
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51249
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
51229
51250
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkValidRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
51230
51251
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
51231
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51232
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
51252
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51253
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
51233
51254
|
break;
|
|
51234
51255
|
}
|
|
51235
|
-
return
|
|
51256
|
+
return "Success";
|
|
51236
51257
|
}
|
|
51237
51258
|
handle(cmd) {
|
|
51238
51259
|
switch (cmd.type) {
|
|
@@ -51342,7 +51363,7 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51342
51363
|
}
|
|
51343
51364
|
}
|
|
51344
51365
|
checkEmptyRange(cmd) {
|
|
51345
|
-
return cmd.ranges.length ?
|
|
51366
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
51346
51367
|
}
|
|
51347
51368
|
import(data) {
|
|
51348
51369
|
for (const sheet of data.sheets) {
|
|
@@ -51385,13 +51406,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51385
51406
|
}
|
|
51386
51407
|
}
|
|
51387
51408
|
checkCriterionTypeIsValid(cmd) {
|
|
51388
|
-
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
51409
|
+
return criterionEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
51389
51410
|
}
|
|
51390
51411
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
51391
51412
|
const criterion = cmd.rule.criterion;
|
|
51392
51413
|
const expectedNumberOfValues = criterionEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
51393
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
51394
|
-
return
|
|
51414
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
51415
|
+
return "Success";
|
|
51395
51416
|
}
|
|
51396
51417
|
checkCriterionValuesAreValid(cmd) {
|
|
51397
51418
|
const criterion = cmd.rule.criterion;
|
|
@@ -51401,12 +51422,12 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
51401
51422
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals" || CompiledFormula.IsBadExpression(value);
|
|
51402
51423
|
return !evaluator.isCriterionValueValid(value);
|
|
51403
51424
|
};
|
|
51404
|
-
if (criterion.values.some(isInvalid)) return
|
|
51405
|
-
return
|
|
51425
|
+
if (criterion.values.some(isInvalid)) return "InvalidDataValidationCriterionValue";
|
|
51426
|
+
return "Success";
|
|
51406
51427
|
}
|
|
51407
51428
|
checkValidRange(cmd) {
|
|
51408
|
-
if (cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range)).map((range) => this.getters.getRangeString(range, cmd.sheetId)).some((xc) => !this.getters.isRangeValid(xc))) return
|
|
51409
|
-
return
|
|
51429
|
+
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";
|
|
51430
|
+
return "Success";
|
|
51410
51431
|
}
|
|
51411
51432
|
};
|
|
51412
51433
|
|
|
@@ -51462,7 +51483,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51462
51483
|
case "CREATE_FIGURE": return this.checkValidations(cmd, this.checkFigureDuplicate, this.checkFigureAnchorOffset);
|
|
51463
51484
|
case "UPDATE_FIGURE": return this.checkValidations(cmd, this.checkFigureExists, this.checkFigureAnchorOffset);
|
|
51464
51485
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd);
|
|
51465
|
-
default: return
|
|
51486
|
+
default: return "Success";
|
|
51466
51487
|
}
|
|
51467
51488
|
}
|
|
51468
51489
|
beforeHandle(cmd) {
|
|
@@ -51631,16 +51652,16 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
51631
51652
|
this.history.update("figures", sheetId, id, void 0);
|
|
51632
51653
|
}
|
|
51633
51654
|
checkFigureExists(cmd) {
|
|
51634
|
-
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return
|
|
51635
|
-
return
|
|
51655
|
+
if (this.figures[cmd.sheetId]?.[cmd.figureId] === void 0) return "FigureDoesNotExist";
|
|
51656
|
+
return "Success";
|
|
51636
51657
|
}
|
|
51637
51658
|
checkFigureDuplicate(cmd) {
|
|
51638
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return
|
|
51639
|
-
return
|
|
51659
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[cmd.figureId])) return "DuplicatedFigureId";
|
|
51660
|
+
return "Success";
|
|
51640
51661
|
}
|
|
51641
51662
|
checkFigureAnchorOffset(cmd) {
|
|
51642
|
-
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return
|
|
51643
|
-
return
|
|
51663
|
+
if (cmd.col < 0 || cmd.row < 0 || cmd.offset && (cmd.offset.x < 0 || cmd.offset.y < 0)) return "WrongSheetPosition";
|
|
51664
|
+
return "Success";
|
|
51644
51665
|
}
|
|
51645
51666
|
getFigures(sheetId) {
|
|
51646
51667
|
const figures = [];
|
|
@@ -51691,28 +51712,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
51691
51712
|
switch (cmd.type) {
|
|
51692
51713
|
case "GROUP_HEADERS": {
|
|
51693
51714
|
const { start, end, sheetId } = cmd;
|
|
51694
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51695
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51696
|
-
if (start > end) return
|
|
51697
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
51715
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51716
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51717
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51718
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
51698
51719
|
break;
|
|
51699
51720
|
}
|
|
51700
51721
|
case "UNGROUP_HEADERS": {
|
|
51701
51722
|
const { start, end, sheetId } = cmd;
|
|
51702
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
51703
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
51704
|
-
if (start > end) return
|
|
51723
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
51724
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
51725
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
51705
51726
|
break;
|
|
51706
51727
|
}
|
|
51707
51728
|
case "UNFOLD_HEADER_GROUP":
|
|
51708
51729
|
case "FOLD_HEADER_GROUP":
|
|
51709
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
51730
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
51710
51731
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
51711
|
-
if (!group) return
|
|
51712
|
-
if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return
|
|
51732
|
+
if (!group) return "UnknownHeaderGroup";
|
|
51733
|
+
if (range(0, this.getters.getNumberHeaders(cmd.sheetId, cmd.dimension)).every((i) => i >= group.start && i <= group.end || this.getters.isHeaderHiddenByUser(cmd.sheetId, cmd.dimension, i))) return "NotEnoughElements";
|
|
51713
51734
|
break;
|
|
51714
51735
|
}
|
|
51715
|
-
return
|
|
51736
|
+
return "Success";
|
|
51716
51737
|
}
|
|
51717
51738
|
handle(cmd) {
|
|
51718
51739
|
switch (cmd.type) {
|
|
@@ -52120,19 +52141,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
52120
52141
|
allowDispatch(cmd) {
|
|
52121
52142
|
switch (cmd.type) {
|
|
52122
52143
|
case "HIDE_COLUMNS_ROWS": {
|
|
52123
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52144
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52124
52145
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
52125
52146
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
52126
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
52127
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
52128
|
-
else return
|
|
52147
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
52148
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
52149
|
+
else return "Success";
|
|
52129
52150
|
}
|
|
52130
52151
|
case "REMOVE_COLUMNS_ROWS":
|
|
52131
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
52132
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
52133
|
-
return
|
|
52152
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
52153
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
52154
|
+
return "Success";
|
|
52134
52155
|
}
|
|
52135
|
-
return
|
|
52156
|
+
return "Success";
|
|
52136
52157
|
}
|
|
52137
52158
|
handle(cmd) {
|
|
52138
52159
|
switch (cmd.type) {
|
|
@@ -52260,9 +52281,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
52260
52281
|
allowDispatch(cmd) {
|
|
52261
52282
|
switch (cmd.type) {
|
|
52262
52283
|
case "CREATE_IMAGE":
|
|
52263
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
52264
|
-
return
|
|
52265
|
-
default: return
|
|
52284
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
52285
|
+
return "Success";
|
|
52286
|
+
default: return "Success";
|
|
52266
52287
|
}
|
|
52267
52288
|
}
|
|
52268
52289
|
handle(cmd) {
|
|
@@ -52386,7 +52407,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52386
52407
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
52387
52408
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
52388
52409
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
52389
|
-
default: return
|
|
52410
|
+
default: return "Success";
|
|
52390
52411
|
}
|
|
52391
52412
|
}
|
|
52392
52413
|
handle(cmd) {
|
|
@@ -52547,18 +52568,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52547
52568
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
52548
52569
|
}
|
|
52549
52570
|
checkDestructiveMerge({ sheetId, target }) {
|
|
52550
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52551
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
52571
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52572
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
52552
52573
|
}
|
|
52553
52574
|
checkOverlap({ target }) {
|
|
52554
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
52555
|
-
return
|
|
52575
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
52576
|
+
return "Success";
|
|
52556
52577
|
}
|
|
52557
52578
|
checkFrozenPanes({ sheetId, target }) {
|
|
52558
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
52579
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
52559
52580
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
52560
|
-
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return
|
|
52561
|
-
return
|
|
52581
|
+
if (doesAnyZoneCrossFrozenPane(target, xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
52582
|
+
return "Success";
|
|
52562
52583
|
}
|
|
52563
52584
|
/**
|
|
52564
52585
|
* The content of a merged cell should always be empty.
|
|
@@ -52566,10 +52587,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52566
52587
|
*/
|
|
52567
52588
|
checkMergedContentUpdate(cmd) {
|
|
52568
52589
|
const { col, row, content } = cmd;
|
|
52569
|
-
if (content === void 0) return
|
|
52590
|
+
if (content === void 0) return "Success";
|
|
52570
52591
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
52571
|
-
if (mainCol === col && mainRow === row) return
|
|
52572
|
-
return
|
|
52592
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
52593
|
+
return "CellIsMerged";
|
|
52573
52594
|
}
|
|
52574
52595
|
checkMergeExists(cmd) {
|
|
52575
52596
|
const { sheetId, target } = cmd;
|
|
@@ -52580,9 +52601,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
52580
52601
|
col: left,
|
|
52581
52602
|
row: top
|
|
52582
52603
|
});
|
|
52583
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
52604
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
52584
52605
|
}
|
|
52585
|
-
return
|
|
52606
|
+
return "Success";
|
|
52586
52607
|
}
|
|
52587
52608
|
/**
|
|
52588
52609
|
* Merge the current selection. Note that:
|
|
@@ -52747,10 +52768,10 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52747
52768
|
allowDispatch(cmd) {
|
|
52748
52769
|
switch (cmd.type) {
|
|
52749
52770
|
case "CREATE_NAMED_RANGE": return this.checkValidNewNamedRangeName(cmd.name);
|
|
52750
|
-
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) :
|
|
52771
|
+
case "UPDATE_NAMED_RANGE": return this.checkValidations(cmd, () => this.checkNamedRangeExists(cmd.oldRangeName), () => cmd.newRangeName !== cmd.oldRangeName ? this.checkValidNewNamedRangeName(cmd.newRangeName) : "Success");
|
|
52751
52772
|
case "DELETE_NAMED_RANGE": return this.checkNamedRangeExists(cmd.name);
|
|
52752
52773
|
}
|
|
52753
|
-
return
|
|
52774
|
+
return "Success";
|
|
52754
52775
|
}
|
|
52755
52776
|
handle(cmd) {
|
|
52756
52777
|
switch (cmd.type) {
|
|
@@ -52814,14 +52835,14 @@ var NamedRangesPlugin = class extends CorePlugin {
|
|
|
52814
52835
|
}
|
|
52815
52836
|
}
|
|
52816
52837
|
checkValidNewNamedRangeName(name) {
|
|
52817
|
-
if (this.getNamedRange(name)) return
|
|
52818
|
-
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return
|
|
52819
|
-
if (rangeReference.test(name)) return
|
|
52820
|
-
return
|
|
52838
|
+
if (this.getNamedRange(name)) return "NamedRangeNameAlreadyExists";
|
|
52839
|
+
if (!validNamedRangeNameRegex.test(name) || isNumber(name, DEFAULT_LOCALE) || ["TRUE", "FALSE"].includes(name.toUpperCase())) return "NamedRangeInvalidName";
|
|
52840
|
+
if (rangeReference.test(name)) return "NamedRangeNameLooksLikeCellReference";
|
|
52841
|
+
return "Success";
|
|
52821
52842
|
}
|
|
52822
52843
|
checkNamedRangeExists(name) {
|
|
52823
|
-
if (!this.getNamedRange(name)) return
|
|
52824
|
-
return
|
|
52844
|
+
if (!this.getNamedRange(name)) return "NamedRangeNotFound";
|
|
52845
|
+
return "Success";
|
|
52825
52846
|
}
|
|
52826
52847
|
};
|
|
52827
52848
|
|
|
@@ -52846,25 +52867,25 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
52846
52867
|
allowDispatch(cmd) {
|
|
52847
52868
|
switch (cmd.type) {
|
|
52848
52869
|
case "ADD_PIVOT":
|
|
52849
|
-
if (cmd.pivotId in this.pivots) return
|
|
52870
|
+
if (cmd.pivotId in this.pivots) return "PivotIdTaken";
|
|
52850
52871
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52851
52872
|
case "UPDATE_PIVOT":
|
|
52852
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52853
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
52854
|
-
if (cmd.pivot.name === "") return
|
|
52873
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52874
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
52875
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
52855
52876
|
return this.checkValidations(cmd.pivot, this.checkDuplicatedMeasureIds, this.checkSortedColumnInMeasures, this.checkCustomFieldsAreValid);
|
|
52856
52877
|
case "RENAME_PIVOT":
|
|
52857
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52858
|
-
if (cmd.name === "") return
|
|
52878
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52879
|
+
if (cmd.name === "") return "EmptyName";
|
|
52859
52880
|
break;
|
|
52860
52881
|
case "REMOVE_PIVOT":
|
|
52861
52882
|
case "DUPLICATE_PIVOT":
|
|
52862
52883
|
case "INSERT_PIVOT":
|
|
52863
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
52884
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52864
52885
|
break;
|
|
52865
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
52886
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
52866
52887
|
}
|
|
52867
|
-
return
|
|
52888
|
+
return "Success";
|
|
52868
52889
|
}
|
|
52869
52890
|
handle(cmd) {
|
|
52870
52891
|
switch (cmd.type) {
|
|
@@ -53061,13 +53082,13 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53061
53082
|
}
|
|
53062
53083
|
checkSortedColumnInMeasures(definition) {
|
|
53063
53084
|
const measures = definition.measures.map((measure) => measure.id);
|
|
53064
|
-
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return
|
|
53065
|
-
return
|
|
53085
|
+
if (definition.sortedColumn && !measures.includes(definition.sortedColumn.measure)) return "InvalidDefinition";
|
|
53086
|
+
return "Success";
|
|
53066
53087
|
}
|
|
53067
53088
|
checkDuplicatedMeasureIds(definition) {
|
|
53068
53089
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
53069
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
53070
|
-
return
|
|
53090
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
53091
|
+
return "Success";
|
|
53071
53092
|
}
|
|
53072
53093
|
checkCustomFieldsAreValid(definition) {
|
|
53073
53094
|
for (const customFieldName in definition.customFields) {
|
|
@@ -53076,15 +53097,15 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
53076
53097
|
const groupNames = /* @__PURE__ */ new Set();
|
|
53077
53098
|
let hasOtherGroup = false;
|
|
53078
53099
|
for (const group of customField.groups) {
|
|
53079
|
-
if (!group.name || groupNames.has(group.name)) return
|
|
53080
|
-
if (group.values.some((value) => groupedValues.has(value))) return
|
|
53081
|
-
if (group.isOtherGroup && hasOtherGroup) return
|
|
53100
|
+
if (!group.name || groupNames.has(group.name)) return "InvalidPivotCustomField";
|
|
53101
|
+
if (group.values.some((value) => groupedValues.has(value))) return "InvalidPivotCustomField";
|
|
53102
|
+
if (group.isOtherGroup && hasOtherGroup) return "InvalidPivotCustomField";
|
|
53082
53103
|
group.values.forEach((value) => groupedValues.add(value));
|
|
53083
53104
|
groupNames.add(group.name);
|
|
53084
53105
|
hasOtherGroup ||= !!group.isOtherGroup;
|
|
53085
53106
|
}
|
|
53086
53107
|
}
|
|
53087
|
-
return
|
|
53108
|
+
return "Success";
|
|
53088
53109
|
}
|
|
53089
53110
|
/**
|
|
53090
53111
|
* Import the pivots
|
|
@@ -53113,9 +53134,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
53113
53134
|
locale = DEFAULT_LOCALE;
|
|
53114
53135
|
allowDispatch(cmd) {
|
|
53115
53136
|
switch (cmd.type) {
|
|
53116
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
53137
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
53117
53138
|
}
|
|
53118
|
-
return
|
|
53139
|
+
return "Success";
|
|
53119
53140
|
}
|
|
53120
53141
|
handle(cmd) {
|
|
53121
53142
|
switch (cmd.type) {
|
|
@@ -53196,7 +53217,7 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53196
53217
|
cellPosition = {};
|
|
53197
53218
|
allowDispatch(cmd) {
|
|
53198
53219
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
53199
|
-
if (genericChecks !==
|
|
53220
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
53200
53221
|
let sheetNameMissing = false;
|
|
53201
53222
|
switch (cmd.type) {
|
|
53202
53223
|
case "CREATE_SHEET":
|
|
@@ -53212,37 +53233,37 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53212
53233
|
if (sheetNameMissing) console.warn("Deprecation Warning: Sheet name is missing in the command %s payload.", cmd.type);
|
|
53213
53234
|
switch (cmd.type) {
|
|
53214
53235
|
case "HIDE_SHEET":
|
|
53215
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
53216
|
-
return
|
|
53236
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
53237
|
+
return "Success";
|
|
53217
53238
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.createSheetHasName, this.checkSheetName, this.checkSheetPosition);
|
|
53218
53239
|
case "DUPLICATE_SHEET":
|
|
53219
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
53220
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
53221
|
-
return
|
|
53240
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
53241
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
53242
|
+
return "Success";
|
|
53222
53243
|
case "MOVE_SHEET": try {
|
|
53223
53244
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
53224
53245
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
53225
|
-
return
|
|
53246
|
+
return "Success";
|
|
53226
53247
|
} catch (e) {
|
|
53227
|
-
return
|
|
53248
|
+
return "WrongSheetMove";
|
|
53228
53249
|
}
|
|
53229
53250
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
53230
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
53231
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
53251
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
53252
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
53232
53253
|
case "ADD_COLUMNS_ROWS":
|
|
53233
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
53234
|
-
else if (cmd.quantity <= 0) return
|
|
53235
|
-
return
|
|
53254
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
53255
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
53256
|
+
return "Success";
|
|
53236
53257
|
case "REMOVE_COLUMNS_ROWS": {
|
|
53237
53258
|
const min = largeMin(cmd.elements);
|
|
53238
53259
|
const max = largeMax(cmd.elements);
|
|
53239
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
53240
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
53241
|
-
else return
|
|
53260
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
53261
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
53262
|
+
else return "Success";
|
|
53242
53263
|
}
|
|
53243
53264
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
53244
53265
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
53245
|
-
default: return
|
|
53266
|
+
default: return "Success";
|
|
53246
53267
|
}
|
|
53247
53268
|
}
|
|
53248
53269
|
handle(cmd) {
|
|
@@ -53517,12 +53538,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53517
53538
|
* not outside the sheet.
|
|
53518
53539
|
*/
|
|
53519
53540
|
checkZonesExistInSheet(sheetId, zones) {
|
|
53520
|
-
if (!zones.every(isZoneValid)) return
|
|
53541
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
53521
53542
|
if (zones.length) {
|
|
53522
53543
|
const sheetZone = this.getSheetZone(sheetId);
|
|
53523
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
53544
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
53524
53545
|
}
|
|
53525
|
-
return
|
|
53546
|
+
return "Success";
|
|
53526
53547
|
}
|
|
53527
53548
|
updateCellPosition(cmd) {
|
|
53528
53549
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -53596,42 +53617,42 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53596
53617
|
throw new Error("There is not enough visible sheets");
|
|
53597
53618
|
}
|
|
53598
53619
|
createSheetHasName(cmd) {
|
|
53599
|
-
if (cmd.name !== void 0 && !cmd.name.trim()) return
|
|
53600
|
-
return
|
|
53620
|
+
if (cmd.name !== void 0 && !cmd.name.trim()) return "MissingSheetName";
|
|
53621
|
+
return "Success";
|
|
53601
53622
|
}
|
|
53602
53623
|
checkSheetName(cmd) {
|
|
53603
53624
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
53604
53625
|
const sheetName = cmd.type === "RENAME_SHEET" ? cmd.newName : cmd.name;
|
|
53605
|
-
if (originalSheetName !== void 0 && sheetName === originalSheetName) return
|
|
53626
|
+
if (originalSheetName !== void 0 && sheetName === originalSheetName) return "UnchangedSheetName";
|
|
53606
53627
|
const { orderedSheetIds, sheets } = this;
|
|
53607
53628
|
const name = sheetName && sheetName.trim().toLowerCase();
|
|
53608
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
53609
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
53610
|
-
return
|
|
53629
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
53630
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
53631
|
+
return "Success";
|
|
53611
53632
|
}
|
|
53612
53633
|
checkSheetPosition(cmd) {
|
|
53613
53634
|
const { orderedSheetIds } = this;
|
|
53614
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
53615
|
-
return
|
|
53635
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
53636
|
+
return "Success";
|
|
53616
53637
|
}
|
|
53617
53638
|
checkRowFreezeQuantity(cmd) {
|
|
53618
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
53639
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53619
53640
|
}
|
|
53620
53641
|
checkColFreezeQuantity(cmd) {
|
|
53621
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
53642
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
53622
53643
|
}
|
|
53623
53644
|
checkRowFreezeOverlapMerge(cmd) {
|
|
53624
53645
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53625
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
53626
|
-
return
|
|
53646
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
53647
|
+
return "Success";
|
|
53627
53648
|
}
|
|
53628
53649
|
checkColFreezeOverlapMerge(cmd) {
|
|
53629
53650
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
53630
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
53631
|
-
return
|
|
53651
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
53652
|
+
return "Success";
|
|
53632
53653
|
}
|
|
53633
53654
|
isRenameAllowed(cmd) {
|
|
53634
|
-
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return
|
|
53655
|
+
if (!(cmd.newName && cmd.newName.trim().toLowerCase())) return "MissingSheetName";
|
|
53635
53656
|
return this.checkSheetName(cmd);
|
|
53636
53657
|
}
|
|
53637
53658
|
renameSheet(sheet, name) {
|
|
@@ -53854,19 +53875,19 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
53854
53875
|
* sheet.
|
|
53855
53876
|
*/
|
|
53856
53877
|
checkSheetExists(cmd) {
|
|
53857
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
53858
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
53859
|
-
return
|
|
53878
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
53879
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
53880
|
+
return "Success";
|
|
53860
53881
|
}
|
|
53861
53882
|
/**
|
|
53862
53883
|
* Check if zones in the command are well formed and
|
|
53863
53884
|
* not outside the sheet.
|
|
53864
53885
|
*/
|
|
53865
53886
|
checkZonesAreInSheet(cmd) {
|
|
53866
|
-
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return
|
|
53867
|
-
if (!("sheetId" in cmd)) return
|
|
53868
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
53869
|
-
if (isTargetDependent(cmd) && cmd.target.length === 0) return
|
|
53887
|
+
if (isRangeDependant(cmd) && cmd.ranges.length === 0) return "EmptyRange";
|
|
53888
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
53889
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => rangeData._sheetId !== "" && !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
53890
|
+
if (isTargetDependent(cmd) && cmd.target.length === 0) return "EmptyTarget";
|
|
53870
53891
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
53871
53892
|
}
|
|
53872
53893
|
};
|
|
@@ -53881,15 +53902,15 @@ var SpreadsheetPivotCorePlugin = class extends CorePlugin {
|
|
|
53881
53902
|
const definition = cmd.pivot;
|
|
53882
53903
|
return this.checkDataSetValidity(definition);
|
|
53883
53904
|
}
|
|
53884
|
-
return
|
|
53905
|
+
return "Success";
|
|
53885
53906
|
}
|
|
53886
53907
|
checkDataSetValidity(definition) {
|
|
53887
53908
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
53888
53909
|
const { zone, sheetId } = definition.dataSet;
|
|
53889
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
53910
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
53890
53911
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
53891
53912
|
}
|
|
53892
|
-
return
|
|
53913
|
+
return "Success";
|
|
53893
53914
|
}
|
|
53894
53915
|
};
|
|
53895
53916
|
|
|
@@ -53907,18 +53928,18 @@ var TableStylePlugin = class extends CorePlugin {
|
|
|
53907
53928
|
switch (cmd.type) {
|
|
53908
53929
|
case "CREATE_TABLE":
|
|
53909
53930
|
case "UPDATE_TABLE":
|
|
53910
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
53931
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
53911
53932
|
break;
|
|
53912
53933
|
case "CREATE_TABLE_STYLE":
|
|
53913
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
53934
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
53914
53935
|
try {
|
|
53915
53936
|
toHex(cmd.primaryColor);
|
|
53916
53937
|
} catch (e) {
|
|
53917
|
-
return
|
|
53938
|
+
return "InvalidTableStyle";
|
|
53918
53939
|
}
|
|
53919
53940
|
break;
|
|
53920
53941
|
}
|
|
53921
|
-
return
|
|
53942
|
+
return "Success";
|
|
53922
53943
|
}
|
|
53923
53944
|
handle(cmd) {
|
|
53924
53945
|
switch (cmd.type) {
|
|
@@ -53989,21 +54010,21 @@ var TablePlugin = class extends CorePlugin {
|
|
|
53989
54010
|
allowDispatch(cmd) {
|
|
53990
54011
|
switch (cmd.type) {
|
|
53991
54012
|
case "CREATE_TABLE":
|
|
53992
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
54013
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
53993
54014
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
53994
|
-
if (!areZonesContinuous(zones)) return
|
|
53995
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
54015
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
54016
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
53996
54017
|
case "UPDATE_TABLE":
|
|
53997
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
54018
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
53998
54019
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
53999
54020
|
case "ADD_MERGE":
|
|
54000
54021
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
54001
54022
|
const tableZone = table.range.zone;
|
|
54002
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
54023
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
54003
54024
|
}
|
|
54004
54025
|
break;
|
|
54005
54026
|
}
|
|
54006
|
-
return
|
|
54027
|
+
return "Success";
|
|
54007
54028
|
}
|
|
54008
54029
|
handle(cmd) {
|
|
54009
54030
|
switch (cmd.type) {
|
|
@@ -54137,19 +54158,19 @@ var TablePlugin = class extends CorePlugin {
|
|
|
54137
54158
|
}
|
|
54138
54159
|
}
|
|
54139
54160
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
54140
|
-
if (!cmd.newTableRange) return
|
|
54161
|
+
if (!cmd.newTableRange) return "Success";
|
|
54141
54162
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
54142
54163
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
54143
|
-
if (zoneIsInSheet !==
|
|
54164
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
54144
54165
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
54145
|
-
if (!updatedTable) return
|
|
54146
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
54166
|
+
if (!updatedTable) return "TableNotFound";
|
|
54167
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
54147
54168
|
}
|
|
54148
54169
|
checkTableConfigUpdateIsValid(config) {
|
|
54149
|
-
if (!config) return
|
|
54150
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
54151
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
54152
|
-
return
|
|
54170
|
+
if (!config) return "Success";
|
|
54171
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
54172
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
54173
|
+
return "Success";
|
|
54153
54174
|
}
|
|
54154
54175
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
54155
54176
|
const zone = tableRange.zone;
|
|
@@ -54389,6 +54410,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
54389
54410
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
54390
54411
|
}
|
|
54391
54412
|
var CompilationParametersBuilder = class {
|
|
54413
|
+
getters;
|
|
54414
|
+
computeCell;
|
|
54392
54415
|
evalContext;
|
|
54393
54416
|
rangeCache = {};
|
|
54394
54417
|
constructor(context, getters, computeCell) {
|
|
@@ -54480,6 +54503,9 @@ var CompilationParametersBuilder = class {
|
|
|
54480
54503
|
//#endregion
|
|
54481
54504
|
//#region src/plugins/ui_core_views/cell_evaluation/interval_tree.ts
|
|
54482
54505
|
var IntervalNode = class {
|
|
54506
|
+
interval;
|
|
54507
|
+
left;
|
|
54508
|
+
right;
|
|
54483
54509
|
/**
|
|
54484
54510
|
* Augmented value: the highest 'bottom' boundary in this subtree.
|
|
54485
54511
|
* Allows O(log n) pruning during overlap searches.
|
|
@@ -55380,6 +55406,7 @@ onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
|
55380
55406
|
const MAX_ITERATION = 30;
|
|
55381
55407
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
55382
55408
|
var Evaluator = class {
|
|
55409
|
+
context;
|
|
55383
55410
|
getters;
|
|
55384
55411
|
compilationParams;
|
|
55385
55412
|
evaluatedCells = new PositionMap();
|
|
@@ -55398,7 +55425,7 @@ var Evaluator = class {
|
|
|
55398
55425
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
55399
55426
|
if (!spreadZone) return;
|
|
55400
55427
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
55401
|
-
if (evaluatedCell?.type ===
|
|
55428
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
55402
55429
|
return union(positionToZone(position), spreadZone);
|
|
55403
55430
|
}
|
|
55404
55431
|
getEvaluatedPositions() {
|
|
@@ -55408,7 +55435,7 @@ var Evaluator = class {
|
|
|
55408
55435
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
55409
55436
|
}
|
|
55410
55437
|
getArrayFormulaSpreadingOn(position) {
|
|
55411
|
-
if (this.getEvaluatedCell(position).type ===
|
|
55438
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
55412
55439
|
return this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position)).find((position) => !this.blockedArrayFormulas.has(position));
|
|
55413
55440
|
}
|
|
55414
55441
|
isArrayFormulaSpillBlocked(position) {
|
|
@@ -55605,7 +55632,7 @@ var Evaluator = class {
|
|
|
55605
55632
|
const formulaReturn = updateEvalContextAndExecute(cellData.compiledFormula, this.compilationParams, formulaPosition.sheetId, this.buildSafeGetSymbolValue(), formulaPosition);
|
|
55606
55633
|
if (!isMatrix(formulaReturn)) {
|
|
55607
55634
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(formulaReturn), this.getters.getLocale(), formulaPosition, cellData);
|
|
55608
|
-
if (evaluatedCell.type ===
|
|
55635
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = formulaReturn.errorOriginPosition ?? formulaPosition;
|
|
55609
55636
|
return evaluatedCell;
|
|
55610
55637
|
}
|
|
55611
55638
|
this.assertSheetHasEnoughSpaceToSpreadFormulaResult(formulaPosition, formulaReturn);
|
|
@@ -55666,7 +55693,7 @@ var Evaluator = class {
|
|
|
55666
55693
|
row: j + row
|
|
55667
55694
|
};
|
|
55668
55695
|
const rawCell = this.getters.getCell(position);
|
|
55669
|
-
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !==
|
|
55696
|
+
if (rawCell?.isFormula || rawCell?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
55670
55697
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
55671
55698
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data."), position);
|
|
55672
55699
|
}
|
|
@@ -55683,7 +55710,7 @@ var Evaluator = class {
|
|
|
55683
55710
|
};
|
|
55684
55711
|
const cell = this.getters.getCell(position);
|
|
55685
55712
|
const evaluatedCell = createEvaluatedCell(validateNumberValue(matrixResult[i][j]), this.getters.getLocale(), position, cell);
|
|
55686
|
-
if (evaluatedCell.type ===
|
|
55713
|
+
if (evaluatedCell.type === "error") evaluatedCell.errorOriginPosition = matrixResult[i][j].errorOriginPosition ?? position;
|
|
55687
55714
|
this.evaluatedCells.set(position, evaluatedCell);
|
|
55688
55715
|
};
|
|
55689
55716
|
return spreadValues;
|
|
@@ -55887,7 +55914,7 @@ var EvaluationPlugin = class extends CoreViewPlugin {
|
|
|
55887
55914
|
sheetId,
|
|
55888
55915
|
col,
|
|
55889
55916
|
row
|
|
55890
|
-
})).every((cell) => cell.type ===
|
|
55917
|
+
})).every((cell) => cell.type === "empty");
|
|
55891
55918
|
}
|
|
55892
55919
|
/**
|
|
55893
55920
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -56840,7 +56867,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56840
56867
|
}
|
|
56841
56868
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
56842
56869
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
56843
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type ===
|
|
56870
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
56844
56871
|
switch (threshold.type) {
|
|
56845
56872
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
56846
56873
|
case "number": return Number(threshold.value);
|
|
@@ -56871,7 +56898,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56871
56898
|
col,
|
|
56872
56899
|
row
|
|
56873
56900
|
});
|
|
56874
|
-
if (cell.type !==
|
|
56901
|
+
if (cell.type !== "number") continue;
|
|
56875
56902
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
56876
56903
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
56877
56904
|
computedIcons[col][row] = icon;
|
|
@@ -56884,7 +56911,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56884
56911
|
}
|
|
56885
56912
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
56886
56913
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
56887
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
56914
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
56888
56915
|
if (max <= 0) return;
|
|
56889
56916
|
const color = rule.color;
|
|
56890
56917
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -56897,7 +56924,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56897
56924
|
col: targetCol,
|
|
56898
56925
|
row: targetRow
|
|
56899
56926
|
});
|
|
56900
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
56927
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
56901
56928
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
56902
56929
|
computedDataBars[col][row] = {
|
|
56903
56930
|
color: colorNumberToHex(color),
|
|
@@ -56931,7 +56958,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56931
56958
|
col,
|
|
56932
56959
|
row
|
|
56933
56960
|
});
|
|
56934
|
-
if (cell.type ===
|
|
56961
|
+
if (cell.type === "number") {
|
|
56935
56962
|
const value = clip(cell.value, minValue, maxValue);
|
|
56936
56963
|
if (!computedStyle[col]) computedStyle[col] = [];
|
|
56937
56964
|
computedStyle[col][row] = computedStyle[col]?.[row] || {};
|
|
@@ -56941,7 +56968,7 @@ var EvaluationConditionalFormatPlugin = class extends CoreViewPlugin {
|
|
|
56941
56968
|
}
|
|
56942
56969
|
getRuleResultForTarget(target, rule, preComputedCriterion) {
|
|
56943
56970
|
const cell = this.getters.getEvaluatedCell(target);
|
|
56944
|
-
if (cell.type ===
|
|
56971
|
+
if (cell.type === "error") return false;
|
|
56945
56972
|
const { sheetId } = target;
|
|
56946
56973
|
const evaluator = criterionEvaluatorRegistry.get(rule.operator);
|
|
56947
56974
|
const evaluatedCriterionValues = rule.values.map((value) => {
|
|
@@ -57087,7 +57114,7 @@ var EvaluationDataValidationPlugin = class extends CoreViewPlugin {
|
|
|
57087
57114
|
if (!validationResults[col]) validationResults[col] = [];
|
|
57088
57115
|
validationResults[col][row] = lazy(() => {
|
|
57089
57116
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
57090
|
-
if (evaluatedCell.type ===
|
|
57117
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
57091
57118
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
57092
57119
|
});
|
|
57093
57120
|
}
|
|
@@ -57818,6 +57845,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
57818
57845
|
"getFirstPivotFunction",
|
|
57819
57846
|
"getPivotCellSortDirection",
|
|
57820
57847
|
"getPivotIdFromPosition",
|
|
57848
|
+
"getPivotIdsFromPosition",
|
|
57821
57849
|
"getPivotCellFromPosition",
|
|
57822
57850
|
"generateNewCalculatedMeasureName",
|
|
57823
57851
|
"isPivotUnused",
|
|
@@ -57877,37 +57905,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
57877
57905
|
}
|
|
57878
57906
|
}
|
|
57879
57907
|
/**
|
|
57880
|
-
* Get the id of the pivot at the given position. Returns undefined if there
|
|
57908
|
+
* Get the id of the first pivot in the formula at the given position. Returns undefined if there
|
|
57881
57909
|
* is no pivot at this position
|
|
57882
57910
|
*/
|
|
57883
57911
|
getPivotIdFromPosition(position) {
|
|
57912
|
+
return this.getPivotIdsFromPosition(position)[0];
|
|
57913
|
+
}
|
|
57914
|
+
/**
|
|
57915
|
+
* Get all of the ids of the pivot present in the formula at the given position.
|
|
57916
|
+
*/
|
|
57917
|
+
getPivotIdsFromPosition(position) {
|
|
57884
57918
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
57885
|
-
if (cell && cell.isFormula)
|
|
57886
|
-
|
|
57887
|
-
|
|
57888
|
-
|
|
57889
|
-
|
|
57890
|
-
|
|
57891
|
-
|
|
57919
|
+
if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
|
|
57920
|
+
return [];
|
|
57921
|
+
}
|
|
57922
|
+
getPivotIdsFromFormula(sheetId, formula) {
|
|
57923
|
+
return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
|
|
57924
|
+
const pivotId = pivotFunction.args[0]?.toString();
|
|
57925
|
+
return pivotId && this.getters.getPivotId(pivotId);
|
|
57926
|
+
}).filter(isDefined);
|
|
57892
57927
|
}
|
|
57893
57928
|
isSpillPivotFormula(position) {
|
|
57894
57929
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
57895
57930
|
if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
|
|
57896
57931
|
return false;
|
|
57897
57932
|
}
|
|
57898
|
-
|
|
57899
|
-
const
|
|
57900
|
-
if (!
|
|
57901
|
-
const
|
|
57902
|
-
|
|
57903
|
-
functionName,
|
|
57904
|
-
|
|
57933
|
+
getPivotFunctions(sheetId, formula) {
|
|
57934
|
+
const pivotFunctions = getPivotFunctions(formula, this.getters);
|
|
57935
|
+
if (!pivotFunctions.length) return [];
|
|
57936
|
+
const evaluatedPivotFunctions = [];
|
|
57937
|
+
for (const pivotFunction of pivotFunctions) {
|
|
57938
|
+
const { functionName, args } = pivotFunction;
|
|
57939
|
+
const evaluatedArgs = args.map((argAst) => {
|
|
57905
57940
|
if (argAst.type === "EMPTY") return;
|
|
57906
57941
|
else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
|
|
57907
57942
|
const argsString = astToFormula(argAst);
|
|
57908
57943
|
return this.getters.evaluateFormula(sheetId, argsString);
|
|
57909
|
-
})
|
|
57910
|
-
|
|
57944
|
+
});
|
|
57945
|
+
evaluatedPivotFunctions.push({
|
|
57946
|
+
functionName,
|
|
57947
|
+
args: evaluatedArgs
|
|
57948
|
+
});
|
|
57949
|
+
}
|
|
57950
|
+
return evaluatedPivotFunctions;
|
|
57951
|
+
}
|
|
57952
|
+
getFirstPivotFunction(sheetId, formula) {
|
|
57953
|
+
return this.getPivotFunctions(sheetId, formula)[0];
|
|
57911
57954
|
}
|
|
57912
57955
|
/**
|
|
57913
57956
|
* Returns the domain args of a pivot formula from a position.
|
|
@@ -58013,8 +58056,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58013
58056
|
const unusedPivots = new Set(this.getters.getPivotIds());
|
|
58014
58057
|
for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
|
|
58015
58058
|
const position = this.getters.getCellPosition(cell.id);
|
|
58016
|
-
const
|
|
58017
|
-
|
|
58059
|
+
const pivotIds = this.getPivotIdsFromPosition(position);
|
|
58060
|
+
for (const pivotId of pivotIds) {
|
|
58018
58061
|
unusedPivots.delete(pivotId);
|
|
58019
58062
|
if (!unusedPivots.size) {
|
|
58020
58063
|
this.unusedPivotsInFormulas = [];
|
|
@@ -58022,6 +58065,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58022
58065
|
}
|
|
58023
58066
|
}
|
|
58024
58067
|
}
|
|
58068
|
+
for (const pivotId of this.getters.getPivotIds()) {
|
|
58069
|
+
const pivot = this.getters.getPivot(pivotId);
|
|
58070
|
+
for (const measure of pivot.definition.measures) if (measure.computedBy) {
|
|
58071
|
+
const { sheetId } = measure.computedBy;
|
|
58072
|
+
const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
|
|
58073
|
+
const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
|
|
58074
|
+
for (const relatedPivotId of relatedPivotIds) {
|
|
58075
|
+
unusedPivots.delete(relatedPivotId);
|
|
58076
|
+
if (!unusedPivots.size) {
|
|
58077
|
+
this.unusedPivotsInFormulas = [];
|
|
58078
|
+
return [];
|
|
58079
|
+
}
|
|
58080
|
+
}
|
|
58081
|
+
}
|
|
58082
|
+
}
|
|
58025
58083
|
this.unusedPivotsInFormulas = [...unusedPivots];
|
|
58026
58084
|
return this.unusedPivotsInFormulas;
|
|
58027
58085
|
}
|
|
@@ -58029,7 +58087,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58029
58087
|
const result = [];
|
|
58030
58088
|
for (const cellId of this.getters.getCellsWithTrackedFormula("PIVOT")) {
|
|
58031
58089
|
const position = this.getters.getCellPosition(cellId);
|
|
58032
|
-
if (this.getters.getEvaluatedCell(position).type ===
|
|
58090
|
+
if (this.getters.getEvaluatedCell(position).type === "error") continue;
|
|
58033
58091
|
const pivotInfo = this.getPivotStyleAtPosition(position);
|
|
58034
58092
|
if (pivotInfo) result.push({
|
|
58035
58093
|
position,
|
|
@@ -58061,6 +58119,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
|
|
|
58061
58119
|
//#endregion
|
|
58062
58120
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
58063
58121
|
var ClipboardHandler = class {
|
|
58122
|
+
getters;
|
|
58123
|
+
dispatch;
|
|
58064
58124
|
constructor(getters, dispatch) {
|
|
58065
58125
|
this.getters = getters;
|
|
58066
58126
|
this.dispatch = dispatch;
|
|
@@ -58068,10 +58128,10 @@ var ClipboardHandler = class {
|
|
|
58068
58128
|
copy(data, isCutOperation, mode = "copyPaste") {}
|
|
58069
58129
|
paste(target, clippedContent, options) {}
|
|
58070
58130
|
isPasteAllowed(sheetId, target, content, option) {
|
|
58071
|
-
return
|
|
58131
|
+
return "Success";
|
|
58072
58132
|
}
|
|
58073
58133
|
isCutAllowed(data) {
|
|
58074
|
-
return
|
|
58134
|
+
return "Success";
|
|
58075
58135
|
}
|
|
58076
58136
|
getPasteTarget(sheetId, target, content, options) {
|
|
58077
58137
|
return {
|
|
@@ -58097,8 +58157,8 @@ var AbstractCellClipboardHandler = class extends ClipboardHandler {
|
|
|
58097
58157
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
58098
58158
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
58099
58159
|
isCutAllowed(data) {
|
|
58100
|
-
if (data.zones.length !== 1) return
|
|
58101
|
-
return
|
|
58160
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
58161
|
+
return "Success";
|
|
58102
58162
|
}
|
|
58103
58163
|
copy(data, isCutOperation, mode = "copyPaste") {
|
|
58104
58164
|
const sheetId = data.sheetId;
|
|
@@ -58163,17 +58223,17 @@ var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
58163
58223
|
};
|
|
58164
58224
|
}
|
|
58165
58225
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
58166
|
-
if (!content.cells) return
|
|
58167
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
58226
|
+
if (!content.cells) return "Success";
|
|
58227
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
58168
58228
|
if (target.length > 1) {
|
|
58169
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
58229
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
58170
58230
|
}
|
|
58171
58231
|
const clipboardHeight = content.cells.length;
|
|
58172
58232
|
const clipboardWidth = content.cells[0].length;
|
|
58173
58233
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
58174
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
58234
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
58175
58235
|
}
|
|
58176
|
-
return
|
|
58236
|
+
return "Success";
|
|
58177
58237
|
}
|
|
58178
58238
|
/**
|
|
58179
58239
|
* Paste the clipboard content in the given target
|
|
@@ -58322,7 +58382,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58322
58382
|
switch (cmd.type) {
|
|
58323
58383
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
58324
58384
|
}
|
|
58325
|
-
return
|
|
58385
|
+
return "Success";
|
|
58326
58386
|
}
|
|
58327
58387
|
handle(cmd) {
|
|
58328
58388
|
switch (cmd.type) {
|
|
@@ -58405,34 +58465,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
58405
58465
|
});
|
|
58406
58466
|
}
|
|
58407
58467
|
checkSingleRangeSelected() {
|
|
58408
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
58409
|
-
return
|
|
58468
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
58469
|
+
return "Success";
|
|
58410
58470
|
}
|
|
58411
58471
|
checkNoMergeInZone() {
|
|
58412
58472
|
const sheetId = this.getters.getActiveSheetId();
|
|
58413
58473
|
const zone = this.getters.getSelectedZone();
|
|
58414
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
58415
|
-
return
|
|
58474
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
58475
|
+
return "Success";
|
|
58416
58476
|
}
|
|
58417
58477
|
checkRangeContainsValues(cmd) {
|
|
58418
58478
|
const sheetId = this.getters.getActiveSheetId();
|
|
58419
58479
|
const zone = this.getters.getSelectedZone();
|
|
58420
58480
|
if (cmd.hasHeader) zone.top += 1;
|
|
58421
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
58422
|
-
return
|
|
58481
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptySelectedRange";
|
|
58482
|
+
return "Success";
|
|
58423
58483
|
}
|
|
58424
58484
|
checkNoColumnProvided(cmd) {
|
|
58425
|
-
if (cmd.columns.length === 0) return
|
|
58426
|
-
return
|
|
58485
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
58486
|
+
return "Success";
|
|
58427
58487
|
}
|
|
58428
58488
|
checkColumnsIncludedInZone(cmd) {
|
|
58429
58489
|
const zone = this.getters.getSelectedZone();
|
|
58430
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
58431
|
-
return
|
|
58490
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
58491
|
+
return "Success";
|
|
58432
58492
|
}
|
|
58433
58493
|
checkColumnsAreUnique(cmd) {
|
|
58434
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
58435
|
-
return
|
|
58494
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
58495
|
+
return "Success";
|
|
58436
58496
|
}
|
|
58437
58497
|
trimWhitespace() {
|
|
58438
58498
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -58550,19 +58610,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
58550
58610
|
let x = 0;
|
|
58551
58611
|
let y = 0;
|
|
58552
58612
|
switch (direction) {
|
|
58553
|
-
case
|
|
58613
|
+
case "up":
|
|
58554
58614
|
x = 0;
|
|
58555
58615
|
y = -rule.current;
|
|
58556
58616
|
break;
|
|
58557
|
-
case
|
|
58617
|
+
case "down":
|
|
58558
58618
|
x = 0;
|
|
58559
58619
|
y = rule.current;
|
|
58560
58620
|
break;
|
|
58561
|
-
case
|
|
58621
|
+
case "left":
|
|
58562
58622
|
x = -rule.current;
|
|
58563
58623
|
y = 0;
|
|
58564
58624
|
break;
|
|
58565
|
-
case
|
|
58625
|
+
case "right":
|
|
58566
58626
|
x = rule.current;
|
|
58567
58627
|
y = 0;
|
|
58568
58628
|
break;
|
|
@@ -58689,11 +58749,11 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58689
58749
|
},
|
|
58690
58750
|
sequence: 10
|
|
58691
58751
|
}).add("increment_alphanumeric_value", {
|
|
58692
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58752
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
58693
58753
|
generateRule: (cell, cells, direction) => {
|
|
58694
58754
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
58695
58755
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
58696
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58756
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
|
|
58697
58757
|
const mostLeadingZeros = group.reduce((candidate, current) => {
|
|
58698
58758
|
const currentLength = current.match(leadingZerosRegex)[0].length;
|
|
58699
58759
|
return currentLength > candidate[1] ? [current, currentLength] : candidate;
|
|
@@ -58711,7 +58771,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58711
58771
|
},
|
|
58712
58772
|
sequence: 15
|
|
58713
58773
|
}).add("copy_text", {
|
|
58714
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58774
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
58715
58775
|
generateRule: () => {
|
|
58716
58776
|
return { type: "COPY_MODIFIER" };
|
|
58717
58777
|
},
|
|
@@ -58728,10 +58788,10 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58728
58788
|
sequence: 30
|
|
58729
58789
|
}).add("increment_dates", {
|
|
58730
58790
|
condition: (cell, cells) => {
|
|
58731
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58791
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
58732
58792
|
},
|
|
58733
58793
|
generateRule: (cell, cells) => {
|
|
58734
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58794
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
58735
58795
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
58736
58796
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
58737
58797
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -58740,26 +58800,26 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
58740
58800
|
if (typeof increment === "object") return {
|
|
58741
58801
|
type: "DATE_INCREMENT_MODIFIER",
|
|
58742
58802
|
increment,
|
|
58743
|
-
current: evaluation.type ===
|
|
58803
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58744
58804
|
};
|
|
58745
58805
|
return {
|
|
58746
58806
|
type: "INCREMENT_MODIFIER",
|
|
58747
58807
|
increment,
|
|
58748
|
-
current: evaluation.type ===
|
|
58808
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58749
58809
|
};
|
|
58750
58810
|
},
|
|
58751
58811
|
sequence: 25
|
|
58752
58812
|
}).add("increment_number", {
|
|
58753
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
58813
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
58754
58814
|
generateRule: (cell, cells, direction) => {
|
|
58755
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
58815
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
58756
58816
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
58757
58817
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
58758
58818
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
58759
58819
|
return {
|
|
58760
58820
|
type: "INCREMENT_MODIFIER",
|
|
58761
58821
|
increment,
|
|
58762
|
-
current: evaluation.type ===
|
|
58822
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
58763
58823
|
};
|
|
58764
58824
|
},
|
|
58765
58825
|
sequence: 40
|
|
@@ -58869,10 +58929,10 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58869
58929
|
const sheetId = this.getters.getActiveSheetId();
|
|
58870
58930
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
58871
58931
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
58872
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
58873
|
-
return
|
|
58932
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
58933
|
+
return "InvalidAutofillSelection";
|
|
58874
58934
|
}
|
|
58875
|
-
return
|
|
58935
|
+
return "Success";
|
|
58876
58936
|
}
|
|
58877
58937
|
handle(cmd) {
|
|
58878
58938
|
switch (cmd.type) {
|
|
@@ -58904,7 +58964,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58904
58964
|
const target = this.autofillZone;
|
|
58905
58965
|
const autofillCellsData = [];
|
|
58906
58966
|
switch (this.direction) {
|
|
58907
|
-
case
|
|
58967
|
+
case "down":
|
|
58908
58968
|
for (let col = source.left; col <= source.right; col++) {
|
|
58909
58969
|
const xcs = [];
|
|
58910
58970
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -58912,7 +58972,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58912
58972
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58913
58973
|
}
|
|
58914
58974
|
break;
|
|
58915
|
-
case
|
|
58975
|
+
case "up":
|
|
58916
58976
|
for (let col = source.left; col <= source.right; col++) {
|
|
58917
58977
|
const xcs = [];
|
|
58918
58978
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -58920,7 +58980,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58920
58980
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58921
58981
|
}
|
|
58922
58982
|
break;
|
|
58923
|
-
case
|
|
58983
|
+
case "left":
|
|
58924
58984
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
58925
58985
|
const xcs = [];
|
|
58926
58986
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -58928,7 +58988,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
58928
58988
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
58929
58989
|
}
|
|
58930
58990
|
break;
|
|
58931
|
-
case
|
|
58991
|
+
case "right":
|
|
58932
58992
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
58933
58993
|
const xcs = [];
|
|
58934
58994
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -59054,19 +59114,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59054
59114
|
}
|
|
59055
59115
|
this.direction = this.getDirection(col, row);
|
|
59056
59116
|
switch (this.direction) {
|
|
59057
|
-
case
|
|
59117
|
+
case "up":
|
|
59058
59118
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
59059
59119
|
this.steps = source.top - row;
|
|
59060
59120
|
break;
|
|
59061
|
-
case
|
|
59121
|
+
case "down":
|
|
59062
59122
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
59063
59123
|
this.steps = row - source.bottom;
|
|
59064
59124
|
break;
|
|
59065
|
-
case
|
|
59125
|
+
case "left":
|
|
59066
59126
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
59067
59127
|
this.steps = source.left - col;
|
|
59068
59128
|
break;
|
|
59069
|
-
case
|
|
59129
|
+
case "right":
|
|
59070
59130
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
59071
59131
|
this.steps = col - source.right;
|
|
59072
59132
|
break;
|
|
@@ -59085,7 +59145,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59085
59145
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
59086
59146
|
...activePosition,
|
|
59087
59147
|
row
|
|
59088
|
-
}).type !==
|
|
59148
|
+
}).type !== "empty") {
|
|
59089
59149
|
autofillRow = row - 1;
|
|
59090
59150
|
break;
|
|
59091
59151
|
}
|
|
@@ -59105,7 +59165,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59105
59165
|
col: col - 1,
|
|
59106
59166
|
row
|
|
59107
59167
|
};
|
|
59108
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
59168
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
59109
59169
|
row += 1;
|
|
59110
59170
|
leftPosition = {
|
|
59111
59171
|
sheetId,
|
|
@@ -59122,7 +59182,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59122
59182
|
col: col + 1,
|
|
59123
59183
|
row
|
|
59124
59184
|
};
|
|
59125
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
59185
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
59126
59186
|
row += 1;
|
|
59127
59187
|
rightPosition = {
|
|
59128
59188
|
sheetId,
|
|
@@ -59212,19 +59272,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
59212
59272
|
const position = {
|
|
59213
59273
|
up: {
|
|
59214
59274
|
number: source.top - row,
|
|
59215
|
-
value:
|
|
59275
|
+
value: "up"
|
|
59216
59276
|
},
|
|
59217
59277
|
down: {
|
|
59218
59278
|
number: row - source.bottom,
|
|
59219
|
-
value:
|
|
59279
|
+
value: "down"
|
|
59220
59280
|
},
|
|
59221
59281
|
left: {
|
|
59222
59282
|
number: source.left - col,
|
|
59223
|
-
value:
|
|
59283
|
+
value: "left"
|
|
59224
59284
|
},
|
|
59225
59285
|
right: {
|
|
59226
59286
|
number: col - source.right,
|
|
59227
|
-
value:
|
|
59287
|
+
value: "right"
|
|
59228
59288
|
}
|
|
59229
59289
|
};
|
|
59230
59290
|
if (Object.values(position).map((x) => x.number > 0 ? 1 : 0).reduce((acc, value) => acc + value) === 1) return Object.values(position).find((x) => x.number > 0 ? 1 : 0).value;
|
|
@@ -59427,7 +59487,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
59427
59487
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
59428
59488
|
}
|
|
59429
59489
|
isNumber(cell) {
|
|
59430
|
-
return cell.type ===
|
|
59490
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
59431
59491
|
}
|
|
59432
59492
|
isZoneValid(zone) {
|
|
59433
59493
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -60490,6 +60550,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
60490
60550
|
//#endregion
|
|
60491
60551
|
//#region src/collaborative/revisions.ts
|
|
60492
60552
|
var Revision = class {
|
|
60553
|
+
rootCommand;
|
|
60554
|
+
timestamp;
|
|
60493
60555
|
id;
|
|
60494
60556
|
clientId;
|
|
60495
60557
|
_commands = [];
|
|
@@ -60526,6 +60588,10 @@ var Revision = class {
|
|
|
60526
60588
|
//#region src/collaborative/session.ts
|
|
60527
60589
|
var ClientDisconnectedError = class extends Error {};
|
|
60528
60590
|
var Session = class extends EventBus {
|
|
60591
|
+
revisions;
|
|
60592
|
+
transportService;
|
|
60593
|
+
serverRevisionId;
|
|
60594
|
+
commandSquisher;
|
|
60529
60595
|
/**
|
|
60530
60596
|
* Positions of the others client.
|
|
60531
60597
|
*/
|
|
@@ -60992,7 +61058,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
60992
61058
|
...position,
|
|
60993
61059
|
content: "FALSE"
|
|
60994
61060
|
});
|
|
60995
|
-
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type ===
|
|
61061
|
+
else if ((cell?.isFormula || cell?.content) && evaluatedCell.type === "empty") {
|
|
60996
61062
|
let value;
|
|
60997
61063
|
if (cell.isFormula) {
|
|
60998
61064
|
const result = this.getters.evaluateCompiledFormula(position.sheetId, cell.compiledFormula);
|
|
@@ -61002,7 +61068,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
61002
61068
|
...position,
|
|
61003
61069
|
content: "FALSE"
|
|
61004
61070
|
});
|
|
61005
|
-
} else if (evaluatedCell.type !==
|
|
61071
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
61006
61072
|
...position,
|
|
61007
61073
|
content: "FALSE"
|
|
61008
61074
|
});
|
|
@@ -61129,7 +61195,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
61129
61195
|
getCellNumberFormat(position) {
|
|
61130
61196
|
for (const pos of [position]) {
|
|
61131
61197
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
61132
|
-
if (cell.type ===
|
|
61198
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
61133
61199
|
}
|
|
61134
61200
|
}
|
|
61135
61201
|
};
|
|
@@ -61297,11 +61363,11 @@ var InsertPivotPlugin = class extends UIPlugin {
|
|
|
61297
61363
|
allowDispatch(cmd) {
|
|
61298
61364
|
switch (cmd.type) {
|
|
61299
61365
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
61300
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
61301
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
61366
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
61367
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
61302
61368
|
break;
|
|
61303
61369
|
}
|
|
61304
|
-
return
|
|
61370
|
+
return "Success";
|
|
61305
61371
|
}
|
|
61306
61372
|
handle(cmd) {
|
|
61307
61373
|
switch (cmd.type) {
|
|
@@ -61564,13 +61630,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
61564
61630
|
allowDispatch(cmd) {
|
|
61565
61631
|
switch (cmd.type) {
|
|
61566
61632
|
case "REQUEST_UNDO":
|
|
61567
|
-
if (!this.canUndo()) return
|
|
61633
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
61568
61634
|
break;
|
|
61569
61635
|
case "REQUEST_REDO":
|
|
61570
|
-
if (!this.canRedo()) return
|
|
61636
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
61571
61637
|
break;
|
|
61572
61638
|
}
|
|
61573
|
-
return
|
|
61639
|
+
return "Success";
|
|
61574
61640
|
}
|
|
61575
61641
|
handle(cmd) {
|
|
61576
61642
|
switch (cmd.type) {
|
|
@@ -61634,9 +61700,9 @@ var LockSheetPlugin = class extends UIPlugin {
|
|
|
61634
61700
|
* to other users and can do any operation and can do core modifications that will only affect them
|
|
61635
61701
|
* It is acceptable to bypass the locked sheet restriction in this case
|
|
61636
61702
|
*/
|
|
61637
|
-
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return
|
|
61638
|
-
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return
|
|
61639
|
-
return
|
|
61703
|
+
if (lockedSheetAllowedCommands.has(cmd.type) || this.getters.isDashboard()) return "Success";
|
|
61704
|
+
if ("sheetId" in cmd && this.getters.isSheetLocked(cmd.sheetId) || !isCoreCommand(cmd) && this.isCurrentSheetLocked()) return "SheetLocked";
|
|
61705
|
+
return "Success";
|
|
61640
61706
|
}
|
|
61641
61707
|
isCurrentSheetLocked() {
|
|
61642
61708
|
return this.getters.isSheetLocked(this.getters.getActiveSheetId());
|
|
@@ -61701,18 +61767,18 @@ var PivotPresencePlugin = class extends UIPlugin {
|
|
|
61701
61767
|
//#endregion
|
|
61702
61768
|
//#region src/helpers/sort.ts
|
|
61703
61769
|
const SORT_TYPES = [
|
|
61704
|
-
|
|
61705
|
-
|
|
61706
|
-
|
|
61707
|
-
|
|
61770
|
+
"number",
|
|
61771
|
+
"error",
|
|
61772
|
+
"text",
|
|
61773
|
+
"boolean"
|
|
61708
61774
|
];
|
|
61709
61775
|
function cellsSortingCriterion(sortingOrder) {
|
|
61710
61776
|
const inverse = sortingOrder === "asc" ? 1 : -1;
|
|
61711
61777
|
return (left, right) => {
|
|
61712
|
-
if (left.type ===
|
|
61713
|
-
else if (right.type ===
|
|
61778
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
61779
|
+
else if (right.type === "empty") return -1;
|
|
61714
61780
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
61715
|
-
if (typeOrder === 0) if (left.type ===
|
|
61781
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
61716
61782
|
else typeOrder = left.value - right.value;
|
|
61717
61783
|
return inverse * typeOrder;
|
|
61718
61784
|
};
|
|
@@ -61723,9 +61789,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
61723
61789
|
type: cell.type,
|
|
61724
61790
|
value: cell.value
|
|
61725
61791
|
}));
|
|
61726
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
61792
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
61727
61793
|
...cell,
|
|
61728
|
-
type:
|
|
61794
|
+
type: "number",
|
|
61729
61795
|
value: 0
|
|
61730
61796
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
61731
61797
|
}
|
|
@@ -61736,10 +61802,10 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61736
61802
|
allowDispatch(cmd) {
|
|
61737
61803
|
switch (cmd.type) {
|
|
61738
61804
|
case "SORT_CELLS":
|
|
61739
|
-
if (!isInside(cmd.col, cmd.row, cmd.zone)) return
|
|
61805
|
+
if (!isInside(cmd.col, cmd.row, cmd.zone)) return "InvalidSortAnchor";
|
|
61740
61806
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes, this.checkArrayFormulaInSortZone);
|
|
61741
61807
|
}
|
|
61742
|
-
return
|
|
61808
|
+
return "Success";
|
|
61743
61809
|
}
|
|
61744
61810
|
handle(cmd) {
|
|
61745
61811
|
switch (cmd.type) {
|
|
@@ -61749,24 +61815,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61749
61815
|
}
|
|
61750
61816
|
}
|
|
61751
61817
|
checkMerge({ sheetId, zone }) {
|
|
61752
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61818
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61753
61819
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
61754
61820
|
sheetId,
|
|
61755
61821
|
col,
|
|
61756
61822
|
row
|
|
61757
|
-
}))) return
|
|
61758
|
-
return
|
|
61823
|
+
}))) return "InvalidSortZone";
|
|
61824
|
+
return "Success";
|
|
61759
61825
|
}
|
|
61760
61826
|
checkMergeSizes({ sheetId, zone }) {
|
|
61761
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
61827
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
61762
61828
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
61763
61829
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
61764
61830
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
61765
61831
|
if (!merges.every((merge) => {
|
|
61766
61832
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
61767
61833
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
61768
|
-
})) return
|
|
61769
|
-
return
|
|
61834
|
+
})) return "InvalidSortZone";
|
|
61835
|
+
return "Success";
|
|
61770
61836
|
}
|
|
61771
61837
|
checkArrayFormulaInSortZone({ sheetId, zone }) {
|
|
61772
61838
|
return positions(zone).some(({ col, row }) => {
|
|
@@ -61780,7 +61846,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61780
61846
|
col,
|
|
61781
61847
|
row
|
|
61782
61848
|
});
|
|
61783
|
-
}) ?
|
|
61849
|
+
}) ? "SortZoneWithArrayFormulas" : "Success";
|
|
61784
61850
|
}
|
|
61785
61851
|
/**
|
|
61786
61852
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -61798,9 +61864,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
61798
61864
|
col,
|
|
61799
61865
|
row
|
|
61800
61866
|
}).type));
|
|
61801
|
-
if (cells[0][0] ===
|
|
61802
|
-
if (cells.some((item) => item[0] ===
|
|
61803
|
-
else if (cells.some((item) => item[1] !==
|
|
61867
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
61868
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
61869
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
61804
61870
|
else return false;
|
|
61805
61871
|
}
|
|
61806
61872
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -61889,7 +61955,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
61889
61955
|
switch (cmd.type) {
|
|
61890
61956
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
61891
61957
|
}
|
|
61892
|
-
return
|
|
61958
|
+
return "Success";
|
|
61893
61959
|
}
|
|
61894
61960
|
handle(cmd) {
|
|
61895
61961
|
switch (cmd.type) {
|
|
@@ -61900,7 +61966,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
61900
61966
|
}
|
|
61901
61967
|
getAutomaticSeparator() {
|
|
61902
61968
|
const cells = this.getters.getSelectedCells();
|
|
61903
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
61969
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
61904
61970
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
61905
61971
|
if (separator) return separator;
|
|
61906
61972
|
}
|
|
@@ -62038,24 +62104,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
62038
62104
|
});
|
|
62039
62105
|
}
|
|
62040
62106
|
checkSingleColSelected() {
|
|
62041
|
-
if (!this.getters.isSingleColSelected()) return
|
|
62042
|
-
return
|
|
62107
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
62108
|
+
return "Success";
|
|
62043
62109
|
}
|
|
62044
62110
|
checkNonEmptySelector(cmd) {
|
|
62045
|
-
if (cmd.separator === "") return
|
|
62046
|
-
return
|
|
62111
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
62112
|
+
return "Success";
|
|
62047
62113
|
}
|
|
62048
62114
|
checkNotOverwritingContent(cmd) {
|
|
62049
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
62115
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
62050
62116
|
const selection = this.getters.getSelectedZones()[0];
|
|
62051
62117
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
62052
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
62053
|
-
return
|
|
62118
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
62119
|
+
return "Success";
|
|
62054
62120
|
}
|
|
62055
62121
|
checkSeparatorInSelection({ separator }) {
|
|
62056
62122
|
const cells = this.getters.getSelectedCells();
|
|
62057
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
62058
|
-
return
|
|
62123
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
62124
|
+
return "NoSplitSeparatorInSelection";
|
|
62059
62125
|
}
|
|
62060
62126
|
};
|
|
62061
62127
|
|
|
@@ -62100,7 +62166,7 @@ var TableAutofillPlugin = class extends UIPlugin {
|
|
|
62100
62166
|
col,
|
|
62101
62167
|
row: r,
|
|
62102
62168
|
sheetId
|
|
62103
|
-
}).type !==
|
|
62169
|
+
}).type !== "empty") return;
|
|
62104
62170
|
}
|
|
62105
62171
|
const oldSelection = {
|
|
62106
62172
|
zone: this.getters.getSelectedZone(),
|
|
@@ -62129,13 +62195,13 @@ var TableResizeUI = class extends UIPlugin {
|
|
|
62129
62195
|
switch (cmd.type) {
|
|
62130
62196
|
case "RESIZE_TABLE":
|
|
62131
62197
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
62132
|
-
if (!table) return
|
|
62198
|
+
if (!table) return "TableNotFound";
|
|
62133
62199
|
const oldTableZone = table.range.zone;
|
|
62134
62200
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
62135
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
62201
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
62136
62202
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
62137
62203
|
}
|
|
62138
|
-
return
|
|
62204
|
+
return "Success";
|
|
62139
62205
|
}
|
|
62140
62206
|
handle(cmd) {
|
|
62141
62207
|
switch (cmd.type) {
|
|
@@ -62363,7 +62429,7 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62363
62429
|
*/
|
|
62364
62430
|
isCellEmpty(position) {
|
|
62365
62431
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
62366
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
62432
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
62367
62433
|
}
|
|
62368
62434
|
getColMaxWidth(sheetId, index) {
|
|
62369
62435
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -62377,8 +62443,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62377
62443
|
* sheet.
|
|
62378
62444
|
*/
|
|
62379
62445
|
checkSheetExists(cmd) {
|
|
62380
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return
|
|
62381
|
-
return
|
|
62446
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0 && cmd.type !== "CREATE_SHEET") return "InvalidSheetId";
|
|
62447
|
+
return "Success";
|
|
62382
62448
|
}
|
|
62383
62449
|
/**
|
|
62384
62450
|
* Check if zones in the command are well formed and
|
|
@@ -62386,11 +62452,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
62386
62452
|
*/
|
|
62387
62453
|
checkZonesAreInSheet(cmd) {
|
|
62388
62454
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
62389
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
62455
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
62390
62456
|
const zones = this.getters.getCommandZones(cmd);
|
|
62391
|
-
if (!sheetId && zones.length > 0) return
|
|
62457
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
62392
62458
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
62393
|
-
return
|
|
62459
|
+
return "Success";
|
|
62394
62460
|
}
|
|
62395
62461
|
autoResizeRows(sheetId, rows) {
|
|
62396
62462
|
const rowSizes = [];
|
|
@@ -62437,20 +62503,20 @@ var CarouselUIPlugin = class extends UIPlugin {
|
|
|
62437
62503
|
allowDispatch(cmd) {
|
|
62438
62504
|
switch (cmd.type) {
|
|
62439
62505
|
case "ADD_FIGURE_CHART_TO_CAROUSEL":
|
|
62440
|
-
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return
|
|
62441
|
-
return
|
|
62506
|
+
if (!this.getters.doesCarouselExist(cmd.carouselFigureId) || this.getters.getFigure(cmd.sheetId, cmd.chartFigureId)?.tag !== "chart") return "InvalidFigureId";
|
|
62507
|
+
return "Success";
|
|
62442
62508
|
case "DUPLICATE_CAROUSEL_CHART":
|
|
62443
|
-
if (!this.getters.doesCarouselExist(cmd.carouselId) || !this.getters.getCarousel(cmd.carouselId).items.some((item) => item.type === "chart" && item.chartId === cmd.chartId) || this.getters.getChart(cmd.duplicatedChartId)) return
|
|
62444
|
-
return
|
|
62509
|
+
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";
|
|
62510
|
+
return "Success";
|
|
62445
62511
|
case "ADD_NEW_CHART_TO_CAROUSEL":
|
|
62446
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62447
|
-
return
|
|
62512
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62513
|
+
return "Success";
|
|
62448
62514
|
case "UPDATE_CAROUSEL_ACTIVE_ITEM":
|
|
62449
|
-
if (!this.getters.doesCarouselExist(cmd.figureId)) return
|
|
62450
|
-
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return
|
|
62451
|
-
return
|
|
62515
|
+
if (!this.getters.doesCarouselExist(cmd.figureId)) return "InvalidFigureId";
|
|
62516
|
+
else if (!this.getters.getCarousel(cmd.figureId).items.some((item) => deepEquals(item, cmd.item))) return "InvalidCarouselItem";
|
|
62517
|
+
return "Success";
|
|
62452
62518
|
}
|
|
62453
|
-
return
|
|
62519
|
+
return "Success";
|
|
62454
62520
|
}
|
|
62455
62521
|
handle(cmd) {
|
|
62456
62522
|
switch (cmd.type) {
|
|
@@ -62687,7 +62753,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62687
62753
|
});
|
|
62688
62754
|
}
|
|
62689
62755
|
case "PASTE": {
|
|
62690
|
-
if (!this.copiedData) return
|
|
62756
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
62691
62757
|
const pasteOption = cmd.pasteOption;
|
|
62692
62758
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
62693
62759
|
pasteOption,
|
|
@@ -62696,21 +62762,21 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62696
62762
|
}
|
|
62697
62763
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
62698
62764
|
const zones = this.getters.getSelectedZones();
|
|
62699
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
62765
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
62700
62766
|
const zone = this.getters.getSelectedZone();
|
|
62701
62767
|
const copiedData = this.getCopiedDataAbove(zone);
|
|
62702
62768
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62703
62769
|
}
|
|
62704
62770
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
62705
62771
|
const zones = this.getters.getSelectedZones();
|
|
62706
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
62772
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
62707
62773
|
const zone = this.getters.getSelectedZone();
|
|
62708
62774
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62709
62775
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
62710
62776
|
}
|
|
62711
62777
|
case "COPY_PASTE_CELLS_ON_ZONE": {
|
|
62712
62778
|
const zones = this.getters.getSelectedZones();
|
|
62713
|
-
if (zones.length > 1) return
|
|
62779
|
+
if (zones.length > 1) return "InvalidCopyPasteSelection";
|
|
62714
62780
|
const zone = this.getters.getSelectedZone();
|
|
62715
62781
|
const copiedData = this.getCopiedDataOnLeft(zone);
|
|
62716
62782
|
return this.isPasteAllowed(zones, copiedData, { isCutOperation: false });
|
|
@@ -62726,7 +62792,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62726
62792
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
62727
62793
|
}
|
|
62728
62794
|
}
|
|
62729
|
-
return
|
|
62795
|
+
return "Success";
|
|
62730
62796
|
}
|
|
62731
62797
|
handle(cmd) {
|
|
62732
62798
|
switch (cmd.type) {
|
|
@@ -62929,16 +62995,16 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
62929
62995
|
const clipboardData = this.getClipboardData(zones);
|
|
62930
62996
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
62931
62997
|
const result = handler.isCutAllowed(clipboardData);
|
|
62932
|
-
if (result !==
|
|
62998
|
+
if (result !== "Success") return result;
|
|
62933
62999
|
}
|
|
62934
|
-
return
|
|
63000
|
+
return "Success";
|
|
62935
63001
|
}
|
|
62936
63002
|
isPasteAllowed(target, copiedData, options) {
|
|
62937
63003
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
62938
63004
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
62939
|
-
if (result !==
|
|
63005
|
+
if (result !== "Success") return result;
|
|
62940
63006
|
}
|
|
62941
|
-
return
|
|
63007
|
+
return "Success";
|
|
62942
63008
|
}
|
|
62943
63009
|
isColRowDirtyingClipboard(position, dimension) {
|
|
62944
63010
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -63019,12 +63085,12 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
63019
63085
|
const file = await this.getImageContent();
|
|
63020
63086
|
const mime = file?.type;
|
|
63021
63087
|
const content = {
|
|
63022
|
-
[
|
|
63023
|
-
[
|
|
63088
|
+
["text/plain"]: "",
|
|
63089
|
+
["text/html"]: ""
|
|
63024
63090
|
};
|
|
63025
63091
|
try {
|
|
63026
|
-
content[
|
|
63027
|
-
content[
|
|
63092
|
+
content["text/plain"] = this.getPlainTextContent();
|
|
63093
|
+
content["text/html"] = await this.getHTMLContent();
|
|
63028
63094
|
} catch (error) {
|
|
63029
63095
|
this.ui.notifyUI({
|
|
63030
63096
|
type: "danger",
|
|
@@ -63216,10 +63282,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
63216
63282
|
allowDispatch(cmd) {
|
|
63217
63283
|
switch (cmd.type) {
|
|
63218
63284
|
case "UPDATE_FILTER":
|
|
63219
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
63285
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
63220
63286
|
break;
|
|
63221
63287
|
}
|
|
63222
|
-
return
|
|
63288
|
+
return "Success";
|
|
63223
63289
|
}
|
|
63224
63290
|
handle(cmd) {
|
|
63225
63291
|
switch (cmd.type) {
|
|
@@ -63583,14 +63649,14 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
63583
63649
|
allowDispatch(cmd) {
|
|
63584
63650
|
switch (cmd.type) {
|
|
63585
63651
|
case "ACTIVATE_SHEET": try {
|
|
63586
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
63652
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
63587
63653
|
break;
|
|
63588
63654
|
} catch (error) {
|
|
63589
|
-
return
|
|
63655
|
+
return "InvalidSheetId";
|
|
63590
63656
|
}
|
|
63591
63657
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
63592
63658
|
}
|
|
63593
|
-
return
|
|
63659
|
+
return "Success";
|
|
63594
63660
|
}
|
|
63595
63661
|
handleEvent(event) {
|
|
63596
63662
|
let anchor = event.anchor;
|
|
@@ -64111,12 +64177,12 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64111
64177
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
64112
64178
|
const id = cmd.sheetId;
|
|
64113
64179
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
64114
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
64180
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
64115
64181
|
const headers = [cmd.base, ...cmd.elements];
|
|
64116
64182
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
64117
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
64118
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
64119
|
-
return
|
|
64183
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
64184
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
64185
|
+
return "Success";
|
|
64120
64186
|
}
|
|
64121
64187
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
64122
64188
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -64218,6 +64284,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
64218
64284
|
//#endregion
|
|
64219
64285
|
//#region src/helpers/internal_viewport.ts
|
|
64220
64286
|
var InternalViewport = class {
|
|
64287
|
+
getters;
|
|
64288
|
+
sheetId;
|
|
64289
|
+
boundaries;
|
|
64221
64290
|
top;
|
|
64222
64291
|
bottom;
|
|
64223
64292
|
left;
|
|
@@ -64489,6 +64558,10 @@ var InternalViewport = class {
|
|
|
64489
64558
|
* ↓ ↓
|
|
64490
64559
|
*/
|
|
64491
64560
|
var ViewportCollection = class {
|
|
64561
|
+
paneDivision;
|
|
64562
|
+
sheetViewWidth;
|
|
64563
|
+
sheetViewHeight;
|
|
64564
|
+
zoomLevel;
|
|
64492
64565
|
getters;
|
|
64493
64566
|
viewports = {};
|
|
64494
64567
|
gridOffsetX = 0;
|
|
@@ -64805,22 +64878,22 @@ var ViewportCollection = class {
|
|
|
64805
64878
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
64806
64879
|
}
|
|
64807
64880
|
checkPositiveDimension(cmd) {
|
|
64808
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
64809
|
-
return
|
|
64881
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
64882
|
+
return "Success";
|
|
64810
64883
|
}
|
|
64811
64884
|
checkValuesAreDifferent(cmd) {
|
|
64812
64885
|
const { height, width } = this.getSheetViewDimension();
|
|
64813
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
64814
|
-
return
|
|
64886
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
64887
|
+
return "Success";
|
|
64815
64888
|
}
|
|
64816
64889
|
checkScrollingDirection(sheetId, { offsetX, offsetY }) {
|
|
64817
64890
|
const pane = this.getMainInternalViewport(sheetId);
|
|
64818
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
64819
|
-
return
|
|
64891
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
64892
|
+
return "Success";
|
|
64820
64893
|
}
|
|
64821
64894
|
checkIfViewportsWillChange(sheetId, { offsetX, offsetY }) {
|
|
64822
64895
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset(sheetId);
|
|
64823
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
64896
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
64824
64897
|
}
|
|
64825
64898
|
getMainViewport(sheetId) {
|
|
64826
64899
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -65137,9 +65210,9 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
65137
65210
|
return this.chainValidations(() => this.viewports.checkScrollingDirection(sheetId, cmd), () => this.viewports.checkIfViewportsWillChange(sheetId, cmd))(cmd);
|
|
65138
65211
|
}
|
|
65139
65212
|
case "RESIZE_SHEETVIEW": return this.chainValidations(() => this.viewports.checkValuesAreDifferent(cmd), () => this.viewports.checkPositiveDimension(cmd))(cmd);
|
|
65140
|
-
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return
|
|
65141
|
-
else return
|
|
65142
|
-
default: return
|
|
65213
|
+
case "SET_ZOOM": if (cmd.zoom > 2 || cmd.zoom < .5) return "InvalidZoomLevel";
|
|
65214
|
+
else return "Success";
|
|
65215
|
+
default: return "Success";
|
|
65143
65216
|
}
|
|
65144
65217
|
}
|
|
65145
65218
|
handleEvent(event) {
|
|
@@ -67213,9 +67286,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
67213
67286
|
newName: name,
|
|
67214
67287
|
oldName: env.model.getters.getSheetName(sheetId)
|
|
67215
67288
|
});
|
|
67216
|
-
if (result.reasons.includes(
|
|
67217
|
-
else if (result.reasons.includes(
|
|
67218
|
-
else if (result.reasons.includes(
|
|
67289
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
67290
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
67291
|
+
else if (result.reasons.includes("ForbiddenCharactersInSheetName")) env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEETNAME_CHARS.join(" ")), errorCallback);
|
|
67219
67292
|
}
|
|
67220
67293
|
|
|
67221
67294
|
//#endregion
|
|
@@ -67273,7 +67346,7 @@ var BottomBarSheet = class extends Component {
|
|
|
67273
67346
|
onMounted(() => {
|
|
67274
67347
|
const animateLockedSheet = throttle(() => this.sheetDivRef.el?.animate(...getSheetLockAnimation(200, 1)).finished.then(() => this.iconRef.el?.animate(...getSheetLockAnimation(200, 2))), 800);
|
|
67275
67348
|
this.env.model.on("command-rejected", this, async ({ command, result }) => {
|
|
67276
|
-
if (result.isCancelledBecause(
|
|
67349
|
+
if (result.isCancelledBecause("SheetLocked")) {
|
|
67277
67350
|
if (!command || !isSheetDependent(command) && this.isSheetActive || isSheetDependent(command) && command.sheetId === this.props.sheetId) {
|
|
67278
67351
|
this.scrollToSheet();
|
|
67279
67352
|
await animateLockedSheet();
|
|
@@ -67410,41 +67483,41 @@ var BottomBarSheet = class extends Component {
|
|
|
67410
67483
|
const selectionStatisticFunctions = [
|
|
67411
67484
|
{
|
|
67412
67485
|
name: _t("Sum"),
|
|
67413
|
-
types: [
|
|
67486
|
+
types: ["number"],
|
|
67414
67487
|
compute: (values, locale) => sum([[values]], locale)
|
|
67415
67488
|
},
|
|
67416
67489
|
{
|
|
67417
67490
|
name: _t("Avg"),
|
|
67418
|
-
types: [
|
|
67491
|
+
types: ["number"],
|
|
67419
67492
|
compute: (values, locale) => average([[values]], locale)
|
|
67420
67493
|
},
|
|
67421
67494
|
{
|
|
67422
67495
|
name: _t("Min"),
|
|
67423
|
-
types: [
|
|
67496
|
+
types: ["number"],
|
|
67424
67497
|
compute: (values, locale) => min([[values]], locale).value
|
|
67425
67498
|
},
|
|
67426
67499
|
{
|
|
67427
67500
|
name: _t("Max"),
|
|
67428
|
-
types: [
|
|
67501
|
+
types: ["number"],
|
|
67429
67502
|
compute: (values, locale) => max([[values]], locale).value
|
|
67430
67503
|
},
|
|
67431
67504
|
{
|
|
67432
67505
|
name: _t("Count"),
|
|
67433
67506
|
types: [
|
|
67434
|
-
|
|
67435
|
-
|
|
67436
|
-
|
|
67437
|
-
|
|
67507
|
+
"number",
|
|
67508
|
+
"text",
|
|
67509
|
+
"boolean",
|
|
67510
|
+
"error"
|
|
67438
67511
|
],
|
|
67439
67512
|
compute: (values) => countAny([[values]])
|
|
67440
67513
|
},
|
|
67441
67514
|
{
|
|
67442
67515
|
name: _t("Count Numbers"),
|
|
67443
67516
|
types: [
|
|
67444
|
-
|
|
67445
|
-
|
|
67446
|
-
|
|
67447
|
-
|
|
67517
|
+
"number",
|
|
67518
|
+
"text",
|
|
67519
|
+
"boolean",
|
|
67520
|
+
"error"
|
|
67448
67521
|
],
|
|
67449
67522
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
67450
67523
|
}
|
|
@@ -67497,7 +67570,7 @@ var AggregateStatisticsStore = class extends SpreadsheetStore {
|
|
|
67497
67570
|
col,
|
|
67498
67571
|
row
|
|
67499
67572
|
});
|
|
67500
|
-
if (evaluatedCell.type !==
|
|
67573
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
67501
67574
|
}
|
|
67502
67575
|
return computeStatisticFnResults(selectionStatisticFunctions, cells, getters.getLocale());
|
|
67503
67576
|
}
|
|
@@ -68445,6 +68518,7 @@ var SmallBottomBar = class extends Component {
|
|
|
68445
68518
|
//#region src/components/standalone_grid_canvas/figure_renderer_store.ts
|
|
68446
68519
|
/** Store that draws the figures directly onto the canvas */
|
|
68447
68520
|
var FigureRendererStore = class extends DisposableStore {
|
|
68521
|
+
renderer;
|
|
68448
68522
|
mutators = ["addLoadedImage"];
|
|
68449
68523
|
getters = this.get(ModelStore).getters;
|
|
68450
68524
|
loadedImages = {};
|
|
@@ -68790,7 +68864,7 @@ var SpreadsheetPrintStore = class extends SpreadsheetStore {
|
|
|
68790
68864
|
const coreCell = this.getters.getCell(position);
|
|
68791
68865
|
if (coreCell && (coreCell.style || coreCell.isFormula || coreCell.content)) return true;
|
|
68792
68866
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
68793
|
-
if (evaluatedCell && evaluatedCell.type !==
|
|
68867
|
+
if (evaluatedCell && evaluatedCell.type !== "empty") return true;
|
|
68794
68868
|
}
|
|
68795
68869
|
return false;
|
|
68796
68870
|
}
|
|
@@ -69131,7 +69205,7 @@ var NamedRangeSelector = class extends Component {
|
|
|
69131
69205
|
}
|
|
69132
69206
|
navigateToRange(range) {
|
|
69133
69207
|
const { sheetId, zone } = range;
|
|
69134
|
-
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !==
|
|
69208
|
+
if (this.env.model.getters.checkZonesExistInSheet(sheetId, [zone]) !== "Success") {
|
|
69135
69209
|
this.env.raiseError(_t("The range you specified is outside of the sheet.\n\nIf you meant to create a named range, named range cannot have the same name as a cell reference. Please choose another name."));
|
|
69136
69210
|
return;
|
|
69137
69211
|
}
|
|
@@ -70016,6 +70090,7 @@ function instantiateClipboard() {
|
|
|
70016
70090
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
70017
70091
|
}
|
|
70018
70092
|
var WebClipboardWrapper = class {
|
|
70093
|
+
clipboard;
|
|
70019
70094
|
constructor(clipboard) {
|
|
70020
70095
|
this.clipboard = clipboard;
|
|
70021
70096
|
}
|
|
@@ -70031,12 +70106,12 @@ var WebClipboardWrapper = class {
|
|
|
70031
70106
|
console.log("Failed to write on the clipboard, falling back to plain/html text. Error %s", e);
|
|
70032
70107
|
try {
|
|
70033
70108
|
await this.clipboard?.write([new ClipboardItem({
|
|
70034
|
-
[
|
|
70035
|
-
[
|
|
70109
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
70110
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
70036
70111
|
})]);
|
|
70037
70112
|
} catch (e) {}
|
|
70038
70113
|
}
|
|
70039
|
-
else await this.writeText(clipboardContent[
|
|
70114
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
70040
70115
|
}
|
|
70041
70116
|
async writeText(text) {
|
|
70042
70117
|
try {
|
|
@@ -70065,7 +70140,7 @@ var WebClipboardWrapper = class {
|
|
|
70065
70140
|
}
|
|
70066
70141
|
else return {
|
|
70067
70142
|
status: "ok",
|
|
70068
|
-
content: { [
|
|
70143
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
70069
70144
|
};
|
|
70070
70145
|
}
|
|
70071
70146
|
getClipboardItems(content) {
|
|
@@ -70217,7 +70292,7 @@ var Spreadsheet = class extends Component {
|
|
|
70217
70292
|
bindModelEvents() {
|
|
70218
70293
|
this.model.on("update", this, () => this.render(true));
|
|
70219
70294
|
this.model.on("command-rejected", this, ({ result }) => {
|
|
70220
|
-
if (result.isCancelledBecause(
|
|
70295
|
+
if (result.isCancelledBecause("SheetLocked")) this.notificationStore.notifyUser({
|
|
70221
70296
|
type: "info",
|
|
70222
70297
|
text: _t("This sheet is locked and cannot be modified. Please unlock it first."),
|
|
70223
70298
|
sticky: false
|
|
@@ -70302,6 +70377,7 @@ var Spreadsheet = class extends Component {
|
|
|
70302
70377
|
//#endregion
|
|
70303
70378
|
//#region src/collaborative/command_squisher.ts
|
|
70304
70379
|
var CommandSquisher = class {
|
|
70380
|
+
getters;
|
|
70305
70381
|
constructor(getters) {
|
|
70306
70382
|
this.getters = getters;
|
|
70307
70383
|
}
|
|
@@ -70408,6 +70484,7 @@ var CommandSquisher = class {
|
|
|
70408
70484
|
//#endregion
|
|
70409
70485
|
//#region src/collaborative/readonly_transport_filter.ts
|
|
70410
70486
|
var ReadonlyTransportFilter = class {
|
|
70487
|
+
transportService;
|
|
70411
70488
|
constructor(transportService) {
|
|
70412
70489
|
this.transportService = transportService;
|
|
70413
70490
|
}
|
|
@@ -70439,6 +70516,8 @@ function inverseCommand(cmd) {
|
|
|
70439
70516
|
* @param operations initial operations
|
|
70440
70517
|
*/
|
|
70441
70518
|
var Branch = class Branch {
|
|
70519
|
+
buildTransformation;
|
|
70520
|
+
operations;
|
|
70442
70521
|
constructor(buildTransformation, operations = []) {
|
|
70443
70522
|
this.buildTransformation = buildTransformation;
|
|
70444
70523
|
this.operations = operations;
|
|
@@ -70555,6 +70634,8 @@ var Branch = class Branch {
|
|
|
70555
70634
|
* to revert it).
|
|
70556
70635
|
*/
|
|
70557
70636
|
var Operation = class {
|
|
70637
|
+
id;
|
|
70638
|
+
data;
|
|
70558
70639
|
constructor(id, data) {
|
|
70559
70640
|
this.id = id;
|
|
70560
70641
|
this.data = data;
|
|
@@ -70564,6 +70645,8 @@ var Operation = class {
|
|
|
70564
70645
|
}
|
|
70565
70646
|
};
|
|
70566
70647
|
var LazyOperation = class LazyOperation {
|
|
70648
|
+
id;
|
|
70649
|
+
lazyData;
|
|
70567
70650
|
constructor(id, lazyData) {
|
|
70568
70651
|
this.id = id;
|
|
70569
70652
|
this.lazyData = lazyData;
|
|
@@ -70589,6 +70672,7 @@ var LazyOperation = class LazyOperation {
|
|
|
70589
70672
|
* ```
|
|
70590
70673
|
*/
|
|
70591
70674
|
var OperationSequence = class OperationSequence {
|
|
70675
|
+
operations;
|
|
70592
70676
|
constructor(operations) {
|
|
70593
70677
|
this.operations = operations;
|
|
70594
70678
|
}
|
|
@@ -70664,6 +70748,7 @@ var OperationSequence = class OperationSequence {
|
|
|
70664
70748
|
*
|
|
70665
70749
|
*/
|
|
70666
70750
|
var Tree = class {
|
|
70751
|
+
buildTransformation;
|
|
70667
70752
|
branches;
|
|
70668
70753
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
70669
70754
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -71173,8 +71258,8 @@ var RangeAdapterPlugin = class {
|
|
|
71173
71258
|
"removeRangesSheetPrefix"
|
|
71174
71259
|
];
|
|
71175
71260
|
allowDispatch(cmd) {
|
|
71176
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
71177
|
-
return
|
|
71261
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
71262
|
+
return "Success";
|
|
71178
71263
|
}
|
|
71179
71264
|
beforeHandle(command) {}
|
|
71180
71265
|
handle(cmd) {
|
|
@@ -71459,6 +71544,7 @@ var EventStream = class {
|
|
|
71459
71544
|
* with the new selected anchor
|
|
71460
71545
|
*/
|
|
71461
71546
|
var SelectionStreamProcessorImpl = class {
|
|
71547
|
+
getters;
|
|
71462
71548
|
stream;
|
|
71463
71549
|
/**
|
|
71464
71550
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -71557,7 +71643,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71557
71643
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
71558
71644
|
*/
|
|
71559
71645
|
moveAnchorCell(direction, step = 1) {
|
|
71560
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71646
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71561
71647
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
71562
71648
|
return this.selectCell(col, row);
|
|
71563
71649
|
}
|
|
@@ -71591,7 +71677,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71591
71677
|
bottom: Math.max(anchorRow, row)
|
|
71592
71678
|
};
|
|
71593
71679
|
const expandedZone = this.getters.expandZone(sheetId, zone);
|
|
71594
|
-
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult(
|
|
71680
|
+
if (isEqual(this.anchor.zone, expandedZone)) return new DispatchResult("NoChanges");
|
|
71595
71681
|
const anchor = {
|
|
71596
71682
|
zone: expandedZone,
|
|
71597
71683
|
cell: {
|
|
@@ -71653,7 +71739,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71653
71739
|
* of the anchor zone which moves.
|
|
71654
71740
|
*/
|
|
71655
71741
|
resizeAnchorZone(direction, step = 1) {
|
|
71656
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
71742
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
71657
71743
|
const sheetId = this.getters.getActiveSheetId();
|
|
71658
71744
|
const anchor = this.anchor;
|
|
71659
71745
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -71900,7 +71986,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71900
71986
|
previousAnchor: deepCopy(this.anchor)
|
|
71901
71987
|
};
|
|
71902
71988
|
const commandResult = this.checkEventAnchorZone(event);
|
|
71903
|
-
if (commandResult !==
|
|
71989
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
71904
71990
|
this.anchor = event.anchor;
|
|
71905
71991
|
this.stream.send(event);
|
|
71906
71992
|
return DispatchResult.Success;
|
|
@@ -71910,15 +71996,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
71910
71996
|
}
|
|
71911
71997
|
checkAnchorZone(anchor) {
|
|
71912
71998
|
const { cell, zone } = anchor;
|
|
71913
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
71999
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
71914
72000
|
const { left, right, top, bottom } = zone;
|
|
71915
72001
|
const sheetId = this.getters.getActiveSheetId();
|
|
71916
72002
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
71917
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
71918
|
-
return
|
|
72003
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
72004
|
+
return "Success";
|
|
71919
72005
|
}
|
|
71920
72006
|
checkAnchorZoneOrThrow(anchor) {
|
|
71921
|
-
if (this.checkAnchorZone(anchor) ===
|
|
72007
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error("The provided anchor is invalid. The cell must be part of the zone.");
|
|
71922
72008
|
}
|
|
71923
72009
|
/**
|
|
71924
72010
|
* ---- PRIVATE ----
|
|
@@ -72075,7 +72161,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
72075
72161
|
isCellSkippableInCluster(position) {
|
|
72076
72162
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
72077
72163
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
72078
|
-
return cell.type ===
|
|
72164
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
72079
72165
|
}
|
|
72080
72166
|
};
|
|
72081
72167
|
|
|
@@ -74292,13 +74378,6 @@ function purgeSingleRowTables(data) {
|
|
|
74292
74378
|
|
|
74293
74379
|
//#endregion
|
|
74294
74380
|
//#region src/model.ts
|
|
74295
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
74296
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
74297
|
-
Status[Status["Running"] = 1] = "Running";
|
|
74298
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
74299
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
74300
|
-
return Status;
|
|
74301
|
-
}(Status || {});
|
|
74302
74381
|
/**
|
|
74303
74382
|
* Model
|
|
74304
74383
|
*
|
|
@@ -74344,7 +74423,7 @@ var Model = class Model extends EventBus {
|
|
|
74344
74423
|
/**
|
|
74345
74424
|
* Internal status of the model. Important for command handling coordination
|
|
74346
74425
|
*/
|
|
74347
|
-
status =
|
|
74426
|
+
status = 0;
|
|
74348
74427
|
/**
|
|
74349
74428
|
* The config object contains some configuration flag and callbacks
|
|
74350
74429
|
*/
|
|
@@ -74491,7 +74570,7 @@ var Model = class Model extends EventBus {
|
|
|
74491
74570
|
onRemoteRevisionReceived({ commands }) {
|
|
74492
74571
|
for (const command of commands) {
|
|
74493
74572
|
const previousStatus = this.status;
|
|
74494
|
-
this.status =
|
|
74573
|
+
this.status = 2;
|
|
74495
74574
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
74496
74575
|
this.status = previousStatus;
|
|
74497
74576
|
}
|
|
@@ -74604,7 +74683,7 @@ var Model = class Model extends EventBus {
|
|
|
74604
74683
|
return this.processCommandResults(results);
|
|
74605
74684
|
}
|
|
74606
74685
|
processCommandResults(results) {
|
|
74607
|
-
if (results.some((r) => r !==
|
|
74686
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
74608
74687
|
return DispatchResult.Success;
|
|
74609
74688
|
}
|
|
74610
74689
|
checkDispatchAllowedRemoteCommand(command) {
|
|
@@ -74618,9 +74697,9 @@ var Model = class Model extends EventBus {
|
|
|
74618
74697
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
74619
74698
|
}
|
|
74620
74699
|
finalize() {
|
|
74621
|
-
this.status =
|
|
74700
|
+
this.status = 3;
|
|
74622
74701
|
for (const h of this.handlers) h.finalize();
|
|
74623
|
-
this.status =
|
|
74702
|
+
this.status = 0;
|
|
74624
74703
|
this.trigger("command-finalized");
|
|
74625
74704
|
}
|
|
74626
74705
|
/**
|
|
@@ -74647,10 +74726,10 @@ var Model = class Model extends EventBus {
|
|
|
74647
74726
|
dispatch = (type, payload) => {
|
|
74648
74727
|
const command = createCommand(type, payload);
|
|
74649
74728
|
const status = this.status;
|
|
74650
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
74651
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
74729
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
74730
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
74652
74731
|
switch (status) {
|
|
74653
|
-
case
|
|
74732
|
+
case 0:
|
|
74654
74733
|
const result = this.checkDispatchAllowed(command);
|
|
74655
74734
|
if (!result.isSuccessful) {
|
|
74656
74735
|
this.trigger("update");
|
|
@@ -74660,7 +74739,7 @@ var Model = class Model extends EventBus {
|
|
|
74660
74739
|
});
|
|
74661
74740
|
return result;
|
|
74662
74741
|
}
|
|
74663
|
-
this.status =
|
|
74742
|
+
this.status = 1;
|
|
74664
74743
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
74665
74744
|
const start = performance.now();
|
|
74666
74745
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -74670,10 +74749,10 @@ var Model = class Model extends EventBus {
|
|
|
74670
74749
|
if (time > 5) console.debug(type, time, "ms");
|
|
74671
74750
|
});
|
|
74672
74751
|
this.session.save(command, commands, changes);
|
|
74673
|
-
this.status =
|
|
74752
|
+
this.status = 0;
|
|
74674
74753
|
this.trigger("update");
|
|
74675
74754
|
break;
|
|
74676
|
-
case
|
|
74755
|
+
case 1:
|
|
74677
74756
|
if (isCoreCommand(command)) {
|
|
74678
74757
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
74679
74758
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -74681,8 +74760,8 @@ var Model = class Model extends EventBus {
|
|
|
74681
74760
|
}
|
|
74682
74761
|
this.dispatchToHandlers(this.handlers, command);
|
|
74683
74762
|
break;
|
|
74684
|
-
case
|
|
74685
|
-
case
|
|
74763
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
74764
|
+
case 2:
|
|
74686
74765
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
74687
74766
|
this.dispatchToHandlers(this.handlers, command);
|
|
74688
74767
|
}
|
|
@@ -74695,7 +74774,7 @@ var Model = class Model extends EventBus {
|
|
|
74695
74774
|
dispatchFromCorePlugin = (type, payload) => {
|
|
74696
74775
|
const command = createCommand(type, payload);
|
|
74697
74776
|
const previousStatus = this.status;
|
|
74698
|
-
this.status =
|
|
74777
|
+
this.status = 2;
|
|
74699
74778
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
74700
74779
|
this.dispatchToHandlers(handlers, command);
|
|
74701
74780
|
this.status = previousStatus;
|
|
@@ -74797,9 +74876,9 @@ function createCommand(type, payload = {}) {
|
|
|
74797
74876
|
//#endregion
|
|
74798
74877
|
//#region src/helpers/figures/charts/calendar_chart.ts
|
|
74799
74878
|
function checkDateGranularity(definition) {
|
|
74800
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return
|
|
74801
|
-
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return
|
|
74802
|
-
return
|
|
74879
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.horizontalGroupBy)) return "InvalidChartDefinition";
|
|
74880
|
+
if (!CALENDAR_CHART_GRANULARITIES.includes(definition.verticalGroupBy)) return "InvalidChartDefinition";
|
|
74881
|
+
return "Success";
|
|
74803
74882
|
}
|
|
74804
74883
|
const CalendarChart = {
|
|
74805
74884
|
sequence: 110,
|
|
@@ -74890,7 +74969,7 @@ const ComboChart = {
|
|
|
74890
74969
|
copyInSheetId: (definition) => definition,
|
|
74891
74970
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
74892
74971
|
transformDefinition: (definition) => definition,
|
|
74893
|
-
validateDefinition: () =>
|
|
74972
|
+
validateDefinition: () => "Success",
|
|
74894
74973
|
updateRanges: (definition) => definition,
|
|
74895
74974
|
getContextCreation: (definition) => definition,
|
|
74896
74975
|
getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
|
|
@@ -74980,7 +75059,7 @@ const FunnelChart = {
|
|
|
74980
75059
|
copyInSheetId: (definition) => definition,
|
|
74981
75060
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
74982
75061
|
transformDefinition: (definition) => definition,
|
|
74983
|
-
validateDefinition: () =>
|
|
75062
|
+
validateDefinition: () => "Success",
|
|
74984
75063
|
updateRanges: (definition) => definition,
|
|
74985
75064
|
getContextCreation: (definition) => definition,
|
|
74986
75065
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75046,7 +75125,7 @@ const GeoChart = {
|
|
|
75046
75125
|
copyInSheetId: (definition) => definition,
|
|
75047
75126
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75048
75127
|
transformDefinition: (definition) => definition,
|
|
75049
|
-
validateDefinition: () =>
|
|
75128
|
+
validateDefinition: () => "Success",
|
|
75050
75129
|
updateRanges: (definition) => definition,
|
|
75051
75130
|
getContextCreation: (definition) => definition,
|
|
75052
75131
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75107,7 +75186,7 @@ const PyramidChart = {
|
|
|
75107
75186
|
copyInSheetId: (definition) => definition,
|
|
75108
75187
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75109
75188
|
transformDefinition: (definition) => definition,
|
|
75110
|
-
validateDefinition: () =>
|
|
75189
|
+
validateDefinition: () => "Success",
|
|
75111
75190
|
updateRanges: (definition) => definition,
|
|
75112
75191
|
getContextCreation: (definition) => definition,
|
|
75113
75192
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75193,7 +75272,7 @@ const RadarChart = {
|
|
|
75193
75272
|
copyInSheetId: (definition) => definition,
|
|
75194
75273
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75195
75274
|
transformDefinition: (definition) => definition,
|
|
75196
|
-
validateDefinition: () =>
|
|
75275
|
+
validateDefinition: () => "Success",
|
|
75197
75276
|
updateRanges: (definition) => definition,
|
|
75198
75277
|
getContextCreation: (definition) => definition,
|
|
75199
75278
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75271,7 +75350,7 @@ const ScatterChart = {
|
|
|
75271
75350
|
copyInSheetId: (definition) => definition,
|
|
75272
75351
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75273
75352
|
transformDefinition: (definition) => definition,
|
|
75274
|
-
validateDefinition: () =>
|
|
75353
|
+
validateDefinition: () => "Success",
|
|
75275
75354
|
updateRanges: (definition) => definition,
|
|
75276
75355
|
getContextCreation: (definition) => definition,
|
|
75277
75356
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
@@ -75350,7 +75429,7 @@ const SunburstChart = {
|
|
|
75350
75429
|
copyInSheetId: (definition) => definition,
|
|
75351
75430
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75352
75431
|
transformDefinition: (definition) => definition,
|
|
75353
|
-
validateDefinition: () =>
|
|
75432
|
+
validateDefinition: () => "Success",
|
|
75354
75433
|
updateRanges: (definition) => definition,
|
|
75355
75434
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75356
75435
|
return {
|
|
@@ -75419,7 +75498,7 @@ const TreeMapChart = {
|
|
|
75419
75498
|
copyInSheetId: (definition) => definition,
|
|
75420
75499
|
duplicateInDuplicatedSheet: (definition) => definition,
|
|
75421
75500
|
transformDefinition: (definition) => definition,
|
|
75422
|
-
validateDefinition: () =>
|
|
75501
|
+
validateDefinition: () => "Success",
|
|
75423
75502
|
updateRanges: (definition) => definition,
|
|
75424
75503
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
75425
75504
|
return {
|
|
@@ -75845,9 +75924,9 @@ var CarouselClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
75845
75924
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
75846
75925
|
}
|
|
75847
75926
|
isPasteAllowed(sheetId, target, content, option) {
|
|
75848
|
-
if (target.length === 0) return
|
|
75849
|
-
if (option?.pasteOption !== void 0) return
|
|
75850
|
-
return
|
|
75927
|
+
if (target.length === 0) return "EmptyTarget";
|
|
75928
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
75929
|
+
return "Success";
|
|
75851
75930
|
}
|
|
75852
75931
|
};
|
|
75853
75932
|
|
|
@@ -75918,9 +75997,9 @@ var ChartClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
75918
75997
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
75919
75998
|
}
|
|
75920
75999
|
isPasteAllowed(sheetId, target, content, option) {
|
|
75921
|
-
if (target.length === 0) return
|
|
75922
|
-
if (option?.pasteOption !== void 0) return
|
|
75923
|
-
return
|
|
76000
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76001
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76002
|
+
return "Success";
|
|
75924
76003
|
}
|
|
75925
76004
|
};
|
|
75926
76005
|
|
|
@@ -76225,9 +76304,9 @@ var ImageClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
76225
76304
|
this.dispatch("SELECT_FIGURE", { figureId });
|
|
76226
76305
|
}
|
|
76227
76306
|
isPasteAllowed(sheetId, target, content, option) {
|
|
76228
|
-
if (target.length === 0) return
|
|
76229
|
-
if (option?.pasteOption !== void 0) return
|
|
76230
|
-
return
|
|
76307
|
+
if (target.length === 0) return "EmptyTarget";
|
|
76308
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
76309
|
+
return "Success";
|
|
76231
76310
|
}
|
|
76232
76311
|
};
|
|
76233
76312
|
|
|
@@ -76323,10 +76402,10 @@ var ReferenceClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
76323
76402
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
76324
76403
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
76325
76404
|
isPasteAllowed(sheetId, target, content, options) {
|
|
76326
|
-
if (!("cells" in content)) return
|
|
76405
|
+
if (!("cells" in content)) return "Success";
|
|
76327
76406
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
76328
|
-
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return
|
|
76329
|
-
return
|
|
76407
|
+
if (doesAnyZoneCrossFrozenPane(getPasteZones(target, content.cells), xSplit, ySplit)) return "FrozenPaneOverlap";
|
|
76408
|
+
return "Success";
|
|
76330
76409
|
}
|
|
76331
76410
|
};
|
|
76332
76411
|
|
|
@@ -79167,15 +79246,15 @@ const DATEDIF = {
|
|
|
79167
79246
|
const jsEndDate = numberToJsDate(_endDate);
|
|
79168
79247
|
if (_endDate < _startDate) return new EvaluationError(_t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
79169
79248
|
switch (_unit) {
|
|
79170
|
-
case
|
|
79171
|
-
case
|
|
79172
|
-
case
|
|
79173
|
-
case
|
|
79174
|
-
case
|
|
79249
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
79250
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
79251
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79252
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
79253
|
+
case "MD":
|
|
79175
79254
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
79176
79255
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
79177
79256
|
return days;
|
|
79178
|
-
case
|
|
79257
|
+
case "YD": {
|
|
79179
79258
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
79180
79259
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
79181
79260
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -79865,11 +79944,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
79865
79944
|
const right = sortColumn[b];
|
|
79866
79945
|
const leftCell = {
|
|
79867
79946
|
value: left,
|
|
79868
|
-
type: left === null ?
|
|
79947
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
79869
79948
|
};
|
|
79870
79949
|
const rightCell = {
|
|
79871
79950
|
value: right,
|
|
79872
|
-
type: right === null ?
|
|
79951
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
79873
79952
|
};
|
|
79874
79953
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
79875
79954
|
if (result !== 0) return result;
|
|
@@ -84409,6 +84488,6 @@ const chartHelpers = {
|
|
|
84409
84488
|
//#endregion
|
|
84410
84489
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CompiledFormula, CorePlugin, CoreViewPlugin, DEFAULT_LOCALE, DEFAULT_LOCALES, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, canExecuteInReadonly, categories, chartHelpers, components, constants, convertAstNodes, coreTypes, createAutocompleteArgumentsProvider, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, isCoreCommand, isSheetDependent, iterateAstNodes, links, load, lockedSheetAllowedCommands, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
84411
84490
|
|
|
84412
|
-
__info__.version = "19.3.
|
|
84413
|
-
__info__.date = "2026-05-
|
|
84414
|
-
__info__.hash = "
|
|
84491
|
+
__info__.version = "19.3.5";
|
|
84492
|
+
__info__.date = "2026-05-27T06:08:23.138Z";
|
|
84493
|
+
__info__.hash = "0cf1540";
|