@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
|
(function(exports, _odoo_owl) {
|
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
17
17
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
18
|
var __getProtoOf = Object.getPrototypeOf;
|
|
19
19
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
20
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
21
21
|
var __exportAll = (all, no_symbols) => {
|
|
22
22
|
let target = {};
|
|
23
23
|
for (var name in all) {
|
|
@@ -338,22 +338,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
338
338
|
"]"
|
|
339
339
|
];
|
|
340
340
|
const FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX = /'|\*|\?|\/|\\|\[|\]/;
|
|
341
|
-
let ComponentsImportance = /* @__PURE__ */ function(ComponentsImportance) {
|
|
342
|
-
ComponentsImportance[ComponentsImportance["Grid"] = 0] = "Grid";
|
|
343
|
-
ComponentsImportance[ComponentsImportance["Highlight"] = 5] = "Highlight";
|
|
344
|
-
ComponentsImportance[ComponentsImportance["HeaderGroupingButton"] = 6] = "HeaderGroupingButton";
|
|
345
|
-
ComponentsImportance[ComponentsImportance["Figure"] = 10] = "Figure";
|
|
346
|
-
ComponentsImportance[ComponentsImportance["ScrollBar"] = 15] = "ScrollBar";
|
|
347
|
-
ComponentsImportance[ComponentsImportance["GridPopover"] = 19] = "GridPopover";
|
|
348
|
-
ComponentsImportance[ComponentsImportance["GridComposer"] = 20] = "GridComposer";
|
|
349
|
-
ComponentsImportance[ComponentsImportance["Dropdown"] = 21] = "Dropdown";
|
|
350
|
-
ComponentsImportance[ComponentsImportance["IconPicker"] = 25] = "IconPicker";
|
|
351
|
-
ComponentsImportance[ComponentsImportance["TopBarComposer"] = 30] = "TopBarComposer";
|
|
352
|
-
ComponentsImportance[ComponentsImportance["Popover"] = 35] = "Popover";
|
|
353
|
-
ComponentsImportance[ComponentsImportance["FigureAnchor"] = 1e3] = "FigureAnchor";
|
|
354
|
-
ComponentsImportance[ComponentsImportance["FigureSnapLine"] = 1001] = "FigureSnapLine";
|
|
355
|
-
return ComponentsImportance;
|
|
356
|
-
}({});
|
|
357
341
|
let DEFAULT_SHEETVIEW_SIZE = 0;
|
|
358
342
|
function getDefaultSheetViewSize() {
|
|
359
343
|
return DEFAULT_SHEETVIEW_SIZE;
|
|
@@ -834,7 +818,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
834
818
|
}
|
|
835
819
|
shift() {
|
|
836
820
|
const current = this.current;
|
|
837
|
-
|
|
821
|
+
const next = this.text[++this.currentIndex];
|
|
822
|
+
this.current = next;
|
|
838
823
|
return current;
|
|
839
824
|
}
|
|
840
825
|
advanceBy(length) {
|
|
@@ -1269,6 +1254,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1269
1254
|
else return COLORS_XL;
|
|
1270
1255
|
}
|
|
1271
1256
|
var ColorGenerator = class {
|
|
1257
|
+
preferredColors;
|
|
1272
1258
|
currentColorIndex = 0;
|
|
1273
1259
|
palette;
|
|
1274
1260
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -1686,6 +1672,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1686
1672
|
return sprintf(_translate(s), ...values);
|
|
1687
1673
|
};
|
|
1688
1674
|
var LazyTranslatedString = class extends String {
|
|
1675
|
+
values;
|
|
1689
1676
|
constructor(str, values) {
|
|
1690
1677
|
super(str);
|
|
1691
1678
|
this.values = values;
|
|
@@ -2786,25 +2773,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2786
2773
|
return sortedValues[indexSup] * (percentIndex - indexLow) + sortedValues[indexLow] * (indexSup - percentIndex);
|
|
2787
2774
|
}
|
|
2788
2775
|
|
|
2789
|
-
//#endregion
|
|
2790
|
-
//#region src/types/cells.ts
|
|
2791
|
-
let CellValueType = /* @__PURE__ */ function(CellValueType) {
|
|
2792
|
-
CellValueType["boolean"] = "boolean";
|
|
2793
|
-
CellValueType["number"] = "number";
|
|
2794
|
-
CellValueType["text"] = "text";
|
|
2795
|
-
CellValueType["empty"] = "empty";
|
|
2796
|
-
CellValueType["error"] = "error";
|
|
2797
|
-
return CellValueType;
|
|
2798
|
-
}({});
|
|
2799
|
-
|
|
2800
|
-
//#endregion
|
|
2801
|
-
//#region src/types/clipboard.ts
|
|
2802
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
2803
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
2804
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
2805
|
-
return ClipboardMIMEType;
|
|
2806
|
-
}({});
|
|
2807
|
-
|
|
2808
2776
|
//#endregion
|
|
2809
2777
|
//#region src/types/commands.ts
|
|
2810
2778
|
function isSheetDependent(cmd) {
|
|
@@ -2966,7 +2934,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2966
2934
|
constructor(results = []) {
|
|
2967
2935
|
if (!Array.isArray(results)) results = [results];
|
|
2968
2936
|
results = [...new Set(results)];
|
|
2969
|
-
this.reasons = results.filter((result) => result !==
|
|
2937
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
2970
2938
|
}
|
|
2971
2939
|
/**
|
|
2972
2940
|
* Static helper which returns a successful DispatchResult
|
|
@@ -3150,13 +3118,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3150
3118
|
function isMatrix(x) {
|
|
3151
3119
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
3152
3120
|
}
|
|
3153
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
3154
|
-
DIRECTION["UP"] = "up";
|
|
3155
|
-
DIRECTION["DOWN"] = "down";
|
|
3156
|
-
DIRECTION["LEFT"] = "left";
|
|
3157
|
-
DIRECTION["RIGHT"] = "right";
|
|
3158
|
-
return DIRECTION;
|
|
3159
|
-
}({});
|
|
3160
3121
|
|
|
3161
3122
|
//#endregion
|
|
3162
3123
|
//#region src/types/rendering.ts
|
|
@@ -3195,6 +3156,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3195
3156
|
};
|
|
3196
3157
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3197
3158
|
var EvaluationError = class {
|
|
3159
|
+
message;
|
|
3160
|
+
value;
|
|
3198
3161
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3199
3162
|
this.message = message;
|
|
3200
3163
|
this.value = value;
|
|
@@ -3893,7 +3856,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3893
3856
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
3894
3857
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
3895
3858
|
sheetIdTo: sheetId
|
|
3896
|
-
}).isCancelledBecause(
|
|
3859
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
3897
3860
|
type: "warning",
|
|
3898
3861
|
sticky: false,
|
|
3899
3862
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -3928,6 +3891,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3928
3891
|
//#endregion
|
|
3929
3892
|
//#region src/helpers/format/format_tokenizer.ts
|
|
3930
3893
|
function tokenizeFormat(str) {
|
|
3894
|
+
str = str.replace(/\s/g, " ");
|
|
3931
3895
|
const chars = new TokenizingChars(str);
|
|
3932
3896
|
const result = [];
|
|
3933
3897
|
let currentFormatPart = [];
|
|
@@ -4865,7 +4829,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4865
4829
|
value,
|
|
4866
4830
|
format,
|
|
4867
4831
|
formattedValue,
|
|
4868
|
-
type:
|
|
4832
|
+
type: "text",
|
|
4869
4833
|
isAutoSummable: true,
|
|
4870
4834
|
defaultAlign: "left"
|
|
4871
4835
|
};
|
|
@@ -4875,7 +4839,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4875
4839
|
value: value || 0,
|
|
4876
4840
|
format,
|
|
4877
4841
|
formattedValue,
|
|
4878
|
-
type:
|
|
4842
|
+
type: "number",
|
|
4879
4843
|
isAutoSummable: true,
|
|
4880
4844
|
defaultAlign: "right"
|
|
4881
4845
|
};
|
|
@@ -4885,7 +4849,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4885
4849
|
value: null,
|
|
4886
4850
|
format,
|
|
4887
4851
|
formattedValue: "",
|
|
4888
|
-
type:
|
|
4852
|
+
type: "empty",
|
|
4889
4853
|
isAutoSummable: true,
|
|
4890
4854
|
defaultAlign: "left"
|
|
4891
4855
|
};
|
|
@@ -4895,7 +4859,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4895
4859
|
value,
|
|
4896
4860
|
format,
|
|
4897
4861
|
formattedValue,
|
|
4898
|
-
type:
|
|
4862
|
+
type: "number",
|
|
4899
4863
|
isAutoSummable: false,
|
|
4900
4864
|
defaultAlign: "right"
|
|
4901
4865
|
};
|
|
@@ -4905,7 +4869,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4905
4869
|
value,
|
|
4906
4870
|
format,
|
|
4907
4871
|
formattedValue,
|
|
4908
|
-
type:
|
|
4872
|
+
type: "boolean",
|
|
4909
4873
|
isAutoSummable: false,
|
|
4910
4874
|
defaultAlign: "center"
|
|
4911
4875
|
};
|
|
@@ -4915,7 +4879,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4915
4879
|
value,
|
|
4916
4880
|
formattedValue: value,
|
|
4917
4881
|
message,
|
|
4918
|
-
type:
|
|
4882
|
+
type: "error",
|
|
4919
4883
|
isAutoSummable: false,
|
|
4920
4884
|
defaultAlign: "center"
|
|
4921
4885
|
};
|
|
@@ -5058,6 +5022,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5058
5022
|
//#endregion
|
|
5059
5023
|
//#region src/helpers/range.ts
|
|
5060
5024
|
var RangeImpl = class RangeImpl {
|
|
5025
|
+
getSheetSize;
|
|
5061
5026
|
_zone;
|
|
5062
5027
|
parts;
|
|
5063
5028
|
invalidXc;
|
|
@@ -5689,10 +5654,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5689
5654
|
return target.map((t) => splitZoneForPaste(t, width, height)).flat();
|
|
5690
5655
|
}
|
|
5691
5656
|
function parseOSClipboardContent(content) {
|
|
5692
|
-
if (!content[
|
|
5693
|
-
const htmlDocument = new DOMParser().parseFromString(content[
|
|
5657
|
+
if (!content["text/html"]) return { text: content["text/plain"] };
|
|
5658
|
+
const htmlDocument = new DOMParser().parseFromString(content["text/html"], "text/html");
|
|
5694
5659
|
return {
|
|
5695
|
-
text: content[
|
|
5660
|
+
text: content["text/plain"],
|
|
5696
5661
|
data: getOSheetDataFromHTML(htmlDocument)
|
|
5697
5662
|
};
|
|
5698
5663
|
}
|
|
@@ -5759,6 +5724,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5759
5724
|
//#endregion
|
|
5760
5725
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
5761
5726
|
var ClipboardHandler = class {
|
|
5727
|
+
getters;
|
|
5728
|
+
dispatch;
|
|
5762
5729
|
constructor(getters, dispatch) {
|
|
5763
5730
|
this.getters = getters;
|
|
5764
5731
|
this.dispatch = dispatch;
|
|
@@ -5766,10 +5733,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5766
5733
|
copy(data, mode = "copyPaste") {}
|
|
5767
5734
|
paste(target, clippedContent, options) {}
|
|
5768
5735
|
isPasteAllowed(sheetId, target, content, option) {
|
|
5769
|
-
return
|
|
5736
|
+
return "Success";
|
|
5770
5737
|
}
|
|
5771
5738
|
isCutAllowed(data) {
|
|
5772
|
-
return
|
|
5739
|
+
return "Success";
|
|
5773
5740
|
}
|
|
5774
5741
|
getPasteTarget(sheetId, target, content, options) {
|
|
5775
5742
|
return {
|
|
@@ -7220,8 +7187,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7220
7187
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
7221
7188
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7222
7189
|
isCutAllowed(data) {
|
|
7223
|
-
if (data.zones.length !== 1) return
|
|
7224
|
-
return
|
|
7190
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
7191
|
+
return "Success";
|
|
7225
7192
|
}
|
|
7226
7193
|
copy(data, mode = "copyPaste") {
|
|
7227
7194
|
const sheetId = data.sheetId;
|
|
@@ -7289,17 +7256,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7289
7256
|
};
|
|
7290
7257
|
}
|
|
7291
7258
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
7292
|
-
if (!content.cells) return
|
|
7293
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
7259
|
+
if (!content.cells) return "Success";
|
|
7260
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
7294
7261
|
if (target.length > 1) {
|
|
7295
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
7262
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
7296
7263
|
}
|
|
7297
7264
|
const clipboardHeight = content.cells.length;
|
|
7298
7265
|
const clipboardWidth = content.cells[0].length;
|
|
7299
7266
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
7300
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
7267
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
7301
7268
|
}
|
|
7302
|
-
return
|
|
7269
|
+
return "Success";
|
|
7303
7270
|
}
|
|
7304
7271
|
/**
|
|
7305
7272
|
* Paste the clipboard content in the given target
|
|
@@ -7481,9 +7448,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7481
7448
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7482
7449
|
}
|
|
7483
7450
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7484
|
-
if (target.length === 0) return
|
|
7485
|
-
if (option?.pasteOption !== void 0) return
|
|
7486
|
-
return
|
|
7451
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7452
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7453
|
+
return "Success";
|
|
7487
7454
|
}
|
|
7488
7455
|
};
|
|
7489
7456
|
|
|
@@ -7782,9 +7749,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7782
7749
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7783
7750
|
}
|
|
7784
7751
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7785
|
-
if (target.length === 0) return
|
|
7786
|
-
if (option?.pasteOption !== void 0) return
|
|
7787
|
-
return
|
|
7752
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7753
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7754
|
+
return "Success";
|
|
7788
7755
|
}
|
|
7789
7756
|
};
|
|
7790
7757
|
|
|
@@ -7879,10 +7846,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7879
7846
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
7880
7847
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7881
7848
|
isPasteAllowed(sheetId, target, content, options) {
|
|
7882
|
-
if (!("cells" in content)) return
|
|
7849
|
+
if (!("cells" in content)) return "Success";
|
|
7883
7850
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
7884
|
-
for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
7885
|
-
return
|
|
7851
|
+
for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
7852
|
+
return "Success";
|
|
7886
7853
|
}
|
|
7887
7854
|
};
|
|
7888
7855
|
|
|
@@ -8134,6 +8101,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
8134
8101
|
}
|
|
8135
8102
|
};
|
|
8136
8103
|
var StoreFactory = class {
|
|
8104
|
+
get;
|
|
8137
8105
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
8138
8106
|
constructor(get) {
|
|
8139
8107
|
this.get = get;
|
|
@@ -8178,6 +8146,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8178
8146
|
return MetaStore;
|
|
8179
8147
|
}
|
|
8180
8148
|
var DisposableStore = class {
|
|
8149
|
+
get;
|
|
8181
8150
|
disposeCallbacks = [];
|
|
8182
8151
|
constructor(get) {
|
|
8183
8152
|
this.get = get;
|
|
@@ -8555,16 +8524,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8555
8524
|
}
|
|
8556
8525
|
function checkDataset(definition) {
|
|
8557
8526
|
if (definition.dataSets) {
|
|
8558
|
-
if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
8559
|
-
if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
8527
|
+
if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
8528
|
+
if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
8560
8529
|
}
|
|
8561
|
-
return
|
|
8530
|
+
return "Success";
|
|
8562
8531
|
}
|
|
8563
8532
|
function checkLabelRange(definition) {
|
|
8564
8533
|
if (definition.labelRange) {
|
|
8565
|
-
if (!rangeReference.test(definition.labelRange || "")) return
|
|
8534
|
+
if (!rangeReference.test(definition.labelRange || "")) return "InvalidLabelRange";
|
|
8566
8535
|
}
|
|
8567
|
-
return
|
|
8536
|
+
return "Success";
|
|
8568
8537
|
}
|
|
8569
8538
|
function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
8570
8539
|
if (!dataSetsHaveTitle) return false;
|
|
@@ -8881,6 +8850,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8881
8850
|
* Represent a raw XML string
|
|
8882
8851
|
*/
|
|
8883
8852
|
var XMLString = class {
|
|
8853
|
+
xmlString;
|
|
8884
8854
|
/**
|
|
8885
8855
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
8886
8856
|
*/
|
|
@@ -8994,6 +8964,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8994
8964
|
ROUNDDOWN: [{
|
|
8995
8965
|
type: "NUMBER",
|
|
8996
8966
|
value: 0
|
|
8967
|
+
}],
|
|
8968
|
+
IFERROR: [{
|
|
8969
|
+
type: "NUMBER",
|
|
8970
|
+
value: 0
|
|
8997
8971
|
}]
|
|
8998
8972
|
};
|
|
8999
8973
|
/**
|
|
@@ -9434,30 +9408,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9434
9408
|
|
|
9435
9409
|
//#endregion
|
|
9436
9410
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
9437
|
-
/**
|
|
9438
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
9439
|
-
*/
|
|
9440
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
9441
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
9442
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
9443
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
9444
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
9445
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
9446
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
9447
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
9448
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
9449
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
9450
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
9451
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
9452
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
9453
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
9454
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
9455
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
9456
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
9457
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
9458
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
9459
|
-
return WarningTypes;
|
|
9460
|
-
}({});
|
|
9461
9411
|
var XLSXImportWarningManager = class {
|
|
9462
9412
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
9463
9413
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -9946,7 +9896,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9946
9896
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
9947
9897
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
9948
9898
|
} catch (e) {}
|
|
9949
|
-
warningManager.generateNotSupportedWarning(
|
|
9899
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
9950
9900
|
}
|
|
9951
9901
|
function isFormatSupported(format) {
|
|
9952
9902
|
try {
|
|
@@ -10030,20 +9980,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10030
9980
|
return arrayToObject(formats, 1);
|
|
10031
9981
|
}
|
|
10032
9982
|
function addStyleWarnings(font, fill, warningManager) {
|
|
10033
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
10034
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
9983
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
9984
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
10035
9985
|
}
|
|
10036
9986
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
10037
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
9987
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
10038
9988
|
}
|
|
10039
9989
|
function addBorderWarnings(border, warningManager) {
|
|
10040
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
9990
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
10041
9991
|
}
|
|
10042
9992
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
10043
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9993
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
10044
9994
|
}
|
|
10045
9995
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
10046
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9996
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
10047
9997
|
}
|
|
10048
9998
|
|
|
10049
9999
|
//#endregion
|
|
@@ -10183,7 +10133,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10183
10133
|
lower: icons.upper
|
|
10184
10134
|
};
|
|
10185
10135
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
10186
|
-
warningManager.generateNotSupportedWarning(
|
|
10136
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
10187
10137
|
switch (key) {
|
|
10188
10138
|
case "upper":
|
|
10189
10139
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -10219,13 +10169,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10219
10169
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
10220
10170
|
}
|
|
10221
10171
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
10222
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
10223
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
10172
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
10173
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
10224
10174
|
if (cf.cfRules[0].dxfId) {
|
|
10225
10175
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
10226
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
10227
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
10228
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
10176
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
10177
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
10178
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
10229
10179
|
}
|
|
10230
10180
|
}
|
|
10231
10181
|
|
|
@@ -10565,13 +10515,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10565
10515
|
if (!dv) continue;
|
|
10566
10516
|
switch (dv.type) {
|
|
10567
10517
|
case "time":
|
|
10568
|
-
warningManager.generateNotSupportedWarning(
|
|
10518
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
10569
10519
|
break;
|
|
10570
10520
|
case "textLength":
|
|
10571
|
-
warningManager.generateNotSupportedWarning(
|
|
10521
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
10572
10522
|
break;
|
|
10573
10523
|
case "whole":
|
|
10574
|
-
warningManager.generateNotSupportedWarning(
|
|
10524
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
10575
10525
|
break;
|
|
10576
10526
|
case "decimal":
|
|
10577
10527
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -10583,7 +10533,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10583
10533
|
break;
|
|
10584
10534
|
case "date":
|
|
10585
10535
|
if (dv.operator === "notEqual") {
|
|
10586
|
-
warningManager.generateNotSupportedWarning(
|
|
10536
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
10587
10537
|
break;
|
|
10588
10538
|
}
|
|
10589
10539
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -10889,7 +10839,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10889
10839
|
}
|
|
10890
10840
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
10891
10841
|
const label = link.display || cellValue;
|
|
10892
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
10842
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
10893
10843
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
10894
10844
|
}
|
|
10895
10845
|
function getSheetDims(sheet) {
|
|
@@ -13174,46 +13124,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13174
13124
|
|
|
13175
13125
|
//#endregion
|
|
13176
13126
|
//#region src/formulas/range_tokenizer.ts
|
|
13177
|
-
var State = /* @__PURE__ */ function(State) {
|
|
13178
|
-
/**
|
|
13179
|
-
* Initial state.
|
|
13180
|
-
* Expecting any reference for the left part of a range
|
|
13181
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
13182
|
-
*/
|
|
13183
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
13184
|
-
/**
|
|
13185
|
-
* Expecting any reference for the right part of a range
|
|
13186
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
13187
|
-
*/
|
|
13188
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
13189
|
-
/**
|
|
13190
|
-
* Expecting the separator without any constraint on the right part
|
|
13191
|
-
*/
|
|
13192
|
-
State[State["Separator"] = 2] = "Separator";
|
|
13193
|
-
/**
|
|
13194
|
-
* Expecting the separator for a full column range
|
|
13195
|
-
*/
|
|
13196
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
13197
|
-
/**
|
|
13198
|
-
* Expecting the separator for a full row range
|
|
13199
|
-
*/
|
|
13200
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
13201
|
-
/**
|
|
13202
|
-
* Expecting the right part of a full column range
|
|
13203
|
-
* e.g. "1", "A1"
|
|
13204
|
-
*/
|
|
13205
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
13206
|
-
/**
|
|
13207
|
-
* Expecting the right part of a full row range
|
|
13208
|
-
* e.g. "A", "A1"
|
|
13209
|
-
*/
|
|
13210
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
13211
|
-
/**
|
|
13212
|
-
* Final state. A range has been matched
|
|
13213
|
-
*/
|
|
13214
|
-
State[State["Found"] = 7] = "Found";
|
|
13215
|
-
return State;
|
|
13216
|
-
}(State || {});
|
|
13217
13127
|
const goTo = (state, guard = () => true) => [{
|
|
13218
13128
|
goTo: state,
|
|
13219
13129
|
guard
|
|
@@ -13223,41 +13133,41 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13223
13133
|
guard
|
|
13224
13134
|
});
|
|
13225
13135
|
const machine = {
|
|
13226
|
-
[
|
|
13227
|
-
REFERENCE: goTo(
|
|
13228
|
-
NUMBER: goTo(
|
|
13229
|
-
SYMBOL: [goToMulti(
|
|
13230
|
-
},
|
|
13231
|
-
[
|
|
13232
|
-
SPACE: goTo(
|
|
13233
|
-
OPERATOR: goTo(
|
|
13234
|
-
},
|
|
13235
|
-
[
|
|
13236
|
-
SPACE: goTo(
|
|
13237
|
-
OPERATOR: goTo(
|
|
13238
|
-
},
|
|
13239
|
-
[
|
|
13240
|
-
SPACE: goTo(
|
|
13241
|
-
OPERATOR: goTo(
|
|
13242
|
-
},
|
|
13243
|
-
[
|
|
13244
|
-
SPACE: goTo(
|
|
13245
|
-
NUMBER: goTo(
|
|
13246
|
-
REFERENCE: goTo(
|
|
13247
|
-
SYMBOL: goTo(
|
|
13248
|
-
},
|
|
13249
|
-
[
|
|
13250
|
-
SPACE: goTo(
|
|
13251
|
-
SYMBOL: goTo(
|
|
13252
|
-
REFERENCE: goTo(
|
|
13253
|
-
},
|
|
13254
|
-
[
|
|
13255
|
-
SPACE: goTo(
|
|
13256
|
-
NUMBER: goTo(
|
|
13257
|
-
REFERENCE: goTo(
|
|
13258
|
-
SYMBOL: goTo(
|
|
13259
|
-
},
|
|
13260
|
-
[
|
|
13136
|
+
[0]: {
|
|
13137
|
+
REFERENCE: goTo(2),
|
|
13138
|
+
NUMBER: goTo(4),
|
|
13139
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
13140
|
+
},
|
|
13141
|
+
[3]: {
|
|
13142
|
+
SPACE: goTo(3),
|
|
13143
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
13144
|
+
},
|
|
13145
|
+
[4]: {
|
|
13146
|
+
SPACE: goTo(4),
|
|
13147
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
13148
|
+
},
|
|
13149
|
+
[2]: {
|
|
13150
|
+
SPACE: goTo(2),
|
|
13151
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
13152
|
+
},
|
|
13153
|
+
[1]: {
|
|
13154
|
+
SPACE: goTo(1),
|
|
13155
|
+
NUMBER: goTo(7),
|
|
13156
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13157
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
13158
|
+
},
|
|
13159
|
+
[5]: {
|
|
13160
|
+
SPACE: goTo(5),
|
|
13161
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
13162
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
13163
|
+
},
|
|
13164
|
+
[6]: {
|
|
13165
|
+
SPACE: goTo(6),
|
|
13166
|
+
NUMBER: goTo(7),
|
|
13167
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13168
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
13169
|
+
},
|
|
13170
|
+
[7]: {}
|
|
13261
13171
|
};
|
|
13262
13172
|
/**
|
|
13263
13173
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -13267,7 +13177,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13267
13177
|
*/
|
|
13268
13178
|
function matchReference(tokens) {
|
|
13269
13179
|
let head = 0;
|
|
13270
|
-
let transitions = machine[
|
|
13180
|
+
let transitions = machine[0];
|
|
13271
13181
|
let matchedTokens = "";
|
|
13272
13182
|
while (transitions !== void 0) {
|
|
13273
13183
|
const token = tokens[head++];
|
|
@@ -13276,7 +13186,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13276
13186
|
const nextState = transition ? transition.goTo : void 0;
|
|
13277
13187
|
switch (nextState) {
|
|
13278
13188
|
case void 0: return null;
|
|
13279
|
-
case
|
|
13189
|
+
case 7:
|
|
13280
13190
|
matchedTokens += token.value;
|
|
13281
13191
|
tokens.splice(0, head);
|
|
13282
13192
|
return {
|
|
@@ -13981,10 +13891,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13981
13891
|
};
|
|
13982
13892
|
function handlePasteResult(env, result) {
|
|
13983
13893
|
if (!result.isSuccessful) {
|
|
13984
|
-
if (result.reasons.includes(
|
|
13985
|
-
else if (result.reasons.includes(
|
|
13986
|
-
else if (result.reasons.includes(
|
|
13987
|
-
else if (result.reasons.includes(
|
|
13894
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
13895
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
13896
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
13897
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
13988
13898
|
}
|
|
13989
13899
|
}
|
|
13990
13900
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -14010,25 +13920,25 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14010
13920
|
//#region src/components/translations_terms.ts
|
|
14011
13921
|
const CfTerms = {
|
|
14012
13922
|
Errors: {
|
|
14013
|
-
[
|
|
14014
|
-
[
|
|
14015
|
-
[
|
|
14016
|
-
[
|
|
14017
|
-
[
|
|
14018
|
-
[
|
|
14019
|
-
[
|
|
14020
|
-
[
|
|
14021
|
-
[
|
|
14022
|
-
[
|
|
14023
|
-
[
|
|
14024
|
-
[
|
|
14025
|
-
[
|
|
14026
|
-
[
|
|
14027
|
-
[
|
|
14028
|
-
[
|
|
14029
|
-
[
|
|
14030
|
-
[
|
|
14031
|
-
[
|
|
13923
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
13924
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
13925
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
13926
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
13927
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
13928
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
13929
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
13930
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
13931
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
13932
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
13933
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
13934
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
13935
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
13936
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
13937
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
13938
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
13939
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
13940
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
13941
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
14032
13942
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
14033
13943
|
},
|
|
14034
13944
|
ColorScale: _t("Color scale"),
|
|
@@ -14063,18 +13973,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14063
13973
|
AggregatedChart: _t("Aggregate"),
|
|
14064
13974
|
Errors: {
|
|
14065
13975
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
14066
|
-
[
|
|
14067
|
-
[
|
|
14068
|
-
[
|
|
14069
|
-
[
|
|
14070
|
-
[
|
|
14071
|
-
[
|
|
14072
|
-
[
|
|
14073
|
-
[
|
|
14074
|
-
[
|
|
14075
|
-
[
|
|
14076
|
-
[
|
|
14077
|
-
[
|
|
13976
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
13977
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
13978
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
13979
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
13980
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
13981
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
13982
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
13983
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
13984
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
13985
|
+
["GaugeRangeMinBiggerThanRangeMax"]: _t("Minimum range limit must be smaller than maximum range limit"),
|
|
13986
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
13987
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
14078
13988
|
}
|
|
14079
13989
|
};
|
|
14080
13990
|
const CustomCurrencyTerms = { Custom: _t("Custom") };
|
|
@@ -14082,16 +13992,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14082
13992
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
14083
13993
|
const SplitToColumnsTerms = { Errors: {
|
|
14084
13994
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
14085
|
-
[
|
|
14086
|
-
[
|
|
14087
|
-
[
|
|
13995
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
13996
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
13997
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
14088
13998
|
} };
|
|
14089
13999
|
const RemoveDuplicateTerms = { Errors: {
|
|
14090
14000
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
14091
|
-
[
|
|
14092
|
-
[
|
|
14093
|
-
[
|
|
14094
|
-
[
|
|
14001
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
14002
|
+
["EmptyTarget"]: _t("Please select a range of cells containing values."),
|
|
14003
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
14004
|
+
["WillRemoveExistingMerge"]: PasteInteractiveContent.willRemoveExistingMerge
|
|
14095
14005
|
} };
|
|
14096
14006
|
const DVTerms = {
|
|
14097
14007
|
DateIs: {
|
|
@@ -14120,10 +14030,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14120
14030
|
const TableTerms = {
|
|
14121
14031
|
Errors: {
|
|
14122
14032
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
14123
|
-
[
|
|
14124
|
-
[
|
|
14125
|
-
[
|
|
14126
|
-
[
|
|
14033
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
14034
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
14035
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
14036
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
14127
14037
|
},
|
|
14128
14038
|
Checkboxes: {
|
|
14129
14039
|
hasFilters: _t("Filter button"),
|
|
@@ -14567,7 +14477,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14567
14477
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
14568
14478
|
function getBaselineText(baseline, keyValue, baselineMode, humanize, locale) {
|
|
14569
14479
|
if (!baseline) return "";
|
|
14570
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
14480
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
14571
14481
|
if (humanize) return humanizeNumber(baseline, locale);
|
|
14572
14482
|
return baseline.formattedValue;
|
|
14573
14483
|
}
|
|
@@ -14596,23 +14506,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14596
14506
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
14597
14507
|
}
|
|
14598
14508
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
14599
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
14509
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
14600
14510
|
const diff = keyValue.value - baseline.value;
|
|
14601
14511
|
if (diff > 0) return colorUp;
|
|
14602
14512
|
else if (diff < 0) return colorDown;
|
|
14603
14513
|
}
|
|
14604
14514
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
14605
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
14515
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
14606
14516
|
const diff = keyValue.value - baseline.value;
|
|
14607
14517
|
if (diff > 0) return "up";
|
|
14608
14518
|
else if (diff < 0) return "down";
|
|
14609
14519
|
return "neutral";
|
|
14610
14520
|
}
|
|
14611
14521
|
function checkKeyValue(definition) {
|
|
14612
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
14522
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
14613
14523
|
}
|
|
14614
14524
|
function checkBaseline(definition) {
|
|
14615
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
14525
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
14616
14526
|
}
|
|
14617
14527
|
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");
|
|
14618
14528
|
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");
|
|
@@ -14842,6 +14752,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14842
14752
|
}, runtime).computeDesign();
|
|
14843
14753
|
}
|
|
14844
14754
|
var ScorecardChartConfigBuilder = class {
|
|
14755
|
+
runtime;
|
|
14845
14756
|
context;
|
|
14846
14757
|
width;
|
|
14847
14758
|
height;
|
|
@@ -15322,7 +15233,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15322
15233
|
}
|
|
15323
15234
|
createChart(chartData) {
|
|
15324
15235
|
const ctx = this.canvas.el.getContext("2d");
|
|
15325
|
-
|
|
15236
|
+
const Chart = getChartJSConstructor();
|
|
15237
|
+
this.chart = new Chart(ctx, chartData);
|
|
15326
15238
|
}
|
|
15327
15239
|
updateChartJs(chartRuntime) {
|
|
15328
15240
|
const chartData = chartRuntime.chartJsConfig;
|
|
@@ -17909,15 +17821,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
17909
17821
|
const jsEndDate = numberToJsDate(_endDate);
|
|
17910
17822
|
assert(() => _endDate >= _startDate, _t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
17911
17823
|
switch (_unit) {
|
|
17912
|
-
case
|
|
17913
|
-
case
|
|
17914
|
-
case
|
|
17915
|
-
case
|
|
17916
|
-
case
|
|
17824
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
17825
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
17826
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17827
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
17828
|
+
case "MD":
|
|
17917
17829
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
17918
17830
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
17919
17831
|
return days;
|
|
17920
|
-
case
|
|
17832
|
+
case "YD": {
|
|
17921
17833
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17922
17834
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
17923
17835
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -18413,18 +18325,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18413
18325
|
//#endregion
|
|
18414
18326
|
//#region src/helpers/sort.ts
|
|
18415
18327
|
const SORT_TYPES = [
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18328
|
+
"number",
|
|
18329
|
+
"error",
|
|
18330
|
+
"text",
|
|
18331
|
+
"boolean"
|
|
18420
18332
|
];
|
|
18421
18333
|
function cellsSortingCriterion(sortingOrder) {
|
|
18422
18334
|
const inverse = sortingOrder === "ascending" ? 1 : -1;
|
|
18423
18335
|
return (left, right) => {
|
|
18424
|
-
if (left.type ===
|
|
18425
|
-
else if (right.type ===
|
|
18336
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
18337
|
+
else if (right.type === "empty") return -1;
|
|
18426
18338
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
18427
|
-
if (typeOrder === 0) if (left.type ===
|
|
18339
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
18428
18340
|
else typeOrder = left.value - right.value;
|
|
18429
18341
|
return inverse * typeOrder;
|
|
18430
18342
|
};
|
|
@@ -18435,9 +18347,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18435
18347
|
type: cell.type,
|
|
18436
18348
|
value: cell.value
|
|
18437
18349
|
}));
|
|
18438
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
18350
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
18439
18351
|
...cell,
|
|
18440
|
-
type:
|
|
18352
|
+
type: "number",
|
|
18441
18353
|
value: 0
|
|
18442
18354
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
18443
18355
|
}
|
|
@@ -18499,7 +18411,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18499
18411
|
});
|
|
18500
18412
|
});
|
|
18501
18413
|
}
|
|
18502
|
-
if (result.isCancelledBecause(
|
|
18414
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
18503
18415
|
const { col, row } = anchor;
|
|
18504
18416
|
env.model.selection.selectZone({
|
|
18505
18417
|
cell: {
|
|
@@ -18552,11 +18464,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18552
18464
|
const right = sortColumn[b];
|
|
18553
18465
|
const leftCell = {
|
|
18554
18466
|
value: left,
|
|
18555
|
-
type: left === null ?
|
|
18467
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
18556
18468
|
};
|
|
18557
18469
|
const rightCell = {
|
|
18558
18470
|
value: right,
|
|
18559
|
-
type: right === null ?
|
|
18471
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
18560
18472
|
};
|
|
18561
18473
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
18562
18474
|
if (result !== 0) return result;
|
|
@@ -20970,8 +20882,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20970
20882
|
row: range.zone.top
|
|
20971
20883
|
};
|
|
20972
20884
|
const type = this.getters.getEvaluatedCell(position).type;
|
|
20973
|
-
if (type ===
|
|
20974
|
-
else if (type ===
|
|
20885
|
+
if (type === "empty") return "b";
|
|
20886
|
+
else if (type === "text") return "l";
|
|
20975
20887
|
else return "v";
|
|
20976
20888
|
}
|
|
20977
20889
|
}
|
|
@@ -24175,6 +24087,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24175
24087
|
//#endregion
|
|
24176
24088
|
//#region src/formulas/code_builder.ts
|
|
24177
24089
|
var FunctionCodeBuilder = class {
|
|
24090
|
+
scope;
|
|
24178
24091
|
code = "";
|
|
24179
24092
|
constructor(scope = new Scope()) {
|
|
24180
24093
|
this.scope = scope;
|
|
@@ -24190,6 +24103,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24190
24103
|
}
|
|
24191
24104
|
};
|
|
24192
24105
|
var FunctionCodeImpl = class {
|
|
24106
|
+
scope;
|
|
24107
|
+
returnExpression;
|
|
24193
24108
|
code;
|
|
24194
24109
|
constructor(scope, code, returnExpression) {
|
|
24195
24110
|
this.scope = scope;
|
|
@@ -24565,6 +24480,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24565
24480
|
function getFirstPivotFunction(tokens) {
|
|
24566
24481
|
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
|
|
24567
24482
|
}
|
|
24483
|
+
function getPivotFunctions(tokens) {
|
|
24484
|
+
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
|
|
24485
|
+
}
|
|
24568
24486
|
/**
|
|
24569
24487
|
* Parse a spreadsheet formula and detect the number of PIVOT functions that are
|
|
24570
24488
|
* present in the given formula.
|
|
@@ -24936,19 +24854,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24936
24854
|
let x = 0;
|
|
24937
24855
|
let y = 0;
|
|
24938
24856
|
switch (direction) {
|
|
24939
|
-
case
|
|
24857
|
+
case "up":
|
|
24940
24858
|
x = 0;
|
|
24941
24859
|
y = -rule.current;
|
|
24942
24860
|
break;
|
|
24943
|
-
case
|
|
24861
|
+
case "down":
|
|
24944
24862
|
x = 0;
|
|
24945
24863
|
y = rule.current;
|
|
24946
24864
|
break;
|
|
24947
|
-
case
|
|
24865
|
+
case "left":
|
|
24948
24866
|
x = -rule.current;
|
|
24949
24867
|
y = 0;
|
|
24950
24868
|
break;
|
|
24951
|
-
case
|
|
24869
|
+
case "right":
|
|
24952
24870
|
x = rule.current;
|
|
24953
24871
|
y = 0;
|
|
24954
24872
|
break;
|
|
@@ -25074,12 +24992,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25074
24992
|
},
|
|
25075
24993
|
sequence: 10
|
|
25076
24994
|
}).add("increment_alphanumeric_value", {
|
|
25077
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
24995
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
25078
24996
|
generateRule: (cell, cells, direction) => {
|
|
25079
24997
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
25080
24998
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
25081
24999
|
const numberPostfixLength = cell.content.length - prefix.length;
|
|
25082
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25000
|
+
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]));
|
|
25083
25001
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25084
25002
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25085
25003
|
return {
|
|
@@ -25092,7 +25010,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25092
25010
|
},
|
|
25093
25011
|
sequence: 15
|
|
25094
25012
|
}).add("copy_text", {
|
|
25095
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25013
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
25096
25014
|
generateRule: () => {
|
|
25097
25015
|
return { type: "COPY_MODIFIER" };
|
|
25098
25016
|
},
|
|
@@ -25109,10 +25027,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25109
25027
|
sequence: 30
|
|
25110
25028
|
}).add("increment_dates", {
|
|
25111
25029
|
condition: (cell, cells) => {
|
|
25112
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25030
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
25113
25031
|
},
|
|
25114
25032
|
generateRule: (cell, cells) => {
|
|
25115
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25033
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
25116
25034
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
25117
25035
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
25118
25036
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -25121,26 +25039,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25121
25039
|
if (typeof increment === "object") return {
|
|
25122
25040
|
type: "DATE_INCREMENT_MODIFIER",
|
|
25123
25041
|
increment,
|
|
25124
|
-
current: evaluation.type ===
|
|
25042
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25125
25043
|
};
|
|
25126
25044
|
return {
|
|
25127
25045
|
type: "INCREMENT_MODIFIER",
|
|
25128
25046
|
increment,
|
|
25129
|
-
current: evaluation.type ===
|
|
25047
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25130
25048
|
};
|
|
25131
25049
|
},
|
|
25132
25050
|
sequence: 25
|
|
25133
25051
|
}).add("increment_number", {
|
|
25134
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25052
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
25135
25053
|
generateRule: (cell, cells, direction) => {
|
|
25136
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25054
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
25137
25055
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25138
25056
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25139
25057
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
25140
25058
|
return {
|
|
25141
25059
|
type: "INCREMENT_MODIFIER",
|
|
25142
25060
|
increment,
|
|
25143
|
-
current: evaluation.type ===
|
|
25061
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25144
25062
|
};
|
|
25145
25063
|
},
|
|
25146
25064
|
sequence: 40
|
|
@@ -26044,47 +25962,47 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26044
25962
|
//#endregion
|
|
26045
25963
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
26046
25964
|
function isDataRangeValid(definition) {
|
|
26047
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
25965
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
26048
25966
|
}
|
|
26049
25967
|
function checkRangeLimits(check, batchValidations) {
|
|
26050
25968
|
return batchValidations((definition) => {
|
|
26051
25969
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
26052
|
-
return
|
|
25970
|
+
return "Success";
|
|
26053
25971
|
}, (definition) => {
|
|
26054
25972
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
26055
|
-
return
|
|
25973
|
+
return "Success";
|
|
26056
25974
|
});
|
|
26057
25975
|
}
|
|
26058
25976
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
26059
25977
|
return batchValidations((definition) => {
|
|
26060
25978
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
26061
|
-
return
|
|
25979
|
+
return "Success";
|
|
26062
25980
|
}, (definition) => {
|
|
26063
25981
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
26064
|
-
return
|
|
25982
|
+
return "Success";
|
|
26065
25983
|
});
|
|
26066
25984
|
}
|
|
26067
25985
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
26068
25986
|
if (definition.sectionRule) {
|
|
26069
|
-
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return
|
|
25987
|
+
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return "GaugeRangeMinBiggerThanRangeMax";
|
|
26070
25988
|
}
|
|
26071
|
-
return
|
|
25989
|
+
return "Success";
|
|
26072
25990
|
}
|
|
26073
25991
|
function checkEmpty(value, valueName) {
|
|
26074
25992
|
if (value === "") switch (valueName) {
|
|
26075
|
-
case "rangeMin": return
|
|
26076
|
-
case "rangeMax": return
|
|
25993
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
25994
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
26077
25995
|
}
|
|
26078
|
-
return
|
|
25996
|
+
return "Success";
|
|
26079
25997
|
}
|
|
26080
25998
|
function checkNaN(value, valueName) {
|
|
26081
25999
|
if (isNaN(value)) switch (valueName) {
|
|
26082
|
-
case "rangeMin": return
|
|
26083
|
-
case "rangeMax": return
|
|
26084
|
-
case "lowerInflectionPointValue": return
|
|
26085
|
-
case "upperInflectionPointValue": return
|
|
26000
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
26001
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
26002
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
26003
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
26086
26004
|
}
|
|
26087
|
-
return
|
|
26005
|
+
return "Success";
|
|
26088
26006
|
}
|
|
26089
26007
|
var GaugeChart = class GaugeChart extends AbstractChart {
|
|
26090
26008
|
dataRange;
|
|
@@ -26180,7 +26098,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26180
26098
|
col: dataRange.zone.left,
|
|
26181
26099
|
row: dataRange.zone.top
|
|
26182
26100
|
});
|
|
26183
|
-
if (cell.type ===
|
|
26101
|
+
if (cell.type === "number") {
|
|
26184
26102
|
gaugeValue = cell.value;
|
|
26185
26103
|
formattedValue = cell.formattedValue;
|
|
26186
26104
|
format = cell.format;
|
|
@@ -27689,7 +27607,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27689
27607
|
function interactiveCut(env) {
|
|
27690
27608
|
const result = env.model.dispatch("CUT");
|
|
27691
27609
|
if (!result.isSuccessful) {
|
|
27692
|
-
if (result.isCancelledBecause(
|
|
27610
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
27693
27611
|
}
|
|
27694
27612
|
}
|
|
27695
27613
|
|
|
@@ -27704,8 +27622,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27704
27622
|
sheetId,
|
|
27705
27623
|
target
|
|
27706
27624
|
});
|
|
27707
|
-
if (result.isCancelledBecause(
|
|
27708
|
-
else if (result.isCancelledBecause(
|
|
27625
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
27626
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
27709
27627
|
env.model.dispatch("ADD_MERGE", {
|
|
27710
27628
|
sheetId,
|
|
27711
27629
|
target,
|
|
@@ -27746,7 +27664,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27746
27664
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
27747
27665
|
const cell = getters.getEvaluatedCell(position);
|
|
27748
27666
|
const errors = [];
|
|
27749
|
-
if (cell.type ===
|
|
27667
|
+
if (cell.type === "error" && !!cell.message) errors.push({
|
|
27750
27668
|
title: _t("Error"),
|
|
27751
27669
|
message: cell.message
|
|
27752
27670
|
});
|
|
@@ -28455,7 +28373,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
28455
28373
|
css`
|
|
28456
28374
|
.o-popover {
|
|
28457
28375
|
position: absolute;
|
|
28458
|
-
z-index: ${
|
|
28376
|
+
z-index: ${35};
|
|
28459
28377
|
overflow: auto;
|
|
28460
28378
|
box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);
|
|
28461
28379
|
width: fit-content;
|
|
@@ -28510,7 +28428,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
28510
28428
|
onMouseWheel: () => {},
|
|
28511
28429
|
onPopoverMoved: () => {},
|
|
28512
28430
|
onPopoverHidden: () => {},
|
|
28513
|
-
zIndex:
|
|
28431
|
+
zIndex: 35
|
|
28514
28432
|
};
|
|
28515
28433
|
popoverRef = (0, _odoo_owl.useRef)("popover");
|
|
28516
28434
|
currentPosition = void 0;
|
|
@@ -28556,6 +28474,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
28556
28474
|
}
|
|
28557
28475
|
};
|
|
28558
28476
|
var PopoverPositionContext = class {
|
|
28477
|
+
anchorRect;
|
|
28478
|
+
containerRect;
|
|
28479
|
+
propsMaxSize;
|
|
28480
|
+
spreadsheetOffset;
|
|
28559
28481
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset) {
|
|
28560
28482
|
this.anchorRect = anchorRect;
|
|
28561
28483
|
this.containerRect = containerRect;
|
|
@@ -29130,7 +29052,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29130
29052
|
const dataSetsHaveTitle = !!getters.getEvaluatedCellsInZone(sheetId, {
|
|
29131
29053
|
...dataSetZone,
|
|
29132
29054
|
bottom: dataSetZone.top
|
|
29133
|
-
}).find((cell) => cell.type !==
|
|
29055
|
+
}).find((cell) => cell.type !== "empty" && cell.type !== "number");
|
|
29134
29056
|
let labelRangeXc;
|
|
29135
29057
|
if (!singleColumn) labelRangeXc = zoneToXc({
|
|
29136
29058
|
...zone,
|
|
@@ -29193,8 +29115,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29193
29115
|
config: tableConfig,
|
|
29194
29116
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29195
29117
|
});
|
|
29196
|
-
if (result.isCancelledBecause(
|
|
29197
|
-
else if (result.isCancelledBecause(
|
|
29118
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29119
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29198
29120
|
return result;
|
|
29199
29121
|
}
|
|
29200
29122
|
|
|
@@ -29225,7 +29147,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29225
29147
|
const target = env.model.getters.getSelectedZones();
|
|
29226
29148
|
if (env.model.getters.getClipboardId() !== clipboardId) interactivePasteFromOS(env, target, clipboardContent, pasteOption);
|
|
29227
29149
|
else interactivePaste(env, target, pasteOption);
|
|
29228
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29150
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29229
29151
|
break;
|
|
29230
29152
|
case "notImplemented":
|
|
29231
29153
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -29607,11 +29529,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29607
29529
|
if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
|
|
29608
29530
|
};
|
|
29609
29531
|
const DELETE_SELECTED_TABLE = (env) => {
|
|
29610
|
-
const
|
|
29611
|
-
const table = env.model.getters.getTable(position);
|
|
29532
|
+
const table = env.model.getters.getFirstTableInSelection();
|
|
29612
29533
|
if (!table) return;
|
|
29613
29534
|
env.model.dispatch("REMOVE_TABLE", {
|
|
29614
|
-
sheetId:
|
|
29535
|
+
sheetId: env.model.getters.getActiveSheetId(),
|
|
29615
29536
|
target: [table.range.zone]
|
|
29616
29537
|
});
|
|
29617
29538
|
};
|
|
@@ -30165,7 +30086,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30165
30086
|
if (!pivotId) return false;
|
|
30166
30087
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
30167
30088
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
30168
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
30089
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
30169
30090
|
},
|
|
30170
30091
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
30171
30092
|
};
|
|
@@ -30750,7 +30671,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30750
30671
|
if (env.model.dispatch(cmd, {
|
|
30751
30672
|
sheetId,
|
|
30752
30673
|
quantity: base
|
|
30753
|
-
}).isCancelledBecause(
|
|
30674
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
30754
30675
|
}
|
|
30755
30676
|
|
|
30756
30677
|
//#endregion
|
|
@@ -31276,7 +31197,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31276
31197
|
col,
|
|
31277
31198
|
row
|
|
31278
31199
|
};
|
|
31279
|
-
if (
|
|
31200
|
+
if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
|
|
31280
31201
|
}
|
|
31281
31202
|
return positions;
|
|
31282
31203
|
}
|
|
@@ -31842,6 +31763,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31842
31763
|
* This plugin handles this internal state.
|
|
31843
31764
|
*/
|
|
31844
31765
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
31766
|
+
initialRanges;
|
|
31767
|
+
inputHasSingleRange;
|
|
31768
|
+
colors;
|
|
31845
31769
|
mutators = [
|
|
31846
31770
|
"resetWithRanges",
|
|
31847
31771
|
"focusById",
|
|
@@ -32438,10 +32362,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32438
32362
|
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32439
32363
|
}
|
|
32440
32364
|
get isDatasetInvalid() {
|
|
32441
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32365
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32442
32366
|
}
|
|
32443
32367
|
get isLabelInvalid() {
|
|
32444
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32368
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32445
32369
|
}
|
|
32446
32370
|
get dataSetsHaveTitleLabel() {
|
|
32447
32371
|
return _t("Use row %s as headers", this.calculateHeaderPosition() || "");
|
|
@@ -33778,7 +33702,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33778
33702
|
return [...this.state.dataRangeDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33779
33703
|
}
|
|
33780
33704
|
get isDataRangeInvalid() {
|
|
33781
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33705
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33782
33706
|
}
|
|
33783
33707
|
onDataRangeChanged(ranges) {
|
|
33784
33708
|
this.dataRange = ranges[0];
|
|
@@ -33864,16 +33788,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33864
33788
|
return [...this.state.sectionRuleDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33865
33789
|
}
|
|
33866
33790
|
isRangeMinInvalid() {
|
|
33867
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33791
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
33868
33792
|
}
|
|
33869
33793
|
isRangeMaxInvalid() {
|
|
33870
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33794
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMax") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMaxNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
33871
33795
|
}
|
|
33872
33796
|
get isLowerInflectionPointInvalid() {
|
|
33873
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33797
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
33874
33798
|
}
|
|
33875
33799
|
get isUpperInflectionPointInvalid() {
|
|
33876
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33800
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeUpperInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
33877
33801
|
}
|
|
33878
33802
|
updateSectionColor(target, color) {
|
|
33879
33803
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33997,10 +33921,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33997
33921
|
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33998
33922
|
}
|
|
33999
33923
|
get isKeyValueInvalid() {
|
|
34000
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33924
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
34001
33925
|
}
|
|
34002
33926
|
get isBaselineInvalid() {
|
|
34003
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33927
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
34004
33928
|
}
|
|
34005
33929
|
onKeyValueRangeChanged(ranges) {
|
|
34006
33930
|
this.keyValue = ranges[0];
|
|
@@ -34889,6 +34813,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34889
34813
|
//#endregion
|
|
34890
34814
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
34891
34815
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
34816
|
+
args;
|
|
34892
34817
|
constructor(get, args) {
|
|
34893
34818
|
super(get);
|
|
34894
34819
|
this.args = args;
|
|
@@ -35026,7 +34951,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35026
34951
|
css`
|
|
35027
34952
|
.o-icon-picker {
|
|
35028
34953
|
position: absolute;
|
|
35029
|
-
z-index: ${
|
|
34954
|
+
z-index: ${25};
|
|
35030
34955
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
35031
34956
|
background-color: white;
|
|
35032
34957
|
padding: 2px 1px;
|
|
@@ -35278,6 +35203,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35278
35203
|
}
|
|
35279
35204
|
};
|
|
35280
35205
|
var ContainerWrapper = class {
|
|
35206
|
+
el;
|
|
35281
35207
|
constructor(el) {
|
|
35282
35208
|
this.el = el;
|
|
35283
35209
|
}
|
|
@@ -35657,11 +35583,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35657
35583
|
colorNumberString = colorNumberString;
|
|
35658
35584
|
state;
|
|
35659
35585
|
setup() {
|
|
35586
|
+
const cf = this.props.editedCf || {
|
|
35587
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
35588
|
+
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
35589
|
+
};
|
|
35660
35590
|
this.state = (0, _odoo_owl.useState)({
|
|
35661
|
-
currentCF:
|
|
35662
|
-
id: this.env.model.uuidGenerator.smallUuid(),
|
|
35663
|
-
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
35664
|
-
},
|
|
35591
|
+
currentCF: cf,
|
|
35665
35592
|
currentCFType: this.props.editedCf?.rule.type || "CellIsRule",
|
|
35666
35593
|
errors: [],
|
|
35667
35594
|
rules: this.getDefaultRules()
|
|
@@ -35683,7 +35610,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35683
35610
|
(0, _odoo_owl.useExternalListener)(window, "click", this.closeMenus);
|
|
35684
35611
|
}
|
|
35685
35612
|
get isRangeValid() {
|
|
35686
|
-
return this.state.errors.includes(
|
|
35613
|
+
return this.state.errors.includes("EmptyRange");
|
|
35687
35614
|
}
|
|
35688
35615
|
get errorMessages() {
|
|
35689
35616
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35711,7 +35638,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35711
35638
|
saveConditionalFormat() {
|
|
35712
35639
|
if (this.state.currentCF) {
|
|
35713
35640
|
if (this.state.currentCF.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35714
|
-
this.state.errors = [
|
|
35641
|
+
this.state.errors = ["InvalidRange"];
|
|
35715
35642
|
return;
|
|
35716
35643
|
}
|
|
35717
35644
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
@@ -35806,10 +35733,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35806
35733
|
* Cell Is Rule
|
|
35807
35734
|
****************************************************************************/
|
|
35808
35735
|
get isValue1Invalid() {
|
|
35809
|
-
return this.state.errors.includes(
|
|
35736
|
+
return this.state.errors.includes("FirstArgMissing") || this.state.errors.includes("ValueCellIsInvalidFormula");
|
|
35810
35737
|
}
|
|
35811
35738
|
get isValue2Invalid() {
|
|
35812
|
-
return this.state.errors.includes(
|
|
35739
|
+
return this.state.errors.includes("SecondArgMissing");
|
|
35813
35740
|
}
|
|
35814
35741
|
toggleStyle(tool) {
|
|
35815
35742
|
const style = this.state.rules.cellIs.style;
|
|
@@ -35838,9 +35765,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35838
35765
|
****************************************************************************/
|
|
35839
35766
|
isValueInvalid(threshold) {
|
|
35840
35767
|
switch (threshold) {
|
|
35841
|
-
case "minimum": return this.state.errors.includes(
|
|
35842
|
-
case "midpoint": return this.state.errors.includes(
|
|
35843
|
-
case "maximum": return this.state.errors.includes(
|
|
35768
|
+
case "minimum": return this.state.errors.includes("MinInvalidFormula") || this.state.errors.includes("MinBiggerThanMid") || this.state.errors.includes("MinBiggerThanMax") || this.state.errors.includes("MinNaN");
|
|
35769
|
+
case "midpoint": return this.state.errors.includes("MidInvalidFormula") || this.state.errors.includes("MidNaN") || this.state.errors.includes("MidBiggerThanMax");
|
|
35770
|
+
case "maximum": return this.state.errors.includes("MaxInvalidFormula") || this.state.errors.includes("MaxNaN");
|
|
35844
35771
|
default: return false;
|
|
35845
35772
|
}
|
|
35846
35773
|
}
|
|
@@ -35877,8 +35804,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35877
35804
|
****************************************************************************/
|
|
35878
35805
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35879
35806
|
switch (inflectionPoint) {
|
|
35880
|
-
case "lowerInflectionPoint": return this.state.errors.includes(
|
|
35881
|
-
case "upperInflectionPoint": return this.state.errors.includes(
|
|
35807
|
+
case "lowerInflectionPoint": return this.state.errors.includes("ValueLowerInflectionNaN") || this.state.errors.includes("ValueLowerInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
35808
|
+
case "upperInflectionPoint": return this.state.errors.includes("ValueUpperInflectionNaN") || this.state.errors.includes("ValueUpperInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
35882
35809
|
default: return true;
|
|
35883
35810
|
}
|
|
35884
35811
|
}
|
|
@@ -36125,13 +36052,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
36125
36052
|
if (currenciesRegistry.getAll().length === 0) (await this.env.loadCurrencies?.() || []).forEach((currency, index) => {
|
|
36126
36053
|
currenciesRegistry.add(index.toString(), currency);
|
|
36127
36054
|
});
|
|
36128
|
-
|
|
36055
|
+
const emptyCurrency = {
|
|
36129
36056
|
name: _t(CustomCurrencyTerms.Custom),
|
|
36130
36057
|
code: "",
|
|
36131
36058
|
symbol: "",
|
|
36132
36059
|
decimalPlaces: 2,
|
|
36133
36060
|
position: "after"
|
|
36134
|
-
}
|
|
36061
|
+
};
|
|
36062
|
+
this.availableCurrencies = [emptyCurrency, ...currenciesRegistry.getAll()];
|
|
36135
36063
|
}
|
|
36136
36064
|
updateSelectCurrency(ev) {
|
|
36137
36065
|
const target = ev.target;
|
|
@@ -37279,12 +37207,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37279
37207
|
//#endregion
|
|
37280
37208
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
37281
37209
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
37282
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
37283
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
37284
|
-
Direction[Direction["current"] = 0] = "current";
|
|
37285
|
-
Direction[Direction["next"] = 1] = "next";
|
|
37286
|
-
return Direction;
|
|
37287
|
-
}(Direction || {});
|
|
37288
37210
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
37289
37211
|
mutators = [
|
|
37290
37212
|
"updateSearchOptions",
|
|
@@ -37345,10 +37267,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37345
37267
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
37346
37268
|
}
|
|
37347
37269
|
selectPreviousMatch() {
|
|
37348
|
-
this.selectNextCell(
|
|
37270
|
+
this.selectNextCell(-1);
|
|
37349
37271
|
}
|
|
37350
37272
|
selectNextMatch() {
|
|
37351
|
-
this.selectNextCell(
|
|
37273
|
+
this.selectNextCell(1);
|
|
37352
37274
|
}
|
|
37353
37275
|
handle(cmd) {
|
|
37354
37276
|
switch (cmd.type) {
|
|
@@ -37415,7 +37337,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37415
37337
|
refreshSearch(jumpToMatchSheet = true) {
|
|
37416
37338
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
37417
37339
|
this.findMatches();
|
|
37418
|
-
this.selectNextCell(
|
|
37340
|
+
this.selectNextCell(0, jumpToMatchSheet);
|
|
37419
37341
|
}
|
|
37420
37342
|
getSheetsInSearchOrder() {
|
|
37421
37343
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37785,6 +37707,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37785
37707
|
//#endregion
|
|
37786
37708
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37787
37709
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37710
|
+
pivotId;
|
|
37711
|
+
initialMeasure;
|
|
37788
37712
|
mutators = [
|
|
37789
37713
|
"cancelMeasureDisplayEdition",
|
|
37790
37714
|
"updateMeasureDisplayType",
|
|
@@ -38689,7 +38613,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38689
38613
|
});
|
|
38690
38614
|
let text;
|
|
38691
38615
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38692
|
-
else if (result.isCancelledBecause(
|
|
38616
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38693
38617
|
else text = _t("Pivot duplication failed.");
|
|
38694
38618
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38695
38619
|
this.env.notifyUser({
|
|
@@ -38753,13 +38677,30 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38753
38677
|
} : fields[fieldName];
|
|
38754
38678
|
const aggregator = measure.aggregator;
|
|
38755
38679
|
return {
|
|
38680
|
+
/**
|
|
38681
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38682
|
+
*/
|
|
38756
38683
|
id: measure.id,
|
|
38684
|
+
/**
|
|
38685
|
+
* Display name of the measure
|
|
38686
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38687
|
+
*/
|
|
38757
38688
|
get displayName() {
|
|
38758
38689
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38759
38690
|
},
|
|
38760
38691
|
userDefinedName: measure.userDefinedName,
|
|
38692
|
+
/**
|
|
38693
|
+
* Get the name of the field of the measure
|
|
38694
|
+
*/
|
|
38761
38695
|
fieldName,
|
|
38696
|
+
/**
|
|
38697
|
+
* Get the aggregator of the measure
|
|
38698
|
+
*/
|
|
38762
38699
|
aggregator,
|
|
38700
|
+
/**
|
|
38701
|
+
* Get the type of the measure field
|
|
38702
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38703
|
+
*/
|
|
38763
38704
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38764
38705
|
isValid: !!(field || measure.computedBy),
|
|
38765
38706
|
isHidden: measure.isHidden,
|
|
@@ -38773,10 +38714,30 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38773
38714
|
const type = field?.type ?? "integer";
|
|
38774
38715
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38775
38716
|
return {
|
|
38717
|
+
/**
|
|
38718
|
+
* Get the display name of the dimension
|
|
38719
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38720
|
+
*/
|
|
38776
38721
|
displayName: field?.string ?? dimension.fieldName,
|
|
38722
|
+
/**
|
|
38723
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38724
|
+
* e.g. "stage_id", "create_date:month"
|
|
38725
|
+
*/
|
|
38777
38726
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38727
|
+
/**
|
|
38728
|
+
* Get the name of the field of the dimension
|
|
38729
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38730
|
+
*/
|
|
38778
38731
|
fieldName: dimension.fieldName,
|
|
38732
|
+
/**
|
|
38733
|
+
* Get the aggregate operator of the dimension
|
|
38734
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38735
|
+
*/
|
|
38779
38736
|
granularity,
|
|
38737
|
+
/**
|
|
38738
|
+
* Get the type of the field of the dimension
|
|
38739
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38740
|
+
*/
|
|
38780
38741
|
type,
|
|
38781
38742
|
order: dimension.order,
|
|
38782
38743
|
isValid: !!field
|
|
@@ -39398,15 +39359,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39398
39359
|
|
|
39399
39360
|
//#endregion
|
|
39400
39361
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39401
|
-
|
|
39402
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39403
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39404
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39405
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39406
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39407
|
-
return ReloadType;
|
|
39408
|
-
}(ReloadType || {});
|
|
39409
|
-
/**
|
|
39362
|
+
/**
|
|
39410
39363
|
* This class represents a pivot table that is created from a range of cells.
|
|
39411
39364
|
* It will extract the fields from the first row of the range and the data from
|
|
39412
39365
|
* the rest of the rows.
|
|
@@ -39447,27 +39400,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39447
39400
|
}
|
|
39448
39401
|
init(params = {}) {
|
|
39449
39402
|
if (!this._definition || params.reload) {
|
|
39450
|
-
this.reload(
|
|
39403
|
+
this.reload(4);
|
|
39451
39404
|
this.needsReevaluation = false;
|
|
39452
39405
|
}
|
|
39453
39406
|
}
|
|
39454
39407
|
reload(type) {
|
|
39455
|
-
if (type ===
|
|
39456
|
-
if (type >=
|
|
39457
|
-
if (type >=
|
|
39458
|
-
if (type >=
|
|
39408
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39409
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39410
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39411
|
+
if (type >= 1) this.table = void 0;
|
|
39459
39412
|
}
|
|
39460
39413
|
onDefinitionChange(nextDefinition) {
|
|
39461
39414
|
const actualDefinition = this.coreDefinition;
|
|
39462
39415
|
this.coreDefinition = nextDefinition;
|
|
39463
39416
|
if (this._definition) {
|
|
39464
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39417
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39465
39418
|
this.reload(reloadType);
|
|
39466
39419
|
}
|
|
39467
39420
|
}
|
|
39468
39421
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39469
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39470
|
-
return
|
|
39422
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39423
|
+
return 4;
|
|
39471
39424
|
}
|
|
39472
39425
|
get isInvalidRange() {
|
|
39473
39426
|
return !!this.invalidRangeError;
|
|
@@ -39540,7 +39493,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39540
39493
|
if (dataEntries.length === 0) return { value: "" };
|
|
39541
39494
|
const measure = this.getMeasure(measureId);
|
|
39542
39495
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39543
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39496
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39544
39497
|
const aggregator = measure.aggregator;
|
|
39545
39498
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39546
39499
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39628,16 +39581,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39628
39581
|
return this.definition.getDimension(nameWithGranularity);
|
|
39629
39582
|
}
|
|
39630
39583
|
getTypeFromZone(sheetId, zone) {
|
|
39631
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39584
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39632
39585
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39633
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39634
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39635
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39586
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39587
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39588
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39636
39589
|
return "char";
|
|
39637
39590
|
}
|
|
39638
39591
|
assertCellIsValidField(col, row, cell) {
|
|
39639
|
-
if (cell.type ===
|
|
39640
|
-
if (cell.type ===
|
|
39592
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39593
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39641
39594
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39642
39595
|
}
|
|
39643
39596
|
/**
|
|
@@ -39705,14 +39658,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39705
39658
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39706
39659
|
if (cell.value === "") entry[field.name] = {
|
|
39707
39660
|
value: null,
|
|
39708
|
-
type:
|
|
39661
|
+
type: "empty",
|
|
39709
39662
|
formattedValue: ""
|
|
39710
39663
|
};
|
|
39711
39664
|
else entry[field.name] = cell;
|
|
39712
39665
|
}
|
|
39713
39666
|
entry["__count"] = {
|
|
39714
39667
|
value: 1,
|
|
39715
|
-
type:
|
|
39668
|
+
type: "number",
|
|
39716
39669
|
formattedValue: "1"
|
|
39717
39670
|
};
|
|
39718
39671
|
dataEntries.push(entry);
|
|
@@ -39725,7 +39678,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39725
39678
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39726
39679
|
entry[dimension.nameWithGranularity] = {
|
|
39727
39680
|
value,
|
|
39728
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39681
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39729
39682
|
format: entry[dimension.fieldName]?.format,
|
|
39730
39683
|
formattedValue: formatValue(valueToFormat, {
|
|
39731
39684
|
locale,
|
|
@@ -39793,6 +39746,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39793
39746
|
//#endregion
|
|
39794
39747
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39795
39748
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39749
|
+
pivotId;
|
|
39796
39750
|
mutators = [
|
|
39797
39751
|
"reset",
|
|
39798
39752
|
"deferUpdates",
|
|
@@ -39927,7 +39881,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39927
39881
|
}))
|
|
39928
39882
|
};
|
|
39929
39883
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39930
|
-
|
|
39884
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39885
|
+
this.draft = cleanedWithGranularity;
|
|
39931
39886
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39932
39887
|
}
|
|
39933
39888
|
/**
|
|
@@ -40244,7 +40199,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
40244
40199
|
separator,
|
|
40245
40200
|
addNewColumns
|
|
40246
40201
|
});
|
|
40247
|
-
if (result.isCancelledBecause(
|
|
40202
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
40248
40203
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
40249
40204
|
separator,
|
|
40250
40205
|
addNewColumns,
|
|
@@ -40325,8 +40280,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
40325
40280
|
}).reasons;
|
|
40326
40281
|
const errors = /* @__PURE__ */ new Set();
|
|
40327
40282
|
for (const reason of cancelledReasons) switch (reason) {
|
|
40328
|
-
case
|
|
40329
|
-
case
|
|
40283
|
+
case "SplitWillOverwriteContent":
|
|
40284
|
+
case "EmptySplitSeparator": break;
|
|
40330
40285
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
40331
40286
|
}
|
|
40332
40287
|
return Array.from(errors);
|
|
@@ -40337,7 +40292,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
40337
40292
|
separator: this.separatorValue,
|
|
40338
40293
|
addNewColumns: this.state.addNewColumns,
|
|
40339
40294
|
force: false
|
|
40340
|
-
}).reasons.includes(
|
|
40295
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
40341
40296
|
return warnings;
|
|
40342
40297
|
}
|
|
40343
40298
|
get separatorValue() {
|
|
@@ -41329,7 +41284,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41329
41284
|
box-sizing: content-box;
|
|
41330
41285
|
|
|
41331
41286
|
.o-fig-anchor {
|
|
41332
|
-
z-index: ${
|
|
41287
|
+
z-index: ${1e3};
|
|
41333
41288
|
position: absolute;
|
|
41334
41289
|
width: ${ANCHOR_SIZE}px;
|
|
41335
41290
|
height: ${ANCHOR_SIZE}px;
|
|
@@ -41431,7 +41386,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41431
41386
|
top: `${y}px`,
|
|
41432
41387
|
width: `${width}px`,
|
|
41433
41388
|
height: `${height}px`,
|
|
41434
|
-
"z-index": String(
|
|
41389
|
+
"z-index": String(10 + (this.isSelected ? 1 : 0))
|
|
41435
41390
|
});
|
|
41436
41391
|
}
|
|
41437
41392
|
getResizerPosition(resizer) {
|
|
@@ -41556,7 +41511,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41556
41511
|
end: group.end
|
|
41557
41512
|
});
|
|
41558
41513
|
if (!result.isSuccessful) {
|
|
41559
|
-
if (result.isCancelledBecause(
|
|
41514
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
41560
41515
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
41561
41516
|
env.raiseError(errorMessage);
|
|
41562
41517
|
}
|
|
@@ -41966,11 +41921,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41966
41921
|
if (this.model.getters.getArrayFormulaSpreadingOn(position)) return "";
|
|
41967
41922
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
41968
41923
|
switch (type) {
|
|
41969
|
-
case
|
|
41970
|
-
case
|
|
41971
|
-
case
|
|
41972
|
-
case
|
|
41973
|
-
case
|
|
41924
|
+
case "empty": return "";
|
|
41925
|
+
case "text":
|
|
41926
|
+
case "error": return value;
|
|
41927
|
+
case "boolean": return formattedValue;
|
|
41928
|
+
case "number":
|
|
41974
41929
|
if (format && isDateTimeFormat(format)) {
|
|
41975
41930
|
if (parseDateTime(formattedValue, locale) !== null) return formattedValue;
|
|
41976
41931
|
return formatValue(value, {
|
|
@@ -42034,7 +41989,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42034
41989
|
const GRID_CELL_REFERENCE_TOP_OFFSET = 28;
|
|
42035
41990
|
css`
|
|
42036
41991
|
div.o-grid-composer {
|
|
42037
|
-
z-index: ${
|
|
41992
|
+
z-index: ${20};
|
|
42038
41993
|
box-sizing: border-box;
|
|
42039
41994
|
position: absolute;
|
|
42040
41995
|
border: ${COMPOSER_BORDER_WIDTH}px solid ${SELECTION_BORDER_COLOR};
|
|
@@ -42046,7 +42001,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42046
42001
|
|
|
42047
42002
|
div.o-cell-reference {
|
|
42048
42003
|
position: absolute;
|
|
42049
|
-
z-index: ${
|
|
42004
|
+
z-index: ${20};
|
|
42050
42005
|
background: ${SELECTION_BORDER_COLOR};
|
|
42051
42006
|
color: white;
|
|
42052
42007
|
font-size: 12px;
|
|
@@ -42661,7 +42616,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42661
42616
|
css`
|
|
42662
42617
|
.o-figure-snap-line {
|
|
42663
42618
|
position: relative;
|
|
42664
|
-
z-index: ${
|
|
42619
|
+
z-index: ${1001};
|
|
42665
42620
|
&.vertical {
|
|
42666
42621
|
width: 0px;
|
|
42667
42622
|
border-left: 1px dashed black;
|
|
@@ -43422,7 +43377,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43422
43377
|
};
|
|
43423
43378
|
static components = { Popover };
|
|
43424
43379
|
cellPopovers;
|
|
43425
|
-
zIndex =
|
|
43380
|
+
zIndex = 19;
|
|
43426
43381
|
setup() {
|
|
43427
43382
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
43428
43383
|
}
|
|
@@ -43667,7 +43622,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43667
43622
|
color: ${ICONS_COLOR};
|
|
43668
43623
|
}
|
|
43669
43624
|
.o-unhide:hover {
|
|
43670
|
-
z-index: ${
|
|
43625
|
+
z-index: ${0 + 1};
|
|
43671
43626
|
background-color: lightgrey;
|
|
43672
43627
|
}
|
|
43673
43628
|
}
|
|
@@ -43739,7 +43694,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43739
43694
|
elements,
|
|
43740
43695
|
position: this.state.position
|
|
43741
43696
|
});
|
|
43742
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
43697
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
43743
43698
|
}
|
|
43744
43699
|
_selectElement(index, addDistinctHeader) {
|
|
43745
43700
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -43823,7 +43778,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43823
43778
|
color: ${ICONS_COLOR};
|
|
43824
43779
|
}
|
|
43825
43780
|
.o-unhide:hover {
|
|
43826
|
-
z-index: ${
|
|
43781
|
+
z-index: ${0 + 1};
|
|
43827
43782
|
background-color: lightgrey;
|
|
43828
43783
|
}
|
|
43829
43784
|
}
|
|
@@ -43896,8 +43851,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43896
43851
|
position: this.state.position
|
|
43897
43852
|
});
|
|
43898
43853
|
if (!result.isSuccessful) {
|
|
43899
|
-
if (result.reasons.includes(
|
|
43900
|
-
else if (result.reasons.includes(
|
|
43854
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
43855
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
43901
43856
|
}
|
|
43902
43857
|
}
|
|
43903
43858
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -44355,7 +44310,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44355
44310
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
44356
44311
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44357
44312
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
44358
|
-
if (nextCell.type !==
|
|
44313
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || cellHasIcon || cellHasCheckbox) return col;
|
|
44359
44314
|
col++;
|
|
44360
44315
|
}
|
|
44361
44316
|
return col;
|
|
@@ -44373,7 +44328,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44373
44328
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
44374
44329
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44375
44330
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
44376
|
-
if (previousCell.type !==
|
|
44331
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || cellHasIcon || cellHasCheckbox) return col;
|
|
44377
44332
|
col--;
|
|
44378
44333
|
}
|
|
44379
44334
|
return col;
|
|
@@ -44382,7 +44337,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44382
44337
|
if (this.getters.getCell(position)?.isFormula && this.getters.shouldShowFormulas()) return "left";
|
|
44383
44338
|
const { align } = this.getters.getCellStyle(position);
|
|
44384
44339
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
44385
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
44340
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
44386
44341
|
return align || evaluatedCell.defaultAlign;
|
|
44387
44342
|
}
|
|
44388
44343
|
createZoneBox(sheetId, zone, viewport) {
|
|
@@ -44407,7 +44362,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44407
44362
|
style: this.getters.getCellComputedStyle(position),
|
|
44408
44363
|
dataBarFill: this.getters.getConditionalDataBar(position),
|
|
44409
44364
|
verticalAlign,
|
|
44410
|
-
isError: cell.type ===
|
|
44365
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position)
|
|
44411
44366
|
};
|
|
44412
44367
|
/** Icon */
|
|
44413
44368
|
const iconSrc = this.getters.getCellIconSrc(position);
|
|
@@ -44427,7 +44382,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44427
44382
|
image: imageHtmlElement
|
|
44428
44383
|
};
|
|
44429
44384
|
}
|
|
44430
|
-
if (cell.type ===
|
|
44385
|
+
if (cell.type === "empty" || this.getters.isCellValidCheckbox(position)) return box;
|
|
44431
44386
|
/** Filter Header or data validation icon */
|
|
44432
44387
|
box.hasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44433
44388
|
const headerIconWidth = box.hasIcon ? 17 + 2 : 0;
|
|
@@ -44815,7 +44770,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44815
44770
|
//#region src/components/highlight/highlight/highlight.ts
|
|
44816
44771
|
css`
|
|
44817
44772
|
.o-highlight {
|
|
44818
|
-
z-index: ${
|
|
44773
|
+
z-index: ${5};
|
|
44819
44774
|
}
|
|
44820
44775
|
`;
|
|
44821
44776
|
var Highlight = class extends _odoo_owl.Component {
|
|
@@ -44936,7 +44891,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44936
44891
|
.o-scrollbar {
|
|
44937
44892
|
position: absolute;
|
|
44938
44893
|
overflow: auto;
|
|
44939
|
-
z-index: ${
|
|
44894
|
+
z-index: ${15};
|
|
44940
44895
|
background-color: ${BACKGROUND_GRAY_COLOR};
|
|
44941
44896
|
|
|
44942
44897
|
&.corner {
|
|
@@ -45332,12 +45287,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45332
45287
|
}
|
|
45333
45288
|
keyDownMapping = {
|
|
45334
45289
|
Enter: () => {
|
|
45335
|
-
this.env.model.getters.getActiveCell().type ===
|
|
45290
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
45336
45291
|
},
|
|
45337
45292
|
Tab: () => this.env.model.selection.moveAnchorCell("right", 1),
|
|
45338
45293
|
"Shift+Tab": () => this.env.model.selection.moveAnchorCell("left", 1),
|
|
45339
45294
|
F2: () => {
|
|
45340
|
-
this.env.model.getters.getActiveCell().type ===
|
|
45295
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
45341
45296
|
},
|
|
45342
45297
|
Delete: () => {
|
|
45343
45298
|
this.env.model.dispatch("DELETE_CONTENT", {
|
|
@@ -45568,7 +45523,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45568
45523
|
sheetId,
|
|
45569
45524
|
col,
|
|
45570
45525
|
row
|
|
45571
|
-
}).type ===
|
|
45526
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
45572
45527
|
else this.onComposerContentFocused();
|
|
45573
45528
|
}
|
|
45574
45529
|
processArrows(ev) {
|
|
@@ -45640,8 +45595,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45640
45595
|
const clipboardData = ev.clipboardData;
|
|
45641
45596
|
if (!clipboardData) return;
|
|
45642
45597
|
const osClipboard = { content: {
|
|
45643
|
-
[
|
|
45644
|
-
[
|
|
45598
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
45599
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
45645
45600
|
} };
|
|
45646
45601
|
const target = this.env.model.getters.getSelectedZones();
|
|
45647
45602
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
@@ -45649,7 +45604,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45649
45604
|
const clipboardId = clipboardContent.data?.clipboardId;
|
|
45650
45605
|
if (this.env.model.getters.getClipboardId() === clipboardId) interactivePaste(this.env, target);
|
|
45651
45606
|
else interactivePasteFromOS(this.env, target, clipboardContent);
|
|
45652
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
45607
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
45653
45608
|
}
|
|
45654
45609
|
clearFormatting() {
|
|
45655
45610
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -46116,7 +46071,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46116
46071
|
* There should not be any side effects in this method.
|
|
46117
46072
|
*/
|
|
46118
46073
|
allowDispatch(command) {
|
|
46119
|
-
return
|
|
46074
|
+
return "Success";
|
|
46120
46075
|
}
|
|
46121
46076
|
/**
|
|
46122
46077
|
* This method is useful when a plugin need to perform some action before a
|
|
@@ -46152,10 +46107,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46152
46107
|
for (const validation of validations) {
|
|
46153
46108
|
let results = validation.call(this, toValidate);
|
|
46154
46109
|
if (!Array.isArray(results)) results = [results];
|
|
46155
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
46110
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
46156
46111
|
if (cancelledReasons.length) return cancelledReasons;
|
|
46157
46112
|
}
|
|
46158
|
-
return
|
|
46113
|
+
return "Success";
|
|
46159
46114
|
};
|
|
46160
46115
|
}
|
|
46161
46116
|
checkValidations(command, ...validations) {
|
|
@@ -46214,7 +46169,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46214
46169
|
allowDispatch(cmd) {
|
|
46215
46170
|
switch (cmd.type) {
|
|
46216
46171
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
46217
|
-
default: return
|
|
46172
|
+
default: return "Success";
|
|
46218
46173
|
}
|
|
46219
46174
|
}
|
|
46220
46175
|
handle(cmd) {
|
|
@@ -46586,8 +46541,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46586
46541
|
checkBordersUnchanged(cmd) {
|
|
46587
46542
|
const currentBorder = this.getCellBorder(cmd);
|
|
46588
46543
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
46589
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
46590
|
-
return
|
|
46544
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
46545
|
+
return "Success";
|
|
46591
46546
|
}
|
|
46592
46547
|
import(data) {
|
|
46593
46548
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const zoneXc in sheet.borders) {
|
|
@@ -46716,8 +46671,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46716
46671
|
switch (cmd.type) {
|
|
46717
46672
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
46718
46673
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
46719
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
46720
|
-
default: return
|
|
46674
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
46675
|
+
default: return "Success";
|
|
46721
46676
|
}
|
|
46722
46677
|
}
|
|
46723
46678
|
handle(cmd) {
|
|
@@ -47140,25 +47095,30 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47140
47095
|
}
|
|
47141
47096
|
checkCellOutOfSheet(cmd) {
|
|
47142
47097
|
const { sheetId, col, row } = cmd;
|
|
47143
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
47144
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
47098
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
47099
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
47145
47100
|
}
|
|
47146
47101
|
checkUselessClearCell(cmd) {
|
|
47147
47102
|
const cell = this.getters.getCell(cmd);
|
|
47148
|
-
if (!cell) return
|
|
47149
|
-
if (!cell.content && !cell.style && !cell.format) return
|
|
47150
|
-
return
|
|
47103
|
+
if (!cell) return "NoChanges";
|
|
47104
|
+
if (!cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
47105
|
+
return "Success";
|
|
47151
47106
|
}
|
|
47152
47107
|
checkUselessUpdateCell(cmd) {
|
|
47153
47108
|
const cell = this.getters.getCell(cmd);
|
|
47154
47109
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
47155
47110
|
const hasStyle = "style" in cmd;
|
|
47156
47111
|
const hasFormat = "format" in cmd;
|
|
47157
|
-
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
47158
|
-
return
|
|
47112
|
+
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
|
|
47113
|
+
return "Success";
|
|
47159
47114
|
}
|
|
47160
47115
|
};
|
|
47161
47116
|
var FormulaCellWithDependencies = class {
|
|
47117
|
+
id;
|
|
47118
|
+
format;
|
|
47119
|
+
style;
|
|
47120
|
+
sheetId;
|
|
47121
|
+
getRangeString;
|
|
47162
47122
|
isFormula = true;
|
|
47163
47123
|
compiledFormula;
|
|
47164
47124
|
constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
|
|
@@ -47193,6 +47153,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47193
47153
|
}
|
|
47194
47154
|
};
|
|
47195
47155
|
var RangeReferenceToken = class {
|
|
47156
|
+
ranges;
|
|
47157
|
+
rangeIndex;
|
|
47158
|
+
sheetId;
|
|
47159
|
+
getRangeString;
|
|
47196
47160
|
type = "REFERENCE";
|
|
47197
47161
|
constructor(ranges, rangeIndex, sheetId, getRangeString) {
|
|
47198
47162
|
this.ranges = ranges;
|
|
@@ -47227,7 +47191,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47227
47191
|
switch (cmd.type) {
|
|
47228
47192
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
47229
47193
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
47230
|
-
default: return
|
|
47194
|
+
default: return "Success";
|
|
47231
47195
|
}
|
|
47232
47196
|
}
|
|
47233
47197
|
handle(cmd) {
|
|
@@ -47346,10 +47310,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47346
47310
|
if (sheetId) this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
47347
47311
|
}
|
|
47348
47312
|
checkChartDuplicate(cmd) {
|
|
47349
|
-
return this.getters.getFigureSheetId(cmd.id) ?
|
|
47313
|
+
return this.getters.getFigureSheetId(cmd.id) ? "DuplicatedChartId" : "Success";
|
|
47350
47314
|
}
|
|
47351
47315
|
checkChartExists(cmd) {
|
|
47352
|
-
return this.isChartDefined(cmd.id) ?
|
|
47316
|
+
return this.isChartDefined(cmd.id) ? "Success" : "ChartDoesNotExist";
|
|
47353
47317
|
}
|
|
47354
47318
|
};
|
|
47355
47319
|
|
|
@@ -47408,7 +47372,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47408
47372
|
case "ADD_CONDITIONAL_FORMAT": return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange);
|
|
47409
47373
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
47410
47374
|
}
|
|
47411
|
-
return
|
|
47375
|
+
return "Success";
|
|
47412
47376
|
}
|
|
47413
47377
|
handle(cmd) {
|
|
47414
47378
|
switch (cmd.type) {
|
|
@@ -47541,21 +47505,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47541
47505
|
this.history.update("cfRules", sheet, currentCF);
|
|
47542
47506
|
}
|
|
47543
47507
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
47544
|
-
if (!this.cfRules[sheetId]) return
|
|
47508
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
47545
47509
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
47546
|
-
if (ruleIndex === -1) return
|
|
47510
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
47547
47511
|
const cfIndex2 = ruleIndex - delta;
|
|
47548
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
47549
|
-
return
|
|
47512
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
47513
|
+
return "Success";
|
|
47550
47514
|
}
|
|
47551
47515
|
checkEmptyRange(cmd) {
|
|
47552
|
-
return cmd.ranges.length ?
|
|
47516
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
47553
47517
|
}
|
|
47554
47518
|
checkCFRule(cmd) {
|
|
47555
47519
|
const rule = cmd.cf.rule;
|
|
47556
47520
|
switch (rule.type) {
|
|
47557
47521
|
case "CellIsRule":
|
|
47558
|
-
if (!CellIsOperators[rule.operator]) return
|
|
47522
|
+
if (!CellIsOperators[rule.operator]) return "InvalidConditionalFormatType";
|
|
47559
47523
|
return this.checkValidations(rule, this.checkOperatorArgsNumber(2, ["Between", "NotBetween"]), this.checkOperatorArgsNumber(1, [
|
|
47560
47524
|
"BeginsWith",
|
|
47561
47525
|
"ContainsText",
|
|
@@ -47570,9 +47534,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47570
47534
|
]), this.checkOperatorArgsNumber(0, ["IsEmpty", "IsNotEmpty"]), this.checkCFValues);
|
|
47571
47535
|
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)));
|
|
47572
47536
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
47573
|
-
case "DataBarRule": return
|
|
47537
|
+
case "DataBarRule": return "Success";
|
|
47574
47538
|
}
|
|
47575
|
-
return
|
|
47539
|
+
return "InvalidConditionalFormatType";
|
|
47576
47540
|
}
|
|
47577
47541
|
checkOperatorArgsNumber(expectedNumber, operators) {
|
|
47578
47542
|
if (expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
@@ -47580,11 +47544,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47580
47544
|
if (operators.includes(rule.operator)) {
|
|
47581
47545
|
const errors = [];
|
|
47582
47546
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
47583
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
47584
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
47585
|
-
return errors.length ? errors :
|
|
47547
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
47548
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
47549
|
+
return errors.length ? errors : "Success";
|
|
47586
47550
|
}
|
|
47587
|
-
return
|
|
47551
|
+
return "Success";
|
|
47588
47552
|
};
|
|
47589
47553
|
}
|
|
47590
47554
|
checkNaN(threshold, thresholdName) {
|
|
@@ -47593,27 +47557,27 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47593
47557
|
"percentage",
|
|
47594
47558
|
"percentile"
|
|
47595
47559
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
47596
|
-
case "min": return
|
|
47597
|
-
case "max": return
|
|
47598
|
-
case "mid": return
|
|
47599
|
-
case "upperInflectionPoint": return
|
|
47600
|
-
case "lowerInflectionPoint": return
|
|
47560
|
+
case "min": return "MinNaN";
|
|
47561
|
+
case "max": return "MaxNaN";
|
|
47562
|
+
case "mid": return "MidNaN";
|
|
47563
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
47564
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
47601
47565
|
}
|
|
47602
|
-
return
|
|
47566
|
+
return "Success";
|
|
47603
47567
|
}
|
|
47604
47568
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
47605
|
-
if (threshold.type !== "formula") return
|
|
47569
|
+
if (threshold.type !== "formula") return "Success";
|
|
47606
47570
|
if (compile(threshold.value || "").isBadExpression) switch (thresholdName) {
|
|
47607
|
-
case "min": return
|
|
47608
|
-
case "max": return
|
|
47609
|
-
case "mid": return
|
|
47610
|
-
case "upperInflectionPoint": return
|
|
47611
|
-
case "lowerInflectionPoint": return
|
|
47571
|
+
case "min": return "MinInvalidFormula";
|
|
47572
|
+
case "max": return "MaxInvalidFormula";
|
|
47573
|
+
case "mid": return "MidInvalidFormula";
|
|
47574
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
47575
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
47612
47576
|
}
|
|
47613
|
-
return
|
|
47577
|
+
return "Success";
|
|
47614
47578
|
}
|
|
47615
47579
|
checkThresholds(check) {
|
|
47616
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
47580
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
47617
47581
|
}
|
|
47618
47582
|
checkInflectionPoints(check) {
|
|
47619
47583
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -47625,8 +47589,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47625
47589
|
"number",
|
|
47626
47590
|
"percentage",
|
|
47627
47591
|
"percentile"
|
|
47628
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
47629
|
-
return
|
|
47592
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
47593
|
+
return "Success";
|
|
47630
47594
|
}
|
|
47631
47595
|
checkMinBiggerThanMax(rule) {
|
|
47632
47596
|
const minValue = rule.minimum.value;
|
|
@@ -47635,8 +47599,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47635
47599
|
"number",
|
|
47636
47600
|
"percentage",
|
|
47637
47601
|
"percentile"
|
|
47638
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
47639
|
-
return
|
|
47602
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
47603
|
+
return "Success";
|
|
47640
47604
|
}
|
|
47641
47605
|
checkMidBiggerThanMax(rule) {
|
|
47642
47606
|
const midValue = rule.midpoint?.value;
|
|
@@ -47645,8 +47609,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47645
47609
|
"number",
|
|
47646
47610
|
"percentage",
|
|
47647
47611
|
"percentile"
|
|
47648
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
47649
|
-
return
|
|
47612
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
47613
|
+
return "Success";
|
|
47650
47614
|
}
|
|
47651
47615
|
checkMinBiggerThanMid(rule) {
|
|
47652
47616
|
const minValue = rule.minimum.value;
|
|
@@ -47655,15 +47619,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47655
47619
|
"number",
|
|
47656
47620
|
"percentage",
|
|
47657
47621
|
"percentile"
|
|
47658
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
47659
|
-
return
|
|
47622
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
47623
|
+
return "Success";
|
|
47660
47624
|
}
|
|
47661
47625
|
checkCFValues(rule) {
|
|
47662
47626
|
for (const value of rule.values) {
|
|
47663
47627
|
if (!value.startsWith("=")) continue;
|
|
47664
|
-
if (compile(value || "").isBadExpression) return
|
|
47628
|
+
if (compile(value || "").isBadExpression) return "ValueCellIsInvalidFormula";
|
|
47665
47629
|
}
|
|
47666
|
-
return
|
|
47630
|
+
return "Success";
|
|
47667
47631
|
}
|
|
47668
47632
|
removeConditionalFormatting(id, sheet) {
|
|
47669
47633
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -47726,14 +47690,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47726
47690
|
allowDispatch(cmd) {
|
|
47727
47691
|
switch (cmd.type) {
|
|
47728
47692
|
case "ADD_DATA_VALIDATION_RULE":
|
|
47729
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
47693
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
47730
47694
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
47731
47695
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
47732
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
47733
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
47696
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
47697
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
47734
47698
|
break;
|
|
47735
47699
|
}
|
|
47736
|
-
return
|
|
47700
|
+
return "Success";
|
|
47737
47701
|
}
|
|
47738
47702
|
handle(cmd) {
|
|
47739
47703
|
switch (cmd.type) {
|
|
@@ -47842,7 +47806,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47842
47806
|
}
|
|
47843
47807
|
}
|
|
47844
47808
|
checkEmptyRange(cmd) {
|
|
47845
|
-
return cmd.ranges.length ?
|
|
47809
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
47846
47810
|
}
|
|
47847
47811
|
import(data) {
|
|
47848
47812
|
for (const sheet of data.sheets) {
|
|
@@ -47885,13 +47849,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47885
47849
|
}
|
|
47886
47850
|
}
|
|
47887
47851
|
checkCriterionTypeIsValid(cmd) {
|
|
47888
|
-
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
47852
|
+
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
47889
47853
|
}
|
|
47890
47854
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
47891
47855
|
const criterion = cmd.rule.criterion;
|
|
47892
47856
|
const expectedNumberOfValues = dataValidationEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
47893
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
47894
|
-
return
|
|
47857
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
47858
|
+
return "Success";
|
|
47895
47859
|
}
|
|
47896
47860
|
checkCriterionValuesAreValid(cmd) {
|
|
47897
47861
|
const criterion = cmd.rule.criterion;
|
|
@@ -47900,8 +47864,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47900
47864
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals";
|
|
47901
47865
|
else if (evaluator.allowedValues === "onlyFormulas") return true;
|
|
47902
47866
|
else return !evaluator.isCriterionValueValid(value);
|
|
47903
|
-
})) return
|
|
47904
|
-
return
|
|
47867
|
+
})) return "InvalidDataValidationCriterionValue";
|
|
47868
|
+
return "Success";
|
|
47905
47869
|
}
|
|
47906
47870
|
};
|
|
47907
47871
|
|
|
@@ -47920,7 +47884,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47920
47884
|
case "CREATE_FIGURE": return this.checkFigureDuplicate(cmd.figure.id);
|
|
47921
47885
|
case "UPDATE_FIGURE":
|
|
47922
47886
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
47923
|
-
default: return
|
|
47887
|
+
default: return "Success";
|
|
47924
47888
|
}
|
|
47925
47889
|
}
|
|
47926
47890
|
beforeHandle(cmd) {
|
|
@@ -48014,12 +47978,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48014
47978
|
this.history.update("figures", sheetId, id, void 0);
|
|
48015
47979
|
}
|
|
48016
47980
|
checkFigureExists(sheetId, figureId) {
|
|
48017
|
-
if (this.figures[sheetId]?.[figureId] === void 0) return
|
|
48018
|
-
return
|
|
47981
|
+
if (this.figures[sheetId]?.[figureId] === void 0) return "FigureDoesNotExist";
|
|
47982
|
+
return "Success";
|
|
48019
47983
|
}
|
|
48020
47984
|
checkFigureDuplicate(figureId) {
|
|
48021
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return
|
|
48022
|
-
return
|
|
47985
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return "DuplicatedFigureId";
|
|
47986
|
+
return "Success";
|
|
48023
47987
|
}
|
|
48024
47988
|
getFigures(sheetId) {
|
|
48025
47989
|
const figures = [];
|
|
@@ -48153,19 +48117,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48153
48117
|
allowDispatch(cmd) {
|
|
48154
48118
|
switch (cmd.type) {
|
|
48155
48119
|
case "HIDE_COLUMNS_ROWS": {
|
|
48156
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
48120
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
48157
48121
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
48158
48122
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
48159
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
48160
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
48161
|
-
else return
|
|
48123
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
48124
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
48125
|
+
else return "Success";
|
|
48162
48126
|
}
|
|
48163
48127
|
case "REMOVE_COLUMNS_ROWS":
|
|
48164
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
48165
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
48166
|
-
return
|
|
48128
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
48129
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
48130
|
+
return "Success";
|
|
48167
48131
|
}
|
|
48168
|
-
return
|
|
48132
|
+
return "Success";
|
|
48169
48133
|
}
|
|
48170
48134
|
handle(cmd) {
|
|
48171
48135
|
switch (cmd.type) {
|
|
@@ -48293,9 +48257,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48293
48257
|
allowDispatch(cmd) {
|
|
48294
48258
|
switch (cmd.type) {
|
|
48295
48259
|
case "CREATE_IMAGE":
|
|
48296
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
48297
|
-
return
|
|
48298
|
-
default: return
|
|
48260
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
48261
|
+
return "Success";
|
|
48262
|
+
default: return "Success";
|
|
48299
48263
|
}
|
|
48300
48264
|
}
|
|
48301
48265
|
handle(cmd) {
|
|
@@ -48436,7 +48400,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48436
48400
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
48437
48401
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
48438
48402
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
48439
|
-
default: return
|
|
48403
|
+
default: return "Success";
|
|
48440
48404
|
}
|
|
48441
48405
|
}
|
|
48442
48406
|
handle(cmd) {
|
|
@@ -48616,18 +48580,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48616
48580
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
48617
48581
|
}
|
|
48618
48582
|
checkDestructiveMerge({ sheetId, target }) {
|
|
48619
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
48620
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
48583
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
48584
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
48621
48585
|
}
|
|
48622
48586
|
checkOverlap({ target }) {
|
|
48623
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
48624
|
-
return
|
|
48587
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
48588
|
+
return "Success";
|
|
48625
48589
|
}
|
|
48626
48590
|
checkFrozenPanes({ sheetId, target }) {
|
|
48627
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
48591
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
48628
48592
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
48629
|
-
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
48630
|
-
return
|
|
48593
|
+
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
48594
|
+
return "Success";
|
|
48631
48595
|
}
|
|
48632
48596
|
/**
|
|
48633
48597
|
* The content of a merged cell should always be empty.
|
|
@@ -48635,10 +48599,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48635
48599
|
*/
|
|
48636
48600
|
checkMergedContentUpdate(cmd) {
|
|
48637
48601
|
const { col, row, content } = cmd;
|
|
48638
|
-
if (content === void 0) return
|
|
48602
|
+
if (content === void 0) return "Success";
|
|
48639
48603
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
48640
|
-
if (mainCol === col && mainRow === row) return
|
|
48641
|
-
return
|
|
48604
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
48605
|
+
return "CellIsMerged";
|
|
48642
48606
|
}
|
|
48643
48607
|
checkMergeExists(cmd) {
|
|
48644
48608
|
const { sheetId, target } = cmd;
|
|
@@ -48649,9 +48613,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48649
48613
|
col: left,
|
|
48650
48614
|
row: top
|
|
48651
48615
|
});
|
|
48652
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
48616
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
48653
48617
|
}
|
|
48654
|
-
return
|
|
48618
|
+
return "Success";
|
|
48655
48619
|
}
|
|
48656
48620
|
/**
|
|
48657
48621
|
* Merge the current selection. Note that:
|
|
@@ -48799,8 +48763,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48799
48763
|
"removeRangesSheetPrefix"
|
|
48800
48764
|
];
|
|
48801
48765
|
allowDispatch(cmd) {
|
|
48802
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
48803
|
-
return
|
|
48766
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
48767
|
+
return "Success";
|
|
48804
48768
|
}
|
|
48805
48769
|
beforeHandle(command) {}
|
|
48806
48770
|
handle(cmd) {
|
|
@@ -49209,40 +49173,40 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49209
49173
|
cellPosition = {};
|
|
49210
49174
|
allowDispatch(cmd) {
|
|
49211
49175
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
49212
|
-
if (genericChecks !==
|
|
49176
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
49213
49177
|
switch (cmd.type) {
|
|
49214
49178
|
case "HIDE_SHEET":
|
|
49215
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
49216
|
-
return
|
|
49179
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
49180
|
+
return "Success";
|
|
49217
49181
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
49218
49182
|
case "DUPLICATE_SHEET":
|
|
49219
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
49220
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
49221
|
-
return
|
|
49183
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
49184
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
49185
|
+
return "Success";
|
|
49222
49186
|
case "MOVE_SHEET": try {
|
|
49223
49187
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
49224
49188
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
49225
|
-
return
|
|
49189
|
+
return "Success";
|
|
49226
49190
|
} catch (e) {
|
|
49227
|
-
return
|
|
49191
|
+
return "WrongSheetMove";
|
|
49228
49192
|
}
|
|
49229
49193
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
49230
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
49231
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
49194
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
49195
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
49232
49196
|
case "ADD_COLUMNS_ROWS":
|
|
49233
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
49234
|
-
else if (cmd.quantity <= 0) return
|
|
49235
|
-
return
|
|
49197
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
49198
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
49199
|
+
return "Success";
|
|
49236
49200
|
case "REMOVE_COLUMNS_ROWS": {
|
|
49237
49201
|
const min = largeMin(cmd.elements);
|
|
49238
49202
|
const max = largeMax(cmd.elements);
|
|
49239
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
49240
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
49241
|
-
else return
|
|
49203
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
49204
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
49205
|
+
else return "Success";
|
|
49242
49206
|
}
|
|
49243
49207
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
49244
49208
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
49245
|
-
default: return
|
|
49209
|
+
default: return "Success";
|
|
49246
49210
|
}
|
|
49247
49211
|
}
|
|
49248
49212
|
handle(cmd) {
|
|
@@ -49505,12 +49469,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49505
49469
|
* not outside the sheet.
|
|
49506
49470
|
*/
|
|
49507
49471
|
checkZonesExistInSheet(sheetId, zones) {
|
|
49508
|
-
if (!zones.every(isZoneValid)) return
|
|
49472
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
49509
49473
|
if (zones.length) {
|
|
49510
49474
|
const sheetZone = this.getSheetZone(sheetId);
|
|
49511
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
49475
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
49512
49476
|
}
|
|
49513
|
-
return
|
|
49477
|
+
return "Success";
|
|
49514
49478
|
}
|
|
49515
49479
|
updateCellPosition(cmd) {
|
|
49516
49480
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -49584,36 +49548,36 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49584
49548
|
}
|
|
49585
49549
|
checkSheetName(cmd) {
|
|
49586
49550
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
49587
|
-
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return
|
|
49551
|
+
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return "UnchangedSheetName";
|
|
49588
49552
|
const { orderedSheetIds, sheets } = this;
|
|
49589
49553
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
49590
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
49591
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
49592
|
-
return
|
|
49554
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
49555
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
49556
|
+
return "Success";
|
|
49593
49557
|
}
|
|
49594
49558
|
checkSheetPosition(cmd) {
|
|
49595
49559
|
const { orderedSheetIds } = this;
|
|
49596
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
49597
|
-
return
|
|
49560
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
49561
|
+
return "Success";
|
|
49598
49562
|
}
|
|
49599
49563
|
checkRowFreezeQuantity(cmd) {
|
|
49600
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
49564
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
49601
49565
|
}
|
|
49602
49566
|
checkColFreezeQuantity(cmd) {
|
|
49603
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
49567
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
49604
49568
|
}
|
|
49605
49569
|
checkRowFreezeOverlapMerge(cmd) {
|
|
49606
49570
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
49607
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
49608
|
-
return
|
|
49571
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
49572
|
+
return "Success";
|
|
49609
49573
|
}
|
|
49610
49574
|
checkColFreezeOverlapMerge(cmd) {
|
|
49611
49575
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
49612
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
49613
|
-
return
|
|
49576
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
49577
|
+
return "Success";
|
|
49614
49578
|
}
|
|
49615
49579
|
isRenameAllowed(cmd) {
|
|
49616
|
-
if (!(cmd.name && cmd.name.trim().toLowerCase())) return
|
|
49580
|
+
if (!(cmd.name && cmd.name.trim().toLowerCase())) return "MissingSheetName";
|
|
49617
49581
|
return this.checkSheetName(cmd);
|
|
49618
49582
|
}
|
|
49619
49583
|
renameSheet(sheet, name) {
|
|
@@ -49835,17 +49799,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49835
49799
|
* sheet.
|
|
49836
49800
|
*/
|
|
49837
49801
|
checkSheetExists(cmd) {
|
|
49838
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
49839
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
49840
|
-
return
|
|
49802
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
49803
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
49804
|
+
return "Success";
|
|
49841
49805
|
}
|
|
49842
49806
|
/**
|
|
49843
49807
|
* Check if zones in the command are well formed and
|
|
49844
49808
|
* not outside the sheet.
|
|
49845
49809
|
*/
|
|
49846
49810
|
checkZonesAreInSheet(cmd) {
|
|
49847
|
-
if (!("sheetId" in cmd)) return
|
|
49848
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
49811
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
49812
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
49849
49813
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
49850
49814
|
}
|
|
49851
49815
|
};
|
|
@@ -49867,21 +49831,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49867
49831
|
allowDispatch(cmd) {
|
|
49868
49832
|
switch (cmd.type) {
|
|
49869
49833
|
case "CREATE_TABLE":
|
|
49870
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
49834
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
49871
49835
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
49872
|
-
if (!areZonesContinuous(zones)) return
|
|
49873
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
49836
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
49837
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
49874
49838
|
case "UPDATE_TABLE":
|
|
49875
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
49839
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
49876
49840
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
49877
49841
|
case "ADD_MERGE":
|
|
49878
49842
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
49879
49843
|
const tableZone = table.range.zone;
|
|
49880
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
49844
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
49881
49845
|
}
|
|
49882
49846
|
break;
|
|
49883
49847
|
}
|
|
49884
|
-
return
|
|
49848
|
+
return "Success";
|
|
49885
49849
|
}
|
|
49886
49850
|
handle(cmd) {
|
|
49887
49851
|
switch (cmd.type) {
|
|
@@ -50019,19 +49983,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50019
49983
|
}
|
|
50020
49984
|
}
|
|
50021
49985
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
50022
|
-
if (!cmd.newTableRange) return
|
|
49986
|
+
if (!cmd.newTableRange) return "Success";
|
|
50023
49987
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
50024
49988
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
50025
|
-
if (zoneIsInSheet !==
|
|
49989
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
50026
49990
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
50027
|
-
if (!updatedTable) return
|
|
50028
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
49991
|
+
if (!updatedTable) return "TableNotFound";
|
|
49992
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
50029
49993
|
}
|
|
50030
49994
|
checkTableConfigUpdateIsValid(config) {
|
|
50031
|
-
if (!config) return
|
|
50032
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
50033
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
50034
|
-
return
|
|
49995
|
+
if (!config) return "Success";
|
|
49996
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
49997
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
49998
|
+
return "Success";
|
|
50035
49999
|
}
|
|
50036
50000
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
50037
50001
|
const zone = tableRange.zone;
|
|
@@ -50262,28 +50226,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50262
50226
|
switch (cmd.type) {
|
|
50263
50227
|
case "GROUP_HEADERS": {
|
|
50264
50228
|
const { start, end, sheetId } = cmd;
|
|
50265
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50266
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
50267
|
-
if (start > end) return
|
|
50268
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
50229
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50230
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
50231
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
50232
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
50269
50233
|
break;
|
|
50270
50234
|
}
|
|
50271
50235
|
case "UNGROUP_HEADERS": {
|
|
50272
50236
|
const { start, end, sheetId } = cmd;
|
|
50273
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50274
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
50275
|
-
if (start > end) return
|
|
50237
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50238
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
50239
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
50276
50240
|
break;
|
|
50277
50241
|
}
|
|
50278
50242
|
case "UNFOLD_HEADER_GROUP":
|
|
50279
50243
|
case "FOLD_HEADER_GROUP":
|
|
50280
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
50244
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
50281
50245
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
50282
|
-
if (!group) return
|
|
50283
|
-
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
|
|
50246
|
+
if (!group) return "UnknownHeaderGroup";
|
|
50247
|
+
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";
|
|
50284
50248
|
break;
|
|
50285
50249
|
}
|
|
50286
|
-
return
|
|
50250
|
+
return "Success";
|
|
50287
50251
|
}
|
|
50288
50252
|
handle(cmd) {
|
|
50289
50253
|
switch (cmd.type) {
|
|
@@ -50612,22 +50576,22 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50612
50576
|
switch (cmd.type) {
|
|
50613
50577
|
case "ADD_PIVOT": return this.checkDuplicatedMeasureIds(cmd.pivot);
|
|
50614
50578
|
case "UPDATE_PIVOT":
|
|
50615
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50616
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
50617
|
-
if (cmd.pivot.name === "") return
|
|
50579
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50580
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
50581
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
50618
50582
|
return this.checkDuplicatedMeasureIds(cmd.pivot);
|
|
50619
50583
|
case "RENAME_PIVOT":
|
|
50620
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50621
|
-
if (cmd.name === "") return
|
|
50584
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50585
|
+
if (cmd.name === "") return "EmptyName";
|
|
50622
50586
|
break;
|
|
50623
50587
|
case "REMOVE_PIVOT":
|
|
50624
50588
|
case "DUPLICATE_PIVOT":
|
|
50625
50589
|
case "INSERT_PIVOT":
|
|
50626
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50590
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50627
50591
|
break;
|
|
50628
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
50592
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50629
50593
|
}
|
|
50630
|
-
return
|
|
50594
|
+
return "Success";
|
|
50631
50595
|
}
|
|
50632
50596
|
handle(cmd) {
|
|
50633
50597
|
switch (cmd.type) {
|
|
@@ -50825,8 +50789,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50825
50789
|
}
|
|
50826
50790
|
checkDuplicatedMeasureIds(definition) {
|
|
50827
50791
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
50828
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
50829
|
-
return
|
|
50792
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
50793
|
+
return "Success";
|
|
50830
50794
|
}
|
|
50831
50795
|
/**
|
|
50832
50796
|
* Import the pivots
|
|
@@ -50855,9 +50819,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50855
50819
|
locale = DEFAULT_LOCALE;
|
|
50856
50820
|
allowDispatch(cmd) {
|
|
50857
50821
|
switch (cmd.type) {
|
|
50858
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
50822
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
50859
50823
|
}
|
|
50860
|
-
return
|
|
50824
|
+
return "Success";
|
|
50861
50825
|
}
|
|
50862
50826
|
handle(cmd) {
|
|
50863
50827
|
switch (cmd.type) {
|
|
@@ -50907,15 +50871,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50907
50871
|
const definition = cmd.pivot;
|
|
50908
50872
|
return this.checkDataSetValidity(definition);
|
|
50909
50873
|
}
|
|
50910
|
-
return
|
|
50874
|
+
return "Success";
|
|
50911
50875
|
}
|
|
50912
50876
|
checkDataSetValidity(definition) {
|
|
50913
50877
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
50914
50878
|
const { zone, sheetId } = definition.dataSet;
|
|
50915
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
50879
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
50916
50880
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
50917
50881
|
}
|
|
50918
|
-
return
|
|
50882
|
+
return "Success";
|
|
50919
50883
|
}
|
|
50920
50884
|
};
|
|
50921
50885
|
|
|
@@ -50933,18 +50897,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50933
50897
|
switch (cmd.type) {
|
|
50934
50898
|
case "CREATE_TABLE":
|
|
50935
50899
|
case "UPDATE_TABLE":
|
|
50936
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
50900
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
50937
50901
|
break;
|
|
50938
50902
|
case "CREATE_TABLE_STYLE":
|
|
50939
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
50903
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
50940
50904
|
try {
|
|
50941
50905
|
toHex(cmd.primaryColor);
|
|
50942
50906
|
} catch (e) {
|
|
50943
|
-
return
|
|
50907
|
+
return "InvalidTableStyle";
|
|
50944
50908
|
}
|
|
50945
50909
|
break;
|
|
50946
50910
|
}
|
|
50947
|
-
return
|
|
50911
|
+
return "Success";
|
|
50948
50912
|
}
|
|
50949
50913
|
handle(cmd) {
|
|
50950
50914
|
switch (cmd.type) {
|
|
@@ -51046,6 +51010,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51046
51010
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
51047
51011
|
}
|
|
51048
51012
|
var CompilationParametersBuilder = class {
|
|
51013
|
+
getters;
|
|
51014
|
+
computeCell;
|
|
51049
51015
|
evalContext;
|
|
51050
51016
|
rangeCache = {};
|
|
51051
51017
|
constructor(context, getters, computeCell) {
|
|
@@ -51499,6 +51465,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51499
51465
|
* It uses an R-Tree data structure to efficiently find dependent cells.
|
|
51500
51466
|
*/
|
|
51501
51467
|
var FormulaDependencyGraph = class {
|
|
51468
|
+
createEmptyPositionSet;
|
|
51502
51469
|
dependencies = new PositionMap();
|
|
51503
51470
|
rTree;
|
|
51504
51471
|
constructor(createEmptyPositionSet, data = []) {
|
|
@@ -51800,6 +51767,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51800
51767
|
const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
|
|
51801
51768
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
51802
51769
|
var Evaluator = class {
|
|
51770
|
+
context;
|
|
51803
51771
|
getters;
|
|
51804
51772
|
compilationParams;
|
|
51805
51773
|
evaluatedCells = new PositionMap();
|
|
@@ -51818,7 +51786,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51818
51786
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
51819
51787
|
if (!spreadZone) return;
|
|
51820
51788
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
51821
|
-
if (evaluatedCell?.type ===
|
|
51789
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
51822
51790
|
return union(positionToZone(position), spreadZone);
|
|
51823
51791
|
}
|
|
51824
51792
|
getEvaluatedPositions() {
|
|
@@ -51828,7 +51796,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51828
51796
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
51829
51797
|
}
|
|
51830
51798
|
getArrayFormulaSpreadingOn(position) {
|
|
51831
|
-
if (this.getEvaluatedCell(position).type ===
|
|
51799
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
51832
51800
|
const arrayFormulas = this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position));
|
|
51833
51801
|
return Array.from(arrayFormulas).find((position) => !this.blockedArrayFormulas.has(position));
|
|
51834
51802
|
}
|
|
@@ -52061,7 +52029,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52061
52029
|
col: i + col,
|
|
52062
52030
|
row: j + row
|
|
52063
52031
|
};
|
|
52064
|
-
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !==
|
|
52032
|
+
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
52065
52033
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
52066
52034
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data in %s.", toXC(position.col, position.row)));
|
|
52067
52035
|
}
|
|
@@ -52287,7 +52255,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52287
52255
|
sheetId,
|
|
52288
52256
|
col,
|
|
52289
52257
|
row
|
|
52290
|
-
})).every((cell) => cell.type ===
|
|
52258
|
+
})).every((cell) => cell.type === "empty");
|
|
52291
52259
|
}
|
|
52292
52260
|
/**
|
|
52293
52261
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -52741,7 +52709,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52741
52709
|
return computedDataBars;
|
|
52742
52710
|
}
|
|
52743
52711
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
52744
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type ===
|
|
52712
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
52745
52713
|
switch (threshold.type) {
|
|
52746
52714
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
52747
52715
|
case "number": return Number(threshold.value);
|
|
@@ -52772,7 +52740,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52772
52740
|
col,
|
|
52773
52741
|
row
|
|
52774
52742
|
});
|
|
52775
|
-
if (cell.type !==
|
|
52743
|
+
if (cell.type !== "number") continue;
|
|
52776
52744
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
52777
52745
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
52778
52746
|
computedIcons[col][row] = icon;
|
|
@@ -52785,7 +52753,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52785
52753
|
}
|
|
52786
52754
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
52787
52755
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
52788
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
52756
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
52789
52757
|
if (max <= 0) return;
|
|
52790
52758
|
const color = rule.color;
|
|
52791
52759
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -52798,7 +52766,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52798
52766
|
col: targetCol,
|
|
52799
52767
|
row: targetRow
|
|
52800
52768
|
});
|
|
52801
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
52769
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
52802
52770
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
52803
52771
|
computedDataBars[col][row] = {
|
|
52804
52772
|
color: colorNumberString(color),
|
|
@@ -52836,7 +52804,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52836
52804
|
col,
|
|
52837
52805
|
row
|
|
52838
52806
|
});
|
|
52839
|
-
if (cell.type ===
|
|
52807
|
+
if (cell.type === "number") {
|
|
52840
52808
|
const value = clip(cell.value, minValue, maxValue);
|
|
52841
52809
|
let color;
|
|
52842
52810
|
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);
|
|
@@ -52870,7 +52838,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52870
52838
|
*/
|
|
52871
52839
|
rulePredicate = { CellIsRule: (target, rule) => {
|
|
52872
52840
|
const cell = this.getters.getEvaluatedCell(target);
|
|
52873
|
-
if (cell.type ===
|
|
52841
|
+
if (cell.type === "error") return false;
|
|
52874
52842
|
let [value0, value1] = rule.values.map((val) => {
|
|
52875
52843
|
if (val.startsWith("=")) return this.getters.evaluateFormula(target.sheetId, val) ?? "";
|
|
52876
52844
|
return parseLiteral(val, DEFAULT_LOCALE);
|
|
@@ -52980,7 +52948,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52980
52948
|
if (!validationResults[col]) validationResults[col] = [];
|
|
52981
52949
|
validationResults[col][row] = lazy(() => {
|
|
52982
52950
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
52983
|
-
if (evaluatedCell.type ===
|
|
52951
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
52984
52952
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
52985
52953
|
});
|
|
52986
52954
|
}
|
|
@@ -53795,6 +53763,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53795
53763
|
"getPivot",
|
|
53796
53764
|
"getFirstPivotFunction",
|
|
53797
53765
|
"getPivotIdFromPosition",
|
|
53766
|
+
"getPivotIdsFromPosition",
|
|
53798
53767
|
"getPivotCellFromPosition",
|
|
53799
53768
|
"generateNewCalculatedMeasureName",
|
|
53800
53769
|
"isPivotUnused",
|
|
@@ -53819,9 +53788,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53819
53788
|
this.refreshPivot(cmd.id);
|
|
53820
53789
|
break;
|
|
53821
53790
|
case "ADD_PIVOT":
|
|
53791
|
+
this.unusedPivots?.push(cmd.pivotId);
|
|
53822
53792
|
this.setupPivot(cmd.pivotId);
|
|
53823
53793
|
break;
|
|
53824
53794
|
case "DUPLICATE_PIVOT":
|
|
53795
|
+
this.unusedPivots?.push(cmd.newPivotId);
|
|
53825
53796
|
this.setupPivot(cmd.newPivotId);
|
|
53826
53797
|
break;
|
|
53827
53798
|
case "UPDATE_PIVOT":
|
|
@@ -53852,37 +53823,52 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53852
53823
|
}
|
|
53853
53824
|
}
|
|
53854
53825
|
/**
|
|
53855
|
-
* Get the id of the pivot at the given position. Returns undefined if there
|
|
53826
|
+
* Get the id of the first pivot in the formula at the given position. Returns undefined if there
|
|
53856
53827
|
* is no pivot at this position
|
|
53857
53828
|
*/
|
|
53858
53829
|
getPivotIdFromPosition(position) {
|
|
53830
|
+
return this.getPivotIdsFromPosition(position)[0];
|
|
53831
|
+
}
|
|
53832
|
+
/**
|
|
53833
|
+
* Get all of the ids of the pivot present in the formula at the given position.
|
|
53834
|
+
*/
|
|
53835
|
+
getPivotIdsFromPosition(position) {
|
|
53859
53836
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
53860
|
-
if (cell && cell.isFormula)
|
|
53861
|
-
|
|
53862
|
-
|
|
53863
|
-
|
|
53864
|
-
|
|
53865
|
-
|
|
53866
|
-
|
|
53837
|
+
if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
|
|
53838
|
+
return [];
|
|
53839
|
+
}
|
|
53840
|
+
getPivotIdsFromFormula(sheetId, formula) {
|
|
53841
|
+
return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
|
|
53842
|
+
const pivotId = pivotFunction.args[0]?.toString();
|
|
53843
|
+
return pivotId && this.getters.getPivotId(pivotId);
|
|
53844
|
+
}).filter(isDefined);
|
|
53867
53845
|
}
|
|
53868
53846
|
isSpillPivotFormula(position) {
|
|
53869
53847
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
53870
53848
|
if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
|
|
53871
53849
|
return false;
|
|
53872
53850
|
}
|
|
53873
|
-
|
|
53874
|
-
const
|
|
53875
|
-
if (!
|
|
53876
|
-
const
|
|
53877
|
-
|
|
53878
|
-
functionName,
|
|
53879
|
-
|
|
53851
|
+
getPivotFunctions(sheetId, tokens) {
|
|
53852
|
+
const pivotFunctions = getPivotFunctions(tokens);
|
|
53853
|
+
if (!pivotFunctions.length) return [];
|
|
53854
|
+
const evaluatedPivotFunctions = [];
|
|
53855
|
+
for (const pivotFunction of pivotFunctions) {
|
|
53856
|
+
const { functionName, args } = pivotFunction;
|
|
53857
|
+
const evaluatedArgs = args.map((argAst) => {
|
|
53880
53858
|
if (argAst.type === "EMPTY") return;
|
|
53881
53859
|
else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
|
|
53882
53860
|
const argsString = astToFormula(argAst);
|
|
53883
53861
|
return this.getters.evaluateFormula(sheetId, argsString);
|
|
53884
|
-
})
|
|
53885
|
-
|
|
53862
|
+
});
|
|
53863
|
+
evaluatedPivotFunctions.push({
|
|
53864
|
+
functionName,
|
|
53865
|
+
args: evaluatedArgs
|
|
53866
|
+
});
|
|
53867
|
+
}
|
|
53868
|
+
return evaluatedPivotFunctions;
|
|
53869
|
+
}
|
|
53870
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
53871
|
+
return this.getPivotFunctions(sheetId, tokens)[0];
|
|
53886
53872
|
}
|
|
53887
53873
|
/**
|
|
53888
53874
|
* Returns the domain args of a pivot formula from a position.
|
|
@@ -53982,8 +53968,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53982
53968
|
const unusedPivots = new Set(this.getters.getPivotIds());
|
|
53983
53969
|
for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
|
|
53984
53970
|
const position = this.getters.getCellPosition(cellId);
|
|
53985
|
-
const
|
|
53986
|
-
|
|
53971
|
+
const pivotIds = this.getPivotIdsFromPosition(position);
|
|
53972
|
+
for (const pivotId of pivotIds) {
|
|
53987
53973
|
unusedPivots.delete(pivotId);
|
|
53988
53974
|
if (!unusedPivots.size) {
|
|
53989
53975
|
this.unusedPivots = [];
|
|
@@ -53991,6 +53977,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53991
53977
|
}
|
|
53992
53978
|
}
|
|
53993
53979
|
}
|
|
53980
|
+
for (const pivotId of this.getters.getPivotIds()) {
|
|
53981
|
+
const pivot = this.getters.getPivotCoreDefinition(pivotId);
|
|
53982
|
+
for (const measure of pivot.measures) if (measure.computedBy) {
|
|
53983
|
+
const { sheetId } = measure.computedBy;
|
|
53984
|
+
const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
|
|
53985
|
+
const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
|
|
53986
|
+
for (const relatedPivotId of relatedPivotIds) {
|
|
53987
|
+
unusedPivots.delete(relatedPivotId);
|
|
53988
|
+
if (!unusedPivots.size) {
|
|
53989
|
+
this.unusedPivots = [];
|
|
53990
|
+
return [];
|
|
53991
|
+
}
|
|
53992
|
+
}
|
|
53993
|
+
}
|
|
53994
|
+
}
|
|
53994
53995
|
this.unusedPivots = [...unusedPivots];
|
|
53995
53996
|
return this.unusedPivots;
|
|
53996
53997
|
}
|
|
@@ -54067,10 +54068,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54067
54068
|
const sheetId = this.getters.getActiveSheetId();
|
|
54068
54069
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
54069
54070
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
54070
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
54071
|
-
return
|
|
54071
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
54072
|
+
return "InvalidAutofillSelection";
|
|
54072
54073
|
}
|
|
54073
|
-
return
|
|
54074
|
+
return "Success";
|
|
54074
54075
|
}
|
|
54075
54076
|
handle(cmd) {
|
|
54076
54077
|
switch (cmd.type) {
|
|
@@ -54102,7 +54103,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54102
54103
|
const target = this.autofillZone;
|
|
54103
54104
|
const autofillCellsData = [];
|
|
54104
54105
|
switch (this.direction) {
|
|
54105
|
-
case
|
|
54106
|
+
case "down":
|
|
54106
54107
|
for (let col = source.left; col <= source.right; col++) {
|
|
54107
54108
|
const xcs = [];
|
|
54108
54109
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -54110,7 +54111,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54110
54111
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54111
54112
|
}
|
|
54112
54113
|
break;
|
|
54113
|
-
case
|
|
54114
|
+
case "up":
|
|
54114
54115
|
for (let col = source.left; col <= source.right; col++) {
|
|
54115
54116
|
const xcs = [];
|
|
54116
54117
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -54118,7 +54119,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54118
54119
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54119
54120
|
}
|
|
54120
54121
|
break;
|
|
54121
|
-
case
|
|
54122
|
+
case "left":
|
|
54122
54123
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54123
54124
|
const xcs = [];
|
|
54124
54125
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -54126,7 +54127,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54126
54127
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54127
54128
|
}
|
|
54128
54129
|
break;
|
|
54129
|
-
case
|
|
54130
|
+
case "right":
|
|
54130
54131
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54131
54132
|
const xcs = [];
|
|
54132
54133
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -54252,19 +54253,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54252
54253
|
}
|
|
54253
54254
|
this.direction = this.getDirection(col, row);
|
|
54254
54255
|
switch (this.direction) {
|
|
54255
|
-
case
|
|
54256
|
+
case "up":
|
|
54256
54257
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
54257
54258
|
this.steps = source.top - row;
|
|
54258
54259
|
break;
|
|
54259
|
-
case
|
|
54260
|
+
case "down":
|
|
54260
54261
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
54261
54262
|
this.steps = row - source.bottom;
|
|
54262
54263
|
break;
|
|
54263
|
-
case
|
|
54264
|
+
case "left":
|
|
54264
54265
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
54265
54266
|
this.steps = source.left - col;
|
|
54266
54267
|
break;
|
|
54267
|
-
case
|
|
54268
|
+
case "right":
|
|
54268
54269
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
54269
54270
|
this.steps = col - source.right;
|
|
54270
54271
|
break;
|
|
@@ -54283,7 +54284,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54283
54284
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
54284
54285
|
...activePosition,
|
|
54285
54286
|
row
|
|
54286
|
-
}).type !==
|
|
54287
|
+
}).type !== "empty") {
|
|
54287
54288
|
autofillRow = row - 1;
|
|
54288
54289
|
break;
|
|
54289
54290
|
}
|
|
@@ -54303,7 +54304,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54303
54304
|
col: col - 1,
|
|
54304
54305
|
row
|
|
54305
54306
|
};
|
|
54306
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
54307
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
54307
54308
|
row += 1;
|
|
54308
54309
|
leftPosition = {
|
|
54309
54310
|
sheetId,
|
|
@@ -54320,7 +54321,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54320
54321
|
col: col + 1,
|
|
54321
54322
|
row
|
|
54322
54323
|
};
|
|
54323
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
54324
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
54324
54325
|
row += 1;
|
|
54325
54326
|
rightPosition = {
|
|
54326
54327
|
sheetId,
|
|
@@ -54410,19 +54411,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54410
54411
|
const position = {
|
|
54411
54412
|
up: {
|
|
54412
54413
|
number: source.top - row,
|
|
54413
|
-
value:
|
|
54414
|
+
value: "up"
|
|
54414
54415
|
},
|
|
54415
54416
|
down: {
|
|
54416
54417
|
number: row - source.bottom,
|
|
54417
|
-
value:
|
|
54418
|
+
value: "down"
|
|
54418
54419
|
},
|
|
54419
54420
|
left: {
|
|
54420
54421
|
number: source.left - col,
|
|
54421
|
-
value:
|
|
54422
|
+
value: "left"
|
|
54422
54423
|
},
|
|
54423
54424
|
right: {
|
|
54424
54425
|
number: col - source.right,
|
|
54425
|
-
value:
|
|
54426
|
+
value: "right"
|
|
54426
54427
|
}
|
|
54427
54428
|
};
|
|
54428
54429
|
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;
|
|
@@ -54625,7 +54626,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54625
54626
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
54626
54627
|
}
|
|
54627
54628
|
isNumber(cell) {
|
|
54628
|
-
return cell.type ===
|
|
54629
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
54629
54630
|
}
|
|
54630
54631
|
isZoneValid(zone) {
|
|
54631
54632
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -55119,6 +55120,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55119
55120
|
//#endregion
|
|
55120
55121
|
//#region src/collaborative/revisions.ts
|
|
55121
55122
|
var Revision = class {
|
|
55123
|
+
rootCommand;
|
|
55124
|
+
timestamp;
|
|
55122
55125
|
id;
|
|
55123
55126
|
clientId;
|
|
55124
55127
|
_commands = [];
|
|
@@ -55155,6 +55158,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55155
55158
|
//#region src/collaborative/session.ts
|
|
55156
55159
|
var ClientDisconnectedError = class extends Error {};
|
|
55157
55160
|
var Session = class extends EventBus {
|
|
55161
|
+
revisions;
|
|
55162
|
+
transportService;
|
|
55163
|
+
serverRevisionId;
|
|
55158
55164
|
/**
|
|
55159
55165
|
* Positions of the others client.
|
|
55160
55166
|
*/
|
|
@@ -55620,7 +55626,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55620
55626
|
switch (cmd.type) {
|
|
55621
55627
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
55622
55628
|
}
|
|
55623
|
-
return
|
|
55629
|
+
return "Success";
|
|
55624
55630
|
}
|
|
55625
55631
|
handle(cmd) {
|
|
55626
55632
|
switch (cmd.type) {
|
|
@@ -55703,34 +55709,34 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55703
55709
|
});
|
|
55704
55710
|
}
|
|
55705
55711
|
checkSingleRangeSelected() {
|
|
55706
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
55707
|
-
return
|
|
55712
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
55713
|
+
return "Success";
|
|
55708
55714
|
}
|
|
55709
55715
|
checkNoMergeInZone() {
|
|
55710
55716
|
const sheetId = this.getters.getActiveSheetId();
|
|
55711
55717
|
const zone = this.getters.getSelectedZone();
|
|
55712
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
55713
|
-
return
|
|
55718
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
55719
|
+
return "Success";
|
|
55714
55720
|
}
|
|
55715
55721
|
checkRangeContainsValues(cmd) {
|
|
55716
55722
|
const sheetId = this.getters.getActiveSheetId();
|
|
55717
55723
|
const zone = this.getters.getSelectedZone();
|
|
55718
55724
|
if (cmd.hasHeader) zone.top += 1;
|
|
55719
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
55720
|
-
return
|
|
55725
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptyTarget";
|
|
55726
|
+
return "Success";
|
|
55721
55727
|
}
|
|
55722
55728
|
checkNoColumnProvided(cmd) {
|
|
55723
|
-
if (cmd.columns.length === 0) return
|
|
55724
|
-
return
|
|
55729
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
55730
|
+
return "Success";
|
|
55725
55731
|
}
|
|
55726
55732
|
checkColumnsIncludedInZone(cmd) {
|
|
55727
55733
|
const zone = this.getters.getSelectedZone();
|
|
55728
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
55729
|
-
return
|
|
55734
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
55735
|
+
return "Success";
|
|
55730
55736
|
}
|
|
55731
55737
|
checkColumnsAreUnique(cmd) {
|
|
55732
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
55733
|
-
return
|
|
55738
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
55739
|
+
return "Success";
|
|
55734
55740
|
}
|
|
55735
55741
|
trimWhitespace() {
|
|
55736
55742
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -55863,7 +55869,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55863
55869
|
getCellNumberFormat(position) {
|
|
55864
55870
|
for (const pos of [position]) {
|
|
55865
55871
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
55866
|
-
if (cell.type ===
|
|
55872
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
55867
55873
|
}
|
|
55868
55874
|
}
|
|
55869
55875
|
};
|
|
@@ -55931,11 +55937,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55931
55937
|
allowDispatch(cmd) {
|
|
55932
55938
|
switch (cmd.type) {
|
|
55933
55939
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
55934
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
55935
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
55940
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
55941
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
55936
55942
|
break;
|
|
55937
55943
|
}
|
|
55938
|
-
return
|
|
55944
|
+
return "Success";
|
|
55939
55945
|
}
|
|
55940
55946
|
handle(cmd) {
|
|
55941
55947
|
switch (cmd.type) {
|
|
@@ -56136,7 +56142,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56136
56142
|
if (!isInside(cmd.col, cmd.row, cmd.zone)) throw new Error(_t("The anchor must be part of the provided zone"));
|
|
56137
56143
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes);
|
|
56138
56144
|
}
|
|
56139
|
-
return
|
|
56145
|
+
return "Success";
|
|
56140
56146
|
}
|
|
56141
56147
|
handle(cmd) {
|
|
56142
56148
|
switch (cmd.type) {
|
|
@@ -56146,24 +56152,24 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56146
56152
|
}
|
|
56147
56153
|
}
|
|
56148
56154
|
checkMerge({ sheetId, zone }) {
|
|
56149
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56155
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56150
56156
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
56151
56157
|
sheetId,
|
|
56152
56158
|
col,
|
|
56153
56159
|
row
|
|
56154
|
-
}))) return
|
|
56155
|
-
return
|
|
56160
|
+
}))) return "InvalidSortZone";
|
|
56161
|
+
return "Success";
|
|
56156
56162
|
}
|
|
56157
56163
|
checkMergeSizes({ sheetId, zone }) {
|
|
56158
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56164
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56159
56165
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
56160
56166
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
56161
56167
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
56162
56168
|
if (!merges.every((merge) => {
|
|
56163
56169
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
56164
56170
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
56165
|
-
})) return
|
|
56166
|
-
return
|
|
56171
|
+
})) return "InvalidSortZone";
|
|
56172
|
+
return "Success";
|
|
56167
56173
|
}
|
|
56168
56174
|
/**
|
|
56169
56175
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -56181,9 +56187,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56181
56187
|
col,
|
|
56182
56188
|
row
|
|
56183
56189
|
}).type));
|
|
56184
|
-
if (cells[0][0] ===
|
|
56185
|
-
if (cells.some((item) => item[0] ===
|
|
56186
|
-
else if (cells.some((item) => item[1] !==
|
|
56190
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
56191
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
56192
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
56187
56193
|
else return false;
|
|
56188
56194
|
}
|
|
56189
56195
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -56441,7 +56447,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56441
56447
|
*/
|
|
56442
56448
|
isCellEmpty(position) {
|
|
56443
56449
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
56444
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
56450
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
56445
56451
|
}
|
|
56446
56452
|
getColMaxWidth(sheetId, index) {
|
|
56447
56453
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -56455,8 +56461,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56455
56461
|
* sheet.
|
|
56456
56462
|
*/
|
|
56457
56463
|
checkSheetExists(cmd) {
|
|
56458
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return
|
|
56459
|
-
return
|
|
56464
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return "InvalidSheetId";
|
|
56465
|
+
return "Success";
|
|
56460
56466
|
}
|
|
56461
56467
|
/**
|
|
56462
56468
|
* Check if zones in the command are well formed and
|
|
@@ -56464,11 +56470,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56464
56470
|
*/
|
|
56465
56471
|
checkZonesAreInSheet(cmd) {
|
|
56466
56472
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
56467
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
56473
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
56468
56474
|
const zones = this.getters.getCommandZones(cmd);
|
|
56469
|
-
if (!sheetId && zones.length > 0) return
|
|
56475
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
56470
56476
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
56471
|
-
return
|
|
56477
|
+
return "Success";
|
|
56472
56478
|
}
|
|
56473
56479
|
autoResizeRows(sheetId, rows) {
|
|
56474
56480
|
const rowSizes = [];
|
|
@@ -56716,7 +56722,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56716
56722
|
...position,
|
|
56717
56723
|
content: "FALSE"
|
|
56718
56724
|
});
|
|
56719
|
-
else if (cell?.content && evaluatedCell.type ===
|
|
56725
|
+
else if (cell?.content && evaluatedCell.type === "empty") {
|
|
56720
56726
|
let value;
|
|
56721
56727
|
if (cell.content.startsWith("=")) {
|
|
56722
56728
|
const result = this.getters.evaluateFormula(position.sheetId, cell.content);
|
|
@@ -56726,7 +56732,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56726
56732
|
...position,
|
|
56727
56733
|
content: "FALSE"
|
|
56728
56734
|
});
|
|
56729
|
-
} else if (evaluatedCell.type !==
|
|
56735
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
56730
56736
|
...position,
|
|
56731
56737
|
content: "FALSE"
|
|
56732
56738
|
});
|
|
@@ -56979,13 +56985,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56979
56985
|
allowDispatch(cmd) {
|
|
56980
56986
|
switch (cmd.type) {
|
|
56981
56987
|
case "REQUEST_UNDO":
|
|
56982
|
-
if (!this.canUndo()) return
|
|
56988
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
56983
56989
|
break;
|
|
56984
56990
|
case "REQUEST_REDO":
|
|
56985
|
-
if (!this.canRedo()) return
|
|
56991
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
56986
56992
|
break;
|
|
56987
56993
|
}
|
|
56988
|
-
return
|
|
56994
|
+
return "Success";
|
|
56989
56995
|
}
|
|
56990
56996
|
handle(cmd) {
|
|
56991
56997
|
switch (cmd.type) {
|
|
@@ -57102,7 +57108,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57102
57108
|
switch (cmd.type) {
|
|
57103
57109
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
57104
57110
|
}
|
|
57105
|
-
return
|
|
57111
|
+
return "Success";
|
|
57106
57112
|
}
|
|
57107
57113
|
handle(cmd) {
|
|
57108
57114
|
switch (cmd.type) {
|
|
@@ -57113,7 +57119,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57113
57119
|
}
|
|
57114
57120
|
getAutomaticSeparator() {
|
|
57115
57121
|
const cells = this.getters.getSelectedCells();
|
|
57116
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
57122
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
57117
57123
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
57118
57124
|
if (separator) return separator;
|
|
57119
57125
|
}
|
|
@@ -57249,24 +57255,24 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57249
57255
|
});
|
|
57250
57256
|
}
|
|
57251
57257
|
checkSingleColSelected() {
|
|
57252
|
-
if (!this.getters.isSingleColSelected()) return
|
|
57253
|
-
return
|
|
57258
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
57259
|
+
return "Success";
|
|
57254
57260
|
}
|
|
57255
57261
|
checkNonEmptySelector(cmd) {
|
|
57256
|
-
if (cmd.separator === "") return
|
|
57257
|
-
return
|
|
57262
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
57263
|
+
return "Success";
|
|
57258
57264
|
}
|
|
57259
57265
|
checkNotOverwritingContent(cmd) {
|
|
57260
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
57266
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
57261
57267
|
const selection = this.getters.getSelectedZones()[0];
|
|
57262
57268
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
57263
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
57264
|
-
return
|
|
57269
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
57270
|
+
return "Success";
|
|
57265
57271
|
}
|
|
57266
57272
|
checkSeparatorInSelection({ separator }) {
|
|
57267
57273
|
const cells = this.getters.getSelectedCells();
|
|
57268
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
57269
|
-
return
|
|
57274
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
57275
|
+
return "NoSplitSeparatorInSelection";
|
|
57270
57276
|
}
|
|
57271
57277
|
};
|
|
57272
57278
|
|
|
@@ -57303,7 +57309,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57303
57309
|
col,
|
|
57304
57310
|
row: r,
|
|
57305
57311
|
sheetId
|
|
57306
|
-
}).type !==
|
|
57312
|
+
}).type !== "empty") return;
|
|
57307
57313
|
}
|
|
57308
57314
|
const oldSelection = {
|
|
57309
57315
|
zone: this.getters.getSelectedZone(),
|
|
@@ -57332,13 +57338,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57332
57338
|
switch (cmd.type) {
|
|
57333
57339
|
case "RESIZE_TABLE":
|
|
57334
57340
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
57335
|
-
if (!table) return
|
|
57341
|
+
if (!table) return "TableNotFound";
|
|
57336
57342
|
const oldTableZone = table.range.zone;
|
|
57337
57343
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
57338
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
57344
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
57339
57345
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
57340
57346
|
}
|
|
57341
|
-
return
|
|
57347
|
+
return "Success";
|
|
57342
57348
|
}
|
|
57343
57349
|
handle(cmd) {
|
|
57344
57350
|
switch (cmd.type) {
|
|
@@ -57403,7 +57409,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57403
57409
|
});
|
|
57404
57410
|
}
|
|
57405
57411
|
case "PASTE": {
|
|
57406
|
-
if (!this.copiedData) return
|
|
57412
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
57407
57413
|
const pasteOption = cmd.pasteOption;
|
|
57408
57414
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
57409
57415
|
pasteOption,
|
|
@@ -57412,12 +57418,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57412
57418
|
}
|
|
57413
57419
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
57414
57420
|
const zones = this.getters.getSelectedZones();
|
|
57415
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
57421
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
57416
57422
|
break;
|
|
57417
57423
|
}
|
|
57418
57424
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
57419
57425
|
const zones = this.getters.getSelectedZones();
|
|
57420
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
57426
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
57421
57427
|
break;
|
|
57422
57428
|
}
|
|
57423
57429
|
case "INSERT_CELL": {
|
|
@@ -57431,7 +57437,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57431
57437
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
57432
57438
|
}
|
|
57433
57439
|
}
|
|
57434
|
-
return
|
|
57440
|
+
return "Success";
|
|
57435
57441
|
}
|
|
57436
57442
|
handle(cmd) {
|
|
57437
57443
|
switch (cmd.type) {
|
|
@@ -57589,16 +57595,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57589
57595
|
const clipboardData = this.getClipboardData(zones);
|
|
57590
57596
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
57591
57597
|
const result = handler.isCutAllowed(clipboardData);
|
|
57592
|
-
if (result !==
|
|
57598
|
+
if (result !== "Success") return result;
|
|
57593
57599
|
}
|
|
57594
|
-
return
|
|
57600
|
+
return "Success";
|
|
57595
57601
|
}
|
|
57596
57602
|
isPasteAllowed(target, copiedData, options) {
|
|
57597
57603
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
57598
57604
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
57599
|
-
if (result !==
|
|
57605
|
+
if (result !== "Success") return result;
|
|
57600
57606
|
}
|
|
57601
|
-
return
|
|
57607
|
+
return "Success";
|
|
57602
57608
|
}
|
|
57603
57609
|
isColRowDirtyingClipboard(position, dimension) {
|
|
57604
57610
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -57675,8 +57681,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57675
57681
|
}
|
|
57676
57682
|
getClipboardContent() {
|
|
57677
57683
|
return {
|
|
57678
|
-
[
|
|
57679
|
-
[
|
|
57684
|
+
["text/plain"]: this.getPlainTextContent(),
|
|
57685
|
+
["text/html"]: this.getHTMLContent()
|
|
57680
57686
|
};
|
|
57681
57687
|
}
|
|
57682
57688
|
getSheetData() {
|
|
@@ -57809,10 +57815,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57809
57815
|
allowDispatch(cmd) {
|
|
57810
57816
|
switch (cmd.type) {
|
|
57811
57817
|
case "UPDATE_FILTER":
|
|
57812
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
57818
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
57813
57819
|
break;
|
|
57814
57820
|
}
|
|
57815
|
-
return
|
|
57821
|
+
return "Success";
|
|
57816
57822
|
}
|
|
57817
57823
|
handle(cmd) {
|
|
57818
57824
|
switch (cmd.type) {
|
|
@@ -58026,14 +58032,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58026
58032
|
allowDispatch(cmd) {
|
|
58027
58033
|
switch (cmd.type) {
|
|
58028
58034
|
case "ACTIVATE_SHEET": try {
|
|
58029
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
58035
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
58030
58036
|
break;
|
|
58031
58037
|
} catch (error) {
|
|
58032
|
-
return
|
|
58038
|
+
return "InvalidSheetId";
|
|
58033
58039
|
}
|
|
58034
58040
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
58035
58041
|
}
|
|
58036
|
-
return
|
|
58042
|
+
return "Success";
|
|
58037
58043
|
}
|
|
58038
58044
|
handleEvent(event) {
|
|
58039
58045
|
const anchor = event.anchor;
|
|
@@ -58322,7 +58328,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58322
58328
|
}, [zone]);
|
|
58323
58329
|
}
|
|
58324
58330
|
setActiveSheet(id) {
|
|
58325
|
-
|
|
58331
|
+
const sheet = this.getters.getSheet(id);
|
|
58332
|
+
this.activeSheet = sheet;
|
|
58326
58333
|
}
|
|
58327
58334
|
activateNextSheet(direction) {
|
|
58328
58335
|
const sheetIds = this.getters.getSheetIds();
|
|
@@ -58460,12 +58467,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58460
58467
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
58461
58468
|
const id = cmd.sheetId;
|
|
58462
58469
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
58463
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
58470
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
58464
58471
|
const headers = [cmd.base, ...cmd.elements];
|
|
58465
58472
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
58466
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
58467
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
58468
|
-
return
|
|
58473
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
58474
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
58475
|
+
return "Success";
|
|
58469
58476
|
}
|
|
58470
58477
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
58471
58478
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -58558,6 +58565,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58558
58565
|
//#endregion
|
|
58559
58566
|
//#region src/helpers/internal_viewport.ts
|
|
58560
58567
|
var InternalViewport = class {
|
|
58568
|
+
getters;
|
|
58569
|
+
sheetId;
|
|
58570
|
+
boundaries;
|
|
58561
58571
|
top;
|
|
58562
58572
|
bottom;
|
|
58563
58573
|
left;
|
|
@@ -58895,7 +58905,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58895
58905
|
switch (cmd.type) {
|
|
58896
58906
|
case "SET_VIEWPORT_OFFSET": return this.chainValidations(this.checkScrollingDirection, this.checkIfViewportsWillChange)(cmd);
|
|
58897
58907
|
case "RESIZE_SHEETVIEW": return this.chainValidations(this.checkValuesAreDifferent, this.checkPositiveDimension)(cmd);
|
|
58898
|
-
default: return
|
|
58908
|
+
default: return "Success";
|
|
58899
58909
|
}
|
|
58900
58910
|
}
|
|
58901
58911
|
handleEvent(event) {
|
|
@@ -59303,23 +59313,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59303
59313
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
59304
59314
|
}
|
|
59305
59315
|
checkPositiveDimension(cmd) {
|
|
59306
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
59307
|
-
return
|
|
59316
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
59317
|
+
return "Success";
|
|
59308
59318
|
}
|
|
59309
59319
|
checkValuesAreDifferent(cmd) {
|
|
59310
59320
|
const { height, width } = this.getSheetViewDimension();
|
|
59311
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
59312
|
-
return
|
|
59321
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
59322
|
+
return "Success";
|
|
59313
59323
|
}
|
|
59314
59324
|
checkScrollingDirection({ offsetX, offsetY }) {
|
|
59315
59325
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
59316
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
59317
|
-
return
|
|
59326
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
59327
|
+
return "Success";
|
|
59318
59328
|
}
|
|
59319
59329
|
checkIfViewportsWillChange({ offsetX, offsetY }) {
|
|
59320
59330
|
const sheetId = this.getters.getActiveSheetId();
|
|
59321
59331
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
59322
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
59332
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
59323
59333
|
}
|
|
59324
59334
|
getMainViewport(sheetId) {
|
|
59325
59335
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -59904,9 +59914,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59904
59914
|
sheetId,
|
|
59905
59915
|
name
|
|
59906
59916
|
});
|
|
59907
|
-
if (result.reasons.includes(
|
|
59908
|
-
else if (result.reasons.includes(
|
|
59909
|
-
else if (result.reasons.includes(
|
|
59917
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
59918
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
59919
|
+
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);
|
|
59910
59920
|
}
|
|
59911
59921
|
|
|
59912
59922
|
//#endregion
|
|
@@ -60118,41 +60128,41 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60118
60128
|
const selectionStatisticFunctions = [
|
|
60119
60129
|
{
|
|
60120
60130
|
name: _t("Sum"),
|
|
60121
|
-
types: [
|
|
60131
|
+
types: ["number"],
|
|
60122
60132
|
compute: (values, locale) => sum([[values]], locale)
|
|
60123
60133
|
},
|
|
60124
60134
|
{
|
|
60125
60135
|
name: _t("Avg"),
|
|
60126
|
-
types: [
|
|
60136
|
+
types: ["number"],
|
|
60127
60137
|
compute: (values, locale) => average([[values]], locale)
|
|
60128
60138
|
},
|
|
60129
60139
|
{
|
|
60130
60140
|
name: _t("Min"),
|
|
60131
|
-
types: [
|
|
60141
|
+
types: ["number"],
|
|
60132
60142
|
compute: (values, locale) => min([[values]], locale).value
|
|
60133
60143
|
},
|
|
60134
60144
|
{
|
|
60135
60145
|
name: _t("Max"),
|
|
60136
|
-
types: [
|
|
60146
|
+
types: ["number"],
|
|
60137
60147
|
compute: (values, locale) => max([[values]], locale).value
|
|
60138
60148
|
},
|
|
60139
60149
|
{
|
|
60140
60150
|
name: _t("Count"),
|
|
60141
60151
|
types: [
|
|
60142
|
-
|
|
60143
|
-
|
|
60144
|
-
|
|
60145
|
-
|
|
60152
|
+
"number",
|
|
60153
|
+
"text",
|
|
60154
|
+
"boolean",
|
|
60155
|
+
"error"
|
|
60146
60156
|
],
|
|
60147
60157
|
compute: (values) => countAny([[values]])
|
|
60148
60158
|
},
|
|
60149
60159
|
{
|
|
60150
60160
|
name: _t("Count Numbers"),
|
|
60151
60161
|
types: [
|
|
60152
|
-
|
|
60153
|
-
|
|
60154
|
-
|
|
60155
|
-
|
|
60162
|
+
"number",
|
|
60163
|
+
"text",
|
|
60164
|
+
"boolean",
|
|
60165
|
+
"error"
|
|
60156
60166
|
],
|
|
60157
60167
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
60158
60168
|
}
|
|
@@ -60202,7 +60212,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60202
60212
|
col,
|
|
60203
60213
|
row
|
|
60204
60214
|
});
|
|
60205
|
-
if (evaluatedCell.type !==
|
|
60215
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
60206
60216
|
}
|
|
60207
60217
|
const locale = getters.getLocale();
|
|
60208
60218
|
const statisticFnResults = {};
|
|
@@ -60687,7 +60697,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60687
60697
|
css`
|
|
60688
60698
|
.o-header-group {
|
|
60689
60699
|
.o-header-group-header {
|
|
60690
|
-
z-index: ${
|
|
60700
|
+
z-index: ${6};
|
|
60691
60701
|
.o-group-fold-button {
|
|
60692
60702
|
cursor: pointer;
|
|
60693
60703
|
width: 13px;
|
|
@@ -61473,7 +61483,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61473
61483
|
});
|
|
61474
61484
|
return cssPropertiesToCss({
|
|
61475
61485
|
"border-color": SELECTION_BORDER_COLOR,
|
|
61476
|
-
"z-index": String(
|
|
61486
|
+
"z-index": String(30)
|
|
61477
61487
|
});
|
|
61478
61488
|
}
|
|
61479
61489
|
onFocus(selection) {
|
|
@@ -61709,7 +61719,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61709
61719
|
overflow-y: auto;
|
|
61710
61720
|
overflow-x: hidden;
|
|
61711
61721
|
padding: 2px;
|
|
61712
|
-
z-index: ${
|
|
61722
|
+
z-index: ${21};
|
|
61713
61723
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
61714
61724
|
background-color: white;
|
|
61715
61725
|
|
|
@@ -61848,6 +61858,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61848
61858
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
61849
61859
|
}
|
|
61850
61860
|
var WebClipboardWrapper = class {
|
|
61861
|
+
clipboard;
|
|
61851
61862
|
constructor(clipboard) {
|
|
61852
61863
|
this.clipboard = clipboard;
|
|
61853
61864
|
}
|
|
@@ -61862,12 +61873,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61862
61873
|
*/
|
|
61863
61874
|
try {
|
|
61864
61875
|
await this.clipboard?.write([new ClipboardItem({
|
|
61865
|
-
[
|
|
61866
|
-
[
|
|
61876
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
61877
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
61867
61878
|
})]);
|
|
61868
61879
|
} catch (e) {}
|
|
61869
61880
|
}
|
|
61870
|
-
else await this.writeText(clipboardContent[
|
|
61881
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
61871
61882
|
}
|
|
61872
61883
|
async writeText(text) {
|
|
61873
61884
|
try {
|
|
@@ -61892,13 +61903,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61892
61903
|
}
|
|
61893
61904
|
else return {
|
|
61894
61905
|
status: "ok",
|
|
61895
|
-
content: { [
|
|
61906
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
61896
61907
|
};
|
|
61897
61908
|
}
|
|
61898
61909
|
getClipboardItems(content) {
|
|
61899
61910
|
const clipboardItemData = {
|
|
61900
|
-
[
|
|
61901
|
-
[
|
|
61911
|
+
["text/plain"]: this.getBlob(content, "text/plain"),
|
|
61912
|
+
["text/html"]: this.getBlob(content, "text/html")
|
|
61902
61913
|
};
|
|
61903
61914
|
return [new ClipboardItem(clipboardItemData)];
|
|
61904
61915
|
}
|
|
@@ -62356,6 +62367,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62356
62367
|
* @param operations initial operations
|
|
62357
62368
|
*/
|
|
62358
62369
|
var Branch = class Branch {
|
|
62370
|
+
buildTransformation;
|
|
62371
|
+
operations;
|
|
62359
62372
|
constructor(buildTransformation, operations = []) {
|
|
62360
62373
|
this.buildTransformation = buildTransformation;
|
|
62361
62374
|
this.operations = operations;
|
|
@@ -62472,6 +62485,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62472
62485
|
* to revert it).
|
|
62473
62486
|
*/
|
|
62474
62487
|
var Operation = class {
|
|
62488
|
+
id;
|
|
62489
|
+
data;
|
|
62475
62490
|
constructor(id, data) {
|
|
62476
62491
|
this.id = id;
|
|
62477
62492
|
this.data = data;
|
|
@@ -62481,6 +62496,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62481
62496
|
}
|
|
62482
62497
|
};
|
|
62483
62498
|
var LazyOperation = class LazyOperation {
|
|
62499
|
+
id;
|
|
62500
|
+
lazyData;
|
|
62484
62501
|
constructor(id, lazyData) {
|
|
62485
62502
|
this.id = id;
|
|
62486
62503
|
this.lazyData = lazyData;
|
|
@@ -62506,6 +62523,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62506
62523
|
* ```
|
|
62507
62524
|
*/
|
|
62508
62525
|
var OperationSequence = class OperationSequence {
|
|
62526
|
+
operations;
|
|
62509
62527
|
constructor(operations) {
|
|
62510
62528
|
this.operations = operations;
|
|
62511
62529
|
}
|
|
@@ -62581,6 +62599,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62581
62599
|
*
|
|
62582
62600
|
*/
|
|
62583
62601
|
var Tree = class {
|
|
62602
|
+
buildTransformation;
|
|
62584
62603
|
branches;
|
|
62585
62604
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
62586
62605
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -63163,6 +63182,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63163
63182
|
* with the new selected anchor
|
|
63164
63183
|
*/
|
|
63165
63184
|
var SelectionStreamProcessorImpl = class {
|
|
63185
|
+
getters;
|
|
63166
63186
|
stream;
|
|
63167
63187
|
/**
|
|
63168
63188
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -63261,7 +63281,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63261
63281
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
63262
63282
|
*/
|
|
63263
63283
|
moveAnchorCell(direction, step = 1) {
|
|
63264
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63284
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63265
63285
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
63266
63286
|
return this.selectCell(col, row);
|
|
63267
63287
|
}
|
|
@@ -63323,7 +63343,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63323
63343
|
* of the anchor zone which moves.
|
|
63324
63344
|
*/
|
|
63325
63345
|
resizeAnchorZone(direction, step = 1) {
|
|
63326
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63346
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63327
63347
|
const sheetId = this.getters.getActiveSheetId();
|
|
63328
63348
|
const anchor = this.anchor;
|
|
63329
63349
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -63570,7 +63590,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63570
63590
|
previousAnchor: deepCopy(this.anchor)
|
|
63571
63591
|
};
|
|
63572
63592
|
const commandResult = this.checkEventAnchorZone(event);
|
|
63573
|
-
if (commandResult !==
|
|
63593
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
63574
63594
|
this.anchor = event.anchor;
|
|
63575
63595
|
this.stream.send(event);
|
|
63576
63596
|
return DispatchResult.Success;
|
|
@@ -63580,15 +63600,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63580
63600
|
}
|
|
63581
63601
|
checkAnchorZone(anchor) {
|
|
63582
63602
|
const { cell, zone } = anchor;
|
|
63583
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
63603
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
63584
63604
|
const { left, right, top, bottom } = zone;
|
|
63585
63605
|
const sheetId = this.getters.getActiveSheetId();
|
|
63586
63606
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
63587
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
63588
|
-
return
|
|
63607
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
63608
|
+
return "Success";
|
|
63589
63609
|
}
|
|
63590
63610
|
checkAnchorZoneOrThrow(anchor) {
|
|
63591
|
-
if (this.checkAnchorZone(anchor) ===
|
|
63611
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
|
|
63592
63612
|
}
|
|
63593
63613
|
/**
|
|
63594
63614
|
* ---- PRIVATE ----
|
|
@@ -63745,7 +63765,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63745
63765
|
isCellSkippableInCluster(position) {
|
|
63746
63766
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
63747
63767
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
63748
|
-
return cell.type ===
|
|
63768
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
63749
63769
|
}
|
|
63750
63770
|
};
|
|
63751
63771
|
|
|
@@ -65668,13 +65688,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65668
65688
|
|
|
65669
65689
|
//#endregion
|
|
65670
65690
|
//#region src/model.ts
|
|
65671
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
65672
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
65673
|
-
Status[Status["Running"] = 1] = "Running";
|
|
65674
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
65675
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
65676
|
-
return Status;
|
|
65677
|
-
}(Status || {});
|
|
65678
65691
|
var Model = class extends EventBus {
|
|
65679
65692
|
corePlugins = [];
|
|
65680
65693
|
featurePlugins = [];
|
|
@@ -65698,7 +65711,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65698
65711
|
/**
|
|
65699
65712
|
* Internal status of the model. Important for command handling coordination
|
|
65700
65713
|
*/
|
|
65701
|
-
status =
|
|
65714
|
+
status = 0;
|
|
65702
65715
|
/**
|
|
65703
65716
|
* The config object contains some configuration flag and callbacks
|
|
65704
65717
|
*/
|
|
@@ -65835,7 +65848,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65835
65848
|
onRemoteRevisionReceived({ commands }) {
|
|
65836
65849
|
for (const command of commands) {
|
|
65837
65850
|
const previousStatus = this.status;
|
|
65838
|
-
this.status =
|
|
65851
|
+
this.status = 2;
|
|
65839
65852
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
65840
65853
|
this.status = previousStatus;
|
|
65841
65854
|
}
|
|
@@ -65933,7 +65946,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65933
65946
|
*/
|
|
65934
65947
|
checkDispatchAllowed(command) {
|
|
65935
65948
|
const results = isCoreCommand(command) ? this.checkDispatchAllowedCoreCommand(command) : this.checkDispatchAllowedLocalCommand(command);
|
|
65936
|
-
if (results.some((r) => r !==
|
|
65949
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
65937
65950
|
return DispatchResult.Success;
|
|
65938
65951
|
}
|
|
65939
65952
|
checkDispatchAllowedCoreCommand(command) {
|
|
@@ -65945,9 +65958,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65945
65958
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
65946
65959
|
}
|
|
65947
65960
|
finalize() {
|
|
65948
|
-
this.status =
|
|
65961
|
+
this.status = 3;
|
|
65949
65962
|
for (const h of this.handlers) h.finalize();
|
|
65950
|
-
this.status =
|
|
65963
|
+
this.status = 0;
|
|
65951
65964
|
this.trigger("command-finalized");
|
|
65952
65965
|
}
|
|
65953
65966
|
/**
|
|
@@ -65974,16 +65987,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65974
65987
|
dispatch = (type, payload) => {
|
|
65975
65988
|
const command = createCommand(type, payload);
|
|
65976
65989
|
const status = this.status;
|
|
65977
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
65978
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
65990
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
65991
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
65979
65992
|
switch (status) {
|
|
65980
|
-
case
|
|
65993
|
+
case 0:
|
|
65981
65994
|
const result = this.checkDispatchAllowed(command);
|
|
65982
65995
|
if (!result.isSuccessful) {
|
|
65983
65996
|
this.trigger("update");
|
|
65984
65997
|
return result;
|
|
65985
65998
|
}
|
|
65986
|
-
this.status =
|
|
65999
|
+
this.status = 1;
|
|
65987
66000
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
65988
66001
|
const start = performance.now();
|
|
65989
66002
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -65993,10 +66006,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65993
66006
|
if (time > 5) console.debug(type, time, "ms");
|
|
65994
66007
|
});
|
|
65995
66008
|
this.session.save(command, commands, changes);
|
|
65996
|
-
this.status =
|
|
66009
|
+
this.status = 0;
|
|
65997
66010
|
this.trigger("update");
|
|
65998
66011
|
break;
|
|
65999
|
-
case
|
|
66012
|
+
case 1:
|
|
66000
66013
|
if (isCoreCommand(command)) {
|
|
66001
66014
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
66002
66015
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -66004,8 +66017,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66004
66017
|
}
|
|
66005
66018
|
this.dispatchToHandlers(this.handlers, command);
|
|
66006
66019
|
break;
|
|
66007
|
-
case
|
|
66008
|
-
case
|
|
66020
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
66021
|
+
case 2:
|
|
66009
66022
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
66010
66023
|
this.dispatchToHandlers(this.handlers, command);
|
|
66011
66024
|
}
|
|
@@ -66018,7 +66031,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66018
66031
|
dispatchFromCorePlugin = (type, payload) => {
|
|
66019
66032
|
const command = createCommand(type, payload);
|
|
66020
66033
|
const previousStatus = this.status;
|
|
66021
|
-
this.status =
|
|
66034
|
+
this.status = 2;
|
|
66022
66035
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
66023
66036
|
this.dispatchToHandlers(handlers, command);
|
|
66024
66037
|
this.status = previousStatus;
|
|
@@ -66362,8 +66375,8 @@ exports.stores = stores;
|
|
|
66362
66375
|
exports.tokenColors = tokenColors;
|
|
66363
66376
|
exports.tokenize = tokenize;
|
|
66364
66377
|
|
|
66365
|
-
__info__.version = "18.0.
|
|
66366
|
-
__info__.date = "2026-
|
|
66367
|
-
__info__.hash = "
|
|
66378
|
+
__info__.version = "18.0.70";
|
|
66379
|
+
__info__.date = "2026-06-06T06:20:39.985Z";
|
|
66380
|
+
__info__.hash = "3ff29f6";
|
|
66368
66381
|
|
|
66369
66382
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|