@odoo/o-spreadsheet 18.0.68 → 18.0.70
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.js +792 -779
- package/dist/o-spreadsheet.esm.js +792 -779
- package/dist/o-spreadsheet.iife.js +793 -780
- package/dist/o-spreadsheet.iife.min.js +414 -414
- package/dist/o_spreadsheet.xml +5 -4
- package/dist/types/helpers/pivot/pivot_composer_helpers.d.ts +4 -0
- package/dist/types/plugins/ui_core_views/pivot_ui.d.ts +17 -9
- 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 18.0.
|
|
6
|
-
* @date 2026-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.70
|
|
6
|
+
* @date 2026-06-06T06:20:39.985Z
|
|
7
|
+
* @hash 3ff29f6
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, markRaw, onMounted, onPatched, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, 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) {
|
|
@@ -336,22 +336,6 @@ const FORBIDDEN_SHEETNAME_CHARS = [
|
|
|
336
336
|
"]"
|
|
337
337
|
];
|
|
338
338
|
const FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX = /'|\*|\?|\/|\\|\[|\]/;
|
|
339
|
-
let ComponentsImportance = /* @__PURE__ */ function(ComponentsImportance) {
|
|
340
|
-
ComponentsImportance[ComponentsImportance["Grid"] = 0] = "Grid";
|
|
341
|
-
ComponentsImportance[ComponentsImportance["Highlight"] = 5] = "Highlight";
|
|
342
|
-
ComponentsImportance[ComponentsImportance["HeaderGroupingButton"] = 6] = "HeaderGroupingButton";
|
|
343
|
-
ComponentsImportance[ComponentsImportance["Figure"] = 10] = "Figure";
|
|
344
|
-
ComponentsImportance[ComponentsImportance["ScrollBar"] = 15] = "ScrollBar";
|
|
345
|
-
ComponentsImportance[ComponentsImportance["GridPopover"] = 19] = "GridPopover";
|
|
346
|
-
ComponentsImportance[ComponentsImportance["GridComposer"] = 20] = "GridComposer";
|
|
347
|
-
ComponentsImportance[ComponentsImportance["Dropdown"] = 21] = "Dropdown";
|
|
348
|
-
ComponentsImportance[ComponentsImportance["IconPicker"] = 25] = "IconPicker";
|
|
349
|
-
ComponentsImportance[ComponentsImportance["TopBarComposer"] = 30] = "TopBarComposer";
|
|
350
|
-
ComponentsImportance[ComponentsImportance["Popover"] = 35] = "Popover";
|
|
351
|
-
ComponentsImportance[ComponentsImportance["FigureAnchor"] = 1e3] = "FigureAnchor";
|
|
352
|
-
ComponentsImportance[ComponentsImportance["FigureSnapLine"] = 1001] = "FigureSnapLine";
|
|
353
|
-
return ComponentsImportance;
|
|
354
|
-
}({});
|
|
355
339
|
let DEFAULT_SHEETVIEW_SIZE = 0;
|
|
356
340
|
function getDefaultSheetViewSize() {
|
|
357
341
|
return DEFAULT_SHEETVIEW_SIZE;
|
|
@@ -832,7 +816,8 @@ var TokenizingChars = class {
|
|
|
832
816
|
}
|
|
833
817
|
shift() {
|
|
834
818
|
const current = this.current;
|
|
835
|
-
|
|
819
|
+
const next = this.text[++this.currentIndex];
|
|
820
|
+
this.current = next;
|
|
836
821
|
return current;
|
|
837
822
|
}
|
|
838
823
|
advanceBy(length) {
|
|
@@ -1267,6 +1252,7 @@ function getColorsPalette(quantity) {
|
|
|
1267
1252
|
else return COLORS_XL;
|
|
1268
1253
|
}
|
|
1269
1254
|
var ColorGenerator = class {
|
|
1255
|
+
preferredColors;
|
|
1270
1256
|
currentColorIndex = 0;
|
|
1271
1257
|
palette;
|
|
1272
1258
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -1684,6 +1670,7 @@ const _t = function(s, ...values) {
|
|
|
1684
1670
|
return sprintf(_translate(s), ...values);
|
|
1685
1671
|
};
|
|
1686
1672
|
var LazyTranslatedString = class extends String {
|
|
1673
|
+
values;
|
|
1687
1674
|
constructor(str, values) {
|
|
1688
1675
|
super(str);
|
|
1689
1676
|
this.values = values;
|
|
@@ -2784,25 +2771,6 @@ function percentile(values, percent, isInclusive) {
|
|
|
2784
2771
|
return sortedValues[indexSup] * (percentIndex - indexLow) + sortedValues[indexLow] * (indexSup - percentIndex);
|
|
2785
2772
|
}
|
|
2786
2773
|
|
|
2787
|
-
//#endregion
|
|
2788
|
-
//#region src/types/cells.ts
|
|
2789
|
-
let CellValueType = /* @__PURE__ */ function(CellValueType) {
|
|
2790
|
-
CellValueType["boolean"] = "boolean";
|
|
2791
|
-
CellValueType["number"] = "number";
|
|
2792
|
-
CellValueType["text"] = "text";
|
|
2793
|
-
CellValueType["empty"] = "empty";
|
|
2794
|
-
CellValueType["error"] = "error";
|
|
2795
|
-
return CellValueType;
|
|
2796
|
-
}({});
|
|
2797
|
-
|
|
2798
|
-
//#endregion
|
|
2799
|
-
//#region src/types/clipboard.ts
|
|
2800
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
2801
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
2802
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
2803
|
-
return ClipboardMIMEType;
|
|
2804
|
-
}({});
|
|
2805
|
-
|
|
2806
2774
|
//#endregion
|
|
2807
2775
|
//#region src/types/commands.ts
|
|
2808
2776
|
function isSheetDependent(cmd) {
|
|
@@ -2964,7 +2932,7 @@ var DispatchResult = class {
|
|
|
2964
2932
|
constructor(results = []) {
|
|
2965
2933
|
if (!Array.isArray(results)) results = [results];
|
|
2966
2934
|
results = [...new Set(results)];
|
|
2967
|
-
this.reasons = results.filter((result) => result !==
|
|
2935
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
2968
2936
|
}
|
|
2969
2937
|
/**
|
|
2970
2938
|
* Static helper which returns a successful DispatchResult
|
|
@@ -3148,13 +3116,6 @@ const borderStyles = [
|
|
|
3148
3116
|
function isMatrix(x) {
|
|
3149
3117
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
3150
3118
|
}
|
|
3151
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
3152
|
-
DIRECTION["UP"] = "up";
|
|
3153
|
-
DIRECTION["DOWN"] = "down";
|
|
3154
|
-
DIRECTION["LEFT"] = "left";
|
|
3155
|
-
DIRECTION["RIGHT"] = "right";
|
|
3156
|
-
return DIRECTION;
|
|
3157
|
-
}({});
|
|
3158
3119
|
|
|
3159
3120
|
//#endregion
|
|
3160
3121
|
//#region src/types/rendering.ts
|
|
@@ -3193,6 +3154,8 @@ const CellErrorType = {
|
|
|
3193
3154
|
};
|
|
3194
3155
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3195
3156
|
var EvaluationError = class {
|
|
3157
|
+
message;
|
|
3158
|
+
value;
|
|
3196
3159
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3197
3160
|
this.message = message;
|
|
3198
3161
|
this.value = value;
|
|
@@ -3891,7 +3854,7 @@ urlRegistry.add("sheet_URL", {
|
|
|
3891
3854
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
3892
3855
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
3893
3856
|
sheetIdTo: sheetId
|
|
3894
|
-
}).isCancelledBecause(
|
|
3857
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
3895
3858
|
type: "warning",
|
|
3896
3859
|
sticky: false,
|
|
3897
3860
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -3926,6 +3889,7 @@ function detectLink(value) {
|
|
|
3926
3889
|
//#endregion
|
|
3927
3890
|
//#region src/helpers/format/format_tokenizer.ts
|
|
3928
3891
|
function tokenizeFormat(str) {
|
|
3892
|
+
str = str.replace(/\s/g, " ");
|
|
3929
3893
|
const chars = new TokenizingChars(str);
|
|
3930
3894
|
const result = [];
|
|
3931
3895
|
let currentFormatPart = [];
|
|
@@ -4863,7 +4827,7 @@ function textCell(value, format, formattedValue) {
|
|
|
4863
4827
|
value,
|
|
4864
4828
|
format,
|
|
4865
4829
|
formattedValue,
|
|
4866
|
-
type:
|
|
4830
|
+
type: "text",
|
|
4867
4831
|
isAutoSummable: true,
|
|
4868
4832
|
defaultAlign: "left"
|
|
4869
4833
|
};
|
|
@@ -4873,7 +4837,7 @@ function numberCell(value, format, formattedValue) {
|
|
|
4873
4837
|
value: value || 0,
|
|
4874
4838
|
format,
|
|
4875
4839
|
formattedValue,
|
|
4876
|
-
type:
|
|
4840
|
+
type: "number",
|
|
4877
4841
|
isAutoSummable: true,
|
|
4878
4842
|
defaultAlign: "right"
|
|
4879
4843
|
};
|
|
@@ -4883,7 +4847,7 @@ const emptyCell = memoize(function emptyCell(format) {
|
|
|
4883
4847
|
value: null,
|
|
4884
4848
|
format,
|
|
4885
4849
|
formattedValue: "",
|
|
4886
|
-
type:
|
|
4850
|
+
type: "empty",
|
|
4887
4851
|
isAutoSummable: true,
|
|
4888
4852
|
defaultAlign: "left"
|
|
4889
4853
|
};
|
|
@@ -4893,7 +4857,7 @@ function dateTimeCell(value, format, formattedValue) {
|
|
|
4893
4857
|
value,
|
|
4894
4858
|
format,
|
|
4895
4859
|
formattedValue,
|
|
4896
|
-
type:
|
|
4860
|
+
type: "number",
|
|
4897
4861
|
isAutoSummable: false,
|
|
4898
4862
|
defaultAlign: "right"
|
|
4899
4863
|
};
|
|
@@ -4903,7 +4867,7 @@ function booleanCell(value, format, formattedValue) {
|
|
|
4903
4867
|
value,
|
|
4904
4868
|
format,
|
|
4905
4869
|
formattedValue,
|
|
4906
|
-
type:
|
|
4870
|
+
type: "boolean",
|
|
4907
4871
|
isAutoSummable: false,
|
|
4908
4872
|
defaultAlign: "center"
|
|
4909
4873
|
};
|
|
@@ -4913,7 +4877,7 @@ function errorCell(value, message) {
|
|
|
4913
4877
|
value,
|
|
4914
4878
|
formattedValue: value,
|
|
4915
4879
|
message,
|
|
4916
|
-
type:
|
|
4880
|
+
type: "error",
|
|
4917
4881
|
isAutoSummable: false,
|
|
4918
4882
|
defaultAlign: "center"
|
|
4919
4883
|
};
|
|
@@ -5056,6 +5020,7 @@ function getFullReference(sheetName, xc) {
|
|
|
5056
5020
|
//#endregion
|
|
5057
5021
|
//#region src/helpers/range.ts
|
|
5058
5022
|
var RangeImpl = class RangeImpl {
|
|
5023
|
+
getSheetSize;
|
|
5059
5024
|
_zone;
|
|
5060
5025
|
parts;
|
|
5061
5026
|
invalidXc;
|
|
@@ -5687,10 +5652,10 @@ function getPasteZones(target, content) {
|
|
|
5687
5652
|
return target.map((t) => splitZoneForPaste(t, width, height)).flat();
|
|
5688
5653
|
}
|
|
5689
5654
|
function parseOSClipboardContent(content) {
|
|
5690
|
-
if (!content[
|
|
5691
|
-
const htmlDocument = new DOMParser().parseFromString(content[
|
|
5655
|
+
if (!content["text/html"]) return { text: content["text/plain"] };
|
|
5656
|
+
const htmlDocument = new DOMParser().parseFromString(content["text/html"], "text/html");
|
|
5692
5657
|
return {
|
|
5693
|
-
text: content[
|
|
5658
|
+
text: content["text/plain"],
|
|
5694
5659
|
data: getOSheetDataFromHTML(htmlDocument)
|
|
5695
5660
|
};
|
|
5696
5661
|
}
|
|
@@ -5757,6 +5722,8 @@ const selectPastedZone = (selection, sourceZones, pastedZones) => {
|
|
|
5757
5722
|
//#endregion
|
|
5758
5723
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
5759
5724
|
var ClipboardHandler = class {
|
|
5725
|
+
getters;
|
|
5726
|
+
dispatch;
|
|
5760
5727
|
constructor(getters, dispatch) {
|
|
5761
5728
|
this.getters = getters;
|
|
5762
5729
|
this.dispatch = dispatch;
|
|
@@ -5764,10 +5731,10 @@ var ClipboardHandler = class {
|
|
|
5764
5731
|
copy(data, mode = "copyPaste") {}
|
|
5765
5732
|
paste(target, clippedContent, options) {}
|
|
5766
5733
|
isPasteAllowed(sheetId, target, content, option) {
|
|
5767
|
-
return
|
|
5734
|
+
return "Success";
|
|
5768
5735
|
}
|
|
5769
5736
|
isCutAllowed(data) {
|
|
5770
|
-
return
|
|
5737
|
+
return "Success";
|
|
5771
5738
|
}
|
|
5772
5739
|
getPasteTarget(sheetId, target, content, options) {
|
|
5773
5740
|
return {
|
|
@@ -7218,8 +7185,8 @@ function addIndentAndAlignToPivotHeader(pivot, domain, functionResult) {
|
|
|
7218
7185
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
7219
7186
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7220
7187
|
isCutAllowed(data) {
|
|
7221
|
-
if (data.zones.length !== 1) return
|
|
7222
|
-
return
|
|
7188
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
7189
|
+
return "Success";
|
|
7223
7190
|
}
|
|
7224
7191
|
copy(data, mode = "copyPaste") {
|
|
7225
7192
|
const sheetId = data.sheetId;
|
|
@@ -7287,17 +7254,17 @@ var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
7287
7254
|
};
|
|
7288
7255
|
}
|
|
7289
7256
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
7290
|
-
if (!content.cells) return
|
|
7291
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
7257
|
+
if (!content.cells) return "Success";
|
|
7258
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
7292
7259
|
if (target.length > 1) {
|
|
7293
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
7260
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
7294
7261
|
}
|
|
7295
7262
|
const clipboardHeight = content.cells.length;
|
|
7296
7263
|
const clipboardWidth = content.cells[0].length;
|
|
7297
7264
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
7298
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
7265
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
7299
7266
|
}
|
|
7300
|
-
return
|
|
7267
|
+
return "Success";
|
|
7301
7268
|
}
|
|
7302
7269
|
/**
|
|
7303
7270
|
* Paste the clipboard content in the given target
|
|
@@ -7479,9 +7446,9 @@ var ChartClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
7479
7446
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7480
7447
|
}
|
|
7481
7448
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7482
|
-
if (target.length === 0) return
|
|
7483
|
-
if (option?.pasteOption !== void 0) return
|
|
7484
|
-
return
|
|
7449
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7450
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7451
|
+
return "Success";
|
|
7485
7452
|
}
|
|
7486
7453
|
};
|
|
7487
7454
|
|
|
@@ -7780,9 +7747,9 @@ var ImageClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
7780
7747
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7781
7748
|
}
|
|
7782
7749
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7783
|
-
if (target.length === 0) return
|
|
7784
|
-
if (option?.pasteOption !== void 0) return
|
|
7785
|
-
return
|
|
7750
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7751
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7752
|
+
return "Success";
|
|
7786
7753
|
}
|
|
7787
7754
|
};
|
|
7788
7755
|
|
|
@@ -7877,10 +7844,10 @@ var ReferenceClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
7877
7844
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
7878
7845
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7879
7846
|
isPasteAllowed(sheetId, target, content, options) {
|
|
7880
|
-
if (!("cells" in content)) return
|
|
7847
|
+
if (!("cells" in content)) return "Success";
|
|
7881
7848
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
7882
|
-
for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
7883
|
-
return
|
|
7849
|
+
for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
7850
|
+
return "Success";
|
|
7884
7851
|
}
|
|
7885
7852
|
};
|
|
7886
7853
|
|
|
@@ -8132,6 +8099,7 @@ var DependencyContainer = class extends EventBus {
|
|
|
8132
8099
|
}
|
|
8133
8100
|
};
|
|
8134
8101
|
var StoreFactory = class {
|
|
8102
|
+
get;
|
|
8135
8103
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
8136
8104
|
constructor(get) {
|
|
8137
8105
|
this.get = get;
|
|
@@ -8176,6 +8144,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8176
8144
|
return MetaStore;
|
|
8177
8145
|
}
|
|
8178
8146
|
var DisposableStore = class {
|
|
8147
|
+
get;
|
|
8179
8148
|
disposeCallbacks = [];
|
|
8180
8149
|
constructor(get) {
|
|
8181
8150
|
this.get = get;
|
|
@@ -8553,16 +8522,16 @@ function chartFontColor(backgroundColor) {
|
|
|
8553
8522
|
}
|
|
8554
8523
|
function checkDataset(definition) {
|
|
8555
8524
|
if (definition.dataSets) {
|
|
8556
|
-
if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
8557
|
-
if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
8525
|
+
if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
8526
|
+
if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
8558
8527
|
}
|
|
8559
|
-
return
|
|
8528
|
+
return "Success";
|
|
8560
8529
|
}
|
|
8561
8530
|
function checkLabelRange(definition) {
|
|
8562
8531
|
if (definition.labelRange) {
|
|
8563
|
-
if (!rangeReference.test(definition.labelRange || "")) return
|
|
8532
|
+
if (!rangeReference.test(definition.labelRange || "")) return "InvalidLabelRange";
|
|
8564
8533
|
}
|
|
8565
|
-
return
|
|
8534
|
+
return "Success";
|
|
8566
8535
|
}
|
|
8567
8536
|
function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
8568
8537
|
if (!dataSetsHaveTitle) return false;
|
|
@@ -8879,6 +8848,7 @@ function getNextNonEmptyBar(bars, startIndex) {
|
|
|
8879
8848
|
* Represent a raw XML string
|
|
8880
8849
|
*/
|
|
8881
8850
|
var XMLString = class {
|
|
8851
|
+
xmlString;
|
|
8882
8852
|
/**
|
|
8883
8853
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
8884
8854
|
*/
|
|
@@ -8992,6 +8962,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
|
8992
8962
|
ROUNDDOWN: [{
|
|
8993
8963
|
type: "NUMBER",
|
|
8994
8964
|
value: 0
|
|
8965
|
+
}],
|
|
8966
|
+
IFERROR: [{
|
|
8967
|
+
type: "NUMBER",
|
|
8968
|
+
value: 0
|
|
8995
8969
|
}]
|
|
8996
8970
|
};
|
|
8997
8971
|
/**
|
|
@@ -9432,30 +9406,6 @@ function prefixFormulaWithEqual(formula) {
|
|
|
9432
9406
|
|
|
9433
9407
|
//#endregion
|
|
9434
9408
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
9435
|
-
/**
|
|
9436
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
9437
|
-
*/
|
|
9438
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
9439
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
9440
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
9441
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
9442
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
9443
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
9444
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
9445
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
9446
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
9447
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
9448
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
9449
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
9450
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
9451
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
9452
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
9453
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
9454
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
9455
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
9456
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
9457
|
-
return WarningTypes;
|
|
9458
|
-
}({});
|
|
9459
9409
|
var XLSXImportWarningManager = class {
|
|
9460
9410
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
9461
9411
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -9944,7 +9894,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
9944
9894
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
9945
9895
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
9946
9896
|
} catch (e) {}
|
|
9947
|
-
warningManager.generateNotSupportedWarning(
|
|
9897
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
9948
9898
|
}
|
|
9949
9899
|
function isFormatSupported(format) {
|
|
9950
9900
|
try {
|
|
@@ -10028,20 +9978,20 @@ function convertFormats(data, warningManager) {
|
|
|
10028
9978
|
return arrayToObject(formats, 1);
|
|
10029
9979
|
}
|
|
10030
9980
|
function addStyleWarnings(font, fill, warningManager) {
|
|
10031
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
10032
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
9981
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
9982
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
10033
9983
|
}
|
|
10034
9984
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
10035
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
9985
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
10036
9986
|
}
|
|
10037
9987
|
function addBorderWarnings(border, warningManager) {
|
|
10038
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
9988
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
10039
9989
|
}
|
|
10040
9990
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
10041
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9991
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
10042
9992
|
}
|
|
10043
9993
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
10044
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9994
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
10045
9995
|
}
|
|
10046
9996
|
|
|
10047
9997
|
//#endregion
|
|
@@ -10181,7 +10131,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
10181
10131
|
lower: icons.upper
|
|
10182
10132
|
};
|
|
10183
10133
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
10184
|
-
warningManager.generateNotSupportedWarning(
|
|
10134
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
10185
10135
|
switch (key) {
|
|
10186
10136
|
case "upper":
|
|
10187
10137
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -10217,13 +10167,13 @@ function convertIcons(xlsxIconSet, index) {
|
|
|
10217
10167
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
10218
10168
|
}
|
|
10219
10169
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
10220
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
10221
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
10170
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
10171
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
10222
10172
|
if (cf.cfRules[0].dxfId) {
|
|
10223
10173
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
10224
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
10225
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
10226
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
10174
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
10175
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
10176
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
10227
10177
|
}
|
|
10228
10178
|
}
|
|
10229
10179
|
|
|
@@ -10563,13 +10513,13 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
10563
10513
|
if (!dv) continue;
|
|
10564
10514
|
switch (dv.type) {
|
|
10565
10515
|
case "time":
|
|
10566
|
-
warningManager.generateNotSupportedWarning(
|
|
10516
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
10567
10517
|
break;
|
|
10568
10518
|
case "textLength":
|
|
10569
|
-
warningManager.generateNotSupportedWarning(
|
|
10519
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
10570
10520
|
break;
|
|
10571
10521
|
case "whole":
|
|
10572
|
-
warningManager.generateNotSupportedWarning(
|
|
10522
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
10573
10523
|
break;
|
|
10574
10524
|
case "decimal":
|
|
10575
10525
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -10581,7 +10531,7 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
10581
10531
|
break;
|
|
10582
10532
|
case "date":
|
|
10583
10533
|
if (dv.operator === "notEqual") {
|
|
10584
|
-
warningManager.generateNotSupportedWarning(
|
|
10534
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
10585
10535
|
break;
|
|
10586
10536
|
}
|
|
10587
10537
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -10887,7 +10837,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
10887
10837
|
}
|
|
10888
10838
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
10889
10839
|
const label = link.display || cellValue;
|
|
10890
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
10840
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
10891
10841
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
10892
10842
|
}
|
|
10893
10843
|
function getSheetDims(sheet) {
|
|
@@ -13172,46 +13122,6 @@ var XlsxReader = class {
|
|
|
13172
13122
|
|
|
13173
13123
|
//#endregion
|
|
13174
13124
|
//#region src/formulas/range_tokenizer.ts
|
|
13175
|
-
var State = /* @__PURE__ */ function(State) {
|
|
13176
|
-
/**
|
|
13177
|
-
* Initial state.
|
|
13178
|
-
* Expecting any reference for the left part of a range
|
|
13179
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
13180
|
-
*/
|
|
13181
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
13182
|
-
/**
|
|
13183
|
-
* Expecting any reference for the right part of a range
|
|
13184
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
13185
|
-
*/
|
|
13186
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
13187
|
-
/**
|
|
13188
|
-
* Expecting the separator without any constraint on the right part
|
|
13189
|
-
*/
|
|
13190
|
-
State[State["Separator"] = 2] = "Separator";
|
|
13191
|
-
/**
|
|
13192
|
-
* Expecting the separator for a full column range
|
|
13193
|
-
*/
|
|
13194
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
13195
|
-
/**
|
|
13196
|
-
* Expecting the separator for a full row range
|
|
13197
|
-
*/
|
|
13198
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
13199
|
-
/**
|
|
13200
|
-
* Expecting the right part of a full column range
|
|
13201
|
-
* e.g. "1", "A1"
|
|
13202
|
-
*/
|
|
13203
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
13204
|
-
/**
|
|
13205
|
-
* Expecting the right part of a full row range
|
|
13206
|
-
* e.g. "A", "A1"
|
|
13207
|
-
*/
|
|
13208
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
13209
|
-
/**
|
|
13210
|
-
* Final state. A range has been matched
|
|
13211
|
-
*/
|
|
13212
|
-
State[State["Found"] = 7] = "Found";
|
|
13213
|
-
return State;
|
|
13214
|
-
}(State || {});
|
|
13215
13125
|
const goTo = (state, guard = () => true) => [{
|
|
13216
13126
|
goTo: state,
|
|
13217
13127
|
guard
|
|
@@ -13221,41 +13131,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
13221
13131
|
guard
|
|
13222
13132
|
});
|
|
13223
13133
|
const machine = {
|
|
13224
|
-
[
|
|
13225
|
-
REFERENCE: goTo(
|
|
13226
|
-
NUMBER: goTo(
|
|
13227
|
-
SYMBOL: [goToMulti(
|
|
13228
|
-
},
|
|
13229
|
-
[
|
|
13230
|
-
SPACE: goTo(
|
|
13231
|
-
OPERATOR: goTo(
|
|
13232
|
-
},
|
|
13233
|
-
[
|
|
13234
|
-
SPACE: goTo(
|
|
13235
|
-
OPERATOR: goTo(
|
|
13236
|
-
},
|
|
13237
|
-
[
|
|
13238
|
-
SPACE: goTo(
|
|
13239
|
-
OPERATOR: goTo(
|
|
13240
|
-
},
|
|
13241
|
-
[
|
|
13242
|
-
SPACE: goTo(
|
|
13243
|
-
NUMBER: goTo(
|
|
13244
|
-
REFERENCE: goTo(
|
|
13245
|
-
SYMBOL: goTo(
|
|
13246
|
-
},
|
|
13247
|
-
[
|
|
13248
|
-
SPACE: goTo(
|
|
13249
|
-
SYMBOL: goTo(
|
|
13250
|
-
REFERENCE: goTo(
|
|
13251
|
-
},
|
|
13252
|
-
[
|
|
13253
|
-
SPACE: goTo(
|
|
13254
|
-
NUMBER: goTo(
|
|
13255
|
-
REFERENCE: goTo(
|
|
13256
|
-
SYMBOL: goTo(
|
|
13257
|
-
},
|
|
13258
|
-
[
|
|
13134
|
+
[0]: {
|
|
13135
|
+
REFERENCE: goTo(2),
|
|
13136
|
+
NUMBER: goTo(4),
|
|
13137
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
13138
|
+
},
|
|
13139
|
+
[3]: {
|
|
13140
|
+
SPACE: goTo(3),
|
|
13141
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
13142
|
+
},
|
|
13143
|
+
[4]: {
|
|
13144
|
+
SPACE: goTo(4),
|
|
13145
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
13146
|
+
},
|
|
13147
|
+
[2]: {
|
|
13148
|
+
SPACE: goTo(2),
|
|
13149
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
13150
|
+
},
|
|
13151
|
+
[1]: {
|
|
13152
|
+
SPACE: goTo(1),
|
|
13153
|
+
NUMBER: goTo(7),
|
|
13154
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13155
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
13156
|
+
},
|
|
13157
|
+
[5]: {
|
|
13158
|
+
SPACE: goTo(5),
|
|
13159
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
13160
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
13161
|
+
},
|
|
13162
|
+
[6]: {
|
|
13163
|
+
SPACE: goTo(6),
|
|
13164
|
+
NUMBER: goTo(7),
|
|
13165
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13166
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
13167
|
+
},
|
|
13168
|
+
[7]: {}
|
|
13259
13169
|
};
|
|
13260
13170
|
/**
|
|
13261
13171
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -13265,7 +13175,7 @@ const machine = {
|
|
|
13265
13175
|
*/
|
|
13266
13176
|
function matchReference(tokens) {
|
|
13267
13177
|
let head = 0;
|
|
13268
|
-
let transitions = machine[
|
|
13178
|
+
let transitions = machine[0];
|
|
13269
13179
|
let matchedTokens = "";
|
|
13270
13180
|
while (transitions !== void 0) {
|
|
13271
13181
|
const token = tokens[head++];
|
|
@@ -13274,7 +13184,7 @@ function matchReference(tokens) {
|
|
|
13274
13184
|
const nextState = transition ? transition.goTo : void 0;
|
|
13275
13185
|
switch (nextState) {
|
|
13276
13186
|
case void 0: return null;
|
|
13277
|
-
case
|
|
13187
|
+
case 7:
|
|
13278
13188
|
matchedTokens += token.value;
|
|
13279
13189
|
tokens.splice(0, head);
|
|
13280
13190
|
return {
|
|
@@ -13979,10 +13889,10 @@ const PasteInteractiveContent = {
|
|
|
13979
13889
|
};
|
|
13980
13890
|
function handlePasteResult(env, result) {
|
|
13981
13891
|
if (!result.isSuccessful) {
|
|
13982
|
-
if (result.reasons.includes(
|
|
13983
|
-
else if (result.reasons.includes(
|
|
13984
|
-
else if (result.reasons.includes(
|
|
13985
|
-
else if (result.reasons.includes(
|
|
13892
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
13893
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
13894
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
13895
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
13986
13896
|
}
|
|
13987
13897
|
}
|
|
13988
13898
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -14008,25 +13918,25 @@ function interactivePasteFromOS(env, target, clipboardContent, pasteOption) {
|
|
|
14008
13918
|
//#region src/components/translations_terms.ts
|
|
14009
13919
|
const CfTerms = {
|
|
14010
13920
|
Errors: {
|
|
14011
|
-
[
|
|
14012
|
-
[
|
|
14013
|
-
[
|
|
14014
|
-
[
|
|
14015
|
-
[
|
|
14016
|
-
[
|
|
14017
|
-
[
|
|
14018
|
-
[
|
|
14019
|
-
[
|
|
14020
|
-
[
|
|
14021
|
-
[
|
|
14022
|
-
[
|
|
14023
|
-
[
|
|
14024
|
-
[
|
|
14025
|
-
[
|
|
14026
|
-
[
|
|
14027
|
-
[
|
|
14028
|
-
[
|
|
14029
|
-
[
|
|
13921
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
13922
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
13923
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
13924
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
13925
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
13926
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
13927
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
13928
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
13929
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
13930
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
13931
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
13932
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
13933
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
13934
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
13935
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
13936
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
13937
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
13938
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
13939
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
14030
13940
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
14031
13941
|
},
|
|
14032
13942
|
ColorScale: _t("Color scale"),
|
|
@@ -14061,18 +13971,18 @@ const ChartTerms = {
|
|
|
14061
13971
|
AggregatedChart: _t("Aggregate"),
|
|
14062
13972
|
Errors: {
|
|
14063
13973
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
14064
|
-
[
|
|
14065
|
-
[
|
|
14066
|
-
[
|
|
14067
|
-
[
|
|
14068
|
-
[
|
|
14069
|
-
[
|
|
14070
|
-
[
|
|
14071
|
-
[
|
|
14072
|
-
[
|
|
14073
|
-
[
|
|
14074
|
-
[
|
|
14075
|
-
[
|
|
13974
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
13975
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
13976
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
13977
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
13978
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
13979
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
13980
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
13981
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
13982
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
13983
|
+
["GaugeRangeMinBiggerThanRangeMax"]: _t("Minimum range limit must be smaller than maximum range limit"),
|
|
13984
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
13985
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
14076
13986
|
}
|
|
14077
13987
|
};
|
|
14078
13988
|
const CustomCurrencyTerms = { Custom: _t("Custom") };
|
|
@@ -14080,16 +13990,16 @@ const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerg
|
|
|
14080
13990
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
14081
13991
|
const SplitToColumnsTerms = { Errors: {
|
|
14082
13992
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
14083
|
-
[
|
|
14084
|
-
[
|
|
14085
|
-
[
|
|
13993
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
13994
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
13995
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
14086
13996
|
} };
|
|
14087
13997
|
const RemoveDuplicateTerms = { Errors: {
|
|
14088
13998
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
14089
|
-
[
|
|
14090
|
-
[
|
|
14091
|
-
[
|
|
14092
|
-
[
|
|
13999
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
14000
|
+
["EmptyTarget"]: _t("Please select a range of cells containing values."),
|
|
14001
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
14002
|
+
["WillRemoveExistingMerge"]: PasteInteractiveContent.willRemoveExistingMerge
|
|
14093
14003
|
} };
|
|
14094
14004
|
const DVTerms = {
|
|
14095
14005
|
DateIs: {
|
|
@@ -14118,10 +14028,10 @@ const DVTerms = {
|
|
|
14118
14028
|
const TableTerms = {
|
|
14119
14029
|
Errors: {
|
|
14120
14030
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
14121
|
-
[
|
|
14122
|
-
[
|
|
14123
|
-
[
|
|
14124
|
-
[
|
|
14031
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
14032
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
14033
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
14034
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
14125
14035
|
},
|
|
14126
14036
|
Checkboxes: {
|
|
14127
14037
|
hasFilters: _t("Filter button"),
|
|
@@ -14565,7 +14475,7 @@ var AbstractChart = class {
|
|
|
14565
14475
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
14566
14476
|
function getBaselineText(baseline, keyValue, baselineMode, humanize, locale) {
|
|
14567
14477
|
if (!baseline) return "";
|
|
14568
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
14478
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
14569
14479
|
if (humanize) return humanizeNumber(baseline, locale);
|
|
14570
14480
|
return baseline.formattedValue;
|
|
14571
14481
|
}
|
|
@@ -14594,23 +14504,23 @@ function getKeyValueText(keyValueCell, humanize, locale) {
|
|
|
14594
14504
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
14595
14505
|
}
|
|
14596
14506
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
14597
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
14507
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
14598
14508
|
const diff = keyValue.value - baseline.value;
|
|
14599
14509
|
if (diff > 0) return colorUp;
|
|
14600
14510
|
else if (diff < 0) return colorDown;
|
|
14601
14511
|
}
|
|
14602
14512
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
14603
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
14513
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
14604
14514
|
const diff = keyValue.value - baseline.value;
|
|
14605
14515
|
if (diff > 0) return "up";
|
|
14606
14516
|
else if (diff < 0) return "down";
|
|
14607
14517
|
return "neutral";
|
|
14608
14518
|
}
|
|
14609
14519
|
function checkKeyValue(definition) {
|
|
14610
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
14520
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
14611
14521
|
}
|
|
14612
14522
|
function checkBaseline(definition) {
|
|
14613
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
14523
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
14614
14524
|
}
|
|
14615
14525
|
const arrowDownPath = new window.Path2D("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");
|
|
14616
14526
|
const arrowUpPath = new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");
|
|
@@ -14840,6 +14750,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
14840
14750
|
}, runtime).computeDesign();
|
|
14841
14751
|
}
|
|
14842
14752
|
var ScorecardChartConfigBuilder = class {
|
|
14753
|
+
runtime;
|
|
14843
14754
|
context;
|
|
14844
14755
|
width;
|
|
14845
14756
|
height;
|
|
@@ -15320,7 +15231,8 @@ var ChartJsComponent = class extends Component {
|
|
|
15320
15231
|
}
|
|
15321
15232
|
createChart(chartData) {
|
|
15322
15233
|
const ctx = this.canvas.el.getContext("2d");
|
|
15323
|
-
|
|
15234
|
+
const Chart = getChartJSConstructor();
|
|
15235
|
+
this.chart = new Chart(ctx, chartData);
|
|
15324
15236
|
}
|
|
15325
15237
|
updateChartJs(chartRuntime) {
|
|
15326
15238
|
const chartData = chartRuntime.chartJsConfig;
|
|
@@ -17907,15 +17819,15 @@ const DATEDIF = {
|
|
|
17907
17819
|
const jsEndDate = numberToJsDate(_endDate);
|
|
17908
17820
|
assert(() => _endDate >= _startDate, _t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
17909
17821
|
switch (_unit) {
|
|
17910
|
-
case
|
|
17911
|
-
case
|
|
17912
|
-
case
|
|
17913
|
-
case
|
|
17914
|
-
case
|
|
17822
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
17823
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
17824
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17825
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
17826
|
+
case "MD":
|
|
17915
17827
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
17916
17828
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
17917
17829
|
return days;
|
|
17918
|
-
case
|
|
17830
|
+
case "YD": {
|
|
17919
17831
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17920
17832
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
17921
17833
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -18411,18 +18323,18 @@ const DELTA = {
|
|
|
18411
18323
|
//#endregion
|
|
18412
18324
|
//#region src/helpers/sort.ts
|
|
18413
18325
|
const SORT_TYPES = [
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18326
|
+
"number",
|
|
18327
|
+
"error",
|
|
18328
|
+
"text",
|
|
18329
|
+
"boolean"
|
|
18418
18330
|
];
|
|
18419
18331
|
function cellsSortingCriterion(sortingOrder) {
|
|
18420
18332
|
const inverse = sortingOrder === "ascending" ? 1 : -1;
|
|
18421
18333
|
return (left, right) => {
|
|
18422
|
-
if (left.type ===
|
|
18423
|
-
else if (right.type ===
|
|
18334
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
18335
|
+
else if (right.type === "empty") return -1;
|
|
18424
18336
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
18425
|
-
if (typeOrder === 0) if (left.type ===
|
|
18337
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
18426
18338
|
else typeOrder = left.value - right.value;
|
|
18427
18339
|
return inverse * typeOrder;
|
|
18428
18340
|
};
|
|
@@ -18433,9 +18345,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
18433
18345
|
type: cell.type,
|
|
18434
18346
|
value: cell.value
|
|
18435
18347
|
}));
|
|
18436
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
18348
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
18437
18349
|
...cell,
|
|
18438
|
-
type:
|
|
18350
|
+
type: "number",
|
|
18439
18351
|
value: 0
|
|
18440
18352
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
18441
18353
|
}
|
|
@@ -18497,7 +18409,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
|
18497
18409
|
});
|
|
18498
18410
|
});
|
|
18499
18411
|
}
|
|
18500
|
-
if (result.isCancelledBecause(
|
|
18412
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
18501
18413
|
const { col, row } = anchor;
|
|
18502
18414
|
env.model.selection.selectZone({
|
|
18503
18415
|
cell: {
|
|
@@ -18550,11 +18462,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
18550
18462
|
const right = sortColumn[b];
|
|
18551
18463
|
const leftCell = {
|
|
18552
18464
|
value: left,
|
|
18553
|
-
type: left === null ?
|
|
18465
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
18554
18466
|
};
|
|
18555
18467
|
const rightCell = {
|
|
18556
18468
|
value: right,
|
|
18557
|
-
type: right === null ?
|
|
18469
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
18558
18470
|
};
|
|
18559
18471
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
18560
18472
|
if (result !== 0) return result;
|
|
@@ -20968,8 +20880,8 @@ const CELL = {
|
|
|
20968
20880
|
row: range.zone.top
|
|
20969
20881
|
};
|
|
20970
20882
|
const type = this.getters.getEvaluatedCell(position).type;
|
|
20971
|
-
if (type ===
|
|
20972
|
-
else if (type ===
|
|
20883
|
+
if (type === "empty") return "b";
|
|
20884
|
+
else if (type === "text") return "l";
|
|
20973
20885
|
else return "v";
|
|
20974
20886
|
}
|
|
20975
20887
|
}
|
|
@@ -24173,6 +24085,7 @@ var Composer = class extends Component {
|
|
|
24173
24085
|
//#endregion
|
|
24174
24086
|
//#region src/formulas/code_builder.ts
|
|
24175
24087
|
var FunctionCodeBuilder = class {
|
|
24088
|
+
scope;
|
|
24176
24089
|
code = "";
|
|
24177
24090
|
constructor(scope = new Scope()) {
|
|
24178
24091
|
this.scope = scope;
|
|
@@ -24188,6 +24101,8 @@ var FunctionCodeBuilder = class {
|
|
|
24188
24101
|
}
|
|
24189
24102
|
};
|
|
24190
24103
|
var FunctionCodeImpl = class {
|
|
24104
|
+
scope;
|
|
24105
|
+
returnExpression;
|
|
24191
24106
|
code;
|
|
24192
24107
|
constructor(scope, code, returnExpression) {
|
|
24193
24108
|
this.scope = scope;
|
|
@@ -24563,6 +24478,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
|
|
|
24563
24478
|
function getFirstPivotFunction(tokens) {
|
|
24564
24479
|
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
|
|
24565
24480
|
}
|
|
24481
|
+
function getPivotFunctions(tokens) {
|
|
24482
|
+
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
|
|
24483
|
+
}
|
|
24566
24484
|
/**
|
|
24567
24485
|
* Parse a spreadsheet formula and detect the number of PIVOT functions that are
|
|
24568
24486
|
* present in the given formula.
|
|
@@ -24934,19 +24852,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
24934
24852
|
let x = 0;
|
|
24935
24853
|
let y = 0;
|
|
24936
24854
|
switch (direction) {
|
|
24937
|
-
case
|
|
24855
|
+
case "up":
|
|
24938
24856
|
x = 0;
|
|
24939
24857
|
y = -rule.current;
|
|
24940
24858
|
break;
|
|
24941
|
-
case
|
|
24859
|
+
case "down":
|
|
24942
24860
|
x = 0;
|
|
24943
24861
|
y = rule.current;
|
|
24944
24862
|
break;
|
|
24945
|
-
case
|
|
24863
|
+
case "left":
|
|
24946
24864
|
x = -rule.current;
|
|
24947
24865
|
y = 0;
|
|
24948
24866
|
break;
|
|
24949
|
-
case
|
|
24867
|
+
case "right":
|
|
24950
24868
|
x = rule.current;
|
|
24951
24869
|
y = 0;
|
|
24952
24870
|
break;
|
|
@@ -25072,12 +24990,12 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25072
24990
|
},
|
|
25073
24991
|
sequence: 10
|
|
25074
24992
|
}).add("increment_alphanumeric_value", {
|
|
25075
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
24993
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
25076
24994
|
generateRule: (cell, cells, direction) => {
|
|
25077
24995
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
25078
24996
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
25079
24997
|
const numberPostfixLength = cell.content.length - prefix.length;
|
|
25080
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
24998
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => parseInt((cell.value ?? "").toString().match(numberPostfixRegExp)[0]));
|
|
25081
24999
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25082
25000
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25083
25001
|
return {
|
|
@@ -25090,7 +25008,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25090
25008
|
},
|
|
25091
25009
|
sequence: 15
|
|
25092
25010
|
}).add("copy_text", {
|
|
25093
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25011
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
25094
25012
|
generateRule: () => {
|
|
25095
25013
|
return { type: "COPY_MODIFIER" };
|
|
25096
25014
|
},
|
|
@@ -25107,10 +25025,10 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25107
25025
|
sequence: 30
|
|
25108
25026
|
}).add("increment_dates", {
|
|
25109
25027
|
condition: (cell, cells) => {
|
|
25110
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25028
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
25111
25029
|
},
|
|
25112
25030
|
generateRule: (cell, cells) => {
|
|
25113
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25031
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
25114
25032
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
25115
25033
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
25116
25034
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -25119,26 +25037,26 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25119
25037
|
if (typeof increment === "object") return {
|
|
25120
25038
|
type: "DATE_INCREMENT_MODIFIER",
|
|
25121
25039
|
increment,
|
|
25122
|
-
current: evaluation.type ===
|
|
25040
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25123
25041
|
};
|
|
25124
25042
|
return {
|
|
25125
25043
|
type: "INCREMENT_MODIFIER",
|
|
25126
25044
|
increment,
|
|
25127
|
-
current: evaluation.type ===
|
|
25045
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25128
25046
|
};
|
|
25129
25047
|
},
|
|
25130
25048
|
sequence: 25
|
|
25131
25049
|
}).add("increment_number", {
|
|
25132
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25050
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
25133
25051
|
generateRule: (cell, cells, direction) => {
|
|
25134
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25052
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
25135
25053
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25136
25054
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25137
25055
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
25138
25056
|
return {
|
|
25139
25057
|
type: "INCREMENT_MODIFIER",
|
|
25140
25058
|
increment,
|
|
25141
|
-
current: evaluation.type ===
|
|
25059
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25142
25060
|
};
|
|
25143
25061
|
},
|
|
25144
25062
|
sequence: 40
|
|
@@ -26042,47 +25960,47 @@ function createComboChartRuntime(chart, getters) {
|
|
|
26042
25960
|
//#endregion
|
|
26043
25961
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
26044
25962
|
function isDataRangeValid(definition) {
|
|
26045
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
25963
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
26046
25964
|
}
|
|
26047
25965
|
function checkRangeLimits(check, batchValidations) {
|
|
26048
25966
|
return batchValidations((definition) => {
|
|
26049
25967
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
26050
|
-
return
|
|
25968
|
+
return "Success";
|
|
26051
25969
|
}, (definition) => {
|
|
26052
25970
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
26053
|
-
return
|
|
25971
|
+
return "Success";
|
|
26054
25972
|
});
|
|
26055
25973
|
}
|
|
26056
25974
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
26057
25975
|
return batchValidations((definition) => {
|
|
26058
25976
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
26059
|
-
return
|
|
25977
|
+
return "Success";
|
|
26060
25978
|
}, (definition) => {
|
|
26061
25979
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
26062
|
-
return
|
|
25980
|
+
return "Success";
|
|
26063
25981
|
});
|
|
26064
25982
|
}
|
|
26065
25983
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
26066
25984
|
if (definition.sectionRule) {
|
|
26067
|
-
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return
|
|
25985
|
+
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return "GaugeRangeMinBiggerThanRangeMax";
|
|
26068
25986
|
}
|
|
26069
|
-
return
|
|
25987
|
+
return "Success";
|
|
26070
25988
|
}
|
|
26071
25989
|
function checkEmpty(value, valueName) {
|
|
26072
25990
|
if (value === "") switch (valueName) {
|
|
26073
|
-
case "rangeMin": return
|
|
26074
|
-
case "rangeMax": return
|
|
25991
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
25992
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
26075
25993
|
}
|
|
26076
|
-
return
|
|
25994
|
+
return "Success";
|
|
26077
25995
|
}
|
|
26078
25996
|
function checkNaN(value, valueName) {
|
|
26079
25997
|
if (isNaN(value)) switch (valueName) {
|
|
26080
|
-
case "rangeMin": return
|
|
26081
|
-
case "rangeMax": return
|
|
26082
|
-
case "lowerInflectionPointValue": return
|
|
26083
|
-
case "upperInflectionPointValue": return
|
|
25998
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
25999
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
26000
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
26001
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
26084
26002
|
}
|
|
26085
|
-
return
|
|
26003
|
+
return "Success";
|
|
26086
26004
|
}
|
|
26087
26005
|
var GaugeChart = class GaugeChart extends AbstractChart {
|
|
26088
26006
|
dataRange;
|
|
@@ -26178,7 +26096,7 @@ function createGaugeChartRuntime(chart, getters) {
|
|
|
26178
26096
|
col: dataRange.zone.left,
|
|
26179
26097
|
row: dataRange.zone.top
|
|
26180
26098
|
});
|
|
26181
|
-
if (cell.type ===
|
|
26099
|
+
if (cell.type === "number") {
|
|
26182
26100
|
gaugeValue = cell.value;
|
|
26183
26101
|
formattedValue = cell.formattedValue;
|
|
26184
26102
|
format = cell.format;
|
|
@@ -27687,7 +27605,7 @@ var MenuItemRegistry = class extends Registry {
|
|
|
27687
27605
|
function interactiveCut(env) {
|
|
27688
27606
|
const result = env.model.dispatch("CUT");
|
|
27689
27607
|
if (!result.isSuccessful) {
|
|
27690
|
-
if (result.isCancelledBecause(
|
|
27608
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
27691
27609
|
}
|
|
27692
27610
|
}
|
|
27693
27611
|
|
|
@@ -27702,8 +27620,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
27702
27620
|
sheetId,
|
|
27703
27621
|
target
|
|
27704
27622
|
});
|
|
27705
|
-
if (result.isCancelledBecause(
|
|
27706
|
-
else if (result.isCancelledBecause(
|
|
27623
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
27624
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
27707
27625
|
env.model.dispatch("ADD_MERGE", {
|
|
27708
27626
|
sheetId,
|
|
27709
27627
|
target,
|
|
@@ -27744,7 +27662,7 @@ var ErrorToolTip = class extends Component {
|
|
|
27744
27662
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
27745
27663
|
const cell = getters.getEvaluatedCell(position);
|
|
27746
27664
|
const errors = [];
|
|
27747
|
-
if (cell.type ===
|
|
27665
|
+
if (cell.type === "error" && !!cell.message) errors.push({
|
|
27748
27666
|
title: _t("Error"),
|
|
27749
27667
|
message: cell.message
|
|
27750
27668
|
});
|
|
@@ -28453,7 +28371,7 @@ function zoneToRect(zone) {
|
|
|
28453
28371
|
css`
|
|
28454
28372
|
.o-popover {
|
|
28455
28373
|
position: absolute;
|
|
28456
|
-
z-index: ${
|
|
28374
|
+
z-index: ${35};
|
|
28457
28375
|
overflow: auto;
|
|
28458
28376
|
box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);
|
|
28459
28377
|
width: fit-content;
|
|
@@ -28508,7 +28426,7 @@ var Popover = class extends Component {
|
|
|
28508
28426
|
onMouseWheel: () => {},
|
|
28509
28427
|
onPopoverMoved: () => {},
|
|
28510
28428
|
onPopoverHidden: () => {},
|
|
28511
|
-
zIndex:
|
|
28429
|
+
zIndex: 35
|
|
28512
28430
|
};
|
|
28513
28431
|
popoverRef = useRef("popover");
|
|
28514
28432
|
currentPosition = void 0;
|
|
@@ -28554,6 +28472,10 @@ var Popover = class extends Component {
|
|
|
28554
28472
|
}
|
|
28555
28473
|
};
|
|
28556
28474
|
var PopoverPositionContext = class {
|
|
28475
|
+
anchorRect;
|
|
28476
|
+
containerRect;
|
|
28477
|
+
propsMaxSize;
|
|
28478
|
+
spreadsheetOffset;
|
|
28557
28479
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset) {
|
|
28558
28480
|
this.anchorRect = anchorRect;
|
|
28559
28481
|
this.containerRect = containerRect;
|
|
@@ -29128,7 +29050,7 @@ function getSmartChartDefinition(zone, getters) {
|
|
|
29128
29050
|
const dataSetsHaveTitle = !!getters.getEvaluatedCellsInZone(sheetId, {
|
|
29129
29051
|
...dataSetZone,
|
|
29130
29052
|
bottom: dataSetZone.top
|
|
29131
|
-
}).find((cell) => cell.type !==
|
|
29053
|
+
}).find((cell) => cell.type !== "empty" && cell.type !== "number");
|
|
29132
29054
|
let labelRangeXc;
|
|
29133
29055
|
if (!singleColumn) labelRangeXc = zoneToXc({
|
|
29134
29056
|
...zone,
|
|
@@ -29191,8 +29113,8 @@ function interactiveCreateTable(env, sheetId, tableConfig) {
|
|
|
29191
29113
|
config: tableConfig,
|
|
29192
29114
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29193
29115
|
});
|
|
29194
|
-
if (result.isCancelledBecause(
|
|
29195
|
-
else if (result.isCancelledBecause(
|
|
29116
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29117
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29196
29118
|
return result;
|
|
29197
29119
|
}
|
|
29198
29120
|
|
|
@@ -29223,7 +29145,7 @@ async function paste$1(env, pasteOption) {
|
|
|
29223
29145
|
const target = env.model.getters.getSelectedZones();
|
|
29224
29146
|
if (env.model.getters.getClipboardId() !== clipboardId) interactivePasteFromOS(env, target, clipboardContent, pasteOption);
|
|
29225
29147
|
else interactivePaste(env, target, pasteOption);
|
|
29226
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29148
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29227
29149
|
break;
|
|
29228
29150
|
case "notImplemented":
|
|
29229
29151
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -29605,11 +29527,10 @@ const INSERT_TABLE = (env) => {
|
|
|
29605
29527
|
if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
|
|
29606
29528
|
};
|
|
29607
29529
|
const DELETE_SELECTED_TABLE = (env) => {
|
|
29608
|
-
const
|
|
29609
|
-
const table = env.model.getters.getTable(position);
|
|
29530
|
+
const table = env.model.getters.getFirstTableInSelection();
|
|
29610
29531
|
if (!table) return;
|
|
29611
29532
|
env.model.dispatch("REMOVE_TABLE", {
|
|
29612
|
-
sheetId:
|
|
29533
|
+
sheetId: env.model.getters.getActiveSheetId(),
|
|
29613
29534
|
target: [table.range.zone]
|
|
29614
29535
|
});
|
|
29615
29536
|
};
|
|
@@ -30163,7 +30084,7 @@ const FIX_FORMULAS = {
|
|
|
30163
30084
|
if (!pivotId) return false;
|
|
30164
30085
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
30165
30086
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
30166
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
30087
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
30167
30088
|
},
|
|
30168
30089
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
30169
30090
|
};
|
|
@@ -30748,7 +30669,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
30748
30669
|
if (env.model.dispatch(cmd, {
|
|
30749
30670
|
sheetId,
|
|
30750
30671
|
quantity: base
|
|
30751
|
-
}).isCancelledBecause(
|
|
30672
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
30752
30673
|
}
|
|
30753
30674
|
|
|
30754
30675
|
//#endregion
|
|
@@ -31274,7 +31195,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
|
|
|
31274
31195
|
col,
|
|
31275
31196
|
row
|
|
31276
31197
|
};
|
|
31277
|
-
if (
|
|
31198
|
+
if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
|
|
31278
31199
|
}
|
|
31279
31200
|
return positions;
|
|
31280
31201
|
}
|
|
@@ -31840,6 +31761,9 @@ var FocusStore = class {
|
|
|
31840
31761
|
* This plugin handles this internal state.
|
|
31841
31762
|
*/
|
|
31842
31763
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
31764
|
+
initialRanges;
|
|
31765
|
+
inputHasSingleRange;
|
|
31766
|
+
colors;
|
|
31843
31767
|
mutators = [
|
|
31844
31768
|
"resetWithRanges",
|
|
31845
31769
|
"focusById",
|
|
@@ -32436,10 +32360,10 @@ var GenericChartConfigPanel = class extends Component {
|
|
|
32436
32360
|
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32437
32361
|
}
|
|
32438
32362
|
get isDatasetInvalid() {
|
|
32439
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32363
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32440
32364
|
}
|
|
32441
32365
|
get isLabelInvalid() {
|
|
32442
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32366
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32443
32367
|
}
|
|
32444
32368
|
get dataSetsHaveTitleLabel() {
|
|
32445
32369
|
return _t("Use row %s as headers", this.calculateHeaderPosition() || "");
|
|
@@ -33776,7 +33700,7 @@ var GaugeChartConfigPanel = class extends Component {
|
|
|
33776
33700
|
return [...this.state.dataRangeDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33777
33701
|
}
|
|
33778
33702
|
get isDataRangeInvalid() {
|
|
33779
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33703
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33780
33704
|
}
|
|
33781
33705
|
onDataRangeChanged(ranges) {
|
|
33782
33706
|
this.dataRange = ranges[0];
|
|
@@ -33862,16 +33786,16 @@ var GaugeChartDesignPanel = class extends Component {
|
|
|
33862
33786
|
return [...this.state.sectionRuleDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33863
33787
|
}
|
|
33864
33788
|
isRangeMinInvalid() {
|
|
33865
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33789
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
33866
33790
|
}
|
|
33867
33791
|
isRangeMaxInvalid() {
|
|
33868
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33792
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMax") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMaxNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
33869
33793
|
}
|
|
33870
33794
|
get isLowerInflectionPointInvalid() {
|
|
33871
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33795
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
33872
33796
|
}
|
|
33873
33797
|
get isUpperInflectionPointInvalid() {
|
|
33874
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33798
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeUpperInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
33875
33799
|
}
|
|
33876
33800
|
updateSectionColor(target, color) {
|
|
33877
33801
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33995,10 +33919,10 @@ var ScorecardChartConfigPanel = class extends Component {
|
|
|
33995
33919
|
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33996
33920
|
}
|
|
33997
33921
|
get isKeyValueInvalid() {
|
|
33998
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33922
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
33999
33923
|
}
|
|
34000
33924
|
get isBaselineInvalid() {
|
|
34001
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33925
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
34002
33926
|
}
|
|
34003
33927
|
onKeyValueRangeChanged(ranges) {
|
|
34004
33928
|
this.keyValue = ranges[0];
|
|
@@ -34887,6 +34811,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
34887
34811
|
//#endregion
|
|
34888
34812
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
34889
34813
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
34814
|
+
args;
|
|
34890
34815
|
constructor(get, args) {
|
|
34891
34816
|
super(get);
|
|
34892
34817
|
this.args = args;
|
|
@@ -35024,7 +34949,7 @@ var StandaloneComposer = class extends Component {
|
|
|
35024
34949
|
css`
|
|
35025
34950
|
.o-icon-picker {
|
|
35026
34951
|
position: absolute;
|
|
35027
|
-
z-index: ${
|
|
34952
|
+
z-index: ${25};
|
|
35028
34953
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
35029
34954
|
background-color: white;
|
|
35030
34955
|
padding: 2px 1px;
|
|
@@ -35276,6 +35201,7 @@ var DOMDndHelper = class {
|
|
|
35276
35201
|
}
|
|
35277
35202
|
};
|
|
35278
35203
|
var ContainerWrapper = class {
|
|
35204
|
+
el;
|
|
35279
35205
|
constructor(el) {
|
|
35280
35206
|
this.el = el;
|
|
35281
35207
|
}
|
|
@@ -35655,11 +35581,12 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
35655
35581
|
colorNumberString = colorNumberString;
|
|
35656
35582
|
state;
|
|
35657
35583
|
setup() {
|
|
35584
|
+
const cf = this.props.editedCf || {
|
|
35585
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
35586
|
+
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
35587
|
+
};
|
|
35658
35588
|
this.state = useState({
|
|
35659
|
-
currentCF:
|
|
35660
|
-
id: this.env.model.uuidGenerator.smallUuid(),
|
|
35661
|
-
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
35662
|
-
},
|
|
35589
|
+
currentCF: cf,
|
|
35663
35590
|
currentCFType: this.props.editedCf?.rule.type || "CellIsRule",
|
|
35664
35591
|
errors: [],
|
|
35665
35592
|
rules: this.getDefaultRules()
|
|
@@ -35681,7 +35608,7 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
35681
35608
|
useExternalListener(window, "click", this.closeMenus);
|
|
35682
35609
|
}
|
|
35683
35610
|
get isRangeValid() {
|
|
35684
|
-
return this.state.errors.includes(
|
|
35611
|
+
return this.state.errors.includes("EmptyRange");
|
|
35685
35612
|
}
|
|
35686
35613
|
get errorMessages() {
|
|
35687
35614
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35709,7 +35636,7 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
35709
35636
|
saveConditionalFormat() {
|
|
35710
35637
|
if (this.state.currentCF) {
|
|
35711
35638
|
if (this.state.currentCF.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35712
|
-
this.state.errors = [
|
|
35639
|
+
this.state.errors = ["InvalidRange"];
|
|
35713
35640
|
return;
|
|
35714
35641
|
}
|
|
35715
35642
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
@@ -35804,10 +35731,10 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
35804
35731
|
* Cell Is Rule
|
|
35805
35732
|
****************************************************************************/
|
|
35806
35733
|
get isValue1Invalid() {
|
|
35807
|
-
return this.state.errors.includes(
|
|
35734
|
+
return this.state.errors.includes("FirstArgMissing") || this.state.errors.includes("ValueCellIsInvalidFormula");
|
|
35808
35735
|
}
|
|
35809
35736
|
get isValue2Invalid() {
|
|
35810
|
-
return this.state.errors.includes(
|
|
35737
|
+
return this.state.errors.includes("SecondArgMissing");
|
|
35811
35738
|
}
|
|
35812
35739
|
toggleStyle(tool) {
|
|
35813
35740
|
const style = this.state.rules.cellIs.style;
|
|
@@ -35836,9 +35763,9 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
35836
35763
|
****************************************************************************/
|
|
35837
35764
|
isValueInvalid(threshold) {
|
|
35838
35765
|
switch (threshold) {
|
|
35839
|
-
case "minimum": return this.state.errors.includes(
|
|
35840
|
-
case "midpoint": return this.state.errors.includes(
|
|
35841
|
-
case "maximum": return this.state.errors.includes(
|
|
35766
|
+
case "minimum": return this.state.errors.includes("MinInvalidFormula") || this.state.errors.includes("MinBiggerThanMid") || this.state.errors.includes("MinBiggerThanMax") || this.state.errors.includes("MinNaN");
|
|
35767
|
+
case "midpoint": return this.state.errors.includes("MidInvalidFormula") || this.state.errors.includes("MidNaN") || this.state.errors.includes("MidBiggerThanMax");
|
|
35768
|
+
case "maximum": return this.state.errors.includes("MaxInvalidFormula") || this.state.errors.includes("MaxNaN");
|
|
35842
35769
|
default: return false;
|
|
35843
35770
|
}
|
|
35844
35771
|
}
|
|
@@ -35875,8 +35802,8 @@ var ConditionalFormattingEditor = class extends Component {
|
|
|
35875
35802
|
****************************************************************************/
|
|
35876
35803
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35877
35804
|
switch (inflectionPoint) {
|
|
35878
|
-
case "lowerInflectionPoint": return this.state.errors.includes(
|
|
35879
|
-
case "upperInflectionPoint": return this.state.errors.includes(
|
|
35805
|
+
case "lowerInflectionPoint": return this.state.errors.includes("ValueLowerInflectionNaN") || this.state.errors.includes("ValueLowerInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
35806
|
+
case "upperInflectionPoint": return this.state.errors.includes("ValueUpperInflectionNaN") || this.state.errors.includes("ValueUpperInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
35880
35807
|
default: return true;
|
|
35881
35808
|
}
|
|
35882
35809
|
}
|
|
@@ -36123,13 +36050,14 @@ var CustomCurrencyPanel = class extends Component {
|
|
|
36123
36050
|
if (currenciesRegistry.getAll().length === 0) (await this.env.loadCurrencies?.() || []).forEach((currency, index) => {
|
|
36124
36051
|
currenciesRegistry.add(index.toString(), currency);
|
|
36125
36052
|
});
|
|
36126
|
-
|
|
36053
|
+
const emptyCurrency = {
|
|
36127
36054
|
name: _t(CustomCurrencyTerms.Custom),
|
|
36128
36055
|
code: "",
|
|
36129
36056
|
symbol: "",
|
|
36130
36057
|
decimalPlaces: 2,
|
|
36131
36058
|
position: "after"
|
|
36132
|
-
}
|
|
36059
|
+
};
|
|
36060
|
+
this.availableCurrencies = [emptyCurrency, ...currenciesRegistry.getAll()];
|
|
36133
36061
|
}
|
|
36134
36062
|
updateSelectCurrency(ev) {
|
|
36135
36063
|
const target = ev.target;
|
|
@@ -37277,12 +37205,6 @@ var DataValidationPanel = class extends Component {
|
|
|
37277
37205
|
//#endregion
|
|
37278
37206
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
37279
37207
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
37280
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
37281
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
37282
|
-
Direction[Direction["current"] = 0] = "current";
|
|
37283
|
-
Direction[Direction["next"] = 1] = "next";
|
|
37284
|
-
return Direction;
|
|
37285
|
-
}(Direction || {});
|
|
37286
37208
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
37287
37209
|
mutators = [
|
|
37288
37210
|
"updateSearchOptions",
|
|
@@ -37343,10 +37265,10 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
37343
37265
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
37344
37266
|
}
|
|
37345
37267
|
selectPreviousMatch() {
|
|
37346
|
-
this.selectNextCell(
|
|
37268
|
+
this.selectNextCell(-1);
|
|
37347
37269
|
}
|
|
37348
37270
|
selectNextMatch() {
|
|
37349
|
-
this.selectNextCell(
|
|
37271
|
+
this.selectNextCell(1);
|
|
37350
37272
|
}
|
|
37351
37273
|
handle(cmd) {
|
|
37352
37274
|
switch (cmd.type) {
|
|
@@ -37413,7 +37335,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
37413
37335
|
refreshSearch(jumpToMatchSheet = true) {
|
|
37414
37336
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
37415
37337
|
this.findMatches();
|
|
37416
|
-
this.selectNextCell(
|
|
37338
|
+
this.selectNextCell(0, jumpToMatchSheet);
|
|
37417
37339
|
}
|
|
37418
37340
|
getSheetsInSearchOrder() {
|
|
37419
37341
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37783,6 +37705,8 @@ var MoreFormatsPanel = class extends Component {
|
|
|
37783
37705
|
//#endregion
|
|
37784
37706
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37785
37707
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37708
|
+
pivotId;
|
|
37709
|
+
initialMeasure;
|
|
37786
37710
|
mutators = [
|
|
37787
37711
|
"cancelMeasureDisplayEdition",
|
|
37788
37712
|
"updateMeasureDisplayType",
|
|
@@ -38687,7 +38611,7 @@ var PivotTitleSection = class extends Component {
|
|
|
38687
38611
|
});
|
|
38688
38612
|
let text;
|
|
38689
38613
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38690
|
-
else if (result.isCancelledBecause(
|
|
38614
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38691
38615
|
else text = _t("Pivot duplication failed.");
|
|
38692
38616
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38693
38617
|
this.env.notifyUser({
|
|
@@ -38751,13 +38675,30 @@ function createMeasure(fields, measure) {
|
|
|
38751
38675
|
} : fields[fieldName];
|
|
38752
38676
|
const aggregator = measure.aggregator;
|
|
38753
38677
|
return {
|
|
38678
|
+
/**
|
|
38679
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38680
|
+
*/
|
|
38754
38681
|
id: measure.id,
|
|
38682
|
+
/**
|
|
38683
|
+
* Display name of the measure
|
|
38684
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38685
|
+
*/
|
|
38755
38686
|
get displayName() {
|
|
38756
38687
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38757
38688
|
},
|
|
38758
38689
|
userDefinedName: measure.userDefinedName,
|
|
38690
|
+
/**
|
|
38691
|
+
* Get the name of the field of the measure
|
|
38692
|
+
*/
|
|
38759
38693
|
fieldName,
|
|
38694
|
+
/**
|
|
38695
|
+
* Get the aggregator of the measure
|
|
38696
|
+
*/
|
|
38760
38697
|
aggregator,
|
|
38698
|
+
/**
|
|
38699
|
+
* Get the type of the measure field
|
|
38700
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38701
|
+
*/
|
|
38761
38702
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38762
38703
|
isValid: !!(field || measure.computedBy),
|
|
38763
38704
|
isHidden: measure.isHidden,
|
|
@@ -38771,10 +38712,30 @@ function createPivotDimension(fields, dimension) {
|
|
|
38771
38712
|
const type = field?.type ?? "integer";
|
|
38772
38713
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38773
38714
|
return {
|
|
38715
|
+
/**
|
|
38716
|
+
* Get the display name of the dimension
|
|
38717
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38718
|
+
*/
|
|
38774
38719
|
displayName: field?.string ?? dimension.fieldName,
|
|
38720
|
+
/**
|
|
38721
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38722
|
+
* e.g. "stage_id", "create_date:month"
|
|
38723
|
+
*/
|
|
38775
38724
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38725
|
+
/**
|
|
38726
|
+
* Get the name of the field of the dimension
|
|
38727
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38728
|
+
*/
|
|
38776
38729
|
fieldName: dimension.fieldName,
|
|
38730
|
+
/**
|
|
38731
|
+
* Get the aggregate operator of the dimension
|
|
38732
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38733
|
+
*/
|
|
38777
38734
|
granularity,
|
|
38735
|
+
/**
|
|
38736
|
+
* Get the type of the field of the dimension
|
|
38737
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38738
|
+
*/
|
|
38778
38739
|
type,
|
|
38779
38740
|
order: dimension.order,
|
|
38780
38741
|
isValid: !!field
|
|
@@ -39396,14 +39357,6 @@ function resetMapValueDimensionDate() {
|
|
|
39396
39357
|
|
|
39397
39358
|
//#endregion
|
|
39398
39359
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39399
|
-
var ReloadType = /* @__PURE__ */ function(ReloadType) {
|
|
39400
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39401
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39402
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39403
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39404
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39405
|
-
return ReloadType;
|
|
39406
|
-
}(ReloadType || {});
|
|
39407
39360
|
/**
|
|
39408
39361
|
* This class represents a pivot table that is created from a range of cells.
|
|
39409
39362
|
* It will extract the fields from the first row of the range and the data from
|
|
@@ -39445,27 +39398,27 @@ var SpreadsheetPivot = class {
|
|
|
39445
39398
|
}
|
|
39446
39399
|
init(params = {}) {
|
|
39447
39400
|
if (!this._definition || params.reload) {
|
|
39448
|
-
this.reload(
|
|
39401
|
+
this.reload(4);
|
|
39449
39402
|
this.needsReevaluation = false;
|
|
39450
39403
|
}
|
|
39451
39404
|
}
|
|
39452
39405
|
reload(type) {
|
|
39453
|
-
if (type ===
|
|
39454
|
-
if (type >=
|
|
39455
|
-
if (type >=
|
|
39456
|
-
if (type >=
|
|
39406
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39407
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39408
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39409
|
+
if (type >= 1) this.table = void 0;
|
|
39457
39410
|
}
|
|
39458
39411
|
onDefinitionChange(nextDefinition) {
|
|
39459
39412
|
const actualDefinition = this.coreDefinition;
|
|
39460
39413
|
this.coreDefinition = nextDefinition;
|
|
39461
39414
|
if (this._definition) {
|
|
39462
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39415
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39463
39416
|
this.reload(reloadType);
|
|
39464
39417
|
}
|
|
39465
39418
|
}
|
|
39466
39419
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39467
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39468
|
-
return
|
|
39420
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39421
|
+
return 4;
|
|
39469
39422
|
}
|
|
39470
39423
|
get isInvalidRange() {
|
|
39471
39424
|
return !!this.invalidRangeError;
|
|
@@ -39538,7 +39491,7 @@ var SpreadsheetPivot = class {
|
|
|
39538
39491
|
if (dataEntries.length === 0) return { value: "" };
|
|
39539
39492
|
const measure = this.getMeasure(measureId);
|
|
39540
39493
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39541
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39494
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39542
39495
|
const aggregator = measure.aggregator;
|
|
39543
39496
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39544
39497
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39626,16 +39579,16 @@ var SpreadsheetPivot = class {
|
|
|
39626
39579
|
return this.definition.getDimension(nameWithGranularity);
|
|
39627
39580
|
}
|
|
39628
39581
|
getTypeFromZone(sheetId, zone) {
|
|
39629
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39582
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39630
39583
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39631
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39632
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39633
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39584
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39585
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39586
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39634
39587
|
return "char";
|
|
39635
39588
|
}
|
|
39636
39589
|
assertCellIsValidField(col, row, cell) {
|
|
39637
|
-
if (cell.type ===
|
|
39638
|
-
if (cell.type ===
|
|
39590
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39591
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39639
39592
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39640
39593
|
}
|
|
39641
39594
|
/**
|
|
@@ -39703,14 +39656,14 @@ var SpreadsheetPivot = class {
|
|
|
39703
39656
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39704
39657
|
if (cell.value === "") entry[field.name] = {
|
|
39705
39658
|
value: null,
|
|
39706
|
-
type:
|
|
39659
|
+
type: "empty",
|
|
39707
39660
|
formattedValue: ""
|
|
39708
39661
|
};
|
|
39709
39662
|
else entry[field.name] = cell;
|
|
39710
39663
|
}
|
|
39711
39664
|
entry["__count"] = {
|
|
39712
39665
|
value: 1,
|
|
39713
|
-
type:
|
|
39666
|
+
type: "number",
|
|
39714
39667
|
formattedValue: "1"
|
|
39715
39668
|
};
|
|
39716
39669
|
dataEntries.push(entry);
|
|
@@ -39723,7 +39676,7 @@ var SpreadsheetPivot = class {
|
|
|
39723
39676
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39724
39677
|
entry[dimension.nameWithGranularity] = {
|
|
39725
39678
|
value,
|
|
39726
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39679
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39727
39680
|
format: entry[dimension.fieldName]?.format,
|
|
39728
39681
|
formattedValue: formatValue(valueToFormat, {
|
|
39729
39682
|
locale,
|
|
@@ -39791,6 +39744,7 @@ function adaptPivotRange(range, applyChange) {
|
|
|
39791
39744
|
//#endregion
|
|
39792
39745
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39793
39746
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39747
|
+
pivotId;
|
|
39794
39748
|
mutators = [
|
|
39795
39749
|
"reset",
|
|
39796
39750
|
"deferUpdates",
|
|
@@ -39925,7 +39879,8 @@ var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
|
39925
39879
|
}))
|
|
39926
39880
|
};
|
|
39927
39881
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39928
|
-
|
|
39882
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39883
|
+
this.draft = cleanedWithGranularity;
|
|
39929
39884
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39930
39885
|
}
|
|
39931
39886
|
/**
|
|
@@ -40242,7 +40197,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
40242
40197
|
separator,
|
|
40243
40198
|
addNewColumns
|
|
40244
40199
|
});
|
|
40245
|
-
if (result.isCancelledBecause(
|
|
40200
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
40246
40201
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
40247
40202
|
separator,
|
|
40248
40203
|
addNewColumns,
|
|
@@ -40323,8 +40278,8 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
40323
40278
|
}).reasons;
|
|
40324
40279
|
const errors = /* @__PURE__ */ new Set();
|
|
40325
40280
|
for (const reason of cancelledReasons) switch (reason) {
|
|
40326
|
-
case
|
|
40327
|
-
case
|
|
40281
|
+
case "SplitWillOverwriteContent":
|
|
40282
|
+
case "EmptySplitSeparator": break;
|
|
40328
40283
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
40329
40284
|
}
|
|
40330
40285
|
return Array.from(errors);
|
|
@@ -40335,7 +40290,7 @@ var SplitIntoColumnsPanel = class extends Component {
|
|
|
40335
40290
|
separator: this.separatorValue,
|
|
40336
40291
|
addNewColumns: this.state.addNewColumns,
|
|
40337
40292
|
force: false
|
|
40338
|
-
}).reasons.includes(
|
|
40293
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
40339
40294
|
return warnings;
|
|
40340
40295
|
}
|
|
40341
40296
|
get separatorValue() {
|
|
@@ -41327,7 +41282,7 @@ css`
|
|
|
41327
41282
|
box-sizing: content-box;
|
|
41328
41283
|
|
|
41329
41284
|
.o-fig-anchor {
|
|
41330
|
-
z-index: ${
|
|
41285
|
+
z-index: ${1e3};
|
|
41331
41286
|
position: absolute;
|
|
41332
41287
|
width: ${ANCHOR_SIZE}px;
|
|
41333
41288
|
height: ${ANCHOR_SIZE}px;
|
|
@@ -41429,7 +41384,7 @@ var FigureComponent = class extends Component {
|
|
|
41429
41384
|
top: `${y}px`,
|
|
41430
41385
|
width: `${width}px`,
|
|
41431
41386
|
height: `${height}px`,
|
|
41432
|
-
"z-index": String(
|
|
41387
|
+
"z-index": String(10 + (this.isSelected ? 1 : 0))
|
|
41433
41388
|
});
|
|
41434
41389
|
}
|
|
41435
41390
|
getResizerPosition(resizer) {
|
|
@@ -41554,7 +41509,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
41554
41509
|
end: group.end
|
|
41555
41510
|
});
|
|
41556
41511
|
if (!result.isSuccessful) {
|
|
41557
|
-
if (result.isCancelledBecause(
|
|
41512
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
41558
41513
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
41559
41514
|
env.raiseError(errorMessage);
|
|
41560
41515
|
}
|
|
@@ -41964,11 +41919,11 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
41964
41919
|
if (this.model.getters.getArrayFormulaSpreadingOn(position)) return "";
|
|
41965
41920
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
41966
41921
|
switch (type) {
|
|
41967
|
-
case
|
|
41968
|
-
case
|
|
41969
|
-
case
|
|
41970
|
-
case
|
|
41971
|
-
case
|
|
41922
|
+
case "empty": return "";
|
|
41923
|
+
case "text":
|
|
41924
|
+
case "error": return value;
|
|
41925
|
+
case "boolean": return formattedValue;
|
|
41926
|
+
case "number":
|
|
41972
41927
|
if (format && isDateTimeFormat(format)) {
|
|
41973
41928
|
if (parseDateTime(formattedValue, locale) !== null) return formattedValue;
|
|
41974
41929
|
return formatValue(value, {
|
|
@@ -42032,7 +41987,7 @@ const COMPOSER_BORDER_WIDTH = 3 * .4 * window.devicePixelRatio || 1;
|
|
|
42032
41987
|
const GRID_CELL_REFERENCE_TOP_OFFSET = 28;
|
|
42033
41988
|
css`
|
|
42034
41989
|
div.o-grid-composer {
|
|
42035
|
-
z-index: ${
|
|
41990
|
+
z-index: ${20};
|
|
42036
41991
|
box-sizing: border-box;
|
|
42037
41992
|
position: absolute;
|
|
42038
41993
|
border: ${COMPOSER_BORDER_WIDTH}px solid ${SELECTION_BORDER_COLOR};
|
|
@@ -42044,7 +41999,7 @@ css`
|
|
|
42044
41999
|
|
|
42045
42000
|
div.o-cell-reference {
|
|
42046
42001
|
position: absolute;
|
|
42047
|
-
z-index: ${
|
|
42002
|
+
z-index: ${20};
|
|
42048
42003
|
background: ${SELECTION_BORDER_COLOR};
|
|
42049
42004
|
color: white;
|
|
42050
42005
|
font-size: 12px;
|
|
@@ -42659,7 +42614,7 @@ function getAxis(fig, axisType) {
|
|
|
42659
42614
|
css`
|
|
42660
42615
|
.o-figure-snap-line {
|
|
42661
42616
|
position: relative;
|
|
42662
|
-
z-index: ${
|
|
42617
|
+
z-index: ${1001};
|
|
42663
42618
|
&.vertical {
|
|
42664
42619
|
width: 0px;
|
|
42665
42620
|
border-left: 1px dashed black;
|
|
@@ -43420,7 +43375,7 @@ var GridPopover = class extends Component {
|
|
|
43420
43375
|
};
|
|
43421
43376
|
static components = { Popover };
|
|
43422
43377
|
cellPopovers;
|
|
43423
|
-
zIndex =
|
|
43378
|
+
zIndex = 19;
|
|
43424
43379
|
setup() {
|
|
43425
43380
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
43426
43381
|
}
|
|
@@ -43665,7 +43620,7 @@ css`
|
|
|
43665
43620
|
color: ${ICONS_COLOR};
|
|
43666
43621
|
}
|
|
43667
43622
|
.o-unhide:hover {
|
|
43668
|
-
z-index: ${
|
|
43623
|
+
z-index: ${0 + 1};
|
|
43669
43624
|
background-color: lightgrey;
|
|
43670
43625
|
}
|
|
43671
43626
|
}
|
|
@@ -43737,7 +43692,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
43737
43692
|
elements,
|
|
43738
43693
|
position: this.state.position
|
|
43739
43694
|
});
|
|
43740
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
43695
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
43741
43696
|
}
|
|
43742
43697
|
_selectElement(index, addDistinctHeader) {
|
|
43743
43698
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -43821,7 +43776,7 @@ css`
|
|
|
43821
43776
|
color: ${ICONS_COLOR};
|
|
43822
43777
|
}
|
|
43823
43778
|
.o-unhide:hover {
|
|
43824
|
-
z-index: ${
|
|
43779
|
+
z-index: ${0 + 1};
|
|
43825
43780
|
background-color: lightgrey;
|
|
43826
43781
|
}
|
|
43827
43782
|
}
|
|
@@ -43894,8 +43849,8 @@ var RowResizer = class extends AbstractResizer {
|
|
|
43894
43849
|
position: this.state.position
|
|
43895
43850
|
});
|
|
43896
43851
|
if (!result.isSuccessful) {
|
|
43897
|
-
if (result.reasons.includes(
|
|
43898
|
-
else if (result.reasons.includes(
|
|
43852
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
43853
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
43899
43854
|
}
|
|
43900
43855
|
}
|
|
43901
43856
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -44353,7 +44308,7 @@ var GridRenderer = class {
|
|
|
44353
44308
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
44354
44309
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44355
44310
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
44356
|
-
if (nextCell.type !==
|
|
44311
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || cellHasIcon || cellHasCheckbox) return col;
|
|
44357
44312
|
col++;
|
|
44358
44313
|
}
|
|
44359
44314
|
return col;
|
|
@@ -44371,7 +44326,7 @@ var GridRenderer = class {
|
|
|
44371
44326
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
44372
44327
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44373
44328
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
44374
|
-
if (previousCell.type !==
|
|
44329
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || cellHasIcon || cellHasCheckbox) return col;
|
|
44375
44330
|
col--;
|
|
44376
44331
|
}
|
|
44377
44332
|
return col;
|
|
@@ -44380,7 +44335,7 @@ var GridRenderer = class {
|
|
|
44380
44335
|
if (this.getters.getCell(position)?.isFormula && this.getters.shouldShowFormulas()) return "left";
|
|
44381
44336
|
const { align } = this.getters.getCellStyle(position);
|
|
44382
44337
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
44383
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
44338
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
44384
44339
|
return align || evaluatedCell.defaultAlign;
|
|
44385
44340
|
}
|
|
44386
44341
|
createZoneBox(sheetId, zone, viewport) {
|
|
@@ -44405,7 +44360,7 @@ var GridRenderer = class {
|
|
|
44405
44360
|
style: this.getters.getCellComputedStyle(position),
|
|
44406
44361
|
dataBarFill: this.getters.getConditionalDataBar(position),
|
|
44407
44362
|
verticalAlign,
|
|
44408
|
-
isError: cell.type ===
|
|
44363
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position)
|
|
44409
44364
|
};
|
|
44410
44365
|
/** Icon */
|
|
44411
44366
|
const iconSrc = this.getters.getCellIconSrc(position);
|
|
@@ -44425,7 +44380,7 @@ var GridRenderer = class {
|
|
|
44425
44380
|
image: imageHtmlElement
|
|
44426
44381
|
};
|
|
44427
44382
|
}
|
|
44428
|
-
if (cell.type ===
|
|
44383
|
+
if (cell.type === "empty" || this.getters.isCellValidCheckbox(position)) return box;
|
|
44429
44384
|
/** Filter Header or data validation icon */
|
|
44430
44385
|
box.hasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44431
44386
|
const headerIconWidth = box.hasIcon ? 17 + 2 : 0;
|
|
@@ -44813,7 +44768,7 @@ var Corner = class extends Component {
|
|
|
44813
44768
|
//#region src/components/highlight/highlight/highlight.ts
|
|
44814
44769
|
css`
|
|
44815
44770
|
.o-highlight {
|
|
44816
|
-
z-index: ${
|
|
44771
|
+
z-index: ${5};
|
|
44817
44772
|
}
|
|
44818
44773
|
`;
|
|
44819
44774
|
var Highlight = class extends Component {
|
|
@@ -44934,7 +44889,7 @@ css`
|
|
|
44934
44889
|
.o-scrollbar {
|
|
44935
44890
|
position: absolute;
|
|
44936
44891
|
overflow: auto;
|
|
44937
|
-
z-index: ${
|
|
44892
|
+
z-index: ${15};
|
|
44938
44893
|
background-color: ${BACKGROUND_GRAY_COLOR};
|
|
44939
44894
|
|
|
44940
44895
|
&.corner {
|
|
@@ -45330,12 +45285,12 @@ var Grid = class extends Component {
|
|
|
45330
45285
|
}
|
|
45331
45286
|
keyDownMapping = {
|
|
45332
45287
|
Enter: () => {
|
|
45333
|
-
this.env.model.getters.getActiveCell().type ===
|
|
45288
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
45334
45289
|
},
|
|
45335
45290
|
Tab: () => this.env.model.selection.moveAnchorCell("right", 1),
|
|
45336
45291
|
"Shift+Tab": () => this.env.model.selection.moveAnchorCell("left", 1),
|
|
45337
45292
|
F2: () => {
|
|
45338
|
-
this.env.model.getters.getActiveCell().type ===
|
|
45293
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
45339
45294
|
},
|
|
45340
45295
|
Delete: () => {
|
|
45341
45296
|
this.env.model.dispatch("DELETE_CONTENT", {
|
|
@@ -45566,7 +45521,7 @@ var Grid = class extends Component {
|
|
|
45566
45521
|
sheetId,
|
|
45567
45522
|
col,
|
|
45568
45523
|
row
|
|
45569
|
-
}).type ===
|
|
45524
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
45570
45525
|
else this.onComposerContentFocused();
|
|
45571
45526
|
}
|
|
45572
45527
|
processArrows(ev) {
|
|
@@ -45638,8 +45593,8 @@ var Grid = class extends Component {
|
|
|
45638
45593
|
const clipboardData = ev.clipboardData;
|
|
45639
45594
|
if (!clipboardData) return;
|
|
45640
45595
|
const osClipboard = { content: {
|
|
45641
|
-
[
|
|
45642
|
-
[
|
|
45596
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
45597
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
45643
45598
|
} };
|
|
45644
45599
|
const target = this.env.model.getters.getSelectedZones();
|
|
45645
45600
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
@@ -45647,7 +45602,7 @@ var Grid = class extends Component {
|
|
|
45647
45602
|
const clipboardId = clipboardContent.data?.clipboardId;
|
|
45648
45603
|
if (this.env.model.getters.getClipboardId() === clipboardId) interactivePaste(this.env, target);
|
|
45649
45604
|
else interactivePasteFromOS(this.env, target, clipboardContent);
|
|
45650
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
45605
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
45651
45606
|
}
|
|
45652
45607
|
clearFormatting() {
|
|
45653
45608
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -46114,7 +46069,7 @@ var BasePlugin = class {
|
|
|
46114
46069
|
* There should not be any side effects in this method.
|
|
46115
46070
|
*/
|
|
46116
46071
|
allowDispatch(command) {
|
|
46117
|
-
return
|
|
46072
|
+
return "Success";
|
|
46118
46073
|
}
|
|
46119
46074
|
/**
|
|
46120
46075
|
* This method is useful when a plugin need to perform some action before a
|
|
@@ -46150,10 +46105,10 @@ var BasePlugin = class {
|
|
|
46150
46105
|
for (const validation of validations) {
|
|
46151
46106
|
let results = validation.call(this, toValidate);
|
|
46152
46107
|
if (!Array.isArray(results)) results = [results];
|
|
46153
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
46108
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
46154
46109
|
if (cancelledReasons.length) return cancelledReasons;
|
|
46155
46110
|
}
|
|
46156
|
-
return
|
|
46111
|
+
return "Success";
|
|
46157
46112
|
};
|
|
46158
46113
|
}
|
|
46159
46114
|
checkValidations(command, ...validations) {
|
|
@@ -46212,7 +46167,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
46212
46167
|
allowDispatch(cmd) {
|
|
46213
46168
|
switch (cmd.type) {
|
|
46214
46169
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
46215
|
-
default: return
|
|
46170
|
+
default: return "Success";
|
|
46216
46171
|
}
|
|
46217
46172
|
}
|
|
46218
46173
|
handle(cmd) {
|
|
@@ -46584,8 +46539,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
46584
46539
|
checkBordersUnchanged(cmd) {
|
|
46585
46540
|
const currentBorder = this.getCellBorder(cmd);
|
|
46586
46541
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
46587
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
46588
|
-
return
|
|
46542
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
46543
|
+
return "Success";
|
|
46589
46544
|
}
|
|
46590
46545
|
import(data) {
|
|
46591
46546
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const zoneXc in sheet.borders) {
|
|
@@ -46714,8 +46669,8 @@ var CellPlugin = class extends CorePlugin {
|
|
|
46714
46669
|
switch (cmd.type) {
|
|
46715
46670
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
46716
46671
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
46717
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
46718
|
-
default: return
|
|
46672
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
46673
|
+
default: return "Success";
|
|
46719
46674
|
}
|
|
46720
46675
|
}
|
|
46721
46676
|
handle(cmd) {
|
|
@@ -47138,25 +47093,30 @@ var CellPlugin = class extends CorePlugin {
|
|
|
47138
47093
|
}
|
|
47139
47094
|
checkCellOutOfSheet(cmd) {
|
|
47140
47095
|
const { sheetId, col, row } = cmd;
|
|
47141
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
47142
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
47096
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
47097
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
47143
47098
|
}
|
|
47144
47099
|
checkUselessClearCell(cmd) {
|
|
47145
47100
|
const cell = this.getters.getCell(cmd);
|
|
47146
|
-
if (!cell) return
|
|
47147
|
-
if (!cell.content && !cell.style && !cell.format) return
|
|
47148
|
-
return
|
|
47101
|
+
if (!cell) return "NoChanges";
|
|
47102
|
+
if (!cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
47103
|
+
return "Success";
|
|
47149
47104
|
}
|
|
47150
47105
|
checkUselessUpdateCell(cmd) {
|
|
47151
47106
|
const cell = this.getters.getCell(cmd);
|
|
47152
47107
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
47153
47108
|
const hasStyle = "style" in cmd;
|
|
47154
47109
|
const hasFormat = "format" in cmd;
|
|
47155
|
-
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
47156
|
-
return
|
|
47110
|
+
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
|
|
47111
|
+
return "Success";
|
|
47157
47112
|
}
|
|
47158
47113
|
};
|
|
47159
47114
|
var FormulaCellWithDependencies = class {
|
|
47115
|
+
id;
|
|
47116
|
+
format;
|
|
47117
|
+
style;
|
|
47118
|
+
sheetId;
|
|
47119
|
+
getRangeString;
|
|
47160
47120
|
isFormula = true;
|
|
47161
47121
|
compiledFormula;
|
|
47162
47122
|
constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
|
|
@@ -47191,6 +47151,10 @@ var FormulaCellWithDependencies = class {
|
|
|
47191
47151
|
}
|
|
47192
47152
|
};
|
|
47193
47153
|
var RangeReferenceToken = class {
|
|
47154
|
+
ranges;
|
|
47155
|
+
rangeIndex;
|
|
47156
|
+
sheetId;
|
|
47157
|
+
getRangeString;
|
|
47194
47158
|
type = "REFERENCE";
|
|
47195
47159
|
constructor(ranges, rangeIndex, sheetId, getRangeString) {
|
|
47196
47160
|
this.ranges = ranges;
|
|
@@ -47225,7 +47189,7 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
47225
47189
|
switch (cmd.type) {
|
|
47226
47190
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
47227
47191
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
47228
|
-
default: return
|
|
47192
|
+
default: return "Success";
|
|
47229
47193
|
}
|
|
47230
47194
|
}
|
|
47231
47195
|
handle(cmd) {
|
|
@@ -47344,10 +47308,10 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
47344
47308
|
if (sheetId) this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
47345
47309
|
}
|
|
47346
47310
|
checkChartDuplicate(cmd) {
|
|
47347
|
-
return this.getters.getFigureSheetId(cmd.id) ?
|
|
47311
|
+
return this.getters.getFigureSheetId(cmd.id) ? "DuplicatedChartId" : "Success";
|
|
47348
47312
|
}
|
|
47349
47313
|
checkChartExists(cmd) {
|
|
47350
|
-
return this.isChartDefined(cmd.id) ?
|
|
47314
|
+
return this.isChartDefined(cmd.id) ? "Success" : "ChartDoesNotExist";
|
|
47351
47315
|
}
|
|
47352
47316
|
};
|
|
47353
47317
|
|
|
@@ -47406,7 +47370,7 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47406
47370
|
case "ADD_CONDITIONAL_FORMAT": return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange);
|
|
47407
47371
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
47408
47372
|
}
|
|
47409
|
-
return
|
|
47373
|
+
return "Success";
|
|
47410
47374
|
}
|
|
47411
47375
|
handle(cmd) {
|
|
47412
47376
|
switch (cmd.type) {
|
|
@@ -47539,21 +47503,21 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47539
47503
|
this.history.update("cfRules", sheet, currentCF);
|
|
47540
47504
|
}
|
|
47541
47505
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
47542
|
-
if (!this.cfRules[sheetId]) return
|
|
47506
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
47543
47507
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
47544
|
-
if (ruleIndex === -1) return
|
|
47508
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
47545
47509
|
const cfIndex2 = ruleIndex - delta;
|
|
47546
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
47547
|
-
return
|
|
47510
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
47511
|
+
return "Success";
|
|
47548
47512
|
}
|
|
47549
47513
|
checkEmptyRange(cmd) {
|
|
47550
|
-
return cmd.ranges.length ?
|
|
47514
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
47551
47515
|
}
|
|
47552
47516
|
checkCFRule(cmd) {
|
|
47553
47517
|
const rule = cmd.cf.rule;
|
|
47554
47518
|
switch (rule.type) {
|
|
47555
47519
|
case "CellIsRule":
|
|
47556
|
-
if (!CellIsOperators[rule.operator]) return
|
|
47520
|
+
if (!CellIsOperators[rule.operator]) return "InvalidConditionalFormatType";
|
|
47557
47521
|
return this.checkValidations(rule, this.checkOperatorArgsNumber(2, ["Between", "NotBetween"]), this.checkOperatorArgsNumber(1, [
|
|
47558
47522
|
"BeginsWith",
|
|
47559
47523
|
"ContainsText",
|
|
@@ -47568,9 +47532,9 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47568
47532
|
]), this.checkOperatorArgsNumber(0, ["IsEmpty", "IsNotEmpty"]), this.checkCFValues);
|
|
47569
47533
|
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)));
|
|
47570
47534
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
47571
|
-
case "DataBarRule": return
|
|
47535
|
+
case "DataBarRule": return "Success";
|
|
47572
47536
|
}
|
|
47573
|
-
return
|
|
47537
|
+
return "InvalidConditionalFormatType";
|
|
47574
47538
|
}
|
|
47575
47539
|
checkOperatorArgsNumber(expectedNumber, operators) {
|
|
47576
47540
|
if (expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
@@ -47578,11 +47542,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47578
47542
|
if (operators.includes(rule.operator)) {
|
|
47579
47543
|
const errors = [];
|
|
47580
47544
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
47581
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
47582
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
47583
|
-
return errors.length ? errors :
|
|
47545
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
47546
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
47547
|
+
return errors.length ? errors : "Success";
|
|
47584
47548
|
}
|
|
47585
|
-
return
|
|
47549
|
+
return "Success";
|
|
47586
47550
|
};
|
|
47587
47551
|
}
|
|
47588
47552
|
checkNaN(threshold, thresholdName) {
|
|
@@ -47591,27 +47555,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47591
47555
|
"percentage",
|
|
47592
47556
|
"percentile"
|
|
47593
47557
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
47594
|
-
case "min": return
|
|
47595
|
-
case "max": return
|
|
47596
|
-
case "mid": return
|
|
47597
|
-
case "upperInflectionPoint": return
|
|
47598
|
-
case "lowerInflectionPoint": return
|
|
47558
|
+
case "min": return "MinNaN";
|
|
47559
|
+
case "max": return "MaxNaN";
|
|
47560
|
+
case "mid": return "MidNaN";
|
|
47561
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
47562
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
47599
47563
|
}
|
|
47600
|
-
return
|
|
47564
|
+
return "Success";
|
|
47601
47565
|
}
|
|
47602
47566
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
47603
|
-
if (threshold.type !== "formula") return
|
|
47567
|
+
if (threshold.type !== "formula") return "Success";
|
|
47604
47568
|
if (compile(threshold.value || "").isBadExpression) switch (thresholdName) {
|
|
47605
|
-
case "min": return
|
|
47606
|
-
case "max": return
|
|
47607
|
-
case "mid": return
|
|
47608
|
-
case "upperInflectionPoint": return
|
|
47609
|
-
case "lowerInflectionPoint": return
|
|
47569
|
+
case "min": return "MinInvalidFormula";
|
|
47570
|
+
case "max": return "MaxInvalidFormula";
|
|
47571
|
+
case "mid": return "MidInvalidFormula";
|
|
47572
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
47573
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
47610
47574
|
}
|
|
47611
|
-
return
|
|
47575
|
+
return "Success";
|
|
47612
47576
|
}
|
|
47613
47577
|
checkThresholds(check) {
|
|
47614
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
47578
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
47615
47579
|
}
|
|
47616
47580
|
checkInflectionPoints(check) {
|
|
47617
47581
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -47623,8 +47587,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47623
47587
|
"number",
|
|
47624
47588
|
"percentage",
|
|
47625
47589
|
"percentile"
|
|
47626
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
47627
|
-
return
|
|
47590
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
47591
|
+
return "Success";
|
|
47628
47592
|
}
|
|
47629
47593
|
checkMinBiggerThanMax(rule) {
|
|
47630
47594
|
const minValue = rule.minimum.value;
|
|
@@ -47633,8 +47597,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47633
47597
|
"number",
|
|
47634
47598
|
"percentage",
|
|
47635
47599
|
"percentile"
|
|
47636
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
47637
|
-
return
|
|
47600
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
47601
|
+
return "Success";
|
|
47638
47602
|
}
|
|
47639
47603
|
checkMidBiggerThanMax(rule) {
|
|
47640
47604
|
const midValue = rule.midpoint?.value;
|
|
@@ -47643,8 +47607,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47643
47607
|
"number",
|
|
47644
47608
|
"percentage",
|
|
47645
47609
|
"percentile"
|
|
47646
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
47647
|
-
return
|
|
47610
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
47611
|
+
return "Success";
|
|
47648
47612
|
}
|
|
47649
47613
|
checkMinBiggerThanMid(rule) {
|
|
47650
47614
|
const minValue = rule.minimum.value;
|
|
@@ -47653,15 +47617,15 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47653
47617
|
"number",
|
|
47654
47618
|
"percentage",
|
|
47655
47619
|
"percentile"
|
|
47656
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
47657
|
-
return
|
|
47620
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
47621
|
+
return "Success";
|
|
47658
47622
|
}
|
|
47659
47623
|
checkCFValues(rule) {
|
|
47660
47624
|
for (const value of rule.values) {
|
|
47661
47625
|
if (!value.startsWith("=")) continue;
|
|
47662
|
-
if (compile(value || "").isBadExpression) return
|
|
47626
|
+
if (compile(value || "").isBadExpression) return "ValueCellIsInvalidFormula";
|
|
47663
47627
|
}
|
|
47664
|
-
return
|
|
47628
|
+
return "Success";
|
|
47665
47629
|
}
|
|
47666
47630
|
removeConditionalFormatting(id, sheet) {
|
|
47667
47631
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -47724,14 +47688,14 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47724
47688
|
allowDispatch(cmd) {
|
|
47725
47689
|
switch (cmd.type) {
|
|
47726
47690
|
case "ADD_DATA_VALIDATION_RULE":
|
|
47727
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
47691
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
47728
47692
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
47729
47693
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
47730
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
47731
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
47694
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
47695
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
47732
47696
|
break;
|
|
47733
47697
|
}
|
|
47734
|
-
return
|
|
47698
|
+
return "Success";
|
|
47735
47699
|
}
|
|
47736
47700
|
handle(cmd) {
|
|
47737
47701
|
switch (cmd.type) {
|
|
@@ -47840,7 +47804,7 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47840
47804
|
}
|
|
47841
47805
|
}
|
|
47842
47806
|
checkEmptyRange(cmd) {
|
|
47843
|
-
return cmd.ranges.length ?
|
|
47807
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
47844
47808
|
}
|
|
47845
47809
|
import(data) {
|
|
47846
47810
|
for (const sheet of data.sheets) {
|
|
@@ -47883,13 +47847,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47883
47847
|
}
|
|
47884
47848
|
}
|
|
47885
47849
|
checkCriterionTypeIsValid(cmd) {
|
|
47886
|
-
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
47850
|
+
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
47887
47851
|
}
|
|
47888
47852
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
47889
47853
|
const criterion = cmd.rule.criterion;
|
|
47890
47854
|
const expectedNumberOfValues = dataValidationEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
47891
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
47892
|
-
return
|
|
47855
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
47856
|
+
return "Success";
|
|
47893
47857
|
}
|
|
47894
47858
|
checkCriterionValuesAreValid(cmd) {
|
|
47895
47859
|
const criterion = cmd.rule.criterion;
|
|
@@ -47898,8 +47862,8 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47898
47862
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals";
|
|
47899
47863
|
else if (evaluator.allowedValues === "onlyFormulas") return true;
|
|
47900
47864
|
else return !evaluator.isCriterionValueValid(value);
|
|
47901
|
-
})) return
|
|
47902
|
-
return
|
|
47865
|
+
})) return "InvalidDataValidationCriterionValue";
|
|
47866
|
+
return "Success";
|
|
47903
47867
|
}
|
|
47904
47868
|
};
|
|
47905
47869
|
|
|
@@ -47918,7 +47882,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
47918
47882
|
case "CREATE_FIGURE": return this.checkFigureDuplicate(cmd.figure.id);
|
|
47919
47883
|
case "UPDATE_FIGURE":
|
|
47920
47884
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
47921
|
-
default: return
|
|
47885
|
+
default: return "Success";
|
|
47922
47886
|
}
|
|
47923
47887
|
}
|
|
47924
47888
|
beforeHandle(cmd) {
|
|
@@ -48012,12 +47976,12 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
48012
47976
|
this.history.update("figures", sheetId, id, void 0);
|
|
48013
47977
|
}
|
|
48014
47978
|
checkFigureExists(sheetId, figureId) {
|
|
48015
|
-
if (this.figures[sheetId]?.[figureId] === void 0) return
|
|
48016
|
-
return
|
|
47979
|
+
if (this.figures[sheetId]?.[figureId] === void 0) return "FigureDoesNotExist";
|
|
47980
|
+
return "Success";
|
|
48017
47981
|
}
|
|
48018
47982
|
checkFigureDuplicate(figureId) {
|
|
48019
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return
|
|
48020
|
-
return
|
|
47983
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return "DuplicatedFigureId";
|
|
47984
|
+
return "Success";
|
|
48021
47985
|
}
|
|
48022
47986
|
getFigures(sheetId) {
|
|
48023
47987
|
const figures = [];
|
|
@@ -48151,19 +48115,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
48151
48115
|
allowDispatch(cmd) {
|
|
48152
48116
|
switch (cmd.type) {
|
|
48153
48117
|
case "HIDE_COLUMNS_ROWS": {
|
|
48154
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
48118
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
48155
48119
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
48156
48120
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
48157
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
48158
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
48159
|
-
else return
|
|
48121
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
48122
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
48123
|
+
else return "Success";
|
|
48160
48124
|
}
|
|
48161
48125
|
case "REMOVE_COLUMNS_ROWS":
|
|
48162
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
48163
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
48164
|
-
return
|
|
48126
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
48127
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
48128
|
+
return "Success";
|
|
48165
48129
|
}
|
|
48166
|
-
return
|
|
48130
|
+
return "Success";
|
|
48167
48131
|
}
|
|
48168
48132
|
handle(cmd) {
|
|
48169
48133
|
switch (cmd.type) {
|
|
@@ -48291,9 +48255,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
48291
48255
|
allowDispatch(cmd) {
|
|
48292
48256
|
switch (cmd.type) {
|
|
48293
48257
|
case "CREATE_IMAGE":
|
|
48294
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
48295
|
-
return
|
|
48296
|
-
default: return
|
|
48258
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
48259
|
+
return "Success";
|
|
48260
|
+
default: return "Success";
|
|
48297
48261
|
}
|
|
48298
48262
|
}
|
|
48299
48263
|
handle(cmd) {
|
|
@@ -48434,7 +48398,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48434
48398
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
48435
48399
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
48436
48400
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
48437
|
-
default: return
|
|
48401
|
+
default: return "Success";
|
|
48438
48402
|
}
|
|
48439
48403
|
}
|
|
48440
48404
|
handle(cmd) {
|
|
@@ -48614,18 +48578,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48614
48578
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
48615
48579
|
}
|
|
48616
48580
|
checkDestructiveMerge({ sheetId, target }) {
|
|
48617
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
48618
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
48581
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
48582
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
48619
48583
|
}
|
|
48620
48584
|
checkOverlap({ target }) {
|
|
48621
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
48622
|
-
return
|
|
48585
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
48586
|
+
return "Success";
|
|
48623
48587
|
}
|
|
48624
48588
|
checkFrozenPanes({ sheetId, target }) {
|
|
48625
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
48589
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
48626
48590
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
48627
|
-
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
48628
|
-
return
|
|
48591
|
+
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
48592
|
+
return "Success";
|
|
48629
48593
|
}
|
|
48630
48594
|
/**
|
|
48631
48595
|
* The content of a merged cell should always be empty.
|
|
@@ -48633,10 +48597,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48633
48597
|
*/
|
|
48634
48598
|
checkMergedContentUpdate(cmd) {
|
|
48635
48599
|
const { col, row, content } = cmd;
|
|
48636
|
-
if (content === void 0) return
|
|
48600
|
+
if (content === void 0) return "Success";
|
|
48637
48601
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
48638
|
-
if (mainCol === col && mainRow === row) return
|
|
48639
|
-
return
|
|
48602
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
48603
|
+
return "CellIsMerged";
|
|
48640
48604
|
}
|
|
48641
48605
|
checkMergeExists(cmd) {
|
|
48642
48606
|
const { sheetId, target } = cmd;
|
|
@@ -48647,9 +48611,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48647
48611
|
col: left,
|
|
48648
48612
|
row: top
|
|
48649
48613
|
});
|
|
48650
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
48614
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
48651
48615
|
}
|
|
48652
|
-
return
|
|
48616
|
+
return "Success";
|
|
48653
48617
|
}
|
|
48654
48618
|
/**
|
|
48655
48619
|
* Merge the current selection. Note that:
|
|
@@ -48797,8 +48761,8 @@ var RangeAdapter = class {
|
|
|
48797
48761
|
"removeRangesSheetPrefix"
|
|
48798
48762
|
];
|
|
48799
48763
|
allowDispatch(cmd) {
|
|
48800
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
48801
|
-
return
|
|
48764
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
48765
|
+
return "Success";
|
|
48802
48766
|
}
|
|
48803
48767
|
beforeHandle(command) {}
|
|
48804
48768
|
handle(cmd) {
|
|
@@ -49207,40 +49171,40 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49207
49171
|
cellPosition = {};
|
|
49208
49172
|
allowDispatch(cmd) {
|
|
49209
49173
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
49210
|
-
if (genericChecks !==
|
|
49174
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
49211
49175
|
switch (cmd.type) {
|
|
49212
49176
|
case "HIDE_SHEET":
|
|
49213
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
49214
|
-
return
|
|
49177
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
49178
|
+
return "Success";
|
|
49215
49179
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
49216
49180
|
case "DUPLICATE_SHEET":
|
|
49217
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
49218
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
49219
|
-
return
|
|
49181
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
49182
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
49183
|
+
return "Success";
|
|
49220
49184
|
case "MOVE_SHEET": try {
|
|
49221
49185
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
49222
49186
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
49223
|
-
return
|
|
49187
|
+
return "Success";
|
|
49224
49188
|
} catch (e) {
|
|
49225
|
-
return
|
|
49189
|
+
return "WrongSheetMove";
|
|
49226
49190
|
}
|
|
49227
49191
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
49228
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
49229
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
49192
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
49193
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
49230
49194
|
case "ADD_COLUMNS_ROWS":
|
|
49231
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
49232
|
-
else if (cmd.quantity <= 0) return
|
|
49233
|
-
return
|
|
49195
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
49196
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
49197
|
+
return "Success";
|
|
49234
49198
|
case "REMOVE_COLUMNS_ROWS": {
|
|
49235
49199
|
const min = largeMin(cmd.elements);
|
|
49236
49200
|
const max = largeMax(cmd.elements);
|
|
49237
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
49238
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
49239
|
-
else return
|
|
49201
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
49202
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
49203
|
+
else return "Success";
|
|
49240
49204
|
}
|
|
49241
49205
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
49242
49206
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
49243
|
-
default: return
|
|
49207
|
+
default: return "Success";
|
|
49244
49208
|
}
|
|
49245
49209
|
}
|
|
49246
49210
|
handle(cmd) {
|
|
@@ -49503,12 +49467,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49503
49467
|
* not outside the sheet.
|
|
49504
49468
|
*/
|
|
49505
49469
|
checkZonesExistInSheet(sheetId, zones) {
|
|
49506
|
-
if (!zones.every(isZoneValid)) return
|
|
49470
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
49507
49471
|
if (zones.length) {
|
|
49508
49472
|
const sheetZone = this.getSheetZone(sheetId);
|
|
49509
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
49473
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
49510
49474
|
}
|
|
49511
|
-
return
|
|
49475
|
+
return "Success";
|
|
49512
49476
|
}
|
|
49513
49477
|
updateCellPosition(cmd) {
|
|
49514
49478
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -49582,36 +49546,36 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49582
49546
|
}
|
|
49583
49547
|
checkSheetName(cmd) {
|
|
49584
49548
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
49585
|
-
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return
|
|
49549
|
+
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return "UnchangedSheetName";
|
|
49586
49550
|
const { orderedSheetIds, sheets } = this;
|
|
49587
49551
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
49588
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
49589
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
49590
|
-
return
|
|
49552
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
49553
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
49554
|
+
return "Success";
|
|
49591
49555
|
}
|
|
49592
49556
|
checkSheetPosition(cmd) {
|
|
49593
49557
|
const { orderedSheetIds } = this;
|
|
49594
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
49595
|
-
return
|
|
49558
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
49559
|
+
return "Success";
|
|
49596
49560
|
}
|
|
49597
49561
|
checkRowFreezeQuantity(cmd) {
|
|
49598
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
49562
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
49599
49563
|
}
|
|
49600
49564
|
checkColFreezeQuantity(cmd) {
|
|
49601
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
49565
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
49602
49566
|
}
|
|
49603
49567
|
checkRowFreezeOverlapMerge(cmd) {
|
|
49604
49568
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
49605
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
49606
|
-
return
|
|
49569
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
49570
|
+
return "Success";
|
|
49607
49571
|
}
|
|
49608
49572
|
checkColFreezeOverlapMerge(cmd) {
|
|
49609
49573
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
49610
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
49611
|
-
return
|
|
49574
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
49575
|
+
return "Success";
|
|
49612
49576
|
}
|
|
49613
49577
|
isRenameAllowed(cmd) {
|
|
49614
|
-
if (!(cmd.name && cmd.name.trim().toLowerCase())) return
|
|
49578
|
+
if (!(cmd.name && cmd.name.trim().toLowerCase())) return "MissingSheetName";
|
|
49615
49579
|
return this.checkSheetName(cmd);
|
|
49616
49580
|
}
|
|
49617
49581
|
renameSheet(sheet, name) {
|
|
@@ -49833,17 +49797,17 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49833
49797
|
* sheet.
|
|
49834
49798
|
*/
|
|
49835
49799
|
checkSheetExists(cmd) {
|
|
49836
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
49837
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
49838
|
-
return
|
|
49800
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
49801
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
49802
|
+
return "Success";
|
|
49839
49803
|
}
|
|
49840
49804
|
/**
|
|
49841
49805
|
* Check if zones in the command are well formed and
|
|
49842
49806
|
* not outside the sheet.
|
|
49843
49807
|
*/
|
|
49844
49808
|
checkZonesAreInSheet(cmd) {
|
|
49845
|
-
if (!("sheetId" in cmd)) return
|
|
49846
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
49809
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
49810
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
49847
49811
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
49848
49812
|
}
|
|
49849
49813
|
};
|
|
@@ -49865,21 +49829,21 @@ var TablePlugin = class extends CorePlugin {
|
|
|
49865
49829
|
allowDispatch(cmd) {
|
|
49866
49830
|
switch (cmd.type) {
|
|
49867
49831
|
case "CREATE_TABLE":
|
|
49868
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
49832
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
49869
49833
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
49870
|
-
if (!areZonesContinuous(zones)) return
|
|
49871
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
49834
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
49835
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
49872
49836
|
case "UPDATE_TABLE":
|
|
49873
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
49837
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
49874
49838
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
49875
49839
|
case "ADD_MERGE":
|
|
49876
49840
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
49877
49841
|
const tableZone = table.range.zone;
|
|
49878
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
49842
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
49879
49843
|
}
|
|
49880
49844
|
break;
|
|
49881
49845
|
}
|
|
49882
|
-
return
|
|
49846
|
+
return "Success";
|
|
49883
49847
|
}
|
|
49884
49848
|
handle(cmd) {
|
|
49885
49849
|
switch (cmd.type) {
|
|
@@ -50017,19 +49981,19 @@ var TablePlugin = class extends CorePlugin {
|
|
|
50017
49981
|
}
|
|
50018
49982
|
}
|
|
50019
49983
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
50020
|
-
if (!cmd.newTableRange) return
|
|
49984
|
+
if (!cmd.newTableRange) return "Success";
|
|
50021
49985
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
50022
49986
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
50023
|
-
if (zoneIsInSheet !==
|
|
49987
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
50024
49988
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
50025
|
-
if (!updatedTable) return
|
|
50026
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
49989
|
+
if (!updatedTable) return "TableNotFound";
|
|
49990
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
50027
49991
|
}
|
|
50028
49992
|
checkTableConfigUpdateIsValid(config) {
|
|
50029
|
-
if (!config) return
|
|
50030
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
50031
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
50032
|
-
return
|
|
49993
|
+
if (!config) return "Success";
|
|
49994
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
49995
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
49996
|
+
return "Success";
|
|
50033
49997
|
}
|
|
50034
49998
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
50035
49999
|
const zone = tableRange.zone;
|
|
@@ -50260,28 +50224,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
50260
50224
|
switch (cmd.type) {
|
|
50261
50225
|
case "GROUP_HEADERS": {
|
|
50262
50226
|
const { start, end, sheetId } = cmd;
|
|
50263
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50264
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
50265
|
-
if (start > end) return
|
|
50266
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
50227
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50228
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
50229
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
50230
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
50267
50231
|
break;
|
|
50268
50232
|
}
|
|
50269
50233
|
case "UNGROUP_HEADERS": {
|
|
50270
50234
|
const { start, end, sheetId } = cmd;
|
|
50271
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50272
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
50273
|
-
if (start > end) return
|
|
50235
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50236
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
50237
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
50274
50238
|
break;
|
|
50275
50239
|
}
|
|
50276
50240
|
case "UNFOLD_HEADER_GROUP":
|
|
50277
50241
|
case "FOLD_HEADER_GROUP":
|
|
50278
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
50242
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
50279
50243
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
50280
|
-
if (!group) return
|
|
50281
|
-
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
|
|
50244
|
+
if (!group) return "UnknownHeaderGroup";
|
|
50245
|
+
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";
|
|
50282
50246
|
break;
|
|
50283
50247
|
}
|
|
50284
|
-
return
|
|
50248
|
+
return "Success";
|
|
50285
50249
|
}
|
|
50286
50250
|
handle(cmd) {
|
|
50287
50251
|
switch (cmd.type) {
|
|
@@ -50610,22 +50574,22 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
50610
50574
|
switch (cmd.type) {
|
|
50611
50575
|
case "ADD_PIVOT": return this.checkDuplicatedMeasureIds(cmd.pivot);
|
|
50612
50576
|
case "UPDATE_PIVOT":
|
|
50613
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50614
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
50615
|
-
if (cmd.pivot.name === "") return
|
|
50577
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50578
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
50579
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
50616
50580
|
return this.checkDuplicatedMeasureIds(cmd.pivot);
|
|
50617
50581
|
case "RENAME_PIVOT":
|
|
50618
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50619
|
-
if (cmd.name === "") return
|
|
50582
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50583
|
+
if (cmd.name === "") return "EmptyName";
|
|
50620
50584
|
break;
|
|
50621
50585
|
case "REMOVE_PIVOT":
|
|
50622
50586
|
case "DUPLICATE_PIVOT":
|
|
50623
50587
|
case "INSERT_PIVOT":
|
|
50624
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50588
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50625
50589
|
break;
|
|
50626
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
50590
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50627
50591
|
}
|
|
50628
|
-
return
|
|
50592
|
+
return "Success";
|
|
50629
50593
|
}
|
|
50630
50594
|
handle(cmd) {
|
|
50631
50595
|
switch (cmd.type) {
|
|
@@ -50823,8 +50787,8 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
50823
50787
|
}
|
|
50824
50788
|
checkDuplicatedMeasureIds(definition) {
|
|
50825
50789
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
50826
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
50827
|
-
return
|
|
50790
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
50791
|
+
return "Success";
|
|
50828
50792
|
}
|
|
50829
50793
|
/**
|
|
50830
50794
|
* Import the pivots
|
|
@@ -50853,9 +50817,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
50853
50817
|
locale = DEFAULT_LOCALE;
|
|
50854
50818
|
allowDispatch(cmd) {
|
|
50855
50819
|
switch (cmd.type) {
|
|
50856
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
50820
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
50857
50821
|
}
|
|
50858
|
-
return
|
|
50822
|
+
return "Success";
|
|
50859
50823
|
}
|
|
50860
50824
|
handle(cmd) {
|
|
50861
50825
|
switch (cmd.type) {
|
|
@@ -50905,15 +50869,15 @@ var SpreadsheetPivotCorePlugin = class extends CorePlugin {
|
|
|
50905
50869
|
const definition = cmd.pivot;
|
|
50906
50870
|
return this.checkDataSetValidity(definition);
|
|
50907
50871
|
}
|
|
50908
|
-
return
|
|
50872
|
+
return "Success";
|
|
50909
50873
|
}
|
|
50910
50874
|
checkDataSetValidity(definition) {
|
|
50911
50875
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
50912
50876
|
const { zone, sheetId } = definition.dataSet;
|
|
50913
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
50877
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
50914
50878
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
50915
50879
|
}
|
|
50916
|
-
return
|
|
50880
|
+
return "Success";
|
|
50917
50881
|
}
|
|
50918
50882
|
};
|
|
50919
50883
|
|
|
@@ -50931,18 +50895,18 @@ var TableStylePlugin = class extends CorePlugin {
|
|
|
50931
50895
|
switch (cmd.type) {
|
|
50932
50896
|
case "CREATE_TABLE":
|
|
50933
50897
|
case "UPDATE_TABLE":
|
|
50934
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
50898
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
50935
50899
|
break;
|
|
50936
50900
|
case "CREATE_TABLE_STYLE":
|
|
50937
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
50901
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
50938
50902
|
try {
|
|
50939
50903
|
toHex(cmd.primaryColor);
|
|
50940
50904
|
} catch (e) {
|
|
50941
|
-
return
|
|
50905
|
+
return "InvalidTableStyle";
|
|
50942
50906
|
}
|
|
50943
50907
|
break;
|
|
50944
50908
|
}
|
|
50945
|
-
return
|
|
50909
|
+
return "Success";
|
|
50946
50910
|
}
|
|
50947
50911
|
handle(cmd) {
|
|
50948
50912
|
switch (cmd.type) {
|
|
@@ -51044,6 +51008,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
51044
51008
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
51045
51009
|
}
|
|
51046
51010
|
var CompilationParametersBuilder = class {
|
|
51011
|
+
getters;
|
|
51012
|
+
computeCell;
|
|
51047
51013
|
evalContext;
|
|
51048
51014
|
rangeCache = {};
|
|
51049
51015
|
constructor(context, getters, computeCell) {
|
|
@@ -51497,6 +51463,7 @@ var ZoneRBush = class extends import_rbush_min.default {
|
|
|
51497
51463
|
* It uses an R-Tree data structure to efficiently find dependent cells.
|
|
51498
51464
|
*/
|
|
51499
51465
|
var FormulaDependencyGraph = class {
|
|
51466
|
+
createEmptyPositionSet;
|
|
51500
51467
|
dependencies = new PositionMap();
|
|
51501
51468
|
rTree;
|
|
51502
51469
|
constructor(createEmptyPositionSet, data = []) {
|
|
@@ -51798,6 +51765,7 @@ const MAX_ITERATION = 30;
|
|
|
51798
51765
|
const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
|
|
51799
51766
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
51800
51767
|
var Evaluator = class {
|
|
51768
|
+
context;
|
|
51801
51769
|
getters;
|
|
51802
51770
|
compilationParams;
|
|
51803
51771
|
evaluatedCells = new PositionMap();
|
|
@@ -51816,7 +51784,7 @@ var Evaluator = class {
|
|
|
51816
51784
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
51817
51785
|
if (!spreadZone) return;
|
|
51818
51786
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
51819
|
-
if (evaluatedCell?.type ===
|
|
51787
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
51820
51788
|
return union(positionToZone(position), spreadZone);
|
|
51821
51789
|
}
|
|
51822
51790
|
getEvaluatedPositions() {
|
|
@@ -51826,7 +51794,7 @@ var Evaluator = class {
|
|
|
51826
51794
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
51827
51795
|
}
|
|
51828
51796
|
getArrayFormulaSpreadingOn(position) {
|
|
51829
|
-
if (this.getEvaluatedCell(position).type ===
|
|
51797
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
51830
51798
|
const arrayFormulas = this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position));
|
|
51831
51799
|
return Array.from(arrayFormulas).find((position) => !this.blockedArrayFormulas.has(position));
|
|
51832
51800
|
}
|
|
@@ -52059,7 +52027,7 @@ var Evaluator = class {
|
|
|
52059
52027
|
col: i + col,
|
|
52060
52028
|
row: j + row
|
|
52061
52029
|
};
|
|
52062
|
-
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !==
|
|
52030
|
+
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
52063
52031
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
52064
52032
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data in %s.", toXC(position.col, position.row)));
|
|
52065
52033
|
}
|
|
@@ -52285,7 +52253,7 @@ var EvaluationPlugin = class extends UIPlugin {
|
|
|
52285
52253
|
sheetId,
|
|
52286
52254
|
col,
|
|
52287
52255
|
row
|
|
52288
|
-
})).every((cell) => cell.type ===
|
|
52256
|
+
})).every((cell) => cell.type === "empty");
|
|
52289
52257
|
}
|
|
52290
52258
|
/**
|
|
52291
52259
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -52739,7 +52707,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52739
52707
|
return computedDataBars;
|
|
52740
52708
|
}
|
|
52741
52709
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
52742
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type ===
|
|
52710
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
52743
52711
|
switch (threshold.type) {
|
|
52744
52712
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
52745
52713
|
case "number": return Number(threshold.value);
|
|
@@ -52770,7 +52738,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52770
52738
|
col,
|
|
52771
52739
|
row
|
|
52772
52740
|
});
|
|
52773
|
-
if (cell.type !==
|
|
52741
|
+
if (cell.type !== "number") continue;
|
|
52774
52742
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
52775
52743
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
52776
52744
|
computedIcons[col][row] = icon;
|
|
@@ -52783,7 +52751,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52783
52751
|
}
|
|
52784
52752
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
52785
52753
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
52786
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
52754
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
52787
52755
|
if (max <= 0) return;
|
|
52788
52756
|
const color = rule.color;
|
|
52789
52757
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -52796,7 +52764,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52796
52764
|
col: targetCol,
|
|
52797
52765
|
row: targetRow
|
|
52798
52766
|
});
|
|
52799
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
52767
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
52800
52768
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
52801
52769
|
computedDataBars[col][row] = {
|
|
52802
52770
|
color: colorNumberString(color),
|
|
@@ -52834,7 +52802,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52834
52802
|
col,
|
|
52835
52803
|
row
|
|
52836
52804
|
});
|
|
52837
|
-
if (cell.type ===
|
|
52805
|
+
if (cell.type === "number") {
|
|
52838
52806
|
const value = clip(cell.value, minValue, maxValue);
|
|
52839
52807
|
let color;
|
|
52840
52808
|
if (colorCellArgs.length === 2 && midValue) color = value <= midValue ? this.colorCell(value, colorCellArgs[0].minValue, colorCellArgs[0].minColor, colorCellArgs[0].colorDiffUnit) : this.colorCell(value, colorCellArgs[1].minValue, colorCellArgs[1].minColor, colorCellArgs[1].colorDiffUnit);
|
|
@@ -52868,7 +52836,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52868
52836
|
*/
|
|
52869
52837
|
rulePredicate = { CellIsRule: (target, rule) => {
|
|
52870
52838
|
const cell = this.getters.getEvaluatedCell(target);
|
|
52871
|
-
if (cell.type ===
|
|
52839
|
+
if (cell.type === "error") return false;
|
|
52872
52840
|
let [value0, value1] = rule.values.map((val) => {
|
|
52873
52841
|
if (val.startsWith("=")) return this.getters.evaluateFormula(target.sheetId, val) ?? "";
|
|
52874
52842
|
return parseLiteral(val, DEFAULT_LOCALE);
|
|
@@ -52978,7 +52946,7 @@ var EvaluationDataValidationPlugin = class extends UIPlugin {
|
|
|
52978
52946
|
if (!validationResults[col]) validationResults[col] = [];
|
|
52979
52947
|
validationResults[col][row] = lazy(() => {
|
|
52980
52948
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
52981
|
-
if (evaluatedCell.type ===
|
|
52949
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
52982
52950
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
52983
52951
|
});
|
|
52984
52952
|
}
|
|
@@ -53793,6 +53761,7 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
53793
53761
|
"getPivot",
|
|
53794
53762
|
"getFirstPivotFunction",
|
|
53795
53763
|
"getPivotIdFromPosition",
|
|
53764
|
+
"getPivotIdsFromPosition",
|
|
53796
53765
|
"getPivotCellFromPosition",
|
|
53797
53766
|
"generateNewCalculatedMeasureName",
|
|
53798
53767
|
"isPivotUnused",
|
|
@@ -53817,9 +53786,11 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
53817
53786
|
this.refreshPivot(cmd.id);
|
|
53818
53787
|
break;
|
|
53819
53788
|
case "ADD_PIVOT":
|
|
53789
|
+
this.unusedPivots?.push(cmd.pivotId);
|
|
53820
53790
|
this.setupPivot(cmd.pivotId);
|
|
53821
53791
|
break;
|
|
53822
53792
|
case "DUPLICATE_PIVOT":
|
|
53793
|
+
this.unusedPivots?.push(cmd.newPivotId);
|
|
53823
53794
|
this.setupPivot(cmd.newPivotId);
|
|
53824
53795
|
break;
|
|
53825
53796
|
case "UPDATE_PIVOT":
|
|
@@ -53850,37 +53821,52 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
53850
53821
|
}
|
|
53851
53822
|
}
|
|
53852
53823
|
/**
|
|
53853
|
-
* Get the id of the pivot at the given position. Returns undefined if there
|
|
53824
|
+
* Get the id of the first pivot in the formula at the given position. Returns undefined if there
|
|
53854
53825
|
* is no pivot at this position
|
|
53855
53826
|
*/
|
|
53856
53827
|
getPivotIdFromPosition(position) {
|
|
53828
|
+
return this.getPivotIdsFromPosition(position)[0];
|
|
53829
|
+
}
|
|
53830
|
+
/**
|
|
53831
|
+
* Get all of the ids of the pivot present in the formula at the given position.
|
|
53832
|
+
*/
|
|
53833
|
+
getPivotIdsFromPosition(position) {
|
|
53857
53834
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
53858
|
-
if (cell && cell.isFormula)
|
|
53859
|
-
|
|
53860
|
-
|
|
53861
|
-
|
|
53862
|
-
|
|
53863
|
-
|
|
53864
|
-
|
|
53835
|
+
if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
|
|
53836
|
+
return [];
|
|
53837
|
+
}
|
|
53838
|
+
getPivotIdsFromFormula(sheetId, formula) {
|
|
53839
|
+
return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
|
|
53840
|
+
const pivotId = pivotFunction.args[0]?.toString();
|
|
53841
|
+
return pivotId && this.getters.getPivotId(pivotId);
|
|
53842
|
+
}).filter(isDefined);
|
|
53865
53843
|
}
|
|
53866
53844
|
isSpillPivotFormula(position) {
|
|
53867
53845
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
53868
53846
|
if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
|
|
53869
53847
|
return false;
|
|
53870
53848
|
}
|
|
53871
|
-
|
|
53872
|
-
const
|
|
53873
|
-
if (!
|
|
53874
|
-
const
|
|
53875
|
-
|
|
53876
|
-
functionName,
|
|
53877
|
-
|
|
53849
|
+
getPivotFunctions(sheetId, tokens) {
|
|
53850
|
+
const pivotFunctions = getPivotFunctions(tokens);
|
|
53851
|
+
if (!pivotFunctions.length) return [];
|
|
53852
|
+
const evaluatedPivotFunctions = [];
|
|
53853
|
+
for (const pivotFunction of pivotFunctions) {
|
|
53854
|
+
const { functionName, args } = pivotFunction;
|
|
53855
|
+
const evaluatedArgs = args.map((argAst) => {
|
|
53878
53856
|
if (argAst.type === "EMPTY") return;
|
|
53879
53857
|
else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
|
|
53880
53858
|
const argsString = astToFormula(argAst);
|
|
53881
53859
|
return this.getters.evaluateFormula(sheetId, argsString);
|
|
53882
|
-
})
|
|
53883
|
-
|
|
53860
|
+
});
|
|
53861
|
+
evaluatedPivotFunctions.push({
|
|
53862
|
+
functionName,
|
|
53863
|
+
args: evaluatedArgs
|
|
53864
|
+
});
|
|
53865
|
+
}
|
|
53866
|
+
return evaluatedPivotFunctions;
|
|
53867
|
+
}
|
|
53868
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
53869
|
+
return this.getPivotFunctions(sheetId, tokens)[0];
|
|
53884
53870
|
}
|
|
53885
53871
|
/**
|
|
53886
53872
|
* Returns the domain args of a pivot formula from a position.
|
|
@@ -53980,8 +53966,8 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
53980
53966
|
const unusedPivots = new Set(this.getters.getPivotIds());
|
|
53981
53967
|
for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
|
|
53982
53968
|
const position = this.getters.getCellPosition(cellId);
|
|
53983
|
-
const
|
|
53984
|
-
|
|
53969
|
+
const pivotIds = this.getPivotIdsFromPosition(position);
|
|
53970
|
+
for (const pivotId of pivotIds) {
|
|
53985
53971
|
unusedPivots.delete(pivotId);
|
|
53986
53972
|
if (!unusedPivots.size) {
|
|
53987
53973
|
this.unusedPivots = [];
|
|
@@ -53989,6 +53975,21 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
53989
53975
|
}
|
|
53990
53976
|
}
|
|
53991
53977
|
}
|
|
53978
|
+
for (const pivotId of this.getters.getPivotIds()) {
|
|
53979
|
+
const pivot = this.getters.getPivotCoreDefinition(pivotId);
|
|
53980
|
+
for (const measure of pivot.measures) if (measure.computedBy) {
|
|
53981
|
+
const { sheetId } = measure.computedBy;
|
|
53982
|
+
const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
|
|
53983
|
+
const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
|
|
53984
|
+
for (const relatedPivotId of relatedPivotIds) {
|
|
53985
|
+
unusedPivots.delete(relatedPivotId);
|
|
53986
|
+
if (!unusedPivots.size) {
|
|
53987
|
+
this.unusedPivots = [];
|
|
53988
|
+
return [];
|
|
53989
|
+
}
|
|
53990
|
+
}
|
|
53991
|
+
}
|
|
53992
|
+
}
|
|
53992
53993
|
this.unusedPivots = [...unusedPivots];
|
|
53993
53994
|
return this.unusedPivots;
|
|
53994
53995
|
}
|
|
@@ -54065,10 +54066,10 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54065
54066
|
const sheetId = this.getters.getActiveSheetId();
|
|
54066
54067
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
54067
54068
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
54068
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
54069
|
-
return
|
|
54069
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
54070
|
+
return "InvalidAutofillSelection";
|
|
54070
54071
|
}
|
|
54071
|
-
return
|
|
54072
|
+
return "Success";
|
|
54072
54073
|
}
|
|
54073
54074
|
handle(cmd) {
|
|
54074
54075
|
switch (cmd.type) {
|
|
@@ -54100,7 +54101,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54100
54101
|
const target = this.autofillZone;
|
|
54101
54102
|
const autofillCellsData = [];
|
|
54102
54103
|
switch (this.direction) {
|
|
54103
|
-
case
|
|
54104
|
+
case "down":
|
|
54104
54105
|
for (let col = source.left; col <= source.right; col++) {
|
|
54105
54106
|
const xcs = [];
|
|
54106
54107
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -54108,7 +54109,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54108
54109
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54109
54110
|
}
|
|
54110
54111
|
break;
|
|
54111
|
-
case
|
|
54112
|
+
case "up":
|
|
54112
54113
|
for (let col = source.left; col <= source.right; col++) {
|
|
54113
54114
|
const xcs = [];
|
|
54114
54115
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -54116,7 +54117,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54116
54117
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54117
54118
|
}
|
|
54118
54119
|
break;
|
|
54119
|
-
case
|
|
54120
|
+
case "left":
|
|
54120
54121
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54121
54122
|
const xcs = [];
|
|
54122
54123
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -54124,7 +54125,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54124
54125
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54125
54126
|
}
|
|
54126
54127
|
break;
|
|
54127
|
-
case
|
|
54128
|
+
case "right":
|
|
54128
54129
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54129
54130
|
const xcs = [];
|
|
54130
54131
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -54250,19 +54251,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54250
54251
|
}
|
|
54251
54252
|
this.direction = this.getDirection(col, row);
|
|
54252
54253
|
switch (this.direction) {
|
|
54253
|
-
case
|
|
54254
|
+
case "up":
|
|
54254
54255
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
54255
54256
|
this.steps = source.top - row;
|
|
54256
54257
|
break;
|
|
54257
|
-
case
|
|
54258
|
+
case "down":
|
|
54258
54259
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
54259
54260
|
this.steps = row - source.bottom;
|
|
54260
54261
|
break;
|
|
54261
|
-
case
|
|
54262
|
+
case "left":
|
|
54262
54263
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
54263
54264
|
this.steps = source.left - col;
|
|
54264
54265
|
break;
|
|
54265
|
-
case
|
|
54266
|
+
case "right":
|
|
54266
54267
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
54267
54268
|
this.steps = col - source.right;
|
|
54268
54269
|
break;
|
|
@@ -54281,7 +54282,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54281
54282
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
54282
54283
|
...activePosition,
|
|
54283
54284
|
row
|
|
54284
|
-
}).type !==
|
|
54285
|
+
}).type !== "empty") {
|
|
54285
54286
|
autofillRow = row - 1;
|
|
54286
54287
|
break;
|
|
54287
54288
|
}
|
|
@@ -54301,7 +54302,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54301
54302
|
col: col - 1,
|
|
54302
54303
|
row
|
|
54303
54304
|
};
|
|
54304
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
54305
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
54305
54306
|
row += 1;
|
|
54306
54307
|
leftPosition = {
|
|
54307
54308
|
sheetId,
|
|
@@ -54318,7 +54319,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54318
54319
|
col: col + 1,
|
|
54319
54320
|
row
|
|
54320
54321
|
};
|
|
54321
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
54322
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
54322
54323
|
row += 1;
|
|
54323
54324
|
rightPosition = {
|
|
54324
54325
|
sheetId,
|
|
@@ -54408,19 +54409,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54408
54409
|
const position = {
|
|
54409
54410
|
up: {
|
|
54410
54411
|
number: source.top - row,
|
|
54411
|
-
value:
|
|
54412
|
+
value: "up"
|
|
54412
54413
|
},
|
|
54413
54414
|
down: {
|
|
54414
54415
|
number: row - source.bottom,
|
|
54415
|
-
value:
|
|
54416
|
+
value: "down"
|
|
54416
54417
|
},
|
|
54417
54418
|
left: {
|
|
54418
54419
|
number: source.left - col,
|
|
54419
|
-
value:
|
|
54420
|
+
value: "left"
|
|
54420
54421
|
},
|
|
54421
54422
|
right: {
|
|
54422
54423
|
number: col - source.right,
|
|
54423
|
-
value:
|
|
54424
|
+
value: "right"
|
|
54424
54425
|
}
|
|
54425
54426
|
};
|
|
54426
54427
|
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;
|
|
@@ -54623,7 +54624,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
54623
54624
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
54624
54625
|
}
|
|
54625
54626
|
isNumber(cell) {
|
|
54626
|
-
return cell.type ===
|
|
54627
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
54627
54628
|
}
|
|
54628
54629
|
isZoneValid(zone) {
|
|
54629
54630
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -55117,6 +55118,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
55117
55118
|
//#endregion
|
|
55118
55119
|
//#region src/collaborative/revisions.ts
|
|
55119
55120
|
var Revision = class {
|
|
55121
|
+
rootCommand;
|
|
55122
|
+
timestamp;
|
|
55120
55123
|
id;
|
|
55121
55124
|
clientId;
|
|
55122
55125
|
_commands = [];
|
|
@@ -55153,6 +55156,9 @@ var Revision = class {
|
|
|
55153
55156
|
//#region src/collaborative/session.ts
|
|
55154
55157
|
var ClientDisconnectedError = class extends Error {};
|
|
55155
55158
|
var Session = class extends EventBus {
|
|
55159
|
+
revisions;
|
|
55160
|
+
transportService;
|
|
55161
|
+
serverRevisionId;
|
|
55156
55162
|
/**
|
|
55157
55163
|
* Positions of the others client.
|
|
55158
55164
|
*/
|
|
@@ -55618,7 +55624,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
55618
55624
|
switch (cmd.type) {
|
|
55619
55625
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
55620
55626
|
}
|
|
55621
|
-
return
|
|
55627
|
+
return "Success";
|
|
55622
55628
|
}
|
|
55623
55629
|
handle(cmd) {
|
|
55624
55630
|
switch (cmd.type) {
|
|
@@ -55701,34 +55707,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
55701
55707
|
});
|
|
55702
55708
|
}
|
|
55703
55709
|
checkSingleRangeSelected() {
|
|
55704
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
55705
|
-
return
|
|
55710
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
55711
|
+
return "Success";
|
|
55706
55712
|
}
|
|
55707
55713
|
checkNoMergeInZone() {
|
|
55708
55714
|
const sheetId = this.getters.getActiveSheetId();
|
|
55709
55715
|
const zone = this.getters.getSelectedZone();
|
|
55710
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
55711
|
-
return
|
|
55716
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
55717
|
+
return "Success";
|
|
55712
55718
|
}
|
|
55713
55719
|
checkRangeContainsValues(cmd) {
|
|
55714
55720
|
const sheetId = this.getters.getActiveSheetId();
|
|
55715
55721
|
const zone = this.getters.getSelectedZone();
|
|
55716
55722
|
if (cmd.hasHeader) zone.top += 1;
|
|
55717
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
55718
|
-
return
|
|
55723
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptyTarget";
|
|
55724
|
+
return "Success";
|
|
55719
55725
|
}
|
|
55720
55726
|
checkNoColumnProvided(cmd) {
|
|
55721
|
-
if (cmd.columns.length === 0) return
|
|
55722
|
-
return
|
|
55727
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
55728
|
+
return "Success";
|
|
55723
55729
|
}
|
|
55724
55730
|
checkColumnsIncludedInZone(cmd) {
|
|
55725
55731
|
const zone = this.getters.getSelectedZone();
|
|
55726
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
55727
|
-
return
|
|
55732
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
55733
|
+
return "Success";
|
|
55728
55734
|
}
|
|
55729
55735
|
checkColumnsAreUnique(cmd) {
|
|
55730
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
55731
|
-
return
|
|
55736
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
55737
|
+
return "Success";
|
|
55732
55738
|
}
|
|
55733
55739
|
trimWhitespace() {
|
|
55734
55740
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -55861,7 +55867,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
55861
55867
|
getCellNumberFormat(position) {
|
|
55862
55868
|
for (const pos of [position]) {
|
|
55863
55869
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
55864
|
-
if (cell.type ===
|
|
55870
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
55865
55871
|
}
|
|
55866
55872
|
}
|
|
55867
55873
|
};
|
|
@@ -55929,11 +55935,11 @@ var InsertPivotPlugin = class extends UIPlugin {
|
|
|
55929
55935
|
allowDispatch(cmd) {
|
|
55930
55936
|
switch (cmd.type) {
|
|
55931
55937
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
55932
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
55933
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
55938
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
55939
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
55934
55940
|
break;
|
|
55935
55941
|
}
|
|
55936
|
-
return
|
|
55942
|
+
return "Success";
|
|
55937
55943
|
}
|
|
55938
55944
|
handle(cmd) {
|
|
55939
55945
|
switch (cmd.type) {
|
|
@@ -56134,7 +56140,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
56134
56140
|
if (!isInside(cmd.col, cmd.row, cmd.zone)) throw new Error(_t("The anchor must be part of the provided zone"));
|
|
56135
56141
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes);
|
|
56136
56142
|
}
|
|
56137
|
-
return
|
|
56143
|
+
return "Success";
|
|
56138
56144
|
}
|
|
56139
56145
|
handle(cmd) {
|
|
56140
56146
|
switch (cmd.type) {
|
|
@@ -56144,24 +56150,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
56144
56150
|
}
|
|
56145
56151
|
}
|
|
56146
56152
|
checkMerge({ sheetId, zone }) {
|
|
56147
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56153
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56148
56154
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
56149
56155
|
sheetId,
|
|
56150
56156
|
col,
|
|
56151
56157
|
row
|
|
56152
|
-
}))) return
|
|
56153
|
-
return
|
|
56158
|
+
}))) return "InvalidSortZone";
|
|
56159
|
+
return "Success";
|
|
56154
56160
|
}
|
|
56155
56161
|
checkMergeSizes({ sheetId, zone }) {
|
|
56156
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56162
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56157
56163
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
56158
56164
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
56159
56165
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
56160
56166
|
if (!merges.every((merge) => {
|
|
56161
56167
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
56162
56168
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
56163
|
-
})) return
|
|
56164
|
-
return
|
|
56169
|
+
})) return "InvalidSortZone";
|
|
56170
|
+
return "Success";
|
|
56165
56171
|
}
|
|
56166
56172
|
/**
|
|
56167
56173
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -56179,9 +56185,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
56179
56185
|
col,
|
|
56180
56186
|
row
|
|
56181
56187
|
}).type));
|
|
56182
|
-
if (cells[0][0] ===
|
|
56183
|
-
if (cells.some((item) => item[0] ===
|
|
56184
|
-
else if (cells.some((item) => item[1] !==
|
|
56188
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
56189
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
56190
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
56185
56191
|
else return false;
|
|
56186
56192
|
}
|
|
56187
56193
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -56439,7 +56445,7 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
56439
56445
|
*/
|
|
56440
56446
|
isCellEmpty(position) {
|
|
56441
56447
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
56442
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
56448
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
56443
56449
|
}
|
|
56444
56450
|
getColMaxWidth(sheetId, index) {
|
|
56445
56451
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -56453,8 +56459,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
56453
56459
|
* sheet.
|
|
56454
56460
|
*/
|
|
56455
56461
|
checkSheetExists(cmd) {
|
|
56456
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return
|
|
56457
|
-
return
|
|
56462
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return "InvalidSheetId";
|
|
56463
|
+
return "Success";
|
|
56458
56464
|
}
|
|
56459
56465
|
/**
|
|
56460
56466
|
* Check if zones in the command are well formed and
|
|
@@ -56462,11 +56468,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
56462
56468
|
*/
|
|
56463
56469
|
checkZonesAreInSheet(cmd) {
|
|
56464
56470
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
56465
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
56471
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
56466
56472
|
const zones = this.getters.getCommandZones(cmd);
|
|
56467
|
-
if (!sheetId && zones.length > 0) return
|
|
56473
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
56468
56474
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
56469
|
-
return
|
|
56475
|
+
return "Success";
|
|
56470
56476
|
}
|
|
56471
56477
|
autoResizeRows(sheetId, rows) {
|
|
56472
56478
|
const rowSizes = [];
|
|
@@ -56714,7 +56720,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
56714
56720
|
...position,
|
|
56715
56721
|
content: "FALSE"
|
|
56716
56722
|
});
|
|
56717
|
-
else if (cell?.content && evaluatedCell.type ===
|
|
56723
|
+
else if (cell?.content && evaluatedCell.type === "empty") {
|
|
56718
56724
|
let value;
|
|
56719
56725
|
if (cell.content.startsWith("=")) {
|
|
56720
56726
|
const result = this.getters.evaluateFormula(position.sheetId, cell.content);
|
|
@@ -56724,7 +56730,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
56724
56730
|
...position,
|
|
56725
56731
|
content: "FALSE"
|
|
56726
56732
|
});
|
|
56727
|
-
} else if (evaluatedCell.type !==
|
|
56733
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
56728
56734
|
...position,
|
|
56729
56735
|
content: "FALSE"
|
|
56730
56736
|
});
|
|
@@ -56977,13 +56983,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
56977
56983
|
allowDispatch(cmd) {
|
|
56978
56984
|
switch (cmd.type) {
|
|
56979
56985
|
case "REQUEST_UNDO":
|
|
56980
|
-
if (!this.canUndo()) return
|
|
56986
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
56981
56987
|
break;
|
|
56982
56988
|
case "REQUEST_REDO":
|
|
56983
|
-
if (!this.canRedo()) return
|
|
56989
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
56984
56990
|
break;
|
|
56985
56991
|
}
|
|
56986
|
-
return
|
|
56992
|
+
return "Success";
|
|
56987
56993
|
}
|
|
56988
56994
|
handle(cmd) {
|
|
56989
56995
|
switch (cmd.type) {
|
|
@@ -57100,7 +57106,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
57100
57106
|
switch (cmd.type) {
|
|
57101
57107
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
57102
57108
|
}
|
|
57103
|
-
return
|
|
57109
|
+
return "Success";
|
|
57104
57110
|
}
|
|
57105
57111
|
handle(cmd) {
|
|
57106
57112
|
switch (cmd.type) {
|
|
@@ -57111,7 +57117,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
57111
57117
|
}
|
|
57112
57118
|
getAutomaticSeparator() {
|
|
57113
57119
|
const cells = this.getters.getSelectedCells();
|
|
57114
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
57120
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
57115
57121
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
57116
57122
|
if (separator) return separator;
|
|
57117
57123
|
}
|
|
@@ -57247,24 +57253,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
57247
57253
|
});
|
|
57248
57254
|
}
|
|
57249
57255
|
checkSingleColSelected() {
|
|
57250
|
-
if (!this.getters.isSingleColSelected()) return
|
|
57251
|
-
return
|
|
57256
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
57257
|
+
return "Success";
|
|
57252
57258
|
}
|
|
57253
57259
|
checkNonEmptySelector(cmd) {
|
|
57254
|
-
if (cmd.separator === "") return
|
|
57255
|
-
return
|
|
57260
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
57261
|
+
return "Success";
|
|
57256
57262
|
}
|
|
57257
57263
|
checkNotOverwritingContent(cmd) {
|
|
57258
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
57264
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
57259
57265
|
const selection = this.getters.getSelectedZones()[0];
|
|
57260
57266
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
57261
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
57262
|
-
return
|
|
57267
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
57268
|
+
return "Success";
|
|
57263
57269
|
}
|
|
57264
57270
|
checkSeparatorInSelection({ separator }) {
|
|
57265
57271
|
const cells = this.getters.getSelectedCells();
|
|
57266
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
57267
|
-
return
|
|
57272
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
57273
|
+
return "NoSplitSeparatorInSelection";
|
|
57268
57274
|
}
|
|
57269
57275
|
};
|
|
57270
57276
|
|
|
@@ -57301,7 +57307,7 @@ var TableAutofillPlugin = class extends UIPlugin {
|
|
|
57301
57307
|
col,
|
|
57302
57308
|
row: r,
|
|
57303
57309
|
sheetId
|
|
57304
|
-
}).type !==
|
|
57310
|
+
}).type !== "empty") return;
|
|
57305
57311
|
}
|
|
57306
57312
|
const oldSelection = {
|
|
57307
57313
|
zone: this.getters.getSelectedZone(),
|
|
@@ -57330,13 +57336,13 @@ var TableResizeUI = class extends UIPlugin {
|
|
|
57330
57336
|
switch (cmd.type) {
|
|
57331
57337
|
case "RESIZE_TABLE":
|
|
57332
57338
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
57333
|
-
if (!table) return
|
|
57339
|
+
if (!table) return "TableNotFound";
|
|
57334
57340
|
const oldTableZone = table.range.zone;
|
|
57335
57341
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
57336
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
57342
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
57337
57343
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
57338
57344
|
}
|
|
57339
|
-
return
|
|
57345
|
+
return "Success";
|
|
57340
57346
|
}
|
|
57341
57347
|
handle(cmd) {
|
|
57342
57348
|
switch (cmd.type) {
|
|
@@ -57401,7 +57407,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57401
57407
|
});
|
|
57402
57408
|
}
|
|
57403
57409
|
case "PASTE": {
|
|
57404
|
-
if (!this.copiedData) return
|
|
57410
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
57405
57411
|
const pasteOption = cmd.pasteOption;
|
|
57406
57412
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
57407
57413
|
pasteOption,
|
|
@@ -57410,12 +57416,12 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57410
57416
|
}
|
|
57411
57417
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
57412
57418
|
const zones = this.getters.getSelectedZones();
|
|
57413
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
57419
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
57414
57420
|
break;
|
|
57415
57421
|
}
|
|
57416
57422
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
57417
57423
|
const zones = this.getters.getSelectedZones();
|
|
57418
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
57424
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
57419
57425
|
break;
|
|
57420
57426
|
}
|
|
57421
57427
|
case "INSERT_CELL": {
|
|
@@ -57429,7 +57435,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57429
57435
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
57430
57436
|
}
|
|
57431
57437
|
}
|
|
57432
|
-
return
|
|
57438
|
+
return "Success";
|
|
57433
57439
|
}
|
|
57434
57440
|
handle(cmd) {
|
|
57435
57441
|
switch (cmd.type) {
|
|
@@ -57587,16 +57593,16 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57587
57593
|
const clipboardData = this.getClipboardData(zones);
|
|
57588
57594
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
57589
57595
|
const result = handler.isCutAllowed(clipboardData);
|
|
57590
|
-
if (result !==
|
|
57596
|
+
if (result !== "Success") return result;
|
|
57591
57597
|
}
|
|
57592
|
-
return
|
|
57598
|
+
return "Success";
|
|
57593
57599
|
}
|
|
57594
57600
|
isPasteAllowed(target, copiedData, options) {
|
|
57595
57601
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
57596
57602
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
57597
|
-
if (result !==
|
|
57603
|
+
if (result !== "Success") return result;
|
|
57598
57604
|
}
|
|
57599
|
-
return
|
|
57605
|
+
return "Success";
|
|
57600
57606
|
}
|
|
57601
57607
|
isColRowDirtyingClipboard(position, dimension) {
|
|
57602
57608
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -57673,8 +57679,8 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57673
57679
|
}
|
|
57674
57680
|
getClipboardContent() {
|
|
57675
57681
|
return {
|
|
57676
|
-
[
|
|
57677
|
-
[
|
|
57682
|
+
["text/plain"]: this.getPlainTextContent(),
|
|
57683
|
+
["text/html"]: this.getHTMLContent()
|
|
57678
57684
|
};
|
|
57679
57685
|
}
|
|
57680
57686
|
getSheetData() {
|
|
@@ -57807,10 +57813,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
57807
57813
|
allowDispatch(cmd) {
|
|
57808
57814
|
switch (cmd.type) {
|
|
57809
57815
|
case "UPDATE_FILTER":
|
|
57810
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
57816
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
57811
57817
|
break;
|
|
57812
57818
|
}
|
|
57813
|
-
return
|
|
57819
|
+
return "Success";
|
|
57814
57820
|
}
|
|
57815
57821
|
handle(cmd) {
|
|
57816
57822
|
switch (cmd.type) {
|
|
@@ -58024,14 +58030,14 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58024
58030
|
allowDispatch(cmd) {
|
|
58025
58031
|
switch (cmd.type) {
|
|
58026
58032
|
case "ACTIVATE_SHEET": try {
|
|
58027
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
58033
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
58028
58034
|
break;
|
|
58029
58035
|
} catch (error) {
|
|
58030
|
-
return
|
|
58036
|
+
return "InvalidSheetId";
|
|
58031
58037
|
}
|
|
58032
58038
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
58033
58039
|
}
|
|
58034
|
-
return
|
|
58040
|
+
return "Success";
|
|
58035
58041
|
}
|
|
58036
58042
|
handleEvent(event) {
|
|
58037
58043
|
const anchor = event.anchor;
|
|
@@ -58320,7 +58326,8 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58320
58326
|
}, [zone]);
|
|
58321
58327
|
}
|
|
58322
58328
|
setActiveSheet(id) {
|
|
58323
|
-
|
|
58329
|
+
const sheet = this.getters.getSheet(id);
|
|
58330
|
+
this.activeSheet = sheet;
|
|
58324
58331
|
}
|
|
58325
58332
|
activateNextSheet(direction) {
|
|
58326
58333
|
const sheetIds = this.getters.getSheetIds();
|
|
@@ -58458,12 +58465,12 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58458
58465
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
58459
58466
|
const id = cmd.sheetId;
|
|
58460
58467
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
58461
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
58468
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
58462
58469
|
const headers = [cmd.base, ...cmd.elements];
|
|
58463
58470
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
58464
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
58465
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
58466
|
-
return
|
|
58471
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
58472
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
58473
|
+
return "Success";
|
|
58467
58474
|
}
|
|
58468
58475
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
58469
58476
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -58556,6 +58563,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58556
58563
|
//#endregion
|
|
58557
58564
|
//#region src/helpers/internal_viewport.ts
|
|
58558
58565
|
var InternalViewport = class {
|
|
58566
|
+
getters;
|
|
58567
|
+
sheetId;
|
|
58568
|
+
boundaries;
|
|
58559
58569
|
top;
|
|
58560
58570
|
bottom;
|
|
58561
58571
|
left;
|
|
@@ -58893,7 +58903,7 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
58893
58903
|
switch (cmd.type) {
|
|
58894
58904
|
case "SET_VIEWPORT_OFFSET": return this.chainValidations(this.checkScrollingDirection, this.checkIfViewportsWillChange)(cmd);
|
|
58895
58905
|
case "RESIZE_SHEETVIEW": return this.chainValidations(this.checkValuesAreDifferent, this.checkPositiveDimension)(cmd);
|
|
58896
|
-
default: return
|
|
58906
|
+
default: return "Success";
|
|
58897
58907
|
}
|
|
58898
58908
|
}
|
|
58899
58909
|
handleEvent(event) {
|
|
@@ -59301,23 +59311,23 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
59301
59311
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
59302
59312
|
}
|
|
59303
59313
|
checkPositiveDimension(cmd) {
|
|
59304
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
59305
|
-
return
|
|
59314
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
59315
|
+
return "Success";
|
|
59306
59316
|
}
|
|
59307
59317
|
checkValuesAreDifferent(cmd) {
|
|
59308
59318
|
const { height, width } = this.getSheetViewDimension();
|
|
59309
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
59310
|
-
return
|
|
59319
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
59320
|
+
return "Success";
|
|
59311
59321
|
}
|
|
59312
59322
|
checkScrollingDirection({ offsetX, offsetY }) {
|
|
59313
59323
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
59314
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
59315
|
-
return
|
|
59324
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
59325
|
+
return "Success";
|
|
59316
59326
|
}
|
|
59317
59327
|
checkIfViewportsWillChange({ offsetX, offsetY }) {
|
|
59318
59328
|
const sheetId = this.getters.getActiveSheetId();
|
|
59319
59329
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
59320
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
59330
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
59321
59331
|
}
|
|
59322
59332
|
getMainViewport(sheetId) {
|
|
59323
59333
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -59902,9 +59912,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
59902
59912
|
sheetId,
|
|
59903
59913
|
name
|
|
59904
59914
|
});
|
|
59905
|
-
if (result.reasons.includes(
|
|
59906
|
-
else if (result.reasons.includes(
|
|
59907
|
-
else if (result.reasons.includes(
|
|
59915
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
59916
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
59917
|
+
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);
|
|
59908
59918
|
}
|
|
59909
59919
|
|
|
59910
59920
|
//#endregion
|
|
@@ -60116,41 +60126,41 @@ var BottomBarSheet = class extends Component {
|
|
|
60116
60126
|
const selectionStatisticFunctions = [
|
|
60117
60127
|
{
|
|
60118
60128
|
name: _t("Sum"),
|
|
60119
|
-
types: [
|
|
60129
|
+
types: ["number"],
|
|
60120
60130
|
compute: (values, locale) => sum([[values]], locale)
|
|
60121
60131
|
},
|
|
60122
60132
|
{
|
|
60123
60133
|
name: _t("Avg"),
|
|
60124
|
-
types: [
|
|
60134
|
+
types: ["number"],
|
|
60125
60135
|
compute: (values, locale) => average([[values]], locale)
|
|
60126
60136
|
},
|
|
60127
60137
|
{
|
|
60128
60138
|
name: _t("Min"),
|
|
60129
|
-
types: [
|
|
60139
|
+
types: ["number"],
|
|
60130
60140
|
compute: (values, locale) => min([[values]], locale).value
|
|
60131
60141
|
},
|
|
60132
60142
|
{
|
|
60133
60143
|
name: _t("Max"),
|
|
60134
|
-
types: [
|
|
60144
|
+
types: ["number"],
|
|
60135
60145
|
compute: (values, locale) => max([[values]], locale).value
|
|
60136
60146
|
},
|
|
60137
60147
|
{
|
|
60138
60148
|
name: _t("Count"),
|
|
60139
60149
|
types: [
|
|
60140
|
-
|
|
60141
|
-
|
|
60142
|
-
|
|
60143
|
-
|
|
60150
|
+
"number",
|
|
60151
|
+
"text",
|
|
60152
|
+
"boolean",
|
|
60153
|
+
"error"
|
|
60144
60154
|
],
|
|
60145
60155
|
compute: (values) => countAny([[values]])
|
|
60146
60156
|
},
|
|
60147
60157
|
{
|
|
60148
60158
|
name: _t("Count Numbers"),
|
|
60149
60159
|
types: [
|
|
60150
|
-
|
|
60151
|
-
|
|
60152
|
-
|
|
60153
|
-
|
|
60160
|
+
"number",
|
|
60161
|
+
"text",
|
|
60162
|
+
"boolean",
|
|
60163
|
+
"error"
|
|
60154
60164
|
],
|
|
60155
60165
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
60156
60166
|
}
|
|
@@ -60200,7 +60210,7 @@ var AggregateStatisticsStore = class extends SpreadsheetStore {
|
|
|
60200
60210
|
col,
|
|
60201
60211
|
row
|
|
60202
60212
|
});
|
|
60203
|
-
if (evaluatedCell.type !==
|
|
60213
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
60204
60214
|
}
|
|
60205
60215
|
const locale = getters.getLocale();
|
|
60206
60216
|
const statisticFnResults = {};
|
|
@@ -60685,7 +60695,7 @@ var SpreadsheetDashboard = class extends Component {
|
|
|
60685
60695
|
css`
|
|
60686
60696
|
.o-header-group {
|
|
60687
60697
|
.o-header-group-header {
|
|
60688
|
-
z-index: ${
|
|
60698
|
+
z-index: ${6};
|
|
60689
60699
|
.o-group-fold-button {
|
|
60690
60700
|
cursor: pointer;
|
|
60691
60701
|
width: 13px;
|
|
@@ -61471,7 +61481,7 @@ var TopBarComposer = class extends Component {
|
|
|
61471
61481
|
});
|
|
61472
61482
|
return cssPropertiesToCss({
|
|
61473
61483
|
"border-color": SELECTION_BORDER_COLOR,
|
|
61474
|
-
"z-index": String(
|
|
61484
|
+
"z-index": String(30)
|
|
61475
61485
|
});
|
|
61476
61486
|
}
|
|
61477
61487
|
onFocus(selection) {
|
|
@@ -61707,7 +61717,7 @@ css`
|
|
|
61707
61717
|
overflow-y: auto;
|
|
61708
61718
|
overflow-x: hidden;
|
|
61709
61719
|
padding: 2px;
|
|
61710
|
-
z-index: ${
|
|
61720
|
+
z-index: ${21};
|
|
61711
61721
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
61712
61722
|
background-color: white;
|
|
61713
61723
|
|
|
@@ -61846,6 +61856,7 @@ function instantiateClipboard() {
|
|
|
61846
61856
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
61847
61857
|
}
|
|
61848
61858
|
var WebClipboardWrapper = class {
|
|
61859
|
+
clipboard;
|
|
61849
61860
|
constructor(clipboard) {
|
|
61850
61861
|
this.clipboard = clipboard;
|
|
61851
61862
|
}
|
|
@@ -61860,12 +61871,12 @@ var WebClipboardWrapper = class {
|
|
|
61860
61871
|
*/
|
|
61861
61872
|
try {
|
|
61862
61873
|
await this.clipboard?.write([new ClipboardItem({
|
|
61863
|
-
[
|
|
61864
|
-
[
|
|
61874
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
61875
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
61865
61876
|
})]);
|
|
61866
61877
|
} catch (e) {}
|
|
61867
61878
|
}
|
|
61868
|
-
else await this.writeText(clipboardContent[
|
|
61879
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
61869
61880
|
}
|
|
61870
61881
|
async writeText(text) {
|
|
61871
61882
|
try {
|
|
@@ -61890,13 +61901,13 @@ var WebClipboardWrapper = class {
|
|
|
61890
61901
|
}
|
|
61891
61902
|
else return {
|
|
61892
61903
|
status: "ok",
|
|
61893
|
-
content: { [
|
|
61904
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
61894
61905
|
};
|
|
61895
61906
|
}
|
|
61896
61907
|
getClipboardItems(content) {
|
|
61897
61908
|
const clipboardItemData = {
|
|
61898
|
-
[
|
|
61899
|
-
[
|
|
61909
|
+
["text/plain"]: this.getBlob(content, "text/plain"),
|
|
61910
|
+
["text/html"]: this.getBlob(content, "text/html")
|
|
61900
61911
|
};
|
|
61901
61912
|
return [new ClipboardItem(clipboardItemData)];
|
|
61902
61913
|
}
|
|
@@ -62354,6 +62365,8 @@ function inverseCommand(cmd) {
|
|
|
62354
62365
|
* @param operations initial operations
|
|
62355
62366
|
*/
|
|
62356
62367
|
var Branch = class Branch {
|
|
62368
|
+
buildTransformation;
|
|
62369
|
+
operations;
|
|
62357
62370
|
constructor(buildTransformation, operations = []) {
|
|
62358
62371
|
this.buildTransformation = buildTransformation;
|
|
62359
62372
|
this.operations = operations;
|
|
@@ -62470,6 +62483,8 @@ var Branch = class Branch {
|
|
|
62470
62483
|
* to revert it).
|
|
62471
62484
|
*/
|
|
62472
62485
|
var Operation = class {
|
|
62486
|
+
id;
|
|
62487
|
+
data;
|
|
62473
62488
|
constructor(id, data) {
|
|
62474
62489
|
this.id = id;
|
|
62475
62490
|
this.data = data;
|
|
@@ -62479,6 +62494,8 @@ var Operation = class {
|
|
|
62479
62494
|
}
|
|
62480
62495
|
};
|
|
62481
62496
|
var LazyOperation = class LazyOperation {
|
|
62497
|
+
id;
|
|
62498
|
+
lazyData;
|
|
62482
62499
|
constructor(id, lazyData) {
|
|
62483
62500
|
this.id = id;
|
|
62484
62501
|
this.lazyData = lazyData;
|
|
@@ -62504,6 +62521,7 @@ var LazyOperation = class LazyOperation {
|
|
|
62504
62521
|
* ```
|
|
62505
62522
|
*/
|
|
62506
62523
|
var OperationSequence = class OperationSequence {
|
|
62524
|
+
operations;
|
|
62507
62525
|
constructor(operations) {
|
|
62508
62526
|
this.operations = operations;
|
|
62509
62527
|
}
|
|
@@ -62579,6 +62597,7 @@ var OperationSequence = class OperationSequence {
|
|
|
62579
62597
|
*
|
|
62580
62598
|
*/
|
|
62581
62599
|
var Tree = class {
|
|
62600
|
+
buildTransformation;
|
|
62582
62601
|
branches;
|
|
62583
62602
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
62584
62603
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -63161,6 +63180,7 @@ var EventStream = class {
|
|
|
63161
63180
|
* with the new selected anchor
|
|
63162
63181
|
*/
|
|
63163
63182
|
var SelectionStreamProcessorImpl = class {
|
|
63183
|
+
getters;
|
|
63164
63184
|
stream;
|
|
63165
63185
|
/**
|
|
63166
63186
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -63259,7 +63279,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63259
63279
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
63260
63280
|
*/
|
|
63261
63281
|
moveAnchorCell(direction, step = 1) {
|
|
63262
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63282
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63263
63283
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
63264
63284
|
return this.selectCell(col, row);
|
|
63265
63285
|
}
|
|
@@ -63321,7 +63341,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63321
63341
|
* of the anchor zone which moves.
|
|
63322
63342
|
*/
|
|
63323
63343
|
resizeAnchorZone(direction, step = 1) {
|
|
63324
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63344
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63325
63345
|
const sheetId = this.getters.getActiveSheetId();
|
|
63326
63346
|
const anchor = this.anchor;
|
|
63327
63347
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -63568,7 +63588,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63568
63588
|
previousAnchor: deepCopy(this.anchor)
|
|
63569
63589
|
};
|
|
63570
63590
|
const commandResult = this.checkEventAnchorZone(event);
|
|
63571
|
-
if (commandResult !==
|
|
63591
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
63572
63592
|
this.anchor = event.anchor;
|
|
63573
63593
|
this.stream.send(event);
|
|
63574
63594
|
return DispatchResult.Success;
|
|
@@ -63578,15 +63598,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63578
63598
|
}
|
|
63579
63599
|
checkAnchorZone(anchor) {
|
|
63580
63600
|
const { cell, zone } = anchor;
|
|
63581
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
63601
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
63582
63602
|
const { left, right, top, bottom } = zone;
|
|
63583
63603
|
const sheetId = this.getters.getActiveSheetId();
|
|
63584
63604
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
63585
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
63586
|
-
return
|
|
63605
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
63606
|
+
return "Success";
|
|
63587
63607
|
}
|
|
63588
63608
|
checkAnchorZoneOrThrow(anchor) {
|
|
63589
|
-
if (this.checkAnchorZone(anchor) ===
|
|
63609
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
|
|
63590
63610
|
}
|
|
63591
63611
|
/**
|
|
63592
63612
|
* ---- PRIVATE ----
|
|
@@ -63743,7 +63763,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63743
63763
|
isCellSkippableInCluster(position) {
|
|
63744
63764
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
63745
63765
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
63746
|
-
return cell.type ===
|
|
63766
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
63747
63767
|
}
|
|
63748
63768
|
};
|
|
63749
63769
|
|
|
@@ -65666,13 +65686,6 @@ function purgeSingleRowTables(data) {
|
|
|
65666
65686
|
|
|
65667
65687
|
//#endregion
|
|
65668
65688
|
//#region src/model.ts
|
|
65669
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
65670
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
65671
|
-
Status[Status["Running"] = 1] = "Running";
|
|
65672
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
65673
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
65674
|
-
return Status;
|
|
65675
|
-
}(Status || {});
|
|
65676
65689
|
var Model = class extends EventBus {
|
|
65677
65690
|
corePlugins = [];
|
|
65678
65691
|
featurePlugins = [];
|
|
@@ -65696,7 +65709,7 @@ var Model = class extends EventBus {
|
|
|
65696
65709
|
/**
|
|
65697
65710
|
* Internal status of the model. Important for command handling coordination
|
|
65698
65711
|
*/
|
|
65699
|
-
status =
|
|
65712
|
+
status = 0;
|
|
65700
65713
|
/**
|
|
65701
65714
|
* The config object contains some configuration flag and callbacks
|
|
65702
65715
|
*/
|
|
@@ -65833,7 +65846,7 @@ var Model = class extends EventBus {
|
|
|
65833
65846
|
onRemoteRevisionReceived({ commands }) {
|
|
65834
65847
|
for (const command of commands) {
|
|
65835
65848
|
const previousStatus = this.status;
|
|
65836
|
-
this.status =
|
|
65849
|
+
this.status = 2;
|
|
65837
65850
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
65838
65851
|
this.status = previousStatus;
|
|
65839
65852
|
}
|
|
@@ -65931,7 +65944,7 @@ var Model = class extends EventBus {
|
|
|
65931
65944
|
*/
|
|
65932
65945
|
checkDispatchAllowed(command) {
|
|
65933
65946
|
const results = isCoreCommand(command) ? this.checkDispatchAllowedCoreCommand(command) : this.checkDispatchAllowedLocalCommand(command);
|
|
65934
|
-
if (results.some((r) => r !==
|
|
65947
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
65935
65948
|
return DispatchResult.Success;
|
|
65936
65949
|
}
|
|
65937
65950
|
checkDispatchAllowedCoreCommand(command) {
|
|
@@ -65943,9 +65956,9 @@ var Model = class extends EventBus {
|
|
|
65943
65956
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
65944
65957
|
}
|
|
65945
65958
|
finalize() {
|
|
65946
|
-
this.status =
|
|
65959
|
+
this.status = 3;
|
|
65947
65960
|
for (const h of this.handlers) h.finalize();
|
|
65948
|
-
this.status =
|
|
65961
|
+
this.status = 0;
|
|
65949
65962
|
this.trigger("command-finalized");
|
|
65950
65963
|
}
|
|
65951
65964
|
/**
|
|
@@ -65972,16 +65985,16 @@ var Model = class extends EventBus {
|
|
|
65972
65985
|
dispatch = (type, payload) => {
|
|
65973
65986
|
const command = createCommand(type, payload);
|
|
65974
65987
|
const status = this.status;
|
|
65975
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
65976
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
65988
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
65989
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
65977
65990
|
switch (status) {
|
|
65978
|
-
case
|
|
65991
|
+
case 0:
|
|
65979
65992
|
const result = this.checkDispatchAllowed(command);
|
|
65980
65993
|
if (!result.isSuccessful) {
|
|
65981
65994
|
this.trigger("update");
|
|
65982
65995
|
return result;
|
|
65983
65996
|
}
|
|
65984
|
-
this.status =
|
|
65997
|
+
this.status = 1;
|
|
65985
65998
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
65986
65999
|
const start = performance.now();
|
|
65987
66000
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -65991,10 +66004,10 @@ var Model = class extends EventBus {
|
|
|
65991
66004
|
if (time > 5) console.debug(type, time, "ms");
|
|
65992
66005
|
});
|
|
65993
66006
|
this.session.save(command, commands, changes);
|
|
65994
|
-
this.status =
|
|
66007
|
+
this.status = 0;
|
|
65995
66008
|
this.trigger("update");
|
|
65996
66009
|
break;
|
|
65997
|
-
case
|
|
66010
|
+
case 1:
|
|
65998
66011
|
if (isCoreCommand(command)) {
|
|
65999
66012
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
66000
66013
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -66002,8 +66015,8 @@ var Model = class extends EventBus {
|
|
|
66002
66015
|
}
|
|
66003
66016
|
this.dispatchToHandlers(this.handlers, command);
|
|
66004
66017
|
break;
|
|
66005
|
-
case
|
|
66006
|
-
case
|
|
66018
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
66019
|
+
case 2:
|
|
66007
66020
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
66008
66021
|
this.dispatchToHandlers(this.handlers, command);
|
|
66009
66022
|
}
|
|
@@ -66016,7 +66029,7 @@ var Model = class extends EventBus {
|
|
|
66016
66029
|
dispatchFromCorePlugin = (type, payload) => {
|
|
66017
66030
|
const command = createCommand(type, payload);
|
|
66018
66031
|
const previousStatus = this.status;
|
|
66019
|
-
this.status =
|
|
66032
|
+
this.status = 2;
|
|
66020
66033
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
66021
66034
|
this.dispatchToHandlers(handlers, command);
|
|
66022
66035
|
this.status = previousStatus;
|
|
@@ -66316,6 +66329,6 @@ const constants = {
|
|
|
66316
66329
|
//#endregion
|
|
66317
66330
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
66318
66331
|
|
|
66319
|
-
__info__.version = "18.0.
|
|
66320
|
-
__info__.date = "2026-
|
|
66321
|
-
__info__.hash = "
|
|
66332
|
+
__info__.version = "18.0.70";
|
|
66333
|
+
__info__.date = "2026-06-06T06:20:39.985Z";
|
|
66334
|
+
__info__.hash = "3ff29f6";
|