@odoo/o-spreadsheet 18.0.68 → 18.0.69
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 +787 -776
- package/dist/o-spreadsheet.esm.js +787 -776
- package/dist/o-spreadsheet.iife.js +788 -777
- package/dist/o-spreadsheet.iife.min.js +414 -414
- package/dist/o_spreadsheet.xml +3 -3
- package/dist/types/helpers/pivot/pivot_composer_helpers.d.ts +4 -0
- package/dist/types/plugins/ui_core_views/pivot_ui.d.ts +16 -8
- package/package.json +17 -17
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 18.0.
|
|
6
|
-
* @date 2026-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.69
|
|
6
|
+
* @date 2026-05-27T05:57:08.710Z
|
|
7
|
+
* @hash 50b85ba
|
|
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.")
|
|
@@ -4865,7 +4828,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4865
4828
|
value,
|
|
4866
4829
|
format,
|
|
4867
4830
|
formattedValue,
|
|
4868
|
-
type:
|
|
4831
|
+
type: "text",
|
|
4869
4832
|
isAutoSummable: true,
|
|
4870
4833
|
defaultAlign: "left"
|
|
4871
4834
|
};
|
|
@@ -4875,7 +4838,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4875
4838
|
value: value || 0,
|
|
4876
4839
|
format,
|
|
4877
4840
|
formattedValue,
|
|
4878
|
-
type:
|
|
4841
|
+
type: "number",
|
|
4879
4842
|
isAutoSummable: true,
|
|
4880
4843
|
defaultAlign: "right"
|
|
4881
4844
|
};
|
|
@@ -4885,7 +4848,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4885
4848
|
value: null,
|
|
4886
4849
|
format,
|
|
4887
4850
|
formattedValue: "",
|
|
4888
|
-
type:
|
|
4851
|
+
type: "empty",
|
|
4889
4852
|
isAutoSummable: true,
|
|
4890
4853
|
defaultAlign: "left"
|
|
4891
4854
|
};
|
|
@@ -4895,7 +4858,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4895
4858
|
value,
|
|
4896
4859
|
format,
|
|
4897
4860
|
formattedValue,
|
|
4898
|
-
type:
|
|
4861
|
+
type: "number",
|
|
4899
4862
|
isAutoSummable: false,
|
|
4900
4863
|
defaultAlign: "right"
|
|
4901
4864
|
};
|
|
@@ -4905,7 +4868,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4905
4868
|
value,
|
|
4906
4869
|
format,
|
|
4907
4870
|
formattedValue,
|
|
4908
|
-
type:
|
|
4871
|
+
type: "boolean",
|
|
4909
4872
|
isAutoSummable: false,
|
|
4910
4873
|
defaultAlign: "center"
|
|
4911
4874
|
};
|
|
@@ -4915,7 +4878,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4915
4878
|
value,
|
|
4916
4879
|
formattedValue: value,
|
|
4917
4880
|
message,
|
|
4918
|
-
type:
|
|
4881
|
+
type: "error",
|
|
4919
4882
|
isAutoSummable: false,
|
|
4920
4883
|
defaultAlign: "center"
|
|
4921
4884
|
};
|
|
@@ -5058,6 +5021,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5058
5021
|
//#endregion
|
|
5059
5022
|
//#region src/helpers/range.ts
|
|
5060
5023
|
var RangeImpl = class RangeImpl {
|
|
5024
|
+
getSheetSize;
|
|
5061
5025
|
_zone;
|
|
5062
5026
|
parts;
|
|
5063
5027
|
invalidXc;
|
|
@@ -5689,10 +5653,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5689
5653
|
return target.map((t) => splitZoneForPaste(t, width, height)).flat();
|
|
5690
5654
|
}
|
|
5691
5655
|
function parseOSClipboardContent(content) {
|
|
5692
|
-
if (!content[
|
|
5693
|
-
const htmlDocument = new DOMParser().parseFromString(content[
|
|
5656
|
+
if (!content["text/html"]) return { text: content["text/plain"] };
|
|
5657
|
+
const htmlDocument = new DOMParser().parseFromString(content["text/html"], "text/html");
|
|
5694
5658
|
return {
|
|
5695
|
-
text: content[
|
|
5659
|
+
text: content["text/plain"],
|
|
5696
5660
|
data: getOSheetDataFromHTML(htmlDocument)
|
|
5697
5661
|
};
|
|
5698
5662
|
}
|
|
@@ -5759,6 +5723,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5759
5723
|
//#endregion
|
|
5760
5724
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
5761
5725
|
var ClipboardHandler = class {
|
|
5726
|
+
getters;
|
|
5727
|
+
dispatch;
|
|
5762
5728
|
constructor(getters, dispatch) {
|
|
5763
5729
|
this.getters = getters;
|
|
5764
5730
|
this.dispatch = dispatch;
|
|
@@ -5766,10 +5732,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5766
5732
|
copy(data, mode = "copyPaste") {}
|
|
5767
5733
|
paste(target, clippedContent, options) {}
|
|
5768
5734
|
isPasteAllowed(sheetId, target, content, option) {
|
|
5769
|
-
return
|
|
5735
|
+
return "Success";
|
|
5770
5736
|
}
|
|
5771
5737
|
isCutAllowed(data) {
|
|
5772
|
-
return
|
|
5738
|
+
return "Success";
|
|
5773
5739
|
}
|
|
5774
5740
|
getPasteTarget(sheetId, target, content, options) {
|
|
5775
5741
|
return {
|
|
@@ -7220,8 +7186,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7220
7186
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
7221
7187
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7222
7188
|
isCutAllowed(data) {
|
|
7223
|
-
if (data.zones.length !== 1) return
|
|
7224
|
-
return
|
|
7189
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
7190
|
+
return "Success";
|
|
7225
7191
|
}
|
|
7226
7192
|
copy(data, mode = "copyPaste") {
|
|
7227
7193
|
const sheetId = data.sheetId;
|
|
@@ -7289,17 +7255,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7289
7255
|
};
|
|
7290
7256
|
}
|
|
7291
7257
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
7292
|
-
if (!content.cells) return
|
|
7293
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
7258
|
+
if (!content.cells) return "Success";
|
|
7259
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
7294
7260
|
if (target.length > 1) {
|
|
7295
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
7261
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
7296
7262
|
}
|
|
7297
7263
|
const clipboardHeight = content.cells.length;
|
|
7298
7264
|
const clipboardWidth = content.cells[0].length;
|
|
7299
7265
|
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
|
|
7266
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
7301
7267
|
}
|
|
7302
|
-
return
|
|
7268
|
+
return "Success";
|
|
7303
7269
|
}
|
|
7304
7270
|
/**
|
|
7305
7271
|
* Paste the clipboard content in the given target
|
|
@@ -7481,9 +7447,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7481
7447
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7482
7448
|
}
|
|
7483
7449
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7484
|
-
if (target.length === 0) return
|
|
7485
|
-
if (option?.pasteOption !== void 0) return
|
|
7486
|
-
return
|
|
7450
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7451
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7452
|
+
return "Success";
|
|
7487
7453
|
}
|
|
7488
7454
|
};
|
|
7489
7455
|
|
|
@@ -7782,9 +7748,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7782
7748
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7783
7749
|
}
|
|
7784
7750
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7785
|
-
if (target.length === 0) return
|
|
7786
|
-
if (option?.pasteOption !== void 0) return
|
|
7787
|
-
return
|
|
7751
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7752
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7753
|
+
return "Success";
|
|
7788
7754
|
}
|
|
7789
7755
|
};
|
|
7790
7756
|
|
|
@@ -7879,10 +7845,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
7879
7845
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
7880
7846
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7881
7847
|
isPasteAllowed(sheetId, target, content, options) {
|
|
7882
|
-
if (!("cells" in content)) return
|
|
7848
|
+
if (!("cells" in content)) return "Success";
|
|
7883
7849
|
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
|
|
7850
|
+
for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
7851
|
+
return "Success";
|
|
7886
7852
|
}
|
|
7887
7853
|
};
|
|
7888
7854
|
|
|
@@ -8134,6 +8100,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
8134
8100
|
}
|
|
8135
8101
|
};
|
|
8136
8102
|
var StoreFactory = class {
|
|
8103
|
+
get;
|
|
8137
8104
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
8138
8105
|
constructor(get) {
|
|
8139
8106
|
this.get = get;
|
|
@@ -8178,6 +8145,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8178
8145
|
return MetaStore;
|
|
8179
8146
|
}
|
|
8180
8147
|
var DisposableStore = class {
|
|
8148
|
+
get;
|
|
8181
8149
|
disposeCallbacks = [];
|
|
8182
8150
|
constructor(get) {
|
|
8183
8151
|
this.get = get;
|
|
@@ -8555,16 +8523,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8555
8523
|
}
|
|
8556
8524
|
function checkDataset(definition) {
|
|
8557
8525
|
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
|
|
8526
|
+
if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
8527
|
+
if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
8560
8528
|
}
|
|
8561
|
-
return
|
|
8529
|
+
return "Success";
|
|
8562
8530
|
}
|
|
8563
8531
|
function checkLabelRange(definition) {
|
|
8564
8532
|
if (definition.labelRange) {
|
|
8565
|
-
if (!rangeReference.test(definition.labelRange || "")) return
|
|
8533
|
+
if (!rangeReference.test(definition.labelRange || "")) return "InvalidLabelRange";
|
|
8566
8534
|
}
|
|
8567
|
-
return
|
|
8535
|
+
return "Success";
|
|
8568
8536
|
}
|
|
8569
8537
|
function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
8570
8538
|
if (!dataSetsHaveTitle) return false;
|
|
@@ -8881,6 +8849,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8881
8849
|
* Represent a raw XML string
|
|
8882
8850
|
*/
|
|
8883
8851
|
var XMLString = class {
|
|
8852
|
+
xmlString;
|
|
8884
8853
|
/**
|
|
8885
8854
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
8886
8855
|
*/
|
|
@@ -8994,6 +8963,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8994
8963
|
ROUNDDOWN: [{
|
|
8995
8964
|
type: "NUMBER",
|
|
8996
8965
|
value: 0
|
|
8966
|
+
}],
|
|
8967
|
+
IFERROR: [{
|
|
8968
|
+
type: "NUMBER",
|
|
8969
|
+
value: 0
|
|
8997
8970
|
}]
|
|
8998
8971
|
};
|
|
8999
8972
|
/**
|
|
@@ -9434,30 +9407,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9434
9407
|
|
|
9435
9408
|
//#endregion
|
|
9436
9409
|
//#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
9410
|
var XLSXImportWarningManager = class {
|
|
9462
9411
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
9463
9412
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -9946,7 +9895,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9946
9895
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
9947
9896
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
9948
9897
|
} catch (e) {}
|
|
9949
|
-
warningManager.generateNotSupportedWarning(
|
|
9898
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
9950
9899
|
}
|
|
9951
9900
|
function isFormatSupported(format) {
|
|
9952
9901
|
try {
|
|
@@ -10030,20 +9979,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10030
9979
|
return arrayToObject(formats, 1);
|
|
10031
9980
|
}
|
|
10032
9981
|
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(
|
|
9982
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
9983
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
10035
9984
|
}
|
|
10036
9985
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
10037
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
9986
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
10038
9987
|
}
|
|
10039
9988
|
function addBorderWarnings(border, warningManager) {
|
|
10040
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
9989
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
10041
9990
|
}
|
|
10042
9991
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
10043
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9992
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
10044
9993
|
}
|
|
10045
9994
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
10046
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9995
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
10047
9996
|
}
|
|
10048
9997
|
|
|
10049
9998
|
//#endregion
|
|
@@ -10183,7 +10132,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10183
10132
|
lower: icons.upper
|
|
10184
10133
|
};
|
|
10185
10134
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
10186
|
-
warningManager.generateNotSupportedWarning(
|
|
10135
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
10187
10136
|
switch (key) {
|
|
10188
10137
|
case "upper":
|
|
10189
10138
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -10219,13 +10168,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10219
10168
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
10220
10169
|
}
|
|
10221
10170
|
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(
|
|
10171
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
10172
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
10224
10173
|
if (cf.cfRules[0].dxfId) {
|
|
10225
10174
|
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(
|
|
10175
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
10176
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
10177
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
10229
10178
|
}
|
|
10230
10179
|
}
|
|
10231
10180
|
|
|
@@ -10565,13 +10514,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10565
10514
|
if (!dv) continue;
|
|
10566
10515
|
switch (dv.type) {
|
|
10567
10516
|
case "time":
|
|
10568
|
-
warningManager.generateNotSupportedWarning(
|
|
10517
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
10569
10518
|
break;
|
|
10570
10519
|
case "textLength":
|
|
10571
|
-
warningManager.generateNotSupportedWarning(
|
|
10520
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
10572
10521
|
break;
|
|
10573
10522
|
case "whole":
|
|
10574
|
-
warningManager.generateNotSupportedWarning(
|
|
10523
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
10575
10524
|
break;
|
|
10576
10525
|
case "decimal":
|
|
10577
10526
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -10583,7 +10532,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10583
10532
|
break;
|
|
10584
10533
|
case "date":
|
|
10585
10534
|
if (dv.operator === "notEqual") {
|
|
10586
|
-
warningManager.generateNotSupportedWarning(
|
|
10535
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
10587
10536
|
break;
|
|
10588
10537
|
}
|
|
10589
10538
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -10889,7 +10838,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10889
10838
|
}
|
|
10890
10839
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
10891
10840
|
const label = link.display || cellValue;
|
|
10892
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
10841
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
10893
10842
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
10894
10843
|
}
|
|
10895
10844
|
function getSheetDims(sheet) {
|
|
@@ -13174,46 +13123,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13174
13123
|
|
|
13175
13124
|
//#endregion
|
|
13176
13125
|
//#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
13126
|
const goTo = (state, guard = () => true) => [{
|
|
13218
13127
|
goTo: state,
|
|
13219
13128
|
guard
|
|
@@ -13223,41 +13132,41 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13223
13132
|
guard
|
|
13224
13133
|
});
|
|
13225
13134
|
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
|
-
[
|
|
13135
|
+
[0]: {
|
|
13136
|
+
REFERENCE: goTo(2),
|
|
13137
|
+
NUMBER: goTo(4),
|
|
13138
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
13139
|
+
},
|
|
13140
|
+
[3]: {
|
|
13141
|
+
SPACE: goTo(3),
|
|
13142
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
13143
|
+
},
|
|
13144
|
+
[4]: {
|
|
13145
|
+
SPACE: goTo(4),
|
|
13146
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
13147
|
+
},
|
|
13148
|
+
[2]: {
|
|
13149
|
+
SPACE: goTo(2),
|
|
13150
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
13151
|
+
},
|
|
13152
|
+
[1]: {
|
|
13153
|
+
SPACE: goTo(1),
|
|
13154
|
+
NUMBER: goTo(7),
|
|
13155
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13156
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
13157
|
+
},
|
|
13158
|
+
[5]: {
|
|
13159
|
+
SPACE: goTo(5),
|
|
13160
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
13161
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
13162
|
+
},
|
|
13163
|
+
[6]: {
|
|
13164
|
+
SPACE: goTo(6),
|
|
13165
|
+
NUMBER: goTo(7),
|
|
13166
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13167
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
13168
|
+
},
|
|
13169
|
+
[7]: {}
|
|
13261
13170
|
};
|
|
13262
13171
|
/**
|
|
13263
13172
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -13267,7 +13176,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13267
13176
|
*/
|
|
13268
13177
|
function matchReference(tokens) {
|
|
13269
13178
|
let head = 0;
|
|
13270
|
-
let transitions = machine[
|
|
13179
|
+
let transitions = machine[0];
|
|
13271
13180
|
let matchedTokens = "";
|
|
13272
13181
|
while (transitions !== void 0) {
|
|
13273
13182
|
const token = tokens[head++];
|
|
@@ -13276,7 +13185,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13276
13185
|
const nextState = transition ? transition.goTo : void 0;
|
|
13277
13186
|
switch (nextState) {
|
|
13278
13187
|
case void 0: return null;
|
|
13279
|
-
case
|
|
13188
|
+
case 7:
|
|
13280
13189
|
matchedTokens += token.value;
|
|
13281
13190
|
tokens.splice(0, head);
|
|
13282
13191
|
return {
|
|
@@ -13981,10 +13890,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13981
13890
|
};
|
|
13982
13891
|
function handlePasteResult(env, result) {
|
|
13983
13892
|
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(
|
|
13893
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
13894
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
13895
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
13896
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
13988
13897
|
}
|
|
13989
13898
|
}
|
|
13990
13899
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -14010,25 +13919,25 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14010
13919
|
//#region src/components/translations_terms.ts
|
|
14011
13920
|
const CfTerms = {
|
|
14012
13921
|
Errors: {
|
|
14013
|
-
[
|
|
14014
|
-
[
|
|
14015
|
-
[
|
|
14016
|
-
[
|
|
14017
|
-
[
|
|
14018
|
-
[
|
|
14019
|
-
[
|
|
14020
|
-
[
|
|
14021
|
-
[
|
|
14022
|
-
[
|
|
14023
|
-
[
|
|
14024
|
-
[
|
|
14025
|
-
[
|
|
14026
|
-
[
|
|
14027
|
-
[
|
|
14028
|
-
[
|
|
14029
|
-
[
|
|
14030
|
-
[
|
|
14031
|
-
[
|
|
13922
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
13923
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
13924
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
13925
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
13926
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
13927
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
13928
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
13929
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
13930
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
13931
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
13932
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
13933
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
13934
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
13935
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
13936
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
13937
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
13938
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
13939
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
13940
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
14032
13941
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
14033
13942
|
},
|
|
14034
13943
|
ColorScale: _t("Color scale"),
|
|
@@ -14063,18 +13972,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14063
13972
|
AggregatedChart: _t("Aggregate"),
|
|
14064
13973
|
Errors: {
|
|
14065
13974
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
14066
|
-
[
|
|
14067
|
-
[
|
|
14068
|
-
[
|
|
14069
|
-
[
|
|
14070
|
-
[
|
|
14071
|
-
[
|
|
14072
|
-
[
|
|
14073
|
-
[
|
|
14074
|
-
[
|
|
14075
|
-
[
|
|
14076
|
-
[
|
|
14077
|
-
[
|
|
13975
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
13976
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
13977
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
13978
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
13979
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
13980
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
13981
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
13982
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
13983
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
13984
|
+
["GaugeRangeMinBiggerThanRangeMax"]: _t("Minimum range limit must be smaller than maximum range limit"),
|
|
13985
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
13986
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
14078
13987
|
}
|
|
14079
13988
|
};
|
|
14080
13989
|
const CustomCurrencyTerms = { Custom: _t("Custom") };
|
|
@@ -14082,16 +13991,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14082
13991
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
14083
13992
|
const SplitToColumnsTerms = { Errors: {
|
|
14084
13993
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
14085
|
-
[
|
|
14086
|
-
[
|
|
14087
|
-
[
|
|
13994
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
13995
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
13996
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
14088
13997
|
} };
|
|
14089
13998
|
const RemoveDuplicateTerms = { Errors: {
|
|
14090
13999
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
14091
|
-
[
|
|
14092
|
-
[
|
|
14093
|
-
[
|
|
14094
|
-
[
|
|
14000
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
14001
|
+
["EmptyTarget"]: _t("Please select a range of cells containing values."),
|
|
14002
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
14003
|
+
["WillRemoveExistingMerge"]: PasteInteractiveContent.willRemoveExistingMerge
|
|
14095
14004
|
} };
|
|
14096
14005
|
const DVTerms = {
|
|
14097
14006
|
DateIs: {
|
|
@@ -14120,10 +14029,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14120
14029
|
const TableTerms = {
|
|
14121
14030
|
Errors: {
|
|
14122
14031
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
14123
|
-
[
|
|
14124
|
-
[
|
|
14125
|
-
[
|
|
14126
|
-
[
|
|
14032
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
14033
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
14034
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
14035
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
14127
14036
|
},
|
|
14128
14037
|
Checkboxes: {
|
|
14129
14038
|
hasFilters: _t("Filter button"),
|
|
@@ -14567,7 +14476,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14567
14476
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
14568
14477
|
function getBaselineText(baseline, keyValue, baselineMode, humanize, locale) {
|
|
14569
14478
|
if (!baseline) return "";
|
|
14570
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
14479
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
14571
14480
|
if (humanize) return humanizeNumber(baseline, locale);
|
|
14572
14481
|
return baseline.formattedValue;
|
|
14573
14482
|
}
|
|
@@ -14596,23 +14505,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14596
14505
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
14597
14506
|
}
|
|
14598
14507
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
14599
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
14508
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
14600
14509
|
const diff = keyValue.value - baseline.value;
|
|
14601
14510
|
if (diff > 0) return colorUp;
|
|
14602
14511
|
else if (diff < 0) return colorDown;
|
|
14603
14512
|
}
|
|
14604
14513
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
14605
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
14514
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
14606
14515
|
const diff = keyValue.value - baseline.value;
|
|
14607
14516
|
if (diff > 0) return "up";
|
|
14608
14517
|
else if (diff < 0) return "down";
|
|
14609
14518
|
return "neutral";
|
|
14610
14519
|
}
|
|
14611
14520
|
function checkKeyValue(definition) {
|
|
14612
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
14521
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
14613
14522
|
}
|
|
14614
14523
|
function checkBaseline(definition) {
|
|
14615
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
14524
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
14616
14525
|
}
|
|
14617
14526
|
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
14527
|
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 +14751,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
14842
14751
|
}, runtime).computeDesign();
|
|
14843
14752
|
}
|
|
14844
14753
|
var ScorecardChartConfigBuilder = class {
|
|
14754
|
+
runtime;
|
|
14845
14755
|
context;
|
|
14846
14756
|
width;
|
|
14847
14757
|
height;
|
|
@@ -15322,7 +15232,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15322
15232
|
}
|
|
15323
15233
|
createChart(chartData) {
|
|
15324
15234
|
const ctx = this.canvas.el.getContext("2d");
|
|
15325
|
-
|
|
15235
|
+
const Chart = getChartJSConstructor();
|
|
15236
|
+
this.chart = new Chart(ctx, chartData);
|
|
15326
15237
|
}
|
|
15327
15238
|
updateChartJs(chartRuntime) {
|
|
15328
15239
|
const chartData = chartRuntime.chartJsConfig;
|
|
@@ -17909,15 +17820,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
17909
17820
|
const jsEndDate = numberToJsDate(_endDate);
|
|
17910
17821
|
assert(() => _endDate >= _startDate, _t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
17911
17822
|
switch (_unit) {
|
|
17912
|
-
case
|
|
17913
|
-
case
|
|
17914
|
-
case
|
|
17915
|
-
case
|
|
17916
|
-
case
|
|
17823
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
17824
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
17825
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17826
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
17827
|
+
case "MD":
|
|
17917
17828
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
17918
17829
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
17919
17830
|
return days;
|
|
17920
|
-
case
|
|
17831
|
+
case "YD": {
|
|
17921
17832
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17922
17833
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
17923
17834
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -18413,18 +18324,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18413
18324
|
//#endregion
|
|
18414
18325
|
//#region src/helpers/sort.ts
|
|
18415
18326
|
const SORT_TYPES = [
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18327
|
+
"number",
|
|
18328
|
+
"error",
|
|
18329
|
+
"text",
|
|
18330
|
+
"boolean"
|
|
18420
18331
|
];
|
|
18421
18332
|
function cellsSortingCriterion(sortingOrder) {
|
|
18422
18333
|
const inverse = sortingOrder === "ascending" ? 1 : -1;
|
|
18423
18334
|
return (left, right) => {
|
|
18424
|
-
if (left.type ===
|
|
18425
|
-
else if (right.type ===
|
|
18335
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
18336
|
+
else if (right.type === "empty") return -1;
|
|
18426
18337
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
18427
|
-
if (typeOrder === 0) if (left.type ===
|
|
18338
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
18428
18339
|
else typeOrder = left.value - right.value;
|
|
18429
18340
|
return inverse * typeOrder;
|
|
18430
18341
|
};
|
|
@@ -18435,9 +18346,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18435
18346
|
type: cell.type,
|
|
18436
18347
|
value: cell.value
|
|
18437
18348
|
}));
|
|
18438
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
18349
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
18439
18350
|
...cell,
|
|
18440
|
-
type:
|
|
18351
|
+
type: "number",
|
|
18441
18352
|
value: 0
|
|
18442
18353
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
18443
18354
|
}
|
|
@@ -18499,7 +18410,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18499
18410
|
});
|
|
18500
18411
|
});
|
|
18501
18412
|
}
|
|
18502
|
-
if (result.isCancelledBecause(
|
|
18413
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
18503
18414
|
const { col, row } = anchor;
|
|
18504
18415
|
env.model.selection.selectZone({
|
|
18505
18416
|
cell: {
|
|
@@ -18552,11 +18463,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18552
18463
|
const right = sortColumn[b];
|
|
18553
18464
|
const leftCell = {
|
|
18554
18465
|
value: left,
|
|
18555
|
-
type: left === null ?
|
|
18466
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
18556
18467
|
};
|
|
18557
18468
|
const rightCell = {
|
|
18558
18469
|
value: right,
|
|
18559
|
-
type: right === null ?
|
|
18470
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
18560
18471
|
};
|
|
18561
18472
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
18562
18473
|
if (result !== 0) return result;
|
|
@@ -20970,8 +20881,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20970
20881
|
row: range.zone.top
|
|
20971
20882
|
};
|
|
20972
20883
|
const type = this.getters.getEvaluatedCell(position).type;
|
|
20973
|
-
if (type ===
|
|
20974
|
-
else if (type ===
|
|
20884
|
+
if (type === "empty") return "b";
|
|
20885
|
+
else if (type === "text") return "l";
|
|
20975
20886
|
else return "v";
|
|
20976
20887
|
}
|
|
20977
20888
|
}
|
|
@@ -24175,6 +24086,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24175
24086
|
//#endregion
|
|
24176
24087
|
//#region src/formulas/code_builder.ts
|
|
24177
24088
|
var FunctionCodeBuilder = class {
|
|
24089
|
+
scope;
|
|
24178
24090
|
code = "";
|
|
24179
24091
|
constructor(scope = new Scope()) {
|
|
24180
24092
|
this.scope = scope;
|
|
@@ -24190,6 +24102,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24190
24102
|
}
|
|
24191
24103
|
};
|
|
24192
24104
|
var FunctionCodeImpl = class {
|
|
24105
|
+
scope;
|
|
24106
|
+
returnExpression;
|
|
24193
24107
|
code;
|
|
24194
24108
|
constructor(scope, code, returnExpression) {
|
|
24195
24109
|
this.scope = scope;
|
|
@@ -24565,6 +24479,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24565
24479
|
function getFirstPivotFunction(tokens) {
|
|
24566
24480
|
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
|
|
24567
24481
|
}
|
|
24482
|
+
function getPivotFunctions(tokens) {
|
|
24483
|
+
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
|
|
24484
|
+
}
|
|
24568
24485
|
/**
|
|
24569
24486
|
* Parse a spreadsheet formula and detect the number of PIVOT functions that are
|
|
24570
24487
|
* present in the given formula.
|
|
@@ -24936,19 +24853,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24936
24853
|
let x = 0;
|
|
24937
24854
|
let y = 0;
|
|
24938
24855
|
switch (direction) {
|
|
24939
|
-
case
|
|
24856
|
+
case "up":
|
|
24940
24857
|
x = 0;
|
|
24941
24858
|
y = -rule.current;
|
|
24942
24859
|
break;
|
|
24943
|
-
case
|
|
24860
|
+
case "down":
|
|
24944
24861
|
x = 0;
|
|
24945
24862
|
y = rule.current;
|
|
24946
24863
|
break;
|
|
24947
|
-
case
|
|
24864
|
+
case "left":
|
|
24948
24865
|
x = -rule.current;
|
|
24949
24866
|
y = 0;
|
|
24950
24867
|
break;
|
|
24951
|
-
case
|
|
24868
|
+
case "right":
|
|
24952
24869
|
x = rule.current;
|
|
24953
24870
|
y = 0;
|
|
24954
24871
|
break;
|
|
@@ -25074,12 +24991,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25074
24991
|
},
|
|
25075
24992
|
sequence: 10
|
|
25076
24993
|
}).add("increment_alphanumeric_value", {
|
|
25077
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
24994
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
25078
24995
|
generateRule: (cell, cells, direction) => {
|
|
25079
24996
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
25080
24997
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
25081
24998
|
const numberPostfixLength = cell.content.length - prefix.length;
|
|
25082
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
24999
|
+
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
25000
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25084
25001
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25085
25002
|
return {
|
|
@@ -25092,7 +25009,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25092
25009
|
},
|
|
25093
25010
|
sequence: 15
|
|
25094
25011
|
}).add("copy_text", {
|
|
25095
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25012
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
25096
25013
|
generateRule: () => {
|
|
25097
25014
|
return { type: "COPY_MODIFIER" };
|
|
25098
25015
|
},
|
|
@@ -25109,10 +25026,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25109
25026
|
sequence: 30
|
|
25110
25027
|
}).add("increment_dates", {
|
|
25111
25028
|
condition: (cell, cells) => {
|
|
25112
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25029
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
25113
25030
|
},
|
|
25114
25031
|
generateRule: (cell, cells) => {
|
|
25115
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25032
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
25116
25033
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
25117
25034
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
25118
25035
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -25121,26 +25038,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25121
25038
|
if (typeof increment === "object") return {
|
|
25122
25039
|
type: "DATE_INCREMENT_MODIFIER",
|
|
25123
25040
|
increment,
|
|
25124
|
-
current: evaluation.type ===
|
|
25041
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25125
25042
|
};
|
|
25126
25043
|
return {
|
|
25127
25044
|
type: "INCREMENT_MODIFIER",
|
|
25128
25045
|
increment,
|
|
25129
|
-
current: evaluation.type ===
|
|
25046
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25130
25047
|
};
|
|
25131
25048
|
},
|
|
25132
25049
|
sequence: 25
|
|
25133
25050
|
}).add("increment_number", {
|
|
25134
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25051
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
25135
25052
|
generateRule: (cell, cells, direction) => {
|
|
25136
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25053
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
25137
25054
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25138
25055
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25139
25056
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
25140
25057
|
return {
|
|
25141
25058
|
type: "INCREMENT_MODIFIER",
|
|
25142
25059
|
increment,
|
|
25143
|
-
current: evaluation.type ===
|
|
25060
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25144
25061
|
};
|
|
25145
25062
|
},
|
|
25146
25063
|
sequence: 40
|
|
@@ -26044,47 +25961,47 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26044
25961
|
//#endregion
|
|
26045
25962
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
26046
25963
|
function isDataRangeValid(definition) {
|
|
26047
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
25964
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
26048
25965
|
}
|
|
26049
25966
|
function checkRangeLimits(check, batchValidations) {
|
|
26050
25967
|
return batchValidations((definition) => {
|
|
26051
25968
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
26052
|
-
return
|
|
25969
|
+
return "Success";
|
|
26053
25970
|
}, (definition) => {
|
|
26054
25971
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
26055
|
-
return
|
|
25972
|
+
return "Success";
|
|
26056
25973
|
});
|
|
26057
25974
|
}
|
|
26058
25975
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
26059
25976
|
return batchValidations((definition) => {
|
|
26060
25977
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
26061
|
-
return
|
|
25978
|
+
return "Success";
|
|
26062
25979
|
}, (definition) => {
|
|
26063
25980
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
26064
|
-
return
|
|
25981
|
+
return "Success";
|
|
26065
25982
|
});
|
|
26066
25983
|
}
|
|
26067
25984
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
26068
25985
|
if (definition.sectionRule) {
|
|
26069
|
-
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return
|
|
25986
|
+
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return "GaugeRangeMinBiggerThanRangeMax";
|
|
26070
25987
|
}
|
|
26071
|
-
return
|
|
25988
|
+
return "Success";
|
|
26072
25989
|
}
|
|
26073
25990
|
function checkEmpty(value, valueName) {
|
|
26074
25991
|
if (value === "") switch (valueName) {
|
|
26075
|
-
case "rangeMin": return
|
|
26076
|
-
case "rangeMax": return
|
|
25992
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
25993
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
26077
25994
|
}
|
|
26078
|
-
return
|
|
25995
|
+
return "Success";
|
|
26079
25996
|
}
|
|
26080
25997
|
function checkNaN(value, valueName) {
|
|
26081
25998
|
if (isNaN(value)) switch (valueName) {
|
|
26082
|
-
case "rangeMin": return
|
|
26083
|
-
case "rangeMax": return
|
|
26084
|
-
case "lowerInflectionPointValue": return
|
|
26085
|
-
case "upperInflectionPointValue": return
|
|
25999
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
26000
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
26001
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
26002
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
26086
26003
|
}
|
|
26087
|
-
return
|
|
26004
|
+
return "Success";
|
|
26088
26005
|
}
|
|
26089
26006
|
var GaugeChart = class GaugeChart extends AbstractChart {
|
|
26090
26007
|
dataRange;
|
|
@@ -26180,7 +26097,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26180
26097
|
col: dataRange.zone.left,
|
|
26181
26098
|
row: dataRange.zone.top
|
|
26182
26099
|
});
|
|
26183
|
-
if (cell.type ===
|
|
26100
|
+
if (cell.type === "number") {
|
|
26184
26101
|
gaugeValue = cell.value;
|
|
26185
26102
|
formattedValue = cell.formattedValue;
|
|
26186
26103
|
format = cell.format;
|
|
@@ -27689,7 +27606,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27689
27606
|
function interactiveCut(env) {
|
|
27690
27607
|
const result = env.model.dispatch("CUT");
|
|
27691
27608
|
if (!result.isSuccessful) {
|
|
27692
|
-
if (result.isCancelledBecause(
|
|
27609
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
27693
27610
|
}
|
|
27694
27611
|
}
|
|
27695
27612
|
|
|
@@ -27704,8 +27621,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27704
27621
|
sheetId,
|
|
27705
27622
|
target
|
|
27706
27623
|
});
|
|
27707
|
-
if (result.isCancelledBecause(
|
|
27708
|
-
else if (result.isCancelledBecause(
|
|
27624
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
27625
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
27709
27626
|
env.model.dispatch("ADD_MERGE", {
|
|
27710
27627
|
sheetId,
|
|
27711
27628
|
target,
|
|
@@ -27746,7 +27663,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27746
27663
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
27747
27664
|
const cell = getters.getEvaluatedCell(position);
|
|
27748
27665
|
const errors = [];
|
|
27749
|
-
if (cell.type ===
|
|
27666
|
+
if (cell.type === "error" && !!cell.message) errors.push({
|
|
27750
27667
|
title: _t("Error"),
|
|
27751
27668
|
message: cell.message
|
|
27752
27669
|
});
|
|
@@ -28455,7 +28372,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
28455
28372
|
css`
|
|
28456
28373
|
.o-popover {
|
|
28457
28374
|
position: absolute;
|
|
28458
|
-
z-index: ${
|
|
28375
|
+
z-index: ${35};
|
|
28459
28376
|
overflow: auto;
|
|
28460
28377
|
box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);
|
|
28461
28378
|
width: fit-content;
|
|
@@ -28510,7 +28427,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
28510
28427
|
onMouseWheel: () => {},
|
|
28511
28428
|
onPopoverMoved: () => {},
|
|
28512
28429
|
onPopoverHidden: () => {},
|
|
28513
|
-
zIndex:
|
|
28430
|
+
zIndex: 35
|
|
28514
28431
|
};
|
|
28515
28432
|
popoverRef = (0, _odoo_owl.useRef)("popover");
|
|
28516
28433
|
currentPosition = void 0;
|
|
@@ -28556,6 +28473,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
28556
28473
|
}
|
|
28557
28474
|
};
|
|
28558
28475
|
var PopoverPositionContext = class {
|
|
28476
|
+
anchorRect;
|
|
28477
|
+
containerRect;
|
|
28478
|
+
propsMaxSize;
|
|
28479
|
+
spreadsheetOffset;
|
|
28559
28480
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset) {
|
|
28560
28481
|
this.anchorRect = anchorRect;
|
|
28561
28482
|
this.containerRect = containerRect;
|
|
@@ -29130,7 +29051,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29130
29051
|
const dataSetsHaveTitle = !!getters.getEvaluatedCellsInZone(sheetId, {
|
|
29131
29052
|
...dataSetZone,
|
|
29132
29053
|
bottom: dataSetZone.top
|
|
29133
|
-
}).find((cell) => cell.type !==
|
|
29054
|
+
}).find((cell) => cell.type !== "empty" && cell.type !== "number");
|
|
29134
29055
|
let labelRangeXc;
|
|
29135
29056
|
if (!singleColumn) labelRangeXc = zoneToXc({
|
|
29136
29057
|
...zone,
|
|
@@ -29193,8 +29114,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29193
29114
|
config: tableConfig,
|
|
29194
29115
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29195
29116
|
});
|
|
29196
|
-
if (result.isCancelledBecause(
|
|
29197
|
-
else if (result.isCancelledBecause(
|
|
29117
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29118
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29198
29119
|
return result;
|
|
29199
29120
|
}
|
|
29200
29121
|
|
|
@@ -29225,7 +29146,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
29225
29146
|
const target = env.model.getters.getSelectedZones();
|
|
29226
29147
|
if (env.model.getters.getClipboardId() !== clipboardId) interactivePasteFromOS(env, target, clipboardContent, pasteOption);
|
|
29227
29148
|
else interactivePaste(env, target, pasteOption);
|
|
29228
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29149
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29229
29150
|
break;
|
|
29230
29151
|
case "notImplemented":
|
|
29231
29152
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -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",
|
|
@@ -53852,37 +53821,52 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53852
53821
|
}
|
|
53853
53822
|
}
|
|
53854
53823
|
/**
|
|
53855
|
-
* Get the id of the pivot at the given position. Returns undefined if there
|
|
53824
|
+
* Get the id of the first pivot in the formula at the given position. Returns undefined if there
|
|
53856
53825
|
* is no pivot at this position
|
|
53857
53826
|
*/
|
|
53858
53827
|
getPivotIdFromPosition(position) {
|
|
53828
|
+
return this.getPivotIdsFromPosition(position)[0];
|
|
53829
|
+
}
|
|
53830
|
+
/**
|
|
53831
|
+
* Get all of the ids of the pivot present in the formula at the given position.
|
|
53832
|
+
*/
|
|
53833
|
+
getPivotIdsFromPosition(position) {
|
|
53859
53834
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
53860
|
-
if (cell && cell.isFormula)
|
|
53861
|
-
|
|
53862
|
-
|
|
53863
|
-
|
|
53864
|
-
|
|
53865
|
-
|
|
53866
|
-
|
|
53835
|
+
if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
|
|
53836
|
+
return [];
|
|
53837
|
+
}
|
|
53838
|
+
getPivotIdsFromFormula(sheetId, formula) {
|
|
53839
|
+
return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
|
|
53840
|
+
const pivotId = pivotFunction.args[0]?.toString();
|
|
53841
|
+
return pivotId && this.getters.getPivotId(pivotId);
|
|
53842
|
+
}).filter(isDefined);
|
|
53867
53843
|
}
|
|
53868
53844
|
isSpillPivotFormula(position) {
|
|
53869
53845
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
53870
53846
|
if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
|
|
53871
53847
|
return false;
|
|
53872
53848
|
}
|
|
53873
|
-
|
|
53874
|
-
const
|
|
53875
|
-
if (!
|
|
53876
|
-
const
|
|
53877
|
-
|
|
53878
|
-
functionName,
|
|
53879
|
-
|
|
53849
|
+
getPivotFunctions(sheetId, tokens) {
|
|
53850
|
+
const pivotFunctions = getPivotFunctions(tokens);
|
|
53851
|
+
if (!pivotFunctions.length) return [];
|
|
53852
|
+
const evaluatedPivotFunctions = [];
|
|
53853
|
+
for (const pivotFunction of pivotFunctions) {
|
|
53854
|
+
const { functionName, args } = pivotFunction;
|
|
53855
|
+
const evaluatedArgs = args.map((argAst) => {
|
|
53880
53856
|
if (argAst.type === "EMPTY") return;
|
|
53881
53857
|
else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
|
|
53882
53858
|
const argsString = astToFormula(argAst);
|
|
53883
53859
|
return this.getters.evaluateFormula(sheetId, argsString);
|
|
53884
|
-
})
|
|
53885
|
-
|
|
53860
|
+
});
|
|
53861
|
+
evaluatedPivotFunctions.push({
|
|
53862
|
+
functionName,
|
|
53863
|
+
args: evaluatedArgs
|
|
53864
|
+
});
|
|
53865
|
+
}
|
|
53866
|
+
return evaluatedPivotFunctions;
|
|
53867
|
+
}
|
|
53868
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
53869
|
+
return this.getPivotFunctions(sheetId, tokens)[0];
|
|
53886
53870
|
}
|
|
53887
53871
|
/**
|
|
53888
53872
|
* Returns the domain args of a pivot formula from a position.
|
|
@@ -53982,8 +53966,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53982
53966
|
const unusedPivots = new Set(this.getters.getPivotIds());
|
|
53983
53967
|
for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
|
|
53984
53968
|
const position = this.getters.getCellPosition(cellId);
|
|
53985
|
-
const
|
|
53986
|
-
|
|
53969
|
+
const pivotIds = this.getPivotIdsFromPosition(position);
|
|
53970
|
+
for (const pivotId of pivotIds) {
|
|
53987
53971
|
unusedPivots.delete(pivotId);
|
|
53988
53972
|
if (!unusedPivots.size) {
|
|
53989
53973
|
this.unusedPivots = [];
|
|
@@ -53991,6 +53975,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53991
53975
|
}
|
|
53992
53976
|
}
|
|
53993
53977
|
}
|
|
53978
|
+
for (const pivotId of this.getters.getPivotIds()) {
|
|
53979
|
+
const pivot = this.getters.getPivot(pivotId);
|
|
53980
|
+
for (const measure of pivot.definition.measures) if (measure.computedBy) {
|
|
53981
|
+
const { sheetId } = measure.computedBy;
|
|
53982
|
+
const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
|
|
53983
|
+
const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
|
|
53984
|
+
for (const relatedPivotId of relatedPivotIds) {
|
|
53985
|
+
unusedPivots.delete(relatedPivotId);
|
|
53986
|
+
if (!unusedPivots.size) {
|
|
53987
|
+
this.unusedPivots = [];
|
|
53988
|
+
return [];
|
|
53989
|
+
}
|
|
53990
|
+
}
|
|
53991
|
+
}
|
|
53992
|
+
}
|
|
53994
53993
|
this.unusedPivots = [...unusedPivots];
|
|
53995
53994
|
return this.unusedPivots;
|
|
53996
53995
|
}
|
|
@@ -54067,10 +54066,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54067
54066
|
const sheetId = this.getters.getActiveSheetId();
|
|
54068
54067
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
54069
54068
|
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
|
|
54069
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
54070
|
+
return "InvalidAutofillSelection";
|
|
54072
54071
|
}
|
|
54073
|
-
return
|
|
54072
|
+
return "Success";
|
|
54074
54073
|
}
|
|
54075
54074
|
handle(cmd) {
|
|
54076
54075
|
switch (cmd.type) {
|
|
@@ -54102,7 +54101,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54102
54101
|
const target = this.autofillZone;
|
|
54103
54102
|
const autofillCellsData = [];
|
|
54104
54103
|
switch (this.direction) {
|
|
54105
|
-
case
|
|
54104
|
+
case "down":
|
|
54106
54105
|
for (let col = source.left; col <= source.right; col++) {
|
|
54107
54106
|
const xcs = [];
|
|
54108
54107
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -54110,7 +54109,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54110
54109
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54111
54110
|
}
|
|
54112
54111
|
break;
|
|
54113
|
-
case
|
|
54112
|
+
case "up":
|
|
54114
54113
|
for (let col = source.left; col <= source.right; col++) {
|
|
54115
54114
|
const xcs = [];
|
|
54116
54115
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -54118,7 +54117,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54118
54117
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54119
54118
|
}
|
|
54120
54119
|
break;
|
|
54121
|
-
case
|
|
54120
|
+
case "left":
|
|
54122
54121
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54123
54122
|
const xcs = [];
|
|
54124
54123
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -54126,7 +54125,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54126
54125
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54127
54126
|
}
|
|
54128
54127
|
break;
|
|
54129
|
-
case
|
|
54128
|
+
case "right":
|
|
54130
54129
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54131
54130
|
const xcs = [];
|
|
54132
54131
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -54252,19 +54251,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54252
54251
|
}
|
|
54253
54252
|
this.direction = this.getDirection(col, row);
|
|
54254
54253
|
switch (this.direction) {
|
|
54255
|
-
case
|
|
54254
|
+
case "up":
|
|
54256
54255
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
54257
54256
|
this.steps = source.top - row;
|
|
54258
54257
|
break;
|
|
54259
|
-
case
|
|
54258
|
+
case "down":
|
|
54260
54259
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
54261
54260
|
this.steps = row - source.bottom;
|
|
54262
54261
|
break;
|
|
54263
|
-
case
|
|
54262
|
+
case "left":
|
|
54264
54263
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
54265
54264
|
this.steps = source.left - col;
|
|
54266
54265
|
break;
|
|
54267
|
-
case
|
|
54266
|
+
case "right":
|
|
54268
54267
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
54269
54268
|
this.steps = col - source.right;
|
|
54270
54269
|
break;
|
|
@@ -54283,7 +54282,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54283
54282
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
54284
54283
|
...activePosition,
|
|
54285
54284
|
row
|
|
54286
|
-
}).type !==
|
|
54285
|
+
}).type !== "empty") {
|
|
54287
54286
|
autofillRow = row - 1;
|
|
54288
54287
|
break;
|
|
54289
54288
|
}
|
|
@@ -54303,7 +54302,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54303
54302
|
col: col - 1,
|
|
54304
54303
|
row
|
|
54305
54304
|
};
|
|
54306
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
54305
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
54307
54306
|
row += 1;
|
|
54308
54307
|
leftPosition = {
|
|
54309
54308
|
sheetId,
|
|
@@ -54320,7 +54319,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54320
54319
|
col: col + 1,
|
|
54321
54320
|
row
|
|
54322
54321
|
};
|
|
54323
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
54322
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
54324
54323
|
row += 1;
|
|
54325
54324
|
rightPosition = {
|
|
54326
54325
|
sheetId,
|
|
@@ -54410,19 +54409,19 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54410
54409
|
const position = {
|
|
54411
54410
|
up: {
|
|
54412
54411
|
number: source.top - row,
|
|
54413
|
-
value:
|
|
54412
|
+
value: "up"
|
|
54414
54413
|
},
|
|
54415
54414
|
down: {
|
|
54416
54415
|
number: row - source.bottom,
|
|
54417
|
-
value:
|
|
54416
|
+
value: "down"
|
|
54418
54417
|
},
|
|
54419
54418
|
left: {
|
|
54420
54419
|
number: source.left - col,
|
|
54421
|
-
value:
|
|
54420
|
+
value: "left"
|
|
54422
54421
|
},
|
|
54423
54422
|
right: {
|
|
54424
54423
|
number: col - source.right,
|
|
54425
|
-
value:
|
|
54424
|
+
value: "right"
|
|
54426
54425
|
}
|
|
54427
54426
|
};
|
|
54428
54427
|
if (Object.values(position).map((x) => x.number > 0 ? 1 : 0).reduce((acc, value) => acc + value) === 1) return Object.values(position).find((x) => x.number > 0 ? 1 : 0).value;
|
|
@@ -54625,7 +54624,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54625
54624
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
54626
54625
|
}
|
|
54627
54626
|
isNumber(cell) {
|
|
54628
|
-
return cell.type ===
|
|
54627
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
54629
54628
|
}
|
|
54630
54629
|
isZoneValid(zone) {
|
|
54631
54630
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -55119,6 +55118,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55119
55118
|
//#endregion
|
|
55120
55119
|
//#region src/collaborative/revisions.ts
|
|
55121
55120
|
var Revision = class {
|
|
55121
|
+
rootCommand;
|
|
55122
|
+
timestamp;
|
|
55122
55123
|
id;
|
|
55123
55124
|
clientId;
|
|
55124
55125
|
_commands = [];
|
|
@@ -55155,6 +55156,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55155
55156
|
//#region src/collaborative/session.ts
|
|
55156
55157
|
var ClientDisconnectedError = class extends Error {};
|
|
55157
55158
|
var Session = class extends EventBus {
|
|
55159
|
+
revisions;
|
|
55160
|
+
transportService;
|
|
55161
|
+
serverRevisionId;
|
|
55158
55162
|
/**
|
|
55159
55163
|
* Positions of the others client.
|
|
55160
55164
|
*/
|
|
@@ -55620,7 +55624,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55620
55624
|
switch (cmd.type) {
|
|
55621
55625
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
55622
55626
|
}
|
|
55623
|
-
return
|
|
55627
|
+
return "Success";
|
|
55624
55628
|
}
|
|
55625
55629
|
handle(cmd) {
|
|
55626
55630
|
switch (cmd.type) {
|
|
@@ -55703,34 +55707,34 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55703
55707
|
});
|
|
55704
55708
|
}
|
|
55705
55709
|
checkSingleRangeSelected() {
|
|
55706
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
55707
|
-
return
|
|
55710
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
55711
|
+
return "Success";
|
|
55708
55712
|
}
|
|
55709
55713
|
checkNoMergeInZone() {
|
|
55710
55714
|
const sheetId = this.getters.getActiveSheetId();
|
|
55711
55715
|
const zone = this.getters.getSelectedZone();
|
|
55712
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
55713
|
-
return
|
|
55716
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
55717
|
+
return "Success";
|
|
55714
55718
|
}
|
|
55715
55719
|
checkRangeContainsValues(cmd) {
|
|
55716
55720
|
const sheetId = this.getters.getActiveSheetId();
|
|
55717
55721
|
const zone = this.getters.getSelectedZone();
|
|
55718
55722
|
if (cmd.hasHeader) zone.top += 1;
|
|
55719
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
55720
|
-
return
|
|
55723
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptyTarget";
|
|
55724
|
+
return "Success";
|
|
55721
55725
|
}
|
|
55722
55726
|
checkNoColumnProvided(cmd) {
|
|
55723
|
-
if (cmd.columns.length === 0) return
|
|
55724
|
-
return
|
|
55727
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
55728
|
+
return "Success";
|
|
55725
55729
|
}
|
|
55726
55730
|
checkColumnsIncludedInZone(cmd) {
|
|
55727
55731
|
const zone = this.getters.getSelectedZone();
|
|
55728
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
55729
|
-
return
|
|
55732
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
55733
|
+
return "Success";
|
|
55730
55734
|
}
|
|
55731
55735
|
checkColumnsAreUnique(cmd) {
|
|
55732
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
55733
|
-
return
|
|
55736
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
55737
|
+
return "Success";
|
|
55734
55738
|
}
|
|
55735
55739
|
trimWhitespace() {
|
|
55736
55740
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -55863,7 +55867,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55863
55867
|
getCellNumberFormat(position) {
|
|
55864
55868
|
for (const pos of [position]) {
|
|
55865
55869
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
55866
|
-
if (cell.type ===
|
|
55870
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
55867
55871
|
}
|
|
55868
55872
|
}
|
|
55869
55873
|
};
|
|
@@ -55931,11 +55935,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55931
55935
|
allowDispatch(cmd) {
|
|
55932
55936
|
switch (cmd.type) {
|
|
55933
55937
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
55934
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
55935
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
55938
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
55939
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
55936
55940
|
break;
|
|
55937
55941
|
}
|
|
55938
|
-
return
|
|
55942
|
+
return "Success";
|
|
55939
55943
|
}
|
|
55940
55944
|
handle(cmd) {
|
|
55941
55945
|
switch (cmd.type) {
|
|
@@ -56136,7 +56140,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56136
56140
|
if (!isInside(cmd.col, cmd.row, cmd.zone)) throw new Error(_t("The anchor must be part of the provided zone"));
|
|
56137
56141
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes);
|
|
56138
56142
|
}
|
|
56139
|
-
return
|
|
56143
|
+
return "Success";
|
|
56140
56144
|
}
|
|
56141
56145
|
handle(cmd) {
|
|
56142
56146
|
switch (cmd.type) {
|
|
@@ -56146,24 +56150,24 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56146
56150
|
}
|
|
56147
56151
|
}
|
|
56148
56152
|
checkMerge({ sheetId, zone }) {
|
|
56149
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56153
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56150
56154
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
56151
56155
|
sheetId,
|
|
56152
56156
|
col,
|
|
56153
56157
|
row
|
|
56154
|
-
}))) return
|
|
56155
|
-
return
|
|
56158
|
+
}))) return "InvalidSortZone";
|
|
56159
|
+
return "Success";
|
|
56156
56160
|
}
|
|
56157
56161
|
checkMergeSizes({ sheetId, zone }) {
|
|
56158
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56162
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56159
56163
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
56160
56164
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
56161
56165
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
56162
56166
|
if (!merges.every((merge) => {
|
|
56163
56167
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
56164
56168
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
56165
|
-
})) return
|
|
56166
|
-
return
|
|
56169
|
+
})) return "InvalidSortZone";
|
|
56170
|
+
return "Success";
|
|
56167
56171
|
}
|
|
56168
56172
|
/**
|
|
56169
56173
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -56181,9 +56185,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56181
56185
|
col,
|
|
56182
56186
|
row
|
|
56183
56187
|
}).type));
|
|
56184
|
-
if (cells[0][0] ===
|
|
56185
|
-
if (cells.some((item) => item[0] ===
|
|
56186
|
-
else if (cells.some((item) => item[1] !==
|
|
56188
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
56189
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
56190
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
56187
56191
|
else return false;
|
|
56188
56192
|
}
|
|
56189
56193
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -56441,7 +56445,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56441
56445
|
*/
|
|
56442
56446
|
isCellEmpty(position) {
|
|
56443
56447
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
56444
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
56448
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
56445
56449
|
}
|
|
56446
56450
|
getColMaxWidth(sheetId, index) {
|
|
56447
56451
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -56455,8 +56459,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56455
56459
|
* sheet.
|
|
56456
56460
|
*/
|
|
56457
56461
|
checkSheetExists(cmd) {
|
|
56458
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return
|
|
56459
|
-
return
|
|
56462
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return "InvalidSheetId";
|
|
56463
|
+
return "Success";
|
|
56460
56464
|
}
|
|
56461
56465
|
/**
|
|
56462
56466
|
* Check if zones in the command are well formed and
|
|
@@ -56464,11 +56468,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56464
56468
|
*/
|
|
56465
56469
|
checkZonesAreInSheet(cmd) {
|
|
56466
56470
|
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
|
|
56471
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
56468
56472
|
const zones = this.getters.getCommandZones(cmd);
|
|
56469
|
-
if (!sheetId && zones.length > 0) return
|
|
56473
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
56470
56474
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
56471
|
-
return
|
|
56475
|
+
return "Success";
|
|
56472
56476
|
}
|
|
56473
56477
|
autoResizeRows(sheetId, rows) {
|
|
56474
56478
|
const rowSizes = [];
|
|
@@ -56716,7 +56720,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56716
56720
|
...position,
|
|
56717
56721
|
content: "FALSE"
|
|
56718
56722
|
});
|
|
56719
|
-
else if (cell?.content && evaluatedCell.type ===
|
|
56723
|
+
else if (cell?.content && evaluatedCell.type === "empty") {
|
|
56720
56724
|
let value;
|
|
56721
56725
|
if (cell.content.startsWith("=")) {
|
|
56722
56726
|
const result = this.getters.evaluateFormula(position.sheetId, cell.content);
|
|
@@ -56726,7 +56730,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56726
56730
|
...position,
|
|
56727
56731
|
content: "FALSE"
|
|
56728
56732
|
});
|
|
56729
|
-
} else if (evaluatedCell.type !==
|
|
56733
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
56730
56734
|
...position,
|
|
56731
56735
|
content: "FALSE"
|
|
56732
56736
|
});
|
|
@@ -56979,13 +56983,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56979
56983
|
allowDispatch(cmd) {
|
|
56980
56984
|
switch (cmd.type) {
|
|
56981
56985
|
case "REQUEST_UNDO":
|
|
56982
|
-
if (!this.canUndo()) return
|
|
56986
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
56983
56987
|
break;
|
|
56984
56988
|
case "REQUEST_REDO":
|
|
56985
|
-
if (!this.canRedo()) return
|
|
56989
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
56986
56990
|
break;
|
|
56987
56991
|
}
|
|
56988
|
-
return
|
|
56992
|
+
return "Success";
|
|
56989
56993
|
}
|
|
56990
56994
|
handle(cmd) {
|
|
56991
56995
|
switch (cmd.type) {
|
|
@@ -57102,7 +57106,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57102
57106
|
switch (cmd.type) {
|
|
57103
57107
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
57104
57108
|
}
|
|
57105
|
-
return
|
|
57109
|
+
return "Success";
|
|
57106
57110
|
}
|
|
57107
57111
|
handle(cmd) {
|
|
57108
57112
|
switch (cmd.type) {
|
|
@@ -57113,7 +57117,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57113
57117
|
}
|
|
57114
57118
|
getAutomaticSeparator() {
|
|
57115
57119
|
const cells = this.getters.getSelectedCells();
|
|
57116
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
57120
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
57117
57121
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
57118
57122
|
if (separator) return separator;
|
|
57119
57123
|
}
|
|
@@ -57249,24 +57253,24 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57249
57253
|
});
|
|
57250
57254
|
}
|
|
57251
57255
|
checkSingleColSelected() {
|
|
57252
|
-
if (!this.getters.isSingleColSelected()) return
|
|
57253
|
-
return
|
|
57256
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
57257
|
+
return "Success";
|
|
57254
57258
|
}
|
|
57255
57259
|
checkNonEmptySelector(cmd) {
|
|
57256
|
-
if (cmd.separator === "") return
|
|
57257
|
-
return
|
|
57260
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
57261
|
+
return "Success";
|
|
57258
57262
|
}
|
|
57259
57263
|
checkNotOverwritingContent(cmd) {
|
|
57260
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
57264
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
57261
57265
|
const selection = this.getters.getSelectedZones()[0];
|
|
57262
57266
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
57263
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
57264
|
-
return
|
|
57267
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
57268
|
+
return "Success";
|
|
57265
57269
|
}
|
|
57266
57270
|
checkSeparatorInSelection({ separator }) {
|
|
57267
57271
|
const cells = this.getters.getSelectedCells();
|
|
57268
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
57269
|
-
return
|
|
57272
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
57273
|
+
return "NoSplitSeparatorInSelection";
|
|
57270
57274
|
}
|
|
57271
57275
|
};
|
|
57272
57276
|
|
|
@@ -57303,7 +57307,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57303
57307
|
col,
|
|
57304
57308
|
row: r,
|
|
57305
57309
|
sheetId
|
|
57306
|
-
}).type !==
|
|
57310
|
+
}).type !== "empty") return;
|
|
57307
57311
|
}
|
|
57308
57312
|
const oldSelection = {
|
|
57309
57313
|
zone: this.getters.getSelectedZone(),
|
|
@@ -57332,13 +57336,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57332
57336
|
switch (cmd.type) {
|
|
57333
57337
|
case "RESIZE_TABLE":
|
|
57334
57338
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
57335
|
-
if (!table) return
|
|
57339
|
+
if (!table) return "TableNotFound";
|
|
57336
57340
|
const oldTableZone = table.range.zone;
|
|
57337
57341
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
57338
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
57342
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
57339
57343
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
57340
57344
|
}
|
|
57341
|
-
return
|
|
57345
|
+
return "Success";
|
|
57342
57346
|
}
|
|
57343
57347
|
handle(cmd) {
|
|
57344
57348
|
switch (cmd.type) {
|
|
@@ -57403,7 +57407,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57403
57407
|
});
|
|
57404
57408
|
}
|
|
57405
57409
|
case "PASTE": {
|
|
57406
|
-
if (!this.copiedData) return
|
|
57410
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
57407
57411
|
const pasteOption = cmd.pasteOption;
|
|
57408
57412
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
57409
57413
|
pasteOption,
|
|
@@ -57412,12 +57416,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57412
57416
|
}
|
|
57413
57417
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
57414
57418
|
const zones = this.getters.getSelectedZones();
|
|
57415
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
57419
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
57416
57420
|
break;
|
|
57417
57421
|
}
|
|
57418
57422
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
57419
57423
|
const zones = this.getters.getSelectedZones();
|
|
57420
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
57424
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
57421
57425
|
break;
|
|
57422
57426
|
}
|
|
57423
57427
|
case "INSERT_CELL": {
|
|
@@ -57431,7 +57435,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57431
57435
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
57432
57436
|
}
|
|
57433
57437
|
}
|
|
57434
|
-
return
|
|
57438
|
+
return "Success";
|
|
57435
57439
|
}
|
|
57436
57440
|
handle(cmd) {
|
|
57437
57441
|
switch (cmd.type) {
|
|
@@ -57589,16 +57593,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57589
57593
|
const clipboardData = this.getClipboardData(zones);
|
|
57590
57594
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
57591
57595
|
const result = handler.isCutAllowed(clipboardData);
|
|
57592
|
-
if (result !==
|
|
57596
|
+
if (result !== "Success") return result;
|
|
57593
57597
|
}
|
|
57594
|
-
return
|
|
57598
|
+
return "Success";
|
|
57595
57599
|
}
|
|
57596
57600
|
isPasteAllowed(target, copiedData, options) {
|
|
57597
57601
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
57598
57602
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
57599
|
-
if (result !==
|
|
57603
|
+
if (result !== "Success") return result;
|
|
57600
57604
|
}
|
|
57601
|
-
return
|
|
57605
|
+
return "Success";
|
|
57602
57606
|
}
|
|
57603
57607
|
isColRowDirtyingClipboard(position, dimension) {
|
|
57604
57608
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -57675,8 +57679,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57675
57679
|
}
|
|
57676
57680
|
getClipboardContent() {
|
|
57677
57681
|
return {
|
|
57678
|
-
[
|
|
57679
|
-
[
|
|
57682
|
+
["text/plain"]: this.getPlainTextContent(),
|
|
57683
|
+
["text/html"]: this.getHTMLContent()
|
|
57680
57684
|
};
|
|
57681
57685
|
}
|
|
57682
57686
|
getSheetData() {
|
|
@@ -57809,10 +57813,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57809
57813
|
allowDispatch(cmd) {
|
|
57810
57814
|
switch (cmd.type) {
|
|
57811
57815
|
case "UPDATE_FILTER":
|
|
57812
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
57816
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
57813
57817
|
break;
|
|
57814
57818
|
}
|
|
57815
|
-
return
|
|
57819
|
+
return "Success";
|
|
57816
57820
|
}
|
|
57817
57821
|
handle(cmd) {
|
|
57818
57822
|
switch (cmd.type) {
|
|
@@ -58026,14 +58030,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58026
58030
|
allowDispatch(cmd) {
|
|
58027
58031
|
switch (cmd.type) {
|
|
58028
58032
|
case "ACTIVATE_SHEET": try {
|
|
58029
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
58033
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
58030
58034
|
break;
|
|
58031
58035
|
} catch (error) {
|
|
58032
|
-
return
|
|
58036
|
+
return "InvalidSheetId";
|
|
58033
58037
|
}
|
|
58034
58038
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
58035
58039
|
}
|
|
58036
|
-
return
|
|
58040
|
+
return "Success";
|
|
58037
58041
|
}
|
|
58038
58042
|
handleEvent(event) {
|
|
58039
58043
|
const anchor = event.anchor;
|
|
@@ -58322,7 +58326,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58322
58326
|
}, [zone]);
|
|
58323
58327
|
}
|
|
58324
58328
|
setActiveSheet(id) {
|
|
58325
|
-
|
|
58329
|
+
const sheet = this.getters.getSheet(id);
|
|
58330
|
+
this.activeSheet = sheet;
|
|
58326
58331
|
}
|
|
58327
58332
|
activateNextSheet(direction) {
|
|
58328
58333
|
const sheetIds = this.getters.getSheetIds();
|
|
@@ -58460,12 +58465,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58460
58465
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
58461
58466
|
const id = cmd.sheetId;
|
|
58462
58467
|
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
|
|
58468
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
58464
58469
|
const headers = [cmd.base, ...cmd.elements];
|
|
58465
58470
|
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
|
|
58471
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
58472
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
58473
|
+
return "Success";
|
|
58469
58474
|
}
|
|
58470
58475
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
58471
58476
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -58558,6 +58563,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58558
58563
|
//#endregion
|
|
58559
58564
|
//#region src/helpers/internal_viewport.ts
|
|
58560
58565
|
var InternalViewport = class {
|
|
58566
|
+
getters;
|
|
58567
|
+
sheetId;
|
|
58568
|
+
boundaries;
|
|
58561
58569
|
top;
|
|
58562
58570
|
bottom;
|
|
58563
58571
|
left;
|
|
@@ -58895,7 +58903,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58895
58903
|
switch (cmd.type) {
|
|
58896
58904
|
case "SET_VIEWPORT_OFFSET": return this.chainValidations(this.checkScrollingDirection, this.checkIfViewportsWillChange)(cmd);
|
|
58897
58905
|
case "RESIZE_SHEETVIEW": return this.chainValidations(this.checkValuesAreDifferent, this.checkPositiveDimension)(cmd);
|
|
58898
|
-
default: return
|
|
58906
|
+
default: return "Success";
|
|
58899
58907
|
}
|
|
58900
58908
|
}
|
|
58901
58909
|
handleEvent(event) {
|
|
@@ -59303,23 +59311,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59303
59311
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
59304
59312
|
}
|
|
59305
59313
|
checkPositiveDimension(cmd) {
|
|
59306
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
59307
|
-
return
|
|
59314
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
59315
|
+
return "Success";
|
|
59308
59316
|
}
|
|
59309
59317
|
checkValuesAreDifferent(cmd) {
|
|
59310
59318
|
const { height, width } = this.getSheetViewDimension();
|
|
59311
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
59312
|
-
return
|
|
59319
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
59320
|
+
return "Success";
|
|
59313
59321
|
}
|
|
59314
59322
|
checkScrollingDirection({ offsetX, offsetY }) {
|
|
59315
59323
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
59316
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
59317
|
-
return
|
|
59324
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
59325
|
+
return "Success";
|
|
59318
59326
|
}
|
|
59319
59327
|
checkIfViewportsWillChange({ offsetX, offsetY }) {
|
|
59320
59328
|
const sheetId = this.getters.getActiveSheetId();
|
|
59321
59329
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
59322
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
59330
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
59323
59331
|
}
|
|
59324
59332
|
getMainViewport(sheetId) {
|
|
59325
59333
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -59904,9 +59912,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59904
59912
|
sheetId,
|
|
59905
59913
|
name
|
|
59906
59914
|
});
|
|
59907
|
-
if (result.reasons.includes(
|
|
59908
|
-
else if (result.reasons.includes(
|
|
59909
|
-
else if (result.reasons.includes(
|
|
59915
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
59916
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
59917
|
+
else if (result.reasons.includes("ForbiddenCharactersInSheetName")) env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEETNAME_CHARS.join(" ")), errorCallback);
|
|
59910
59918
|
}
|
|
59911
59919
|
|
|
59912
59920
|
//#endregion
|
|
@@ -60118,41 +60126,41 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60118
60126
|
const selectionStatisticFunctions = [
|
|
60119
60127
|
{
|
|
60120
60128
|
name: _t("Sum"),
|
|
60121
|
-
types: [
|
|
60129
|
+
types: ["number"],
|
|
60122
60130
|
compute: (values, locale) => sum([[values]], locale)
|
|
60123
60131
|
},
|
|
60124
60132
|
{
|
|
60125
60133
|
name: _t("Avg"),
|
|
60126
|
-
types: [
|
|
60134
|
+
types: ["number"],
|
|
60127
60135
|
compute: (values, locale) => average([[values]], locale)
|
|
60128
60136
|
},
|
|
60129
60137
|
{
|
|
60130
60138
|
name: _t("Min"),
|
|
60131
|
-
types: [
|
|
60139
|
+
types: ["number"],
|
|
60132
60140
|
compute: (values, locale) => min([[values]], locale).value
|
|
60133
60141
|
},
|
|
60134
60142
|
{
|
|
60135
60143
|
name: _t("Max"),
|
|
60136
|
-
types: [
|
|
60144
|
+
types: ["number"],
|
|
60137
60145
|
compute: (values, locale) => max([[values]], locale).value
|
|
60138
60146
|
},
|
|
60139
60147
|
{
|
|
60140
60148
|
name: _t("Count"),
|
|
60141
60149
|
types: [
|
|
60142
|
-
|
|
60143
|
-
|
|
60144
|
-
|
|
60145
|
-
|
|
60150
|
+
"number",
|
|
60151
|
+
"text",
|
|
60152
|
+
"boolean",
|
|
60153
|
+
"error"
|
|
60146
60154
|
],
|
|
60147
60155
|
compute: (values) => countAny([[values]])
|
|
60148
60156
|
},
|
|
60149
60157
|
{
|
|
60150
60158
|
name: _t("Count Numbers"),
|
|
60151
60159
|
types: [
|
|
60152
|
-
|
|
60153
|
-
|
|
60154
|
-
|
|
60155
|
-
|
|
60160
|
+
"number",
|
|
60161
|
+
"text",
|
|
60162
|
+
"boolean",
|
|
60163
|
+
"error"
|
|
60156
60164
|
],
|
|
60157
60165
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
60158
60166
|
}
|
|
@@ -60202,7 +60210,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60202
60210
|
col,
|
|
60203
60211
|
row
|
|
60204
60212
|
});
|
|
60205
|
-
if (evaluatedCell.type !==
|
|
60213
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
60206
60214
|
}
|
|
60207
60215
|
const locale = getters.getLocale();
|
|
60208
60216
|
const statisticFnResults = {};
|
|
@@ -60687,7 +60695,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60687
60695
|
css`
|
|
60688
60696
|
.o-header-group {
|
|
60689
60697
|
.o-header-group-header {
|
|
60690
|
-
z-index: ${
|
|
60698
|
+
z-index: ${6};
|
|
60691
60699
|
.o-group-fold-button {
|
|
60692
60700
|
cursor: pointer;
|
|
60693
60701
|
width: 13px;
|
|
@@ -61473,7 +61481,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61473
61481
|
});
|
|
61474
61482
|
return cssPropertiesToCss({
|
|
61475
61483
|
"border-color": SELECTION_BORDER_COLOR,
|
|
61476
|
-
"z-index": String(
|
|
61484
|
+
"z-index": String(30)
|
|
61477
61485
|
});
|
|
61478
61486
|
}
|
|
61479
61487
|
onFocus(selection) {
|
|
@@ -61709,7 +61717,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61709
61717
|
overflow-y: auto;
|
|
61710
61718
|
overflow-x: hidden;
|
|
61711
61719
|
padding: 2px;
|
|
61712
|
-
z-index: ${
|
|
61720
|
+
z-index: ${21};
|
|
61713
61721
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
61714
61722
|
background-color: white;
|
|
61715
61723
|
|
|
@@ -61848,6 +61856,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61848
61856
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
61849
61857
|
}
|
|
61850
61858
|
var WebClipboardWrapper = class {
|
|
61859
|
+
clipboard;
|
|
61851
61860
|
constructor(clipboard) {
|
|
61852
61861
|
this.clipboard = clipboard;
|
|
61853
61862
|
}
|
|
@@ -61862,12 +61871,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61862
61871
|
*/
|
|
61863
61872
|
try {
|
|
61864
61873
|
await this.clipboard?.write([new ClipboardItem({
|
|
61865
|
-
[
|
|
61866
|
-
[
|
|
61874
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
61875
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
61867
61876
|
})]);
|
|
61868
61877
|
} catch (e) {}
|
|
61869
61878
|
}
|
|
61870
|
-
else await this.writeText(clipboardContent[
|
|
61879
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
61871
61880
|
}
|
|
61872
61881
|
async writeText(text) {
|
|
61873
61882
|
try {
|
|
@@ -61892,13 +61901,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61892
61901
|
}
|
|
61893
61902
|
else return {
|
|
61894
61903
|
status: "ok",
|
|
61895
|
-
content: { [
|
|
61904
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
61896
61905
|
};
|
|
61897
61906
|
}
|
|
61898
61907
|
getClipboardItems(content) {
|
|
61899
61908
|
const clipboardItemData = {
|
|
61900
|
-
[
|
|
61901
|
-
[
|
|
61909
|
+
["text/plain"]: this.getBlob(content, "text/plain"),
|
|
61910
|
+
["text/html"]: this.getBlob(content, "text/html")
|
|
61902
61911
|
};
|
|
61903
61912
|
return [new ClipboardItem(clipboardItemData)];
|
|
61904
61913
|
}
|
|
@@ -62356,6 +62365,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62356
62365
|
* @param operations initial operations
|
|
62357
62366
|
*/
|
|
62358
62367
|
var Branch = class Branch {
|
|
62368
|
+
buildTransformation;
|
|
62369
|
+
operations;
|
|
62359
62370
|
constructor(buildTransformation, operations = []) {
|
|
62360
62371
|
this.buildTransformation = buildTransformation;
|
|
62361
62372
|
this.operations = operations;
|
|
@@ -62472,6 +62483,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62472
62483
|
* to revert it).
|
|
62473
62484
|
*/
|
|
62474
62485
|
var Operation = class {
|
|
62486
|
+
id;
|
|
62487
|
+
data;
|
|
62475
62488
|
constructor(id, data) {
|
|
62476
62489
|
this.id = id;
|
|
62477
62490
|
this.data = data;
|
|
@@ -62481,6 +62494,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62481
62494
|
}
|
|
62482
62495
|
};
|
|
62483
62496
|
var LazyOperation = class LazyOperation {
|
|
62497
|
+
id;
|
|
62498
|
+
lazyData;
|
|
62484
62499
|
constructor(id, lazyData) {
|
|
62485
62500
|
this.id = id;
|
|
62486
62501
|
this.lazyData = lazyData;
|
|
@@ -62506,6 +62521,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62506
62521
|
* ```
|
|
62507
62522
|
*/
|
|
62508
62523
|
var OperationSequence = class OperationSequence {
|
|
62524
|
+
operations;
|
|
62509
62525
|
constructor(operations) {
|
|
62510
62526
|
this.operations = operations;
|
|
62511
62527
|
}
|
|
@@ -62581,6 +62597,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62581
62597
|
*
|
|
62582
62598
|
*/
|
|
62583
62599
|
var Tree = class {
|
|
62600
|
+
buildTransformation;
|
|
62584
62601
|
branches;
|
|
62585
62602
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
62586
62603
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -63163,6 +63180,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63163
63180
|
* with the new selected anchor
|
|
63164
63181
|
*/
|
|
63165
63182
|
var SelectionStreamProcessorImpl = class {
|
|
63183
|
+
getters;
|
|
63166
63184
|
stream;
|
|
63167
63185
|
/**
|
|
63168
63186
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -63261,7 +63279,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63261
63279
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
63262
63280
|
*/
|
|
63263
63281
|
moveAnchorCell(direction, step = 1) {
|
|
63264
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63282
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63265
63283
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
63266
63284
|
return this.selectCell(col, row);
|
|
63267
63285
|
}
|
|
@@ -63323,7 +63341,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63323
63341
|
* of the anchor zone which moves.
|
|
63324
63342
|
*/
|
|
63325
63343
|
resizeAnchorZone(direction, step = 1) {
|
|
63326
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63344
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63327
63345
|
const sheetId = this.getters.getActiveSheetId();
|
|
63328
63346
|
const anchor = this.anchor;
|
|
63329
63347
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -63570,7 +63588,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63570
63588
|
previousAnchor: deepCopy(this.anchor)
|
|
63571
63589
|
};
|
|
63572
63590
|
const commandResult = this.checkEventAnchorZone(event);
|
|
63573
|
-
if (commandResult !==
|
|
63591
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
63574
63592
|
this.anchor = event.anchor;
|
|
63575
63593
|
this.stream.send(event);
|
|
63576
63594
|
return DispatchResult.Success;
|
|
@@ -63580,15 +63598,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63580
63598
|
}
|
|
63581
63599
|
checkAnchorZone(anchor) {
|
|
63582
63600
|
const { cell, zone } = anchor;
|
|
63583
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
63601
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
63584
63602
|
const { left, right, top, bottom } = zone;
|
|
63585
63603
|
const sheetId = this.getters.getActiveSheetId();
|
|
63586
63604
|
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
|
|
63605
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
63606
|
+
return "Success";
|
|
63589
63607
|
}
|
|
63590
63608
|
checkAnchorZoneOrThrow(anchor) {
|
|
63591
|
-
if (this.checkAnchorZone(anchor) ===
|
|
63609
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
|
|
63592
63610
|
}
|
|
63593
63611
|
/**
|
|
63594
63612
|
* ---- PRIVATE ----
|
|
@@ -63745,7 +63763,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63745
63763
|
isCellSkippableInCluster(position) {
|
|
63746
63764
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
63747
63765
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
63748
|
-
return cell.type ===
|
|
63766
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
63749
63767
|
}
|
|
63750
63768
|
};
|
|
63751
63769
|
|
|
@@ -65668,13 +65686,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65668
65686
|
|
|
65669
65687
|
//#endregion
|
|
65670
65688
|
//#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
65689
|
var Model = class extends EventBus {
|
|
65679
65690
|
corePlugins = [];
|
|
65680
65691
|
featurePlugins = [];
|
|
@@ -65698,7 +65709,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65698
65709
|
/**
|
|
65699
65710
|
* Internal status of the model. Important for command handling coordination
|
|
65700
65711
|
*/
|
|
65701
|
-
status =
|
|
65712
|
+
status = 0;
|
|
65702
65713
|
/**
|
|
65703
65714
|
* The config object contains some configuration flag and callbacks
|
|
65704
65715
|
*/
|
|
@@ -65835,7 +65846,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65835
65846
|
onRemoteRevisionReceived({ commands }) {
|
|
65836
65847
|
for (const command of commands) {
|
|
65837
65848
|
const previousStatus = this.status;
|
|
65838
|
-
this.status =
|
|
65849
|
+
this.status = 2;
|
|
65839
65850
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
65840
65851
|
this.status = previousStatus;
|
|
65841
65852
|
}
|
|
@@ -65933,7 +65944,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65933
65944
|
*/
|
|
65934
65945
|
checkDispatchAllowed(command) {
|
|
65935
65946
|
const results = isCoreCommand(command) ? this.checkDispatchAllowedCoreCommand(command) : this.checkDispatchAllowedLocalCommand(command);
|
|
65936
|
-
if (results.some((r) => r !==
|
|
65947
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
65937
65948
|
return DispatchResult.Success;
|
|
65938
65949
|
}
|
|
65939
65950
|
checkDispatchAllowedCoreCommand(command) {
|
|
@@ -65945,9 +65956,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65945
65956
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
65946
65957
|
}
|
|
65947
65958
|
finalize() {
|
|
65948
|
-
this.status =
|
|
65959
|
+
this.status = 3;
|
|
65949
65960
|
for (const h of this.handlers) h.finalize();
|
|
65950
|
-
this.status =
|
|
65961
|
+
this.status = 0;
|
|
65951
65962
|
this.trigger("command-finalized");
|
|
65952
65963
|
}
|
|
65953
65964
|
/**
|
|
@@ -65974,16 +65985,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65974
65985
|
dispatch = (type, payload) => {
|
|
65975
65986
|
const command = createCommand(type, payload);
|
|
65976
65987
|
const status = this.status;
|
|
65977
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
65978
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
65988
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
65989
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
65979
65990
|
switch (status) {
|
|
65980
|
-
case
|
|
65991
|
+
case 0:
|
|
65981
65992
|
const result = this.checkDispatchAllowed(command);
|
|
65982
65993
|
if (!result.isSuccessful) {
|
|
65983
65994
|
this.trigger("update");
|
|
65984
65995
|
return result;
|
|
65985
65996
|
}
|
|
65986
|
-
this.status =
|
|
65997
|
+
this.status = 1;
|
|
65987
65998
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
65988
65999
|
const start = performance.now();
|
|
65989
66000
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -65993,10 +66004,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65993
66004
|
if (time > 5) console.debug(type, time, "ms");
|
|
65994
66005
|
});
|
|
65995
66006
|
this.session.save(command, commands, changes);
|
|
65996
|
-
this.status =
|
|
66007
|
+
this.status = 0;
|
|
65997
66008
|
this.trigger("update");
|
|
65998
66009
|
break;
|
|
65999
|
-
case
|
|
66010
|
+
case 1:
|
|
66000
66011
|
if (isCoreCommand(command)) {
|
|
66001
66012
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
66002
66013
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -66004,8 +66015,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66004
66015
|
}
|
|
66005
66016
|
this.dispatchToHandlers(this.handlers, command);
|
|
66006
66017
|
break;
|
|
66007
|
-
case
|
|
66008
|
-
case
|
|
66018
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
66019
|
+
case 2:
|
|
66009
66020
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
66010
66021
|
this.dispatchToHandlers(this.handlers, command);
|
|
66011
66022
|
}
|
|
@@ -66018,7 +66029,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66018
66029
|
dispatchFromCorePlugin = (type, payload) => {
|
|
66019
66030
|
const command = createCommand(type, payload);
|
|
66020
66031
|
const previousStatus = this.status;
|
|
66021
|
-
this.status =
|
|
66032
|
+
this.status = 2;
|
|
66022
66033
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
66023
66034
|
this.dispatchToHandlers(handlers, command);
|
|
66024
66035
|
this.status = previousStatus;
|
|
@@ -66362,8 +66373,8 @@ exports.stores = stores;
|
|
|
66362
66373
|
exports.tokenColors = tokenColors;
|
|
66363
66374
|
exports.tokenize = tokenize;
|
|
66364
66375
|
|
|
66365
|
-
__info__.version = "18.0.
|
|
66366
|
-
__info__.date = "2026-05-
|
|
66367
|
-
__info__.hash = "
|
|
66376
|
+
__info__.version = "18.0.69";
|
|
66377
|
+
__info__.date = "2026-05-27T05:57:08.710Z";
|
|
66378
|
+
__info__.hash = "50b85ba";
|
|
66368
66379
|
|
|
66369
66380
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|