@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
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
@@ -15,7 +15,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
15
15
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
16
|
var __getProtoOf = Object.getPrototypeOf;
|
|
17
17
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
19
19
|
var __exportAll = (all, no_symbols) => {
|
|
20
20
|
let target = {};
|
|
21
21
|
for (var name in all) {
|
|
@@ -337,22 +337,6 @@ const FORBIDDEN_SHEETNAME_CHARS = [
|
|
|
337
337
|
"]"
|
|
338
338
|
];
|
|
339
339
|
const FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX = /'|\*|\?|\/|\\|\[|\]/;
|
|
340
|
-
let ComponentsImportance = /* @__PURE__ */ function(ComponentsImportance) {
|
|
341
|
-
ComponentsImportance[ComponentsImportance["Grid"] = 0] = "Grid";
|
|
342
|
-
ComponentsImportance[ComponentsImportance["Highlight"] = 5] = "Highlight";
|
|
343
|
-
ComponentsImportance[ComponentsImportance["HeaderGroupingButton"] = 6] = "HeaderGroupingButton";
|
|
344
|
-
ComponentsImportance[ComponentsImportance["Figure"] = 10] = "Figure";
|
|
345
|
-
ComponentsImportance[ComponentsImportance["ScrollBar"] = 15] = "ScrollBar";
|
|
346
|
-
ComponentsImportance[ComponentsImportance["GridPopover"] = 19] = "GridPopover";
|
|
347
|
-
ComponentsImportance[ComponentsImportance["GridComposer"] = 20] = "GridComposer";
|
|
348
|
-
ComponentsImportance[ComponentsImportance["Dropdown"] = 21] = "Dropdown";
|
|
349
|
-
ComponentsImportance[ComponentsImportance["IconPicker"] = 25] = "IconPicker";
|
|
350
|
-
ComponentsImportance[ComponentsImportance["TopBarComposer"] = 30] = "TopBarComposer";
|
|
351
|
-
ComponentsImportance[ComponentsImportance["Popover"] = 35] = "Popover";
|
|
352
|
-
ComponentsImportance[ComponentsImportance["FigureAnchor"] = 1e3] = "FigureAnchor";
|
|
353
|
-
ComponentsImportance[ComponentsImportance["FigureSnapLine"] = 1001] = "FigureSnapLine";
|
|
354
|
-
return ComponentsImportance;
|
|
355
|
-
}({});
|
|
356
340
|
let DEFAULT_SHEETVIEW_SIZE = 0;
|
|
357
341
|
function getDefaultSheetViewSize() {
|
|
358
342
|
return DEFAULT_SHEETVIEW_SIZE;
|
|
@@ -833,7 +817,8 @@ var TokenizingChars = class {
|
|
|
833
817
|
}
|
|
834
818
|
shift() {
|
|
835
819
|
const current = this.current;
|
|
836
|
-
|
|
820
|
+
const next = this.text[++this.currentIndex];
|
|
821
|
+
this.current = next;
|
|
837
822
|
return current;
|
|
838
823
|
}
|
|
839
824
|
advanceBy(length) {
|
|
@@ -1268,6 +1253,7 @@ function getColorsPalette(quantity) {
|
|
|
1268
1253
|
else return COLORS_XL;
|
|
1269
1254
|
}
|
|
1270
1255
|
var ColorGenerator = class {
|
|
1256
|
+
preferredColors;
|
|
1271
1257
|
currentColorIndex = 0;
|
|
1272
1258
|
palette;
|
|
1273
1259
|
constructor(paletteSize, preferredColors = []) {
|
|
@@ -1685,6 +1671,7 @@ const _t = function(s, ...values) {
|
|
|
1685
1671
|
return sprintf(_translate(s), ...values);
|
|
1686
1672
|
};
|
|
1687
1673
|
var LazyTranslatedString = class extends String {
|
|
1674
|
+
values;
|
|
1688
1675
|
constructor(str, values) {
|
|
1689
1676
|
super(str);
|
|
1690
1677
|
this.values = values;
|
|
@@ -2785,25 +2772,6 @@ function percentile(values, percent, isInclusive) {
|
|
|
2785
2772
|
return sortedValues[indexSup] * (percentIndex - indexLow) + sortedValues[indexLow] * (indexSup - percentIndex);
|
|
2786
2773
|
}
|
|
2787
2774
|
|
|
2788
|
-
//#endregion
|
|
2789
|
-
//#region src/types/cells.ts
|
|
2790
|
-
let CellValueType = /* @__PURE__ */ function(CellValueType) {
|
|
2791
|
-
CellValueType["boolean"] = "boolean";
|
|
2792
|
-
CellValueType["number"] = "number";
|
|
2793
|
-
CellValueType["text"] = "text";
|
|
2794
|
-
CellValueType["empty"] = "empty";
|
|
2795
|
-
CellValueType["error"] = "error";
|
|
2796
|
-
return CellValueType;
|
|
2797
|
-
}({});
|
|
2798
|
-
|
|
2799
|
-
//#endregion
|
|
2800
|
-
//#region src/types/clipboard.ts
|
|
2801
|
-
let ClipboardMIMEType = /* @__PURE__ */ function(ClipboardMIMEType) {
|
|
2802
|
-
ClipboardMIMEType["PlainText"] = "text/plain";
|
|
2803
|
-
ClipboardMIMEType["Html"] = "text/html";
|
|
2804
|
-
return ClipboardMIMEType;
|
|
2805
|
-
}({});
|
|
2806
|
-
|
|
2807
2775
|
//#endregion
|
|
2808
2776
|
//#region src/types/commands.ts
|
|
2809
2777
|
function isSheetDependent(cmd) {
|
|
@@ -2965,7 +2933,7 @@ var DispatchResult = class {
|
|
|
2965
2933
|
constructor(results = []) {
|
|
2966
2934
|
if (!Array.isArray(results)) results = [results];
|
|
2967
2935
|
results = [...new Set(results)];
|
|
2968
|
-
this.reasons = results.filter((result) => result !==
|
|
2936
|
+
this.reasons = results.filter((result) => result !== "Success");
|
|
2969
2937
|
}
|
|
2970
2938
|
/**
|
|
2971
2939
|
* Static helper which returns a successful DispatchResult
|
|
@@ -3149,13 +3117,6 @@ const borderStyles = [
|
|
|
3149
3117
|
function isMatrix(x) {
|
|
3150
3118
|
return Array.isArray(x) && Array.isArray(x[0]);
|
|
3151
3119
|
}
|
|
3152
|
-
let DIRECTION = /* @__PURE__ */ function(DIRECTION) {
|
|
3153
|
-
DIRECTION["UP"] = "up";
|
|
3154
|
-
DIRECTION["DOWN"] = "down";
|
|
3155
|
-
DIRECTION["LEFT"] = "left";
|
|
3156
|
-
DIRECTION["RIGHT"] = "right";
|
|
3157
|
-
return DIRECTION;
|
|
3158
|
-
}({});
|
|
3159
3120
|
|
|
3160
3121
|
//#endregion
|
|
3161
3122
|
//#region src/types/rendering.ts
|
|
@@ -3194,6 +3155,8 @@ const CellErrorType = {
|
|
|
3194
3155
|
};
|
|
3195
3156
|
const errorTypes = new Set(Object.values(CellErrorType));
|
|
3196
3157
|
var EvaluationError = class {
|
|
3158
|
+
message;
|
|
3159
|
+
value;
|
|
3197
3160
|
constructor(message = _t("Error"), value = CellErrorType.GenericError) {
|
|
3198
3161
|
this.message = message;
|
|
3199
3162
|
this.value = value;
|
|
@@ -3892,7 +3855,7 @@ urlRegistry.add("sheet_URL", {
|
|
|
3892
3855
|
if (env.model.dispatch("ACTIVATE_SHEET", {
|
|
3893
3856
|
sheetIdFrom: env.model.getters.getActiveSheetId(),
|
|
3894
3857
|
sheetIdTo: sheetId
|
|
3895
|
-
}).isCancelledBecause(
|
|
3858
|
+
}).isCancelledBecause("SheetIsHidden")) env.notifyUser({
|
|
3896
3859
|
type: "warning",
|
|
3897
3860
|
sticky: false,
|
|
3898
3861
|
text: _t("Cannot open the link because the linked sheet is hidden.")
|
|
@@ -4864,7 +4827,7 @@ function textCell(value, format, formattedValue) {
|
|
|
4864
4827
|
value,
|
|
4865
4828
|
format,
|
|
4866
4829
|
formattedValue,
|
|
4867
|
-
type:
|
|
4830
|
+
type: "text",
|
|
4868
4831
|
isAutoSummable: true,
|
|
4869
4832
|
defaultAlign: "left"
|
|
4870
4833
|
};
|
|
@@ -4874,7 +4837,7 @@ function numberCell(value, format, formattedValue) {
|
|
|
4874
4837
|
value: value || 0,
|
|
4875
4838
|
format,
|
|
4876
4839
|
formattedValue,
|
|
4877
|
-
type:
|
|
4840
|
+
type: "number",
|
|
4878
4841
|
isAutoSummable: true,
|
|
4879
4842
|
defaultAlign: "right"
|
|
4880
4843
|
};
|
|
@@ -4884,7 +4847,7 @@ const emptyCell = memoize(function emptyCell(format) {
|
|
|
4884
4847
|
value: null,
|
|
4885
4848
|
format,
|
|
4886
4849
|
formattedValue: "",
|
|
4887
|
-
type:
|
|
4850
|
+
type: "empty",
|
|
4888
4851
|
isAutoSummable: true,
|
|
4889
4852
|
defaultAlign: "left"
|
|
4890
4853
|
};
|
|
@@ -4894,7 +4857,7 @@ function dateTimeCell(value, format, formattedValue) {
|
|
|
4894
4857
|
value,
|
|
4895
4858
|
format,
|
|
4896
4859
|
formattedValue,
|
|
4897
|
-
type:
|
|
4860
|
+
type: "number",
|
|
4898
4861
|
isAutoSummable: false,
|
|
4899
4862
|
defaultAlign: "right"
|
|
4900
4863
|
};
|
|
@@ -4904,7 +4867,7 @@ function booleanCell(value, format, formattedValue) {
|
|
|
4904
4867
|
value,
|
|
4905
4868
|
format,
|
|
4906
4869
|
formattedValue,
|
|
4907
|
-
type:
|
|
4870
|
+
type: "boolean",
|
|
4908
4871
|
isAutoSummable: false,
|
|
4909
4872
|
defaultAlign: "center"
|
|
4910
4873
|
};
|
|
@@ -4914,7 +4877,7 @@ function errorCell(value, message) {
|
|
|
4914
4877
|
value,
|
|
4915
4878
|
formattedValue: value,
|
|
4916
4879
|
message,
|
|
4917
|
-
type:
|
|
4880
|
+
type: "error",
|
|
4918
4881
|
isAutoSummable: false,
|
|
4919
4882
|
defaultAlign: "center"
|
|
4920
4883
|
};
|
|
@@ -5057,6 +5020,7 @@ function getFullReference(sheetName, xc) {
|
|
|
5057
5020
|
//#endregion
|
|
5058
5021
|
//#region src/helpers/range.ts
|
|
5059
5022
|
var RangeImpl = class RangeImpl {
|
|
5023
|
+
getSheetSize;
|
|
5060
5024
|
_zone;
|
|
5061
5025
|
parts;
|
|
5062
5026
|
invalidXc;
|
|
@@ -5688,10 +5652,10 @@ function getPasteZones(target, content) {
|
|
|
5688
5652
|
return target.map((t) => splitZoneForPaste(t, width, height)).flat();
|
|
5689
5653
|
}
|
|
5690
5654
|
function parseOSClipboardContent(content) {
|
|
5691
|
-
if (!content[
|
|
5692
|
-
const htmlDocument = new DOMParser().parseFromString(content[
|
|
5655
|
+
if (!content["text/html"]) return { text: content["text/plain"] };
|
|
5656
|
+
const htmlDocument = new DOMParser().parseFromString(content["text/html"], "text/html");
|
|
5693
5657
|
return {
|
|
5694
|
-
text: content[
|
|
5658
|
+
text: content["text/plain"],
|
|
5695
5659
|
data: getOSheetDataFromHTML(htmlDocument)
|
|
5696
5660
|
};
|
|
5697
5661
|
}
|
|
@@ -5758,6 +5722,8 @@ const selectPastedZone = (selection, sourceZones, pastedZones) => {
|
|
|
5758
5722
|
//#endregion
|
|
5759
5723
|
//#region src/clipboard_handlers/abstract_clipboard_handler.ts
|
|
5760
5724
|
var ClipboardHandler = class {
|
|
5725
|
+
getters;
|
|
5726
|
+
dispatch;
|
|
5761
5727
|
constructor(getters, dispatch) {
|
|
5762
5728
|
this.getters = getters;
|
|
5763
5729
|
this.dispatch = dispatch;
|
|
@@ -5765,10 +5731,10 @@ var ClipboardHandler = class {
|
|
|
5765
5731
|
copy(data, mode = "copyPaste") {}
|
|
5766
5732
|
paste(target, clippedContent, options) {}
|
|
5767
5733
|
isPasteAllowed(sheetId, target, content, option) {
|
|
5768
|
-
return
|
|
5734
|
+
return "Success";
|
|
5769
5735
|
}
|
|
5770
5736
|
isCutAllowed(data) {
|
|
5771
|
-
return
|
|
5737
|
+
return "Success";
|
|
5772
5738
|
}
|
|
5773
5739
|
getPasteTarget(sheetId, target, content, options) {
|
|
5774
5740
|
return {
|
|
@@ -7219,8 +7185,8 @@ function addIndentAndAlignToPivotHeader(pivot, domain, functionResult) {
|
|
|
7219
7185
|
//#region src/clipboard_handlers/cell_clipboard.ts
|
|
7220
7186
|
var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7221
7187
|
isCutAllowed(data) {
|
|
7222
|
-
if (data.zones.length !== 1) return
|
|
7223
|
-
return
|
|
7188
|
+
if (data.zones.length !== 1) return "WrongCutSelection";
|
|
7189
|
+
return "Success";
|
|
7224
7190
|
}
|
|
7225
7191
|
copy(data, mode = "copyPaste") {
|
|
7226
7192
|
const sheetId = data.sheetId;
|
|
@@ -7288,17 +7254,17 @@ var CellClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
7288
7254
|
};
|
|
7289
7255
|
}
|
|
7290
7256
|
isPasteAllowed(sheetId, target, content, clipboardOptions) {
|
|
7291
|
-
if (!content.cells) return
|
|
7292
|
-
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return
|
|
7257
|
+
if (!content.cells) return "Success";
|
|
7258
|
+
if (clipboardOptions?.isCutOperation && clipboardOptions?.pasteOption !== void 0) return "WrongPasteOption";
|
|
7293
7259
|
if (target.length > 1) {
|
|
7294
|
-
if (content.cells.length > 1 || content.cells[0].length > 1) return
|
|
7260
|
+
if (content.cells.length > 1 || content.cells[0].length > 1) return "WrongPasteSelection";
|
|
7295
7261
|
}
|
|
7296
7262
|
const clipboardHeight = content.cells.length;
|
|
7297
7263
|
const clipboardWidth = content.cells[0].length;
|
|
7298
7264
|
for (const zone of getPasteZones(target, content.cells)) if (this.getters.doesIntersectMerge(sheetId, zone)) {
|
|
7299
|
-
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return
|
|
7265
|
+
if (target.length > 1 || !this.getters.isSingleCellOrMerge(sheetId, target[0]) || clipboardHeight * clipboardWidth !== 1) return "WillRemoveExistingMerge";
|
|
7300
7266
|
}
|
|
7301
|
-
return
|
|
7267
|
+
return "Success";
|
|
7302
7268
|
}
|
|
7303
7269
|
/**
|
|
7304
7270
|
* Paste the clipboard content in the given target
|
|
@@ -7480,9 +7446,9 @@ var ChartClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
7480
7446
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7481
7447
|
}
|
|
7482
7448
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7483
|
-
if (target.length === 0) return
|
|
7484
|
-
if (option?.pasteOption !== void 0) return
|
|
7485
|
-
return
|
|
7449
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7450
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7451
|
+
return "Success";
|
|
7486
7452
|
}
|
|
7487
7453
|
};
|
|
7488
7454
|
|
|
@@ -7781,9 +7747,9 @@ var ImageClipboardHandler = class extends AbstractFigureClipboardHandler {
|
|
|
7781
7747
|
this.dispatch("SELECT_FIGURE", { id: figureId });
|
|
7782
7748
|
}
|
|
7783
7749
|
isPasteAllowed(sheetId, target, content, option) {
|
|
7784
|
-
if (target.length === 0) return
|
|
7785
|
-
if (option?.pasteOption !== void 0) return
|
|
7786
|
-
return
|
|
7750
|
+
if (target.length === 0) return "EmptyTarget";
|
|
7751
|
+
if (option?.pasteOption !== void 0) return "WrongFigurePasteOption";
|
|
7752
|
+
return "Success";
|
|
7787
7753
|
}
|
|
7788
7754
|
};
|
|
7789
7755
|
|
|
@@ -7878,10 +7844,10 @@ var ReferenceClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
|
7878
7844
|
//#region src/clipboard_handlers/sheet_clipboard.ts
|
|
7879
7845
|
var SheetClipboardHandler = class extends AbstractCellClipboardHandler {
|
|
7880
7846
|
isPasteAllowed(sheetId, target, content, options) {
|
|
7881
|
-
if (!("cells" in content)) return
|
|
7847
|
+
if (!("cells" in content)) return "Success";
|
|
7882
7848
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
7883
|
-
for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
7884
|
-
return
|
|
7849
|
+
for (const zone of getPasteZones(target, content.cells)) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
7850
|
+
return "Success";
|
|
7885
7851
|
}
|
|
7886
7852
|
};
|
|
7887
7853
|
|
|
@@ -8133,6 +8099,7 @@ var DependencyContainer = class extends EventBus {
|
|
|
8133
8099
|
}
|
|
8134
8100
|
};
|
|
8135
8101
|
var StoreFactory = class {
|
|
8102
|
+
get;
|
|
8136
8103
|
pendingBuilds = /* @__PURE__ */ new Set();
|
|
8137
8104
|
constructor(get) {
|
|
8138
8105
|
this.get = get;
|
|
@@ -8177,6 +8144,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
8177
8144
|
return MetaStore;
|
|
8178
8145
|
}
|
|
8179
8146
|
var DisposableStore = class {
|
|
8147
|
+
get;
|
|
8180
8148
|
disposeCallbacks = [];
|
|
8181
8149
|
constructor(get) {
|
|
8182
8150
|
this.get = get;
|
|
@@ -8554,16 +8522,16 @@ function chartFontColor(backgroundColor) {
|
|
|
8554
8522
|
}
|
|
8555
8523
|
function checkDataset(definition) {
|
|
8556
8524
|
if (definition.dataSets) {
|
|
8557
|
-
if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return
|
|
8558
|
-
if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return
|
|
8525
|
+
if (definition.dataSets.find((range) => !rangeReference.test(range.dataRange)) !== void 0) return "InvalidDataSet";
|
|
8526
|
+
if (definition.dataSets.map((ds) => toUnboundedZone(ds.dataRange)).some((zone) => zone.top !== zone.bottom && isFullRow(zone))) return "InvalidDataSet";
|
|
8559
8527
|
}
|
|
8560
|
-
return
|
|
8528
|
+
return "Success";
|
|
8561
8529
|
}
|
|
8562
8530
|
function checkLabelRange(definition) {
|
|
8563
8531
|
if (definition.labelRange) {
|
|
8564
|
-
if (!rangeReference.test(definition.labelRange || "")) return
|
|
8532
|
+
if (!rangeReference.test(definition.labelRange || "")) return "InvalidLabelRange";
|
|
8565
8533
|
}
|
|
8566
|
-
return
|
|
8534
|
+
return "Success";
|
|
8567
8535
|
}
|
|
8568
8536
|
function shouldRemoveFirstLabel(labelRange, dataset, dataSetsHaveTitle) {
|
|
8569
8537
|
if (!dataSetsHaveTitle) return false;
|
|
@@ -8880,6 +8848,7 @@ function getNextNonEmptyBar(bars, startIndex) {
|
|
|
8880
8848
|
* Represent a raw XML string
|
|
8881
8849
|
*/
|
|
8882
8850
|
var XMLString = class {
|
|
8851
|
+
xmlString;
|
|
8883
8852
|
/**
|
|
8884
8853
|
* @param xmlString should be a well formed, properly escaped XML string
|
|
8885
8854
|
*/
|
|
@@ -8993,6 +8962,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
|
8993
8962
|
ROUNDDOWN: [{
|
|
8994
8963
|
type: "NUMBER",
|
|
8995
8964
|
value: 0
|
|
8965
|
+
}],
|
|
8966
|
+
IFERROR: [{
|
|
8967
|
+
type: "NUMBER",
|
|
8968
|
+
value: 0
|
|
8996
8969
|
}]
|
|
8997
8970
|
};
|
|
8998
8971
|
/**
|
|
@@ -9433,30 +9406,6 @@ function prefixFormulaWithEqual(formula) {
|
|
|
9433
9406
|
|
|
9434
9407
|
//#endregion
|
|
9435
9408
|
//#region src/xlsx/helpers/xlsx_parser_error_manager.ts
|
|
9436
|
-
/**
|
|
9437
|
-
* Map of the different types of conversions warnings and their name in error messages
|
|
9438
|
-
*/
|
|
9439
|
-
let WarningTypes = /* @__PURE__ */ function(WarningTypes) {
|
|
9440
|
-
WarningTypes["DiagonalBorderNotSupported"] = "Diagonal Borders";
|
|
9441
|
-
WarningTypes["BorderStyleNotSupported"] = "Border style";
|
|
9442
|
-
WarningTypes["FillStyleNotSupported"] = "Fill Style";
|
|
9443
|
-
WarningTypes["FontNotSupported"] = "Font";
|
|
9444
|
-
WarningTypes["HorizontalAlignmentNotSupported"] = "Horizontal Alignment";
|
|
9445
|
-
WarningTypes["VerticalAlignmentNotSupported"] = "Vertical Alignments";
|
|
9446
|
-
WarningTypes["MultipleRulesCfNotSupported"] = "Multiple rules conditional formats";
|
|
9447
|
-
WarningTypes["CfTypeNotSupported"] = "Conditional format type";
|
|
9448
|
-
WarningTypes["CfFormatBorderNotSupported"] = "Borders in conditional formats";
|
|
9449
|
-
WarningTypes["CfFormatAlignmentNotSupported"] = "Alignment in conditional formats";
|
|
9450
|
-
WarningTypes["CfFormatNumFmtNotSupported"] = "Num formats in conditional formats";
|
|
9451
|
-
WarningTypes["CfIconSetEmptyIconNotSupported"] = "IconSets with empty icons";
|
|
9452
|
-
WarningTypes["BadlyFormattedHyperlink"] = "Badly formatted hyperlink";
|
|
9453
|
-
WarningTypes["NumFmtIdNotSupported"] = "Number format";
|
|
9454
|
-
WarningTypes["TimeDataValidationNotSupported"] = "Time data validation rules";
|
|
9455
|
-
WarningTypes["TextLengthDataValidationNotSupported"] = "Text length data validation rules";
|
|
9456
|
-
WarningTypes["WholeNumberDataValidationNotSupported"] = "Whole number data validation rules";
|
|
9457
|
-
WarningTypes["NotEqualDateDataValidationNotSupported"] = "Not equal date data validation rules";
|
|
9458
|
-
return WarningTypes;
|
|
9459
|
-
}({});
|
|
9460
9409
|
var XLSXImportWarningManager = class {
|
|
9461
9410
|
_parsingWarnings = /* @__PURE__ */ new Set();
|
|
9462
9411
|
_conversionWarnings = /* @__PURE__ */ new Set();
|
|
@@ -9945,7 +9894,7 @@ function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
|
9945
9894
|
if (isXlsxDateFormat(convertedFormat)) convertedFormat = convertDateFormat$1(convertedFormat);
|
|
9946
9895
|
if (isFormatSupported(convertedFormat)) return convertedFormat;
|
|
9947
9896
|
} catch (e) {}
|
|
9948
|
-
warningManager.generateNotSupportedWarning(
|
|
9897
|
+
warningManager.generateNotSupportedWarning("Number format", format || `nmFmtId ${numFmtId}`);
|
|
9949
9898
|
}
|
|
9950
9899
|
function isFormatSupported(format) {
|
|
9951
9900
|
try {
|
|
@@ -10029,20 +9978,20 @@ function convertFormats(data, warningManager) {
|
|
|
10029
9978
|
return arrayToObject(formats, 1);
|
|
10030
9979
|
}
|
|
10031
9980
|
function addStyleWarnings(font, fill, warningManager) {
|
|
10032
|
-
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning(
|
|
10033
|
-
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning(
|
|
9981
|
+
if (font && font.name && !SUPPORTED_FONTS.includes(font.name)) warningManager.generateNotSupportedWarning("Font", font.name, SUPPORTED_FONTS);
|
|
9982
|
+
if (fill && fill.patternType && !SUPPORTED_FILL_PATTERNS.includes(fill.patternType)) warningManager.generateNotSupportedWarning("Fill Style", fill.patternType, SUPPORTED_FILL_PATTERNS);
|
|
10034
9983
|
}
|
|
10035
9984
|
function addBorderDescrWarnings(borderDescr, warningManager) {
|
|
10036
|
-
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning(
|
|
9985
|
+
if (!SUPPORTED_BORDER_STYLES.includes(borderDescr.style)) warningManager.generateNotSupportedWarning("Border style", borderDescr.style, SUPPORTED_BORDER_STYLES);
|
|
10037
9986
|
}
|
|
10038
9987
|
function addBorderWarnings(border, warningManager) {
|
|
10039
|
-
if (border.diagonal) warningManager.generateNotSupportedWarning(
|
|
9988
|
+
if (border.diagonal) warningManager.generateNotSupportedWarning("Diagonal Borders");
|
|
10040
9989
|
}
|
|
10041
9990
|
function addHorizontalAlignmentWarnings(alignment, warningManager) {
|
|
10042
|
-
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9991
|
+
if (alignment && !SUPPORTED_HORIZONTAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Horizontal Alignment", alignment, SUPPORTED_HORIZONTAL_ALIGNMENTS);
|
|
10043
9992
|
}
|
|
10044
9993
|
function addVerticalAlignmentWarnings(alignment, warningManager) {
|
|
10045
|
-
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning(
|
|
9994
|
+
if (alignment && !SUPPORTED_VERTICAL_ALIGNMENTS.includes(alignment)) warningManager.generateNotSupportedWarning("Vertical Alignments", alignment, SUPPORTED_VERTICAL_ALIGNMENTS);
|
|
10046
9995
|
}
|
|
10047
9996
|
|
|
10048
9997
|
//#endregion
|
|
@@ -10182,7 +10131,7 @@ function convertIconSet(id, xlsxCf, warningManager) {
|
|
|
10182
10131
|
lower: icons.upper
|
|
10183
10132
|
};
|
|
10184
10133
|
for (const key of Object.keys(icons)) if (!icons[key]) {
|
|
10185
|
-
warningManager.generateNotSupportedWarning(
|
|
10134
|
+
warningManager.generateNotSupportedWarning("IconSets with empty icons");
|
|
10186
10135
|
switch (key) {
|
|
10187
10136
|
case "upper":
|
|
10188
10137
|
icons[key] = ICON_SETS.dots.good;
|
|
@@ -10218,13 +10167,13 @@ function convertIcons(xlsxIconSet, index) {
|
|
|
10218
10167
|
return index === 0 ? ICON_SETS[iconSet].bad : index === 1 ? ICON_SETS[iconSet].neutral : ICON_SETS[iconSet].good;
|
|
10219
10168
|
}
|
|
10220
10169
|
function addCfConversionWarnings(cf, dxfs, warningManager) {
|
|
10221
|
-
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning(
|
|
10222
|
-
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning(
|
|
10170
|
+
if (cf.cfRules.length > 1) warningManager.generateNotSupportedWarning("Multiple rules conditional formats");
|
|
10171
|
+
if (!SUPPORTED_CF_TYPES.includes(cf.cfRules[0].type)) warningManager.generateNotSupportedWarning("Conditional format type", cf.cfRules[0].type);
|
|
10223
10172
|
if (cf.cfRules[0].dxfId) {
|
|
10224
10173
|
const dxf = dxfs[cf.cfRules[0].dxfId];
|
|
10225
|
-
if (dxf.border) warningManager.generateNotSupportedWarning(
|
|
10226
|
-
if (dxf.alignment) warningManager.generateNotSupportedWarning(
|
|
10227
|
-
if (dxf.numFmt) warningManager.generateNotSupportedWarning(
|
|
10174
|
+
if (dxf.border) warningManager.generateNotSupportedWarning("Borders in conditional formats");
|
|
10175
|
+
if (dxf.alignment) warningManager.generateNotSupportedWarning("Alignment in conditional formats");
|
|
10176
|
+
if (dxf.numFmt) warningManager.generateNotSupportedWarning("Num formats in conditional formats");
|
|
10228
10177
|
}
|
|
10229
10178
|
}
|
|
10230
10179
|
|
|
@@ -10564,13 +10513,13 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
10564
10513
|
if (!dv) continue;
|
|
10565
10514
|
switch (dv.type) {
|
|
10566
10515
|
case "time":
|
|
10567
|
-
warningManager.generateNotSupportedWarning(
|
|
10516
|
+
warningManager.generateNotSupportedWarning("Time data validation rules");
|
|
10568
10517
|
break;
|
|
10569
10518
|
case "textLength":
|
|
10570
|
-
warningManager.generateNotSupportedWarning(
|
|
10519
|
+
warningManager.generateNotSupportedWarning("Text length data validation rules");
|
|
10571
10520
|
break;
|
|
10572
10521
|
case "whole":
|
|
10573
|
-
warningManager.generateNotSupportedWarning(
|
|
10522
|
+
warningManager.generateNotSupportedWarning("Whole number data validation rules");
|
|
10574
10523
|
break;
|
|
10575
10524
|
case "decimal":
|
|
10576
10525
|
const decimalRule = convertDecimalRule(dvId++, dv);
|
|
@@ -10582,7 +10531,7 @@ function convertDataValidationRules(xlsxDataValidations, warningManager) {
|
|
|
10582
10531
|
break;
|
|
10583
10532
|
case "date":
|
|
10584
10533
|
if (dv.operator === "notEqual") {
|
|
10585
|
-
warningManager.generateNotSupportedWarning(
|
|
10534
|
+
warningManager.generateNotSupportedWarning("Not equal date data validation rules");
|
|
10586
10535
|
break;
|
|
10587
10536
|
}
|
|
10588
10537
|
const dateRule = convertDateRule(dvId++, dv);
|
|
@@ -10888,7 +10837,7 @@ function getCellValue(cell, hyperLinksMap, sharedStrings, warningManager) {
|
|
|
10888
10837
|
}
|
|
10889
10838
|
function convertHyperlink(link, cellValue, warningManager) {
|
|
10890
10839
|
const label = link.display || cellValue;
|
|
10891
|
-
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning(
|
|
10840
|
+
if (!link.relTarget && !link.location) warningManager.generateNotSupportedWarning("Badly formatted hyperlink");
|
|
10892
10841
|
return markdownLink(label, link.relTarget ? link.relTarget : buildSheetLink(splitReference(link.location).sheetName));
|
|
10893
10842
|
}
|
|
10894
10843
|
function getSheetDims(sheet) {
|
|
@@ -13173,46 +13122,6 @@ var XlsxReader = class {
|
|
|
13173
13122
|
|
|
13174
13123
|
//#endregion
|
|
13175
13124
|
//#region src/formulas/range_tokenizer.ts
|
|
13176
|
-
var State = /* @__PURE__ */ function(State) {
|
|
13177
|
-
/**
|
|
13178
|
-
* Initial state.
|
|
13179
|
-
* Expecting any reference for the left part of a range
|
|
13180
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
13181
|
-
*/
|
|
13182
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
13183
|
-
/**
|
|
13184
|
-
* Expecting any reference for the right part of a range
|
|
13185
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
13186
|
-
*/
|
|
13187
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
13188
|
-
/**
|
|
13189
|
-
* Expecting the separator without any constraint on the right part
|
|
13190
|
-
*/
|
|
13191
|
-
State[State["Separator"] = 2] = "Separator";
|
|
13192
|
-
/**
|
|
13193
|
-
* Expecting the separator for a full column range
|
|
13194
|
-
*/
|
|
13195
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
13196
|
-
/**
|
|
13197
|
-
* Expecting the separator for a full row range
|
|
13198
|
-
*/
|
|
13199
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
13200
|
-
/**
|
|
13201
|
-
* Expecting the right part of a full column range
|
|
13202
|
-
* e.g. "1", "A1"
|
|
13203
|
-
*/
|
|
13204
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
13205
|
-
/**
|
|
13206
|
-
* Expecting the right part of a full row range
|
|
13207
|
-
* e.g. "A", "A1"
|
|
13208
|
-
*/
|
|
13209
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
13210
|
-
/**
|
|
13211
|
-
* Final state. A range has been matched
|
|
13212
|
-
*/
|
|
13213
|
-
State[State["Found"] = 7] = "Found";
|
|
13214
|
-
return State;
|
|
13215
|
-
}(State || {});
|
|
13216
13125
|
const goTo = (state, guard = () => true) => [{
|
|
13217
13126
|
goTo: state,
|
|
13218
13127
|
guard
|
|
@@ -13222,41 +13131,41 @@ const goToMulti = (state, guard = () => true) => ({
|
|
|
13222
13131
|
guard
|
|
13223
13132
|
});
|
|
13224
13133
|
const machine = {
|
|
13225
|
-
[
|
|
13226
|
-
REFERENCE: goTo(
|
|
13227
|
-
NUMBER: goTo(
|
|
13228
|
-
SYMBOL: [goToMulti(
|
|
13229
|
-
},
|
|
13230
|
-
[
|
|
13231
|
-
SPACE: goTo(
|
|
13232
|
-
OPERATOR: goTo(
|
|
13233
|
-
},
|
|
13234
|
-
[
|
|
13235
|
-
SPACE: goTo(
|
|
13236
|
-
OPERATOR: goTo(
|
|
13237
|
-
},
|
|
13238
|
-
[
|
|
13239
|
-
SPACE: goTo(
|
|
13240
|
-
OPERATOR: goTo(
|
|
13241
|
-
},
|
|
13242
|
-
[
|
|
13243
|
-
SPACE: goTo(
|
|
13244
|
-
NUMBER: goTo(
|
|
13245
|
-
REFERENCE: goTo(
|
|
13246
|
-
SYMBOL: goTo(
|
|
13247
|
-
},
|
|
13248
|
-
[
|
|
13249
|
-
SPACE: goTo(
|
|
13250
|
-
SYMBOL: goTo(
|
|
13251
|
-
REFERENCE: goTo(
|
|
13252
|
-
},
|
|
13253
|
-
[
|
|
13254
|
-
SPACE: goTo(
|
|
13255
|
-
NUMBER: goTo(
|
|
13256
|
-
REFERENCE: goTo(
|
|
13257
|
-
SYMBOL: goTo(
|
|
13258
|
-
},
|
|
13259
|
-
[
|
|
13134
|
+
[0]: {
|
|
13135
|
+
REFERENCE: goTo(2),
|
|
13136
|
+
NUMBER: goTo(4),
|
|
13137
|
+
SYMBOL: [goToMulti(3, (token) => isColReference(token.value)), goToMulti(4, (token) => isRowReference(token.value))]
|
|
13138
|
+
},
|
|
13139
|
+
[3]: {
|
|
13140
|
+
SPACE: goTo(3),
|
|
13141
|
+
OPERATOR: goTo(5, (token) => token.value === ":")
|
|
13142
|
+
},
|
|
13143
|
+
[4]: {
|
|
13144
|
+
SPACE: goTo(4),
|
|
13145
|
+
OPERATOR: goTo(6, (token) => token.value === ":")
|
|
13146
|
+
},
|
|
13147
|
+
[2]: {
|
|
13148
|
+
SPACE: goTo(2),
|
|
13149
|
+
OPERATOR: goTo(1, (token) => token.value === ":")
|
|
13150
|
+
},
|
|
13151
|
+
[1]: {
|
|
13152
|
+
SPACE: goTo(1),
|
|
13153
|
+
NUMBER: goTo(7),
|
|
13154
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13155
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value) || isRowHeader(token.value))
|
|
13156
|
+
},
|
|
13157
|
+
[5]: {
|
|
13158
|
+
SPACE: goTo(5),
|
|
13159
|
+
SYMBOL: goTo(7, (token) => isColHeader(token.value)),
|
|
13160
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value))
|
|
13161
|
+
},
|
|
13162
|
+
[6]: {
|
|
13163
|
+
SPACE: goTo(6),
|
|
13164
|
+
NUMBER: goTo(7),
|
|
13165
|
+
REFERENCE: goTo(7, (token) => isSingleCellReference(token.value)),
|
|
13166
|
+
SYMBOL: goTo(7, (token) => isRowHeader(token.value))
|
|
13167
|
+
},
|
|
13168
|
+
[7]: {}
|
|
13260
13169
|
};
|
|
13261
13170
|
/**
|
|
13262
13171
|
* Check if the list of tokens starts with a sequence of tokens representing
|
|
@@ -13266,7 +13175,7 @@ const machine = {
|
|
|
13266
13175
|
*/
|
|
13267
13176
|
function matchReference(tokens) {
|
|
13268
13177
|
let head = 0;
|
|
13269
|
-
let transitions = machine[
|
|
13178
|
+
let transitions = machine[0];
|
|
13270
13179
|
let matchedTokens = "";
|
|
13271
13180
|
while (transitions !== void 0) {
|
|
13272
13181
|
const token = tokens[head++];
|
|
@@ -13275,7 +13184,7 @@ function matchReference(tokens) {
|
|
|
13275
13184
|
const nextState = transition ? transition.goTo : void 0;
|
|
13276
13185
|
switch (nextState) {
|
|
13277
13186
|
case void 0: return null;
|
|
13278
|
-
case
|
|
13187
|
+
case 7:
|
|
13279
13188
|
matchedTokens += token.value;
|
|
13280
13189
|
tokens.splice(0, head);
|
|
13281
13190
|
return {
|
|
@@ -13980,10 +13889,10 @@ const PasteInteractiveContent = {
|
|
|
13980
13889
|
};
|
|
13981
13890
|
function handlePasteResult(env, result) {
|
|
13982
13891
|
if (!result.isSuccessful) {
|
|
13983
|
-
if (result.reasons.includes(
|
|
13984
|
-
else if (result.reasons.includes(
|
|
13985
|
-
else if (result.reasons.includes(
|
|
13986
|
-
else if (result.reasons.includes(
|
|
13892
|
+
if (result.reasons.includes("WrongPasteSelection")) env.raiseError(PasteInteractiveContent.wrongPasteSelection);
|
|
13893
|
+
else if (result.reasons.includes("WillRemoveExistingMerge")) env.raiseError(PasteInteractiveContent.willRemoveExistingMerge);
|
|
13894
|
+
else if (result.reasons.includes("WrongFigurePasteOption")) env.raiseError(PasteInteractiveContent.wrongFigurePasteOption);
|
|
13895
|
+
else if (result.reasons.includes("FrozenPaneOverlap")) env.raiseError(PasteInteractiveContent.frozenPaneOverlap);
|
|
13987
13896
|
}
|
|
13988
13897
|
}
|
|
13989
13898
|
function interactivePaste(env, target, pasteOption) {
|
|
@@ -14009,25 +13918,25 @@ function interactivePasteFromOS(env, target, clipboardContent, pasteOption) {
|
|
|
14009
13918
|
//#region src/components/translations_terms.ts
|
|
14010
13919
|
const CfTerms = {
|
|
14011
13920
|
Errors: {
|
|
14012
|
-
[
|
|
14013
|
-
[
|
|
14014
|
-
[
|
|
14015
|
-
[
|
|
14016
|
-
[
|
|
14017
|
-
[
|
|
14018
|
-
[
|
|
14019
|
-
[
|
|
14020
|
-
[
|
|
14021
|
-
[
|
|
14022
|
-
[
|
|
14023
|
-
[
|
|
14024
|
-
[
|
|
14025
|
-
[
|
|
14026
|
-
[
|
|
14027
|
-
[
|
|
14028
|
-
[
|
|
14029
|
-
[
|
|
14030
|
-
[
|
|
13921
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
13922
|
+
["FirstArgMissing"]: _t("The argument is missing. Please provide a value"),
|
|
13923
|
+
["SecondArgMissing"]: _t("The second argument is missing. Please provide a value"),
|
|
13924
|
+
["MinNaN"]: _t("The minpoint must be a number"),
|
|
13925
|
+
["MidNaN"]: _t("The midpoint must be a number"),
|
|
13926
|
+
["MaxNaN"]: _t("The maxpoint must be a number"),
|
|
13927
|
+
["ValueUpperInflectionNaN"]: _t("The first value must be a number"),
|
|
13928
|
+
["ValueLowerInflectionNaN"]: _t("The second value must be a number"),
|
|
13929
|
+
["MinBiggerThanMax"]: _t("Minimum must be smaller then Maximum"),
|
|
13930
|
+
["MinBiggerThanMid"]: _t("Minimum must be smaller then Midpoint"),
|
|
13931
|
+
["MidBiggerThanMax"]: _t("Midpoint must be smaller then Maximum"),
|
|
13932
|
+
["LowerBiggerThanUpper"]: _t("Lower inflection point must be smaller than upper inflection point"),
|
|
13933
|
+
["MinInvalidFormula"]: _t("Invalid Minpoint formula"),
|
|
13934
|
+
["MaxInvalidFormula"]: _t("Invalid Maxpoint formula"),
|
|
13935
|
+
["MidInvalidFormula"]: _t("Invalid Midpoint formula"),
|
|
13936
|
+
["ValueUpperInvalidFormula"]: _t("Invalid upper inflection point formula"),
|
|
13937
|
+
["ValueLowerInvalidFormula"]: _t("Invalid lower inflection point formula"),
|
|
13938
|
+
["EmptyRange"]: _t("A range needs to be defined"),
|
|
13939
|
+
["ValueCellIsInvalidFormula"]: _t("At least one of the provided values is an invalid formula"),
|
|
14031
13940
|
Unexpected: _t("The rule is invalid for an unknown reason")
|
|
14032
13941
|
},
|
|
14033
13942
|
ColorScale: _t("Color scale"),
|
|
@@ -14062,18 +13971,18 @@ const ChartTerms = {
|
|
|
14062
13971
|
AggregatedChart: _t("Aggregate"),
|
|
14063
13972
|
Errors: {
|
|
14064
13973
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
14065
|
-
[
|
|
14066
|
-
[
|
|
14067
|
-
[
|
|
14068
|
-
[
|
|
14069
|
-
[
|
|
14070
|
-
[
|
|
14071
|
-
[
|
|
14072
|
-
[
|
|
14073
|
-
[
|
|
14074
|
-
[
|
|
14075
|
-
[
|
|
14076
|
-
[
|
|
13974
|
+
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
13975
|
+
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
13976
|
+
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
13977
|
+
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
13978
|
+
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
13979
|
+
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
13980
|
+
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
13981
|
+
["EmptyGaugeRangeMax"]: _t("A maximum range limit value is needed"),
|
|
13982
|
+
["GaugeRangeMaxNaN"]: _t("The maximum range limit value must be a number"),
|
|
13983
|
+
["GaugeRangeMinBiggerThanRangeMax"]: _t("Minimum range limit must be smaller than maximum range limit"),
|
|
13984
|
+
["GaugeLowerInflectionPointNaN"]: _t("The lower inflection point value must be a number"),
|
|
13985
|
+
["GaugeUpperInflectionPointNaN"]: _t("The upper inflection point value must be a number")
|
|
14077
13986
|
}
|
|
14078
13987
|
};
|
|
14079
13988
|
const CustomCurrencyTerms = { Custom: _t("Custom") };
|
|
@@ -14081,16 +13990,16 @@ const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerg
|
|
|
14081
13990
|
const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
|
|
14082
13991
|
const SplitToColumnsTerms = { Errors: {
|
|
14083
13992
|
Unexpected: _t("Cannot split the selection for an unknown reason"),
|
|
14084
|
-
[
|
|
14085
|
-
[
|
|
14086
|
-
[
|
|
13993
|
+
["NoSplitSeparatorInSelection"]: _t("There is no match for the selected separator in the selection"),
|
|
13994
|
+
["MoreThanOneColumnSelected"]: _t("Only a selection from a single column can be split"),
|
|
13995
|
+
["SplitWillOverwriteContent"]: _t("Splitting will overwrite existing content")
|
|
14087
13996
|
} };
|
|
14088
13997
|
const RemoveDuplicateTerms = { Errors: {
|
|
14089
13998
|
Unexpected: _t("Cannot remove duplicates for an unknown reason"),
|
|
14090
|
-
[
|
|
14091
|
-
[
|
|
14092
|
-
[
|
|
14093
|
-
[
|
|
13999
|
+
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
14000
|
+
["EmptyTarget"]: _t("Please select a range of cells containing values."),
|
|
14001
|
+
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
14002
|
+
["WillRemoveExistingMerge"]: PasteInteractiveContent.willRemoveExistingMerge
|
|
14094
14003
|
} };
|
|
14095
14004
|
const DVTerms = {
|
|
14096
14005
|
DateIs: {
|
|
@@ -14119,10 +14028,10 @@ const DVTerms = {
|
|
|
14119
14028
|
const TableTerms = {
|
|
14120
14029
|
Errors: {
|
|
14121
14030
|
Unexpected: _t("The table zone is invalid for an unknown reason"),
|
|
14122
|
-
[
|
|
14123
|
-
[
|
|
14124
|
-
[
|
|
14125
|
-
[
|
|
14031
|
+
["TableOverlap"]: _t("You cannot create overlapping tables."),
|
|
14032
|
+
["NonContinuousTargets"]: _t("A table can only be created on a continuous selection."),
|
|
14033
|
+
["InvalidRange"]: _t("The range is invalid"),
|
|
14034
|
+
["TargetOutOfSheet"]: _t("The range is out of the sheet")
|
|
14126
14035
|
},
|
|
14127
14036
|
Checkboxes: {
|
|
14128
14037
|
hasFilters: _t("Filter button"),
|
|
@@ -14566,7 +14475,7 @@ var AbstractChart = class {
|
|
|
14566
14475
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
14567
14476
|
function getBaselineText(baseline, keyValue, baselineMode, humanize, locale) {
|
|
14568
14477
|
if (!baseline) return "";
|
|
14569
|
-
else if (baselineMode === "text" || keyValue?.type !==
|
|
14478
|
+
else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
|
|
14570
14479
|
if (humanize) return humanizeNumber(baseline, locale);
|
|
14571
14480
|
return baseline.formattedValue;
|
|
14572
14481
|
}
|
|
@@ -14595,23 +14504,23 @@ function getKeyValueText(keyValueCell, humanize, locale) {
|
|
|
14595
14504
|
return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
|
|
14596
14505
|
}
|
|
14597
14506
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
14598
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !==
|
|
14507
|
+
if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
|
|
14599
14508
|
const diff = keyValue.value - baseline.value;
|
|
14600
14509
|
if (diff > 0) return colorUp;
|
|
14601
14510
|
else if (diff < 0) return colorDown;
|
|
14602
14511
|
}
|
|
14603
14512
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
14604
|
-
if (baselineMode === "text" || baseline?.type !==
|
|
14513
|
+
if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
|
|
14605
14514
|
const diff = keyValue.value - baseline.value;
|
|
14606
14515
|
if (diff > 0) return "up";
|
|
14607
14516
|
else if (diff < 0) return "down";
|
|
14608
14517
|
return "neutral";
|
|
14609
14518
|
}
|
|
14610
14519
|
function checkKeyValue(definition) {
|
|
14611
|
-
return definition.keyValue && !rangeReference.test(definition.keyValue) ?
|
|
14520
|
+
return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
|
|
14612
14521
|
}
|
|
14613
14522
|
function checkBaseline(definition) {
|
|
14614
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ?
|
|
14523
|
+
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
14615
14524
|
}
|
|
14616
14525
|
const arrowDownPath = new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
|
|
14617
14526
|
const arrowUpPath = new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");
|
|
@@ -14841,6 +14750,7 @@ function getScorecardConfiguration({ width, height }, runtime) {
|
|
|
14841
14750
|
}, runtime).computeDesign();
|
|
14842
14751
|
}
|
|
14843
14752
|
var ScorecardChartConfigBuilder = class {
|
|
14753
|
+
runtime;
|
|
14844
14754
|
context;
|
|
14845
14755
|
width;
|
|
14846
14756
|
height;
|
|
@@ -15321,7 +15231,8 @@ var ChartJsComponent = class extends _odoo_owl.Component {
|
|
|
15321
15231
|
}
|
|
15322
15232
|
createChart(chartData) {
|
|
15323
15233
|
const ctx = this.canvas.el.getContext("2d");
|
|
15324
|
-
|
|
15234
|
+
const Chart = getChartJSConstructor();
|
|
15235
|
+
this.chart = new Chart(ctx, chartData);
|
|
15325
15236
|
}
|
|
15326
15237
|
updateChartJs(chartRuntime) {
|
|
15327
15238
|
const chartData = chartRuntime.chartJsConfig;
|
|
@@ -17908,15 +17819,15 @@ const DATEDIF = {
|
|
|
17908
17819
|
const jsEndDate = numberToJsDate(_endDate);
|
|
17909
17820
|
assert(() => _endDate >= _startDate, _t("start_date (%s) should be on or before end_date (%s).", jsStartDate.toLocaleDateString(), jsEndDate.toLocaleDateString()));
|
|
17910
17821
|
switch (_unit) {
|
|
17911
|
-
case
|
|
17912
|
-
case
|
|
17913
|
-
case
|
|
17914
|
-
case
|
|
17915
|
-
case
|
|
17822
|
+
case "Y": return getTimeDifferenceInWholeYears(jsStartDate, jsEndDate);
|
|
17823
|
+
case "M": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate);
|
|
17824
|
+
case "D": return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17825
|
+
case "YM": return getTimeDifferenceInWholeMonths(jsStartDate, jsEndDate) - getTimeDifferenceInWholeYears(jsStartDate, jsEndDate) * 12;
|
|
17826
|
+
case "MD":
|
|
17916
17827
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
17917
17828
|
if (days < 0) days = getDaysInMonth(new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1)) - Math.abs(days);
|
|
17918
17829
|
return days;
|
|
17919
|
-
case
|
|
17830
|
+
case "YD": {
|
|
17920
17831
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
17921
17832
|
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
17922
17833
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
@@ -18412,18 +18323,18 @@ const DELTA = {
|
|
|
18412
18323
|
//#endregion
|
|
18413
18324
|
//#region src/helpers/sort.ts
|
|
18414
18325
|
const SORT_TYPES = [
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18326
|
+
"number",
|
|
18327
|
+
"error",
|
|
18328
|
+
"text",
|
|
18329
|
+
"boolean"
|
|
18419
18330
|
];
|
|
18420
18331
|
function cellsSortingCriterion(sortingOrder) {
|
|
18421
18332
|
const inverse = sortingOrder === "ascending" ? 1 : -1;
|
|
18422
18333
|
return (left, right) => {
|
|
18423
|
-
if (left.type ===
|
|
18424
|
-
else if (right.type ===
|
|
18334
|
+
if (left.type === "empty") return right.type === "empty" ? 0 : 1;
|
|
18335
|
+
else if (right.type === "empty") return -1;
|
|
18425
18336
|
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
18426
|
-
if (typeOrder === 0) if (left.type ===
|
|
18337
|
+
if (typeOrder === 0) if (left.type === "text" || left.type === "error") typeOrder = left.value.localeCompare(right.value);
|
|
18427
18338
|
else typeOrder = left.value - right.value;
|
|
18428
18339
|
return inverse * typeOrder;
|
|
18429
18340
|
};
|
|
@@ -18434,9 +18345,9 @@ function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
|
18434
18345
|
type: cell.type,
|
|
18435
18346
|
value: cell.value
|
|
18436
18347
|
}));
|
|
18437
|
-
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type ===
|
|
18348
|
+
return (emptyCellAsZero ? cellsWithIndex.map((cell) => cell.type === "empty" ? {
|
|
18438
18349
|
...cell,
|
|
18439
|
-
type:
|
|
18350
|
+
type: "number",
|
|
18440
18351
|
value: 0
|
|
18441
18352
|
} : cell) : cellsWithIndex).sort(cellsSortingCriterion(sortDirection));
|
|
18442
18353
|
}
|
|
@@ -18498,7 +18409,7 @@ function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
|
18498
18409
|
});
|
|
18499
18410
|
});
|
|
18500
18411
|
}
|
|
18501
|
-
if (result.isCancelledBecause(
|
|
18412
|
+
if (result.isCancelledBecause("InvalidSortZone")) {
|
|
18502
18413
|
const { col, row } = anchor;
|
|
18503
18414
|
env.model.selection.selectZone({
|
|
18504
18415
|
cell: {
|
|
@@ -18551,11 +18462,11 @@ function sortMatrix(matrix, locale, ...criteria) {
|
|
|
18551
18462
|
const right = sortColumn[b];
|
|
18552
18463
|
const leftCell = {
|
|
18553
18464
|
value: left,
|
|
18554
|
-
type: left === null ?
|
|
18465
|
+
type: left === null ? "empty" : typeof left === "string" ? "text" : typeof left
|
|
18555
18466
|
};
|
|
18556
18467
|
const rightCell = {
|
|
18557
18468
|
value: right,
|
|
18558
|
-
type: right === null ?
|
|
18469
|
+
type: right === null ? "empty" : typeof right === "string" ? "text" : typeof right
|
|
18559
18470
|
};
|
|
18560
18471
|
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
18561
18472
|
if (result !== 0) return result;
|
|
@@ -20969,8 +20880,8 @@ const CELL = {
|
|
|
20969
20880
|
row: range.zone.top
|
|
20970
20881
|
};
|
|
20971
20882
|
const type = this.getters.getEvaluatedCell(position).type;
|
|
20972
|
-
if (type ===
|
|
20973
|
-
else if (type ===
|
|
20883
|
+
if (type === "empty") return "b";
|
|
20884
|
+
else if (type === "text") return "l";
|
|
20974
20885
|
else return "v";
|
|
20975
20886
|
}
|
|
20976
20887
|
}
|
|
@@ -24174,6 +24085,7 @@ var Composer = class extends _odoo_owl.Component {
|
|
|
24174
24085
|
//#endregion
|
|
24175
24086
|
//#region src/formulas/code_builder.ts
|
|
24176
24087
|
var FunctionCodeBuilder = class {
|
|
24088
|
+
scope;
|
|
24177
24089
|
code = "";
|
|
24178
24090
|
constructor(scope = new Scope()) {
|
|
24179
24091
|
this.scope = scope;
|
|
@@ -24189,6 +24101,8 @@ var FunctionCodeBuilder = class {
|
|
|
24189
24101
|
}
|
|
24190
24102
|
};
|
|
24191
24103
|
var FunctionCodeImpl = class {
|
|
24104
|
+
scope;
|
|
24105
|
+
returnExpression;
|
|
24192
24106
|
code;
|
|
24193
24107
|
constructor(scope, code, returnExpression) {
|
|
24194
24108
|
this.scope = scope;
|
|
@@ -24564,6 +24478,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
|
|
|
24564
24478
|
function getFirstPivotFunction(tokens) {
|
|
24565
24479
|
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
|
|
24566
24480
|
}
|
|
24481
|
+
function getPivotFunctions(tokens) {
|
|
24482
|
+
return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
|
|
24483
|
+
}
|
|
24567
24484
|
/**
|
|
24568
24485
|
* Parse a spreadsheet formula and detect the number of PIVOT functions that are
|
|
24569
24486
|
* present in the given formula.
|
|
@@ -24935,19 +24852,19 @@ autofillModifiersRegistry.add("ALPHANUMERIC_INCREMENT_MODIFIER", { apply: (rule,
|
|
|
24935
24852
|
let x = 0;
|
|
24936
24853
|
let y = 0;
|
|
24937
24854
|
switch (direction) {
|
|
24938
|
-
case
|
|
24855
|
+
case "up":
|
|
24939
24856
|
x = 0;
|
|
24940
24857
|
y = -rule.current;
|
|
24941
24858
|
break;
|
|
24942
|
-
case
|
|
24859
|
+
case "down":
|
|
24943
24860
|
x = 0;
|
|
24944
24861
|
y = rule.current;
|
|
24945
24862
|
break;
|
|
24946
|
-
case
|
|
24863
|
+
case "left":
|
|
24947
24864
|
x = -rule.current;
|
|
24948
24865
|
y = 0;
|
|
24949
24866
|
break;
|
|
24950
|
-
case
|
|
24867
|
+
case "right":
|
|
24951
24868
|
x = rule.current;
|
|
24952
24869
|
y = 0;
|
|
24953
24870
|
break;
|
|
@@ -25073,12 +24990,12 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25073
24990
|
},
|
|
25074
24991
|
sequence: 10
|
|
25075
24992
|
}).add("increment_alphanumeric_value", {
|
|
25076
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
24993
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text" && alphaNumericValueRegExp.test(cell.content),
|
|
25077
24994
|
generateRule: (cell, cells, direction) => {
|
|
25078
24995
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
25079
24996
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
25080
24997
|
const numberPostfixLength = cell.content.length - prefix.length;
|
|
25081
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
24998
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "text" && alphaNumericValueRegExp.test(evaluatedCell.value)).filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0]).map((cell) => parseInt((cell.value ?? "").toString().match(numberPostfixRegExp)[0]));
|
|
25082
24999
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25083
25000
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25084
25001
|
return {
|
|
@@ -25091,7 +25008,7 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25091
25008
|
},
|
|
25092
25009
|
sequence: 15
|
|
25093
25010
|
}).add("copy_text", {
|
|
25094
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25011
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "text",
|
|
25095
25012
|
generateRule: () => {
|
|
25096
25013
|
return { type: "COPY_MODIFIER" };
|
|
25097
25014
|
},
|
|
@@ -25108,10 +25025,10 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25108
25025
|
sequence: 30
|
|
25109
25026
|
}).add("increment_dates", {
|
|
25110
25027
|
condition: (cell, cells) => {
|
|
25111
|
-
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25028
|
+
return !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number" && !!cell.format && isDateTimeFormat(cell.format);
|
|
25112
25029
|
},
|
|
25113
25030
|
generateRule: (cell, cells) => {
|
|
25114
|
-
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25031
|
+
const increment = calculateDateIncrementBasedOnGroup(getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !!evaluatedCell.format && isDateTimeFormat(evaluatedCell.format)).map((cell) => Number(cell.value)));
|
|
25115
25032
|
if (increment === void 0) return { type: "COPY_MODIFIER" };
|
|
25116
25033
|
/** requires to detect the current date (requires to be an integer value with the right format)
|
|
25117
25034
|
* detect if year or if month or if day then extrapolate increment required (+1 month, +1 year + 1 day)
|
|
@@ -25120,26 +25037,26 @@ autofillRulesRegistry.add("simple_value_copy", {
|
|
|
25120
25037
|
if (typeof increment === "object") return {
|
|
25121
25038
|
type: "DATE_INCREMENT_MODIFIER",
|
|
25122
25039
|
increment,
|
|
25123
|
-
current: evaluation.type ===
|
|
25040
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25124
25041
|
};
|
|
25125
25042
|
return {
|
|
25126
25043
|
type: "INCREMENT_MODIFIER",
|
|
25127
25044
|
increment,
|
|
25128
|
-
current: evaluation.type ===
|
|
25045
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25129
25046
|
};
|
|
25130
25047
|
},
|
|
25131
25048
|
sequence: 25
|
|
25132
25049
|
}).add("increment_number", {
|
|
25133
|
-
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type ===
|
|
25050
|
+
condition: (cell) => !cell.isFormula && evaluateLiteral(cell, { locale: DEFAULT_LOCALE }).type === "number",
|
|
25134
25051
|
generateRule: (cell, cells, direction) => {
|
|
25135
|
-
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type ===
|
|
25052
|
+
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === "number" && !isDateTimeFormat(evaluatedCell.format || "")).map((cell) => Number(cell.value));
|
|
25136
25053
|
let increment = calculateIncrementBasedOnGroup(group);
|
|
25137
25054
|
if (["up", "left"].includes(direction) && group.length === 1) increment = -increment;
|
|
25138
25055
|
const evaluation = evaluateLiteral(cell, { locale: DEFAULT_LOCALE });
|
|
25139
25056
|
return {
|
|
25140
25057
|
type: "INCREMENT_MODIFIER",
|
|
25141
25058
|
increment,
|
|
25142
|
-
current: evaluation.type ===
|
|
25059
|
+
current: evaluation.type === "number" ? evaluation.value : 0
|
|
25143
25060
|
};
|
|
25144
25061
|
},
|
|
25145
25062
|
sequence: 40
|
|
@@ -26043,47 +25960,47 @@ function createComboChartRuntime(chart, getters) {
|
|
|
26043
25960
|
//#endregion
|
|
26044
25961
|
//#region src/helpers/figures/charts/gauge_chart.ts
|
|
26045
25962
|
function isDataRangeValid(definition) {
|
|
26046
|
-
return definition.dataRange && !rangeReference.test(definition.dataRange) ?
|
|
25963
|
+
return definition.dataRange && !rangeReference.test(definition.dataRange) ? "InvalidGaugeDataRange" : "Success";
|
|
26047
25964
|
}
|
|
26048
25965
|
function checkRangeLimits(check, batchValidations) {
|
|
26049
25966
|
return batchValidations((definition) => {
|
|
26050
25967
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMin, "rangeMin");
|
|
26051
|
-
return
|
|
25968
|
+
return "Success";
|
|
26052
25969
|
}, (definition) => {
|
|
26053
25970
|
if (definition.sectionRule) return check(definition.sectionRule.rangeMax, "rangeMax");
|
|
26054
|
-
return
|
|
25971
|
+
return "Success";
|
|
26055
25972
|
});
|
|
26056
25973
|
}
|
|
26057
25974
|
function checkInflectionPointsValue(check, batchValidations) {
|
|
26058
25975
|
return batchValidations((definition) => {
|
|
26059
25976
|
if (definition.sectionRule) return check(definition.sectionRule.lowerInflectionPoint.value, "lowerInflectionPointValue");
|
|
26060
|
-
return
|
|
25977
|
+
return "Success";
|
|
26061
25978
|
}, (definition) => {
|
|
26062
25979
|
if (definition.sectionRule) return check(definition.sectionRule.upperInflectionPoint.value, "upperInflectionPointValue");
|
|
26063
|
-
return
|
|
25980
|
+
return "Success";
|
|
26064
25981
|
});
|
|
26065
25982
|
}
|
|
26066
25983
|
function checkRangeMinBiggerThanRangeMax(definition) {
|
|
26067
25984
|
if (definition.sectionRule) {
|
|
26068
|
-
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return
|
|
25985
|
+
if (Number(definition.sectionRule.rangeMin) >= Number(definition.sectionRule.rangeMax)) return "GaugeRangeMinBiggerThanRangeMax";
|
|
26069
25986
|
}
|
|
26070
|
-
return
|
|
25987
|
+
return "Success";
|
|
26071
25988
|
}
|
|
26072
25989
|
function checkEmpty(value, valueName) {
|
|
26073
25990
|
if (value === "") switch (valueName) {
|
|
26074
|
-
case "rangeMin": return
|
|
26075
|
-
case "rangeMax": return
|
|
25991
|
+
case "rangeMin": return "EmptyGaugeRangeMin";
|
|
25992
|
+
case "rangeMax": return "EmptyGaugeRangeMax";
|
|
26076
25993
|
}
|
|
26077
|
-
return
|
|
25994
|
+
return "Success";
|
|
26078
25995
|
}
|
|
26079
25996
|
function checkNaN(value, valueName) {
|
|
26080
25997
|
if (isNaN(value)) switch (valueName) {
|
|
26081
|
-
case "rangeMin": return
|
|
26082
|
-
case "rangeMax": return
|
|
26083
|
-
case "lowerInflectionPointValue": return
|
|
26084
|
-
case "upperInflectionPointValue": return
|
|
25998
|
+
case "rangeMin": return "GaugeRangeMinNaN";
|
|
25999
|
+
case "rangeMax": return "GaugeRangeMaxNaN";
|
|
26000
|
+
case "lowerInflectionPointValue": return "GaugeLowerInflectionPointNaN";
|
|
26001
|
+
case "upperInflectionPointValue": return "GaugeUpperInflectionPointNaN";
|
|
26085
26002
|
}
|
|
26086
|
-
return
|
|
26003
|
+
return "Success";
|
|
26087
26004
|
}
|
|
26088
26005
|
var GaugeChart = class GaugeChart extends AbstractChart {
|
|
26089
26006
|
dataRange;
|
|
@@ -26179,7 +26096,7 @@ function createGaugeChartRuntime(chart, getters) {
|
|
|
26179
26096
|
col: dataRange.zone.left,
|
|
26180
26097
|
row: dataRange.zone.top
|
|
26181
26098
|
});
|
|
26182
|
-
if (cell.type ===
|
|
26099
|
+
if (cell.type === "number") {
|
|
26183
26100
|
gaugeValue = cell.value;
|
|
26184
26101
|
formattedValue = cell.formattedValue;
|
|
26185
26102
|
format = cell.format;
|
|
@@ -27688,7 +27605,7 @@ var MenuItemRegistry = class extends Registry {
|
|
|
27688
27605
|
function interactiveCut(env) {
|
|
27689
27606
|
const result = env.model.dispatch("CUT");
|
|
27690
27607
|
if (!result.isSuccessful) {
|
|
27691
|
-
if (result.isCancelledBecause(
|
|
27608
|
+
if (result.isCancelledBecause("WrongCutSelection")) env.raiseError(_t("This operation is not allowed with multiple selections."));
|
|
27692
27609
|
}
|
|
27693
27610
|
}
|
|
27694
27611
|
|
|
@@ -27703,8 +27620,8 @@ function interactiveAddMerge(env, sheetId, target) {
|
|
|
27703
27620
|
sheetId,
|
|
27704
27621
|
target
|
|
27705
27622
|
});
|
|
27706
|
-
if (result.isCancelledBecause(
|
|
27707
|
-
else if (result.isCancelledBecause(
|
|
27623
|
+
if (result.isCancelledBecause("MergeInTable")) env.raiseError(AddMergeInteractiveContent.MergeInFilter);
|
|
27624
|
+
else if (result.isCancelledBecause("MergeIsDestructive")) env.askConfirmation(AddMergeInteractiveContent.MergeIsDestructive, () => {
|
|
27708
27625
|
env.model.dispatch("ADD_MERGE", {
|
|
27709
27626
|
sheetId,
|
|
27710
27627
|
target,
|
|
@@ -27745,7 +27662,7 @@ var ErrorToolTip = class extends _odoo_owl.Component {
|
|
|
27745
27662
|
const ErrorToolTipPopoverBuilder = { onHover: (position, getters) => {
|
|
27746
27663
|
const cell = getters.getEvaluatedCell(position);
|
|
27747
27664
|
const errors = [];
|
|
27748
|
-
if (cell.type ===
|
|
27665
|
+
if (cell.type === "error" && !!cell.message) errors.push({
|
|
27749
27666
|
title: _t("Error"),
|
|
27750
27667
|
message: cell.message
|
|
27751
27668
|
});
|
|
@@ -28454,7 +28371,7 @@ function zoneToRect(zone) {
|
|
|
28454
28371
|
css`
|
|
28455
28372
|
.o-popover {
|
|
28456
28373
|
position: absolute;
|
|
28457
|
-
z-index: ${
|
|
28374
|
+
z-index: ${35};
|
|
28458
28375
|
overflow: auto;
|
|
28459
28376
|
box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);
|
|
28460
28377
|
width: fit-content;
|
|
@@ -28509,7 +28426,7 @@ var Popover = class extends _odoo_owl.Component {
|
|
|
28509
28426
|
onMouseWheel: () => {},
|
|
28510
28427
|
onPopoverMoved: () => {},
|
|
28511
28428
|
onPopoverHidden: () => {},
|
|
28512
|
-
zIndex:
|
|
28429
|
+
zIndex: 35
|
|
28513
28430
|
};
|
|
28514
28431
|
popoverRef = (0, _odoo_owl.useRef)("popover");
|
|
28515
28432
|
currentPosition = void 0;
|
|
@@ -28555,6 +28472,10 @@ var Popover = class extends _odoo_owl.Component {
|
|
|
28555
28472
|
}
|
|
28556
28473
|
};
|
|
28557
28474
|
var PopoverPositionContext = class {
|
|
28475
|
+
anchorRect;
|
|
28476
|
+
containerRect;
|
|
28477
|
+
propsMaxSize;
|
|
28478
|
+
spreadsheetOffset;
|
|
28558
28479
|
constructor(anchorRect, containerRect, propsMaxSize, spreadsheetOffset) {
|
|
28559
28480
|
this.anchorRect = anchorRect;
|
|
28560
28481
|
this.containerRect = containerRect;
|
|
@@ -29129,7 +29050,7 @@ function getSmartChartDefinition(zone, getters) {
|
|
|
29129
29050
|
const dataSetsHaveTitle = !!getters.getEvaluatedCellsInZone(sheetId, {
|
|
29130
29051
|
...dataSetZone,
|
|
29131
29052
|
bottom: dataSetZone.top
|
|
29132
|
-
}).find((cell) => cell.type !==
|
|
29053
|
+
}).find((cell) => cell.type !== "empty" && cell.type !== "number");
|
|
29133
29054
|
let labelRangeXc;
|
|
29134
29055
|
if (!singleColumn) labelRangeXc = zoneToXc({
|
|
29135
29056
|
...zone,
|
|
@@ -29192,8 +29113,8 @@ function interactiveCreateTable(env, sheetId, tableConfig) {
|
|
|
29192
29113
|
config: tableConfig,
|
|
29193
29114
|
tableType: isDynamic ? "dynamic" : "static"
|
|
29194
29115
|
});
|
|
29195
|
-
if (result.isCancelledBecause(
|
|
29196
|
-
else if (result.isCancelledBecause(
|
|
29116
|
+
if (result.isCancelledBecause("TableOverlap")) env.raiseError(TableTerms.Errors.TableOverlap);
|
|
29117
|
+
else if (result.isCancelledBecause("NonContinuousTargets")) env.raiseError(TableTerms.Errors.NonContinuousTargets);
|
|
29197
29118
|
return result;
|
|
29198
29119
|
}
|
|
29199
29120
|
|
|
@@ -29224,7 +29145,7 @@ async function paste$1(env, pasteOption) {
|
|
|
29224
29145
|
const target = env.model.getters.getSelectedZones();
|
|
29225
29146
|
if (env.model.getters.getClipboardId() !== clipboardId) interactivePasteFromOS(env, target, clipboardContent, pasteOption);
|
|
29226
29147
|
else interactivePaste(env, target, pasteOption);
|
|
29227
|
-
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ [
|
|
29148
|
+
if (env.model.getters.isCutOperation() && pasteOption !== "asValue") await env.clipboard.write({ ["text/plain"]: "" });
|
|
29228
29149
|
break;
|
|
29229
29150
|
case "notImplemented":
|
|
29230
29151
|
env.raiseError(_t("Pasting from the context menu is not supported in this browser. Use keyboard shortcuts ctrl+c / ctrl+v instead."));
|
|
@@ -30164,7 +30085,7 @@ const FIX_FORMULAS = {
|
|
|
30164
30085
|
if (!pivotId) return false;
|
|
30165
30086
|
const pivot = env.model.getters.getPivot(pivotId);
|
|
30166
30087
|
const cell = env.model.getters.getEvaluatedCell(position);
|
|
30167
|
-
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !==
|
|
30088
|
+
return pivot.isValid() && env.model.getters.isSpillPivotFormula(position) && cell.type !== "error";
|
|
30168
30089
|
},
|
|
30169
30090
|
icon: "o-spreadsheet-Icon.PIVOT"
|
|
30170
30091
|
};
|
|
@@ -30749,7 +30670,7 @@ function interactiveFreezeColumnsRows(env, dimension, base) {
|
|
|
30749
30670
|
if (env.model.dispatch(cmd, {
|
|
30750
30671
|
sheetId,
|
|
30751
30672
|
quantity: base
|
|
30752
|
-
}).isCancelledBecause(
|
|
30673
|
+
}).isCancelledBecause("MergeOverlap")) env.raiseError(MergeErrorMessage);
|
|
30753
30674
|
}
|
|
30754
30675
|
|
|
30755
30676
|
//#endregion
|
|
@@ -31275,7 +31196,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
|
|
|
31275
31196
|
col,
|
|
31276
31197
|
row
|
|
31277
31198
|
};
|
|
31278
|
-
if (
|
|
31199
|
+
if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
|
|
31279
31200
|
}
|
|
31280
31201
|
return positions;
|
|
31281
31202
|
}
|
|
@@ -31841,6 +31762,9 @@ var FocusStore = class {
|
|
|
31841
31762
|
* This plugin handles this internal state.
|
|
31842
31763
|
*/
|
|
31843
31764
|
var SelectionInputStore = class extends SpreadsheetStore {
|
|
31765
|
+
initialRanges;
|
|
31766
|
+
inputHasSingleRange;
|
|
31767
|
+
colors;
|
|
31844
31768
|
mutators = [
|
|
31845
31769
|
"resetWithRanges",
|
|
31846
31770
|
"focusById",
|
|
@@ -32437,10 +32361,10 @@ var GenericChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
32437
32361
|
return [...this.state.datasetDispatchResult?.reasons || [], ...this.state.labelsDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
32438
32362
|
}
|
|
32439
32363
|
get isDatasetInvalid() {
|
|
32440
|
-
return !!this.state.datasetDispatchResult?.isCancelledBecause(
|
|
32364
|
+
return !!this.state.datasetDispatchResult?.isCancelledBecause("InvalidDataSet");
|
|
32441
32365
|
}
|
|
32442
32366
|
get isLabelInvalid() {
|
|
32443
|
-
return !!this.state.labelsDispatchResult?.isCancelledBecause(
|
|
32367
|
+
return !!this.state.labelsDispatchResult?.isCancelledBecause("InvalidLabelRange");
|
|
32444
32368
|
}
|
|
32445
32369
|
get dataSetsHaveTitleLabel() {
|
|
32446
32370
|
return _t("Use row %s as headers", this.calculateHeaderPosition() || "");
|
|
@@ -33777,7 +33701,7 @@ var GaugeChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
33777
33701
|
return [...this.state.dataRangeDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33778
33702
|
}
|
|
33779
33703
|
get isDataRangeInvalid() {
|
|
33780
|
-
return !!this.state.dataRangeDispatchResult?.isCancelledBecause(
|
|
33704
|
+
return !!this.state.dataRangeDispatchResult?.isCancelledBecause("InvalidGaugeDataRange");
|
|
33781
33705
|
}
|
|
33782
33706
|
onDataRangeChanged(ranges) {
|
|
33783
33707
|
this.dataRange = ranges[0];
|
|
@@ -33863,16 +33787,16 @@ var GaugeChartDesignPanel = class extends _odoo_owl.Component {
|
|
|
33863
33787
|
return [...this.state.sectionRuleDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33864
33788
|
}
|
|
33865
33789
|
isRangeMinInvalid() {
|
|
33866
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33790
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
33867
33791
|
}
|
|
33868
33792
|
isRangeMaxInvalid() {
|
|
33869
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33793
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMax") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMaxNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinBiggerThanRangeMax"));
|
|
33870
33794
|
}
|
|
33871
33795
|
get isLowerInflectionPointInvalid() {
|
|
33872
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33796
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
33873
33797
|
}
|
|
33874
33798
|
get isUpperInflectionPointInvalid() {
|
|
33875
|
-
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause(
|
|
33799
|
+
return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeUpperInflectionPointNaN") || this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeLowerBiggerThanUpper"));
|
|
33876
33800
|
}
|
|
33877
33801
|
updateSectionColor(target, color) {
|
|
33878
33802
|
const sectionRule = deepCopy(this.state.sectionRule);
|
|
@@ -33996,10 +33920,10 @@ var ScorecardChartConfigPanel = class extends _odoo_owl.Component {
|
|
|
33996
33920
|
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
33997
33921
|
}
|
|
33998
33922
|
get isKeyValueInvalid() {
|
|
33999
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33923
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
|
|
34000
33924
|
}
|
|
34001
33925
|
get isBaselineInvalid() {
|
|
34002
|
-
return !!this.state.keyValueDispatchResult?.isCancelledBecause(
|
|
33926
|
+
return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
34003
33927
|
}
|
|
34004
33928
|
onKeyValueRangeChanged(ranges) {
|
|
34005
33929
|
this.keyValue = ranges[0];
|
|
@@ -34888,6 +34812,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
34888
34812
|
//#endregion
|
|
34889
34813
|
//#region src/components/composer/standalone_composer/standalone_composer_store.ts
|
|
34890
34814
|
var StandaloneComposerStore = class extends AbstractComposerStore {
|
|
34815
|
+
args;
|
|
34891
34816
|
constructor(get, args) {
|
|
34892
34817
|
super(get);
|
|
34893
34818
|
this.args = args;
|
|
@@ -35025,7 +34950,7 @@ var StandaloneComposer = class extends _odoo_owl.Component {
|
|
|
35025
34950
|
css`
|
|
35026
34951
|
.o-icon-picker {
|
|
35027
34952
|
position: absolute;
|
|
35028
|
-
z-index: ${
|
|
34953
|
+
z-index: ${25};
|
|
35029
34954
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
35030
34955
|
background-color: white;
|
|
35031
34956
|
padding: 2px 1px;
|
|
@@ -35277,6 +35202,7 @@ var DOMDndHelper = class {
|
|
|
35277
35202
|
}
|
|
35278
35203
|
};
|
|
35279
35204
|
var ContainerWrapper = class {
|
|
35205
|
+
el;
|
|
35280
35206
|
constructor(el) {
|
|
35281
35207
|
this.el = el;
|
|
35282
35208
|
}
|
|
@@ -35656,11 +35582,12 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
35656
35582
|
colorNumberString = colorNumberString;
|
|
35657
35583
|
state;
|
|
35658
35584
|
setup() {
|
|
35585
|
+
const cf = this.props.editedCf || {
|
|
35586
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
35587
|
+
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
35588
|
+
};
|
|
35659
35589
|
this.state = (0, _odoo_owl.useState)({
|
|
35660
|
-
currentCF:
|
|
35661
|
-
id: this.env.model.uuidGenerator.smallUuid(),
|
|
35662
|
-
ranges: this.env.model.getters.getSelectedZones().map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone))
|
|
35663
|
-
},
|
|
35590
|
+
currentCF: cf,
|
|
35664
35591
|
currentCFType: this.props.editedCf?.rule.type || "CellIsRule",
|
|
35665
35592
|
errors: [],
|
|
35666
35593
|
rules: this.getDefaultRules()
|
|
@@ -35682,7 +35609,7 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
35682
35609
|
(0, _odoo_owl.useExternalListener)(window, "click", this.closeMenus);
|
|
35683
35610
|
}
|
|
35684
35611
|
get isRangeValid() {
|
|
35685
|
-
return this.state.errors.includes(
|
|
35612
|
+
return this.state.errors.includes("EmptyRange");
|
|
35686
35613
|
}
|
|
35687
35614
|
get errorMessages() {
|
|
35688
35615
|
return this.state.errors.map((error) => CfTerms.Errors[error] || CfTerms.Errors.Unexpected);
|
|
@@ -35710,7 +35637,7 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
35710
35637
|
saveConditionalFormat() {
|
|
35711
35638
|
if (this.state.currentCF) {
|
|
35712
35639
|
if (this.state.currentCF.ranges.some((xc) => !xc.match(rangeReference))) {
|
|
35713
|
-
this.state.errors = [
|
|
35640
|
+
this.state.errors = ["InvalidRange"];
|
|
35714
35641
|
return;
|
|
35715
35642
|
}
|
|
35716
35643
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
@@ -35805,10 +35732,10 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
35805
35732
|
* Cell Is Rule
|
|
35806
35733
|
****************************************************************************/
|
|
35807
35734
|
get isValue1Invalid() {
|
|
35808
|
-
return this.state.errors.includes(
|
|
35735
|
+
return this.state.errors.includes("FirstArgMissing") || this.state.errors.includes("ValueCellIsInvalidFormula");
|
|
35809
35736
|
}
|
|
35810
35737
|
get isValue2Invalid() {
|
|
35811
|
-
return this.state.errors.includes(
|
|
35738
|
+
return this.state.errors.includes("SecondArgMissing");
|
|
35812
35739
|
}
|
|
35813
35740
|
toggleStyle(tool) {
|
|
35814
35741
|
const style = this.state.rules.cellIs.style;
|
|
@@ -35837,9 +35764,9 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
35837
35764
|
****************************************************************************/
|
|
35838
35765
|
isValueInvalid(threshold) {
|
|
35839
35766
|
switch (threshold) {
|
|
35840
|
-
case "minimum": return this.state.errors.includes(
|
|
35841
|
-
case "midpoint": return this.state.errors.includes(
|
|
35842
|
-
case "maximum": return this.state.errors.includes(
|
|
35767
|
+
case "minimum": return this.state.errors.includes("MinInvalidFormula") || this.state.errors.includes("MinBiggerThanMid") || this.state.errors.includes("MinBiggerThanMax") || this.state.errors.includes("MinNaN");
|
|
35768
|
+
case "midpoint": return this.state.errors.includes("MidInvalidFormula") || this.state.errors.includes("MidNaN") || this.state.errors.includes("MidBiggerThanMax");
|
|
35769
|
+
case "maximum": return this.state.errors.includes("MaxInvalidFormula") || this.state.errors.includes("MaxNaN");
|
|
35843
35770
|
default: return false;
|
|
35844
35771
|
}
|
|
35845
35772
|
}
|
|
@@ -35876,8 +35803,8 @@ var ConditionalFormattingEditor = class extends _odoo_owl.Component {
|
|
|
35876
35803
|
****************************************************************************/
|
|
35877
35804
|
isInflectionPointInvalid(inflectionPoint) {
|
|
35878
35805
|
switch (inflectionPoint) {
|
|
35879
|
-
case "lowerInflectionPoint": return this.state.errors.includes(
|
|
35880
|
-
case "upperInflectionPoint": return this.state.errors.includes(
|
|
35806
|
+
case "lowerInflectionPoint": return this.state.errors.includes("ValueLowerInflectionNaN") || this.state.errors.includes("ValueLowerInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
35807
|
+
case "upperInflectionPoint": return this.state.errors.includes("ValueUpperInflectionNaN") || this.state.errors.includes("ValueUpperInvalidFormula") || this.state.errors.includes("LowerBiggerThanUpper");
|
|
35881
35808
|
default: return true;
|
|
35882
35809
|
}
|
|
35883
35810
|
}
|
|
@@ -36124,13 +36051,14 @@ var CustomCurrencyPanel = class extends _odoo_owl.Component {
|
|
|
36124
36051
|
if (currenciesRegistry.getAll().length === 0) (await this.env.loadCurrencies?.() || []).forEach((currency, index) => {
|
|
36125
36052
|
currenciesRegistry.add(index.toString(), currency);
|
|
36126
36053
|
});
|
|
36127
|
-
|
|
36054
|
+
const emptyCurrency = {
|
|
36128
36055
|
name: _t(CustomCurrencyTerms.Custom),
|
|
36129
36056
|
code: "",
|
|
36130
36057
|
symbol: "",
|
|
36131
36058
|
decimalPlaces: 2,
|
|
36132
36059
|
position: "after"
|
|
36133
|
-
}
|
|
36060
|
+
};
|
|
36061
|
+
this.availableCurrencies = [emptyCurrency, ...currenciesRegistry.getAll()];
|
|
36134
36062
|
}
|
|
36135
36063
|
updateSelectCurrency(ev) {
|
|
36136
36064
|
const target = ev.target;
|
|
@@ -37278,12 +37206,6 @@ var DataValidationPanel = class extends _odoo_owl.Component {
|
|
|
37278
37206
|
//#endregion
|
|
37279
37207
|
//#region src/components/side_panel/find_and_replace/find_and_replace_store.ts
|
|
37280
37208
|
const FIND_AND_REPLACE_HIGHLIGHT_COLOR = "#8B008B";
|
|
37281
|
-
var Direction = /* @__PURE__ */ function(Direction) {
|
|
37282
|
-
Direction[Direction["previous"] = -1] = "previous";
|
|
37283
|
-
Direction[Direction["current"] = 0] = "current";
|
|
37284
|
-
Direction[Direction["next"] = 1] = "next";
|
|
37285
|
-
return Direction;
|
|
37286
|
-
}(Direction || {});
|
|
37287
37209
|
var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
37288
37210
|
mutators = [
|
|
37289
37211
|
"updateSearchOptions",
|
|
@@ -37344,10 +37266,10 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
37344
37266
|
this.updateSearchOptions({ searchFormulas: showFormula });
|
|
37345
37267
|
}
|
|
37346
37268
|
selectPreviousMatch() {
|
|
37347
|
-
this.selectNextCell(
|
|
37269
|
+
this.selectNextCell(-1);
|
|
37348
37270
|
}
|
|
37349
37271
|
selectNextMatch() {
|
|
37350
|
-
this.selectNextCell(
|
|
37272
|
+
this.selectNextCell(1);
|
|
37351
37273
|
}
|
|
37352
37274
|
handle(cmd) {
|
|
37353
37275
|
switch (cmd.type) {
|
|
@@ -37414,7 +37336,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
|
|
|
37414
37336
|
refreshSearch(jumpToMatchSheet = true) {
|
|
37415
37337
|
if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
|
|
37416
37338
|
this.findMatches();
|
|
37417
|
-
this.selectNextCell(
|
|
37339
|
+
this.selectNextCell(0, jumpToMatchSheet);
|
|
37418
37340
|
}
|
|
37419
37341
|
getSheetsInSearchOrder() {
|
|
37420
37342
|
switch (this.searchOptions.searchScope) {
|
|
@@ -37784,6 +37706,8 @@ var MoreFormatsPanel = class extends _odoo_owl.Component {
|
|
|
37784
37706
|
//#endregion
|
|
37785
37707
|
//#region src/components/side_panel/pivot/pivot_measure_display_panel/pivot_measure_display_panel_store.ts
|
|
37786
37708
|
var PivotMeasureDisplayPanelStore = class extends SpreadsheetStore {
|
|
37709
|
+
pivotId;
|
|
37710
|
+
initialMeasure;
|
|
37787
37711
|
mutators = [
|
|
37788
37712
|
"cancelMeasureDisplayEdition",
|
|
37789
37713
|
"updateMeasureDisplayType",
|
|
@@ -38688,7 +38612,7 @@ var PivotTitleSection = class extends _odoo_owl.Component {
|
|
|
38688
38612
|
});
|
|
38689
38613
|
let text;
|
|
38690
38614
|
if (result.isSuccessful) text = _t("Pivot duplicated.");
|
|
38691
|
-
else if (result.isCancelledBecause(
|
|
38615
|
+
else if (result.isCancelledBecause("PivotInError")) text = _t("Cannot duplicate a pivot in error.");
|
|
38692
38616
|
else text = _t("Pivot duplication failed.");
|
|
38693
38617
|
const type = result.isSuccessful ? "success" : "danger";
|
|
38694
38618
|
this.env.notifyUser({
|
|
@@ -38752,13 +38676,30 @@ function createMeasure(fields, measure) {
|
|
|
38752
38676
|
} : fields[fieldName];
|
|
38753
38677
|
const aggregator = measure.aggregator;
|
|
38754
38678
|
return {
|
|
38679
|
+
/**
|
|
38680
|
+
* Get the id of the measure, as it is stored in the pivot formula
|
|
38681
|
+
*/
|
|
38755
38682
|
id: measure.id,
|
|
38683
|
+
/**
|
|
38684
|
+
* Display name of the measure
|
|
38685
|
+
* e.g. "__count" -> "Count", "amount_total" -> "Total Amount"
|
|
38686
|
+
*/
|
|
38756
38687
|
get displayName() {
|
|
38757
38688
|
return measure.userDefinedName ?? field?.string ?? measure.fieldName;
|
|
38758
38689
|
},
|
|
38759
38690
|
userDefinedName: measure.userDefinedName,
|
|
38691
|
+
/**
|
|
38692
|
+
* Get the name of the field of the measure
|
|
38693
|
+
*/
|
|
38760
38694
|
fieldName,
|
|
38695
|
+
/**
|
|
38696
|
+
* Get the aggregator of the measure
|
|
38697
|
+
*/
|
|
38761
38698
|
aggregator,
|
|
38699
|
+
/**
|
|
38700
|
+
* Get the type of the measure field
|
|
38701
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38702
|
+
*/
|
|
38762
38703
|
type: fieldName === "__count" ? "integer" : field?.type ?? "integer",
|
|
38763
38704
|
isValid: !!(field || measure.computedBy),
|
|
38764
38705
|
isHidden: measure.isHidden,
|
|
@@ -38772,10 +38713,30 @@ function createPivotDimension(fields, dimension) {
|
|
|
38772
38713
|
const type = field?.type ?? "integer";
|
|
38773
38714
|
const granularity = field && isDateOrDatetimeField(field) ? dimension.granularity : void 0;
|
|
38774
38715
|
return {
|
|
38716
|
+
/**
|
|
38717
|
+
* Get the display name of the dimension
|
|
38718
|
+
* e.g. "stage_id" -> "Stage", "create_date:month" -> "Create Date"
|
|
38719
|
+
*/
|
|
38775
38720
|
displayName: field?.string ?? dimension.fieldName,
|
|
38721
|
+
/**
|
|
38722
|
+
* Get the name of the dimension, as it is stored in the pivot formula
|
|
38723
|
+
* e.g. "stage_id", "create_date:month"
|
|
38724
|
+
*/
|
|
38776
38725
|
nameWithGranularity: dimension.fieldName + (granularity ? `:${granularity}` : ""),
|
|
38726
|
+
/**
|
|
38727
|
+
* Get the name of the field of the dimension
|
|
38728
|
+
* e.g. "stage_id" -> "stage_id", "create_date:month" -> "create_date"
|
|
38729
|
+
*/
|
|
38777
38730
|
fieldName: dimension.fieldName,
|
|
38731
|
+
/**
|
|
38732
|
+
* Get the aggregate operator of the dimension
|
|
38733
|
+
* e.g. "stage_id" -> undefined, "create_date:month" -> "month"
|
|
38734
|
+
*/
|
|
38778
38735
|
granularity,
|
|
38736
|
+
/**
|
|
38737
|
+
* Get the type of the field of the dimension
|
|
38738
|
+
* e.g. "stage_id" -> "many2one", "create_date:month" -> "date"
|
|
38739
|
+
*/
|
|
38779
38740
|
type,
|
|
38780
38741
|
order: dimension.order,
|
|
38781
38742
|
isValid: !!field
|
|
@@ -39397,14 +39358,6 @@ function resetMapValueDimensionDate() {
|
|
|
39397
39358
|
|
|
39398
39359
|
//#endregion
|
|
39399
39360
|
//#region src/helpers/pivot/spreadsheet_pivot/spreadsheet_pivot.ts
|
|
39400
|
-
var ReloadType = /* @__PURE__ */ function(ReloadType) {
|
|
39401
|
-
ReloadType[ReloadType["NONE"] = 0] = "NONE";
|
|
39402
|
-
ReloadType[ReloadType["TABLE"] = 1] = "TABLE";
|
|
39403
|
-
ReloadType[ReloadType["DATA"] = 2] = "DATA";
|
|
39404
|
-
ReloadType[ReloadType["DEFINITION"] = 3] = "DEFINITION";
|
|
39405
|
-
ReloadType[ReloadType["ALL"] = 4] = "ALL";
|
|
39406
|
-
return ReloadType;
|
|
39407
|
-
}(ReloadType || {});
|
|
39408
39361
|
/**
|
|
39409
39362
|
* This class represents a pivot table that is created from a range of cells.
|
|
39410
39363
|
* It will extract the fields from the first row of the range and the data from
|
|
@@ -39446,27 +39399,27 @@ var SpreadsheetPivot = class {
|
|
|
39446
39399
|
}
|
|
39447
39400
|
init(params = {}) {
|
|
39448
39401
|
if (!this._definition || params.reload) {
|
|
39449
|
-
this.reload(
|
|
39402
|
+
this.reload(4);
|
|
39450
39403
|
this.needsReevaluation = false;
|
|
39451
39404
|
}
|
|
39452
39405
|
}
|
|
39453
39406
|
reload(type) {
|
|
39454
|
-
if (type ===
|
|
39455
|
-
if (type >=
|
|
39456
|
-
if (type >=
|
|
39457
|
-
if (type >=
|
|
39407
|
+
if (type === 4) this.metaData = this.loadMetaData();
|
|
39408
|
+
if (type >= 3) this._definition = this.loadRuntimeDefinition();
|
|
39409
|
+
if (type >= 2) this.dataEntries = this.loadData();
|
|
39410
|
+
if (type >= 1) this.table = void 0;
|
|
39458
39411
|
}
|
|
39459
39412
|
onDefinitionChange(nextDefinition) {
|
|
39460
39413
|
const actualDefinition = this.coreDefinition;
|
|
39461
39414
|
this.coreDefinition = nextDefinition;
|
|
39462
39415
|
if (this._definition) {
|
|
39463
|
-
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition),
|
|
39416
|
+
const reloadType = Math.max(this.computeShouldReload(actualDefinition, nextDefinition), 0);
|
|
39464
39417
|
this.reload(reloadType);
|
|
39465
39418
|
}
|
|
39466
39419
|
}
|
|
39467
39420
|
computeShouldReload(actualDefinition, nextDefinition) {
|
|
39468
|
-
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return
|
|
39469
|
-
return
|
|
39421
|
+
if (deepEquals(actualDefinition.dataSet, nextDefinition.dataSet)) return 3;
|
|
39422
|
+
return 4;
|
|
39470
39423
|
}
|
|
39471
39424
|
get isInvalidRange() {
|
|
39472
39425
|
return !!this.invalidRangeError;
|
|
@@ -39539,7 +39492,7 @@ var SpreadsheetPivot = class {
|
|
|
39539
39492
|
if (dataEntries.length === 0) return { value: "" };
|
|
39540
39493
|
const measure = this.getMeasure(measureId);
|
|
39541
39494
|
const allValues = dataEntries.map((value) => value[measure.fieldName]).filter(isDefined);
|
|
39542
|
-
const values = allValues.filter((cell) => cell.type !==
|
|
39495
|
+
const values = allValues.filter((cell) => cell.type !== "empty");
|
|
39543
39496
|
const aggregator = measure.aggregator;
|
|
39544
39497
|
const operator = AGGREGATORS_FN[aggregator];
|
|
39545
39498
|
if (!operator) throw new Error(`Aggregator ${aggregator} does not exist`);
|
|
@@ -39627,16 +39580,16 @@ var SpreadsheetPivot = class {
|
|
|
39627
39580
|
return this.definition.getDimension(nameWithGranularity);
|
|
39628
39581
|
}
|
|
39629
39582
|
getTypeFromZone(sheetId, zone) {
|
|
39630
|
-
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type ===
|
|
39583
|
+
const nonEmptyCells = this.getters.getEvaluatedCellsInZone(sheetId, zone).filter((cell) => !(cell.type === "empty" || cell.value === ""));
|
|
39631
39584
|
if (nonEmptyCells.length === 0) return "integer";
|
|
39632
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39633
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39634
|
-
if (nonEmptyCells.every((cell) => cell.type ===
|
|
39585
|
+
if (nonEmptyCells.every((cell) => cell.type === "number" && cell.format && isDateTimeFormat(cell.format))) return "datetime";
|
|
39586
|
+
if (nonEmptyCells.every((cell) => cell.type === "boolean")) return "boolean";
|
|
39587
|
+
if (nonEmptyCells.every((cell) => cell.type === "number")) return "integer";
|
|
39635
39588
|
return "char";
|
|
39636
39589
|
}
|
|
39637
39590
|
assertCellIsValidField(col, row, cell) {
|
|
39638
|
-
if (cell.type ===
|
|
39639
|
-
if (cell.type ===
|
|
39591
|
+
if (cell.type === "error") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains an error", toXC(col, row)));
|
|
39592
|
+
if (cell.type === "empty" || cell.value === "") throw new EvaluationError(_t("The pivot cannot be created because cell %s is empty", toXC(col, row)));
|
|
39640
39593
|
if (cell.value === "__count") throw new EvaluationError(_t("The pivot cannot be created because cell %s contains a reserved value", toXC(col, row)));
|
|
39641
39594
|
}
|
|
39642
39595
|
/**
|
|
@@ -39704,14 +39657,14 @@ var SpreadsheetPivot = class {
|
|
|
39704
39657
|
if (!field) throw new Error(`Field ${this.metaData.fieldKeys[index]} does not exist`);
|
|
39705
39658
|
if (cell.value === "") entry[field.name] = {
|
|
39706
39659
|
value: null,
|
|
39707
|
-
type:
|
|
39660
|
+
type: "empty",
|
|
39708
39661
|
formattedValue: ""
|
|
39709
39662
|
};
|
|
39710
39663
|
else entry[field.name] = cell;
|
|
39711
39664
|
}
|
|
39712
39665
|
entry["__count"] = {
|
|
39713
39666
|
value: 1,
|
|
39714
|
-
type:
|
|
39667
|
+
type: "number",
|
|
39715
39668
|
formattedValue: "1"
|
|
39716
39669
|
};
|
|
39717
39670
|
dataEntries.push(entry);
|
|
@@ -39724,7 +39677,7 @@ var SpreadsheetPivot = class {
|
|
|
39724
39677
|
const { format, value: valueToFormat } = pivotTimeAdapter(dimension.granularity || "month").toValueAndFormat(value, locale);
|
|
39725
39678
|
entry[dimension.nameWithGranularity] = {
|
|
39726
39679
|
value,
|
|
39727
|
-
type: entry[dimension.fieldName]?.type ||
|
|
39680
|
+
type: entry[dimension.fieldName]?.type || "empty",
|
|
39728
39681
|
format: entry[dimension.fieldName]?.format,
|
|
39729
39682
|
formattedValue: formatValue(valueToFormat, {
|
|
39730
39683
|
locale,
|
|
@@ -39792,6 +39745,7 @@ function adaptPivotRange(range, applyChange) {
|
|
|
39792
39745
|
//#endregion
|
|
39793
39746
|
//#region src/components/side_panel/pivot/pivot_side_panel/pivot_side_panel_store.ts
|
|
39794
39747
|
var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
39748
|
+
pivotId;
|
|
39795
39749
|
mutators = [
|
|
39796
39750
|
"reset",
|
|
39797
39751
|
"deferUpdates",
|
|
@@ -39926,7 +39880,8 @@ var PivotSidePanelStore = class extends SpreadsheetStore {
|
|
|
39926
39880
|
}))
|
|
39927
39881
|
};
|
|
39928
39882
|
if (!this.draft && deepEquals(coreDefinition, cleanedDefinition)) return;
|
|
39929
|
-
|
|
39883
|
+
const cleanedWithGranularity = this.addDefaultDateTimeGranularity(this.fields, cleanedDefinition);
|
|
39884
|
+
this.draft = cleanedWithGranularity;
|
|
39930
39885
|
if (!this.updatesAreDeferred) this.applyUpdate();
|
|
39931
39886
|
}
|
|
39932
39887
|
/**
|
|
@@ -40243,7 +40198,7 @@ function interactiveSplitToColumns(env, separator, addNewColumns) {
|
|
|
40243
40198
|
separator,
|
|
40244
40199
|
addNewColumns
|
|
40245
40200
|
});
|
|
40246
|
-
if (result.isCancelledBecause(
|
|
40201
|
+
if (result.isCancelledBecause("SplitWillOverwriteContent")) env.askConfirmation(SplitToColumnsInteractiveContent.SplitIsDestructive, () => {
|
|
40247
40202
|
result = env.model.dispatch("SPLIT_TEXT_INTO_COLUMNS", {
|
|
40248
40203
|
separator,
|
|
40249
40204
|
addNewColumns,
|
|
@@ -40324,8 +40279,8 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
40324
40279
|
}).reasons;
|
|
40325
40280
|
const errors = /* @__PURE__ */ new Set();
|
|
40326
40281
|
for (const reason of cancelledReasons) switch (reason) {
|
|
40327
|
-
case
|
|
40328
|
-
case
|
|
40282
|
+
case "SplitWillOverwriteContent":
|
|
40283
|
+
case "EmptySplitSeparator": break;
|
|
40329
40284
|
default: errors.add(SplitToColumnsTerms.Errors[reason] || SplitToColumnsTerms.Errors.Unexpected);
|
|
40330
40285
|
}
|
|
40331
40286
|
return Array.from(errors);
|
|
@@ -40336,7 +40291,7 @@ var SplitIntoColumnsPanel = class extends _odoo_owl.Component {
|
|
|
40336
40291
|
separator: this.separatorValue,
|
|
40337
40292
|
addNewColumns: this.state.addNewColumns,
|
|
40338
40293
|
force: false
|
|
40339
|
-
}).reasons.includes(
|
|
40294
|
+
}).reasons.includes("SplitWillOverwriteContent")) warnings.push(SplitToColumnsTerms.Errors["SplitWillOverwriteContent"]);
|
|
40340
40295
|
return warnings;
|
|
40341
40296
|
}
|
|
40342
40297
|
get separatorValue() {
|
|
@@ -41328,7 +41283,7 @@ css`
|
|
|
41328
41283
|
box-sizing: content-box;
|
|
41329
41284
|
|
|
41330
41285
|
.o-fig-anchor {
|
|
41331
|
-
z-index: ${
|
|
41286
|
+
z-index: ${1e3};
|
|
41332
41287
|
position: absolute;
|
|
41333
41288
|
width: ${ANCHOR_SIZE}px;
|
|
41334
41289
|
height: ${ANCHOR_SIZE}px;
|
|
@@ -41430,7 +41385,7 @@ var FigureComponent = class extends _odoo_owl.Component {
|
|
|
41430
41385
|
top: `${y}px`,
|
|
41431
41386
|
width: `${width}px`,
|
|
41432
41387
|
height: `${height}px`,
|
|
41433
|
-
"z-index": String(
|
|
41388
|
+
"z-index": String(10 + (this.isSelected ? 1 : 0))
|
|
41434
41389
|
});
|
|
41435
41390
|
}
|
|
41436
41391
|
getResizerPosition(resizer) {
|
|
@@ -41555,7 +41510,7 @@ function interactiveToggleGroup(env, sheetId, dimension, start, end) {
|
|
|
41555
41510
|
end: group.end
|
|
41556
41511
|
});
|
|
41557
41512
|
if (!result.isSuccessful) {
|
|
41558
|
-
if (result.isCancelledBecause(
|
|
41513
|
+
if (result.isCancelledBecause("NotEnoughElements")) {
|
|
41559
41514
|
const errorMessage = dimension === "ROW" ? ToggleGroupInteractiveContent.CannotHideAllRows : ToggleGroupInteractiveContent.CannotHideAllColumns;
|
|
41560
41515
|
env.raiseError(errorMessage);
|
|
41561
41516
|
}
|
|
@@ -41965,11 +41920,11 @@ var CellComposerStore = class extends AbstractComposerStore {
|
|
|
41965
41920
|
if (this.model.getters.getArrayFormulaSpreadingOn(position)) return "";
|
|
41966
41921
|
const { format, value, type, formattedValue } = this.getters.getEvaluatedCell(position);
|
|
41967
41922
|
switch (type) {
|
|
41968
|
-
case
|
|
41969
|
-
case
|
|
41970
|
-
case
|
|
41971
|
-
case
|
|
41972
|
-
case
|
|
41923
|
+
case "empty": return "";
|
|
41924
|
+
case "text":
|
|
41925
|
+
case "error": return value;
|
|
41926
|
+
case "boolean": return formattedValue;
|
|
41927
|
+
case "number":
|
|
41973
41928
|
if (format && isDateTimeFormat(format)) {
|
|
41974
41929
|
if (parseDateTime(formattedValue, locale) !== null) return formattedValue;
|
|
41975
41930
|
return formatValue(value, {
|
|
@@ -42033,7 +41988,7 @@ const COMPOSER_BORDER_WIDTH = 3 * .4 * window.devicePixelRatio || 1;
|
|
|
42033
41988
|
const GRID_CELL_REFERENCE_TOP_OFFSET = 28;
|
|
42034
41989
|
css`
|
|
42035
41990
|
div.o-grid-composer {
|
|
42036
|
-
z-index: ${
|
|
41991
|
+
z-index: ${20};
|
|
42037
41992
|
box-sizing: border-box;
|
|
42038
41993
|
position: absolute;
|
|
42039
41994
|
border: ${COMPOSER_BORDER_WIDTH}px solid ${SELECTION_BORDER_COLOR};
|
|
@@ -42045,7 +42000,7 @@ css`
|
|
|
42045
42000
|
|
|
42046
42001
|
div.o-cell-reference {
|
|
42047
42002
|
position: absolute;
|
|
42048
|
-
z-index: ${
|
|
42003
|
+
z-index: ${20};
|
|
42049
42004
|
background: ${SELECTION_BORDER_COLOR};
|
|
42050
42005
|
color: white;
|
|
42051
42006
|
font-size: 12px;
|
|
@@ -42660,7 +42615,7 @@ function getAxis(fig, axisType) {
|
|
|
42660
42615
|
css`
|
|
42661
42616
|
.o-figure-snap-line {
|
|
42662
42617
|
position: relative;
|
|
42663
|
-
z-index: ${
|
|
42618
|
+
z-index: ${1001};
|
|
42664
42619
|
&.vertical {
|
|
42665
42620
|
width: 0px;
|
|
42666
42621
|
border-left: 1px dashed black;
|
|
@@ -43421,7 +43376,7 @@ var GridPopover = class extends _odoo_owl.Component {
|
|
|
43421
43376
|
};
|
|
43422
43377
|
static components = { Popover };
|
|
43423
43378
|
cellPopovers;
|
|
43424
|
-
zIndex =
|
|
43379
|
+
zIndex = 19;
|
|
43425
43380
|
setup() {
|
|
43426
43381
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
43427
43382
|
}
|
|
@@ -43666,7 +43621,7 @@ css`
|
|
|
43666
43621
|
color: ${ICONS_COLOR};
|
|
43667
43622
|
}
|
|
43668
43623
|
.o-unhide:hover {
|
|
43669
|
-
z-index: ${
|
|
43624
|
+
z-index: ${0 + 1};
|
|
43670
43625
|
background-color: lightgrey;
|
|
43671
43626
|
}
|
|
43672
43627
|
}
|
|
@@ -43738,7 +43693,7 @@ var ColResizer = class extends AbstractResizer {
|
|
|
43738
43693
|
elements,
|
|
43739
43694
|
position: this.state.position
|
|
43740
43695
|
});
|
|
43741
|
-
if (!result.isSuccessful && result.reasons.includes(
|
|
43696
|
+
if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
43742
43697
|
}
|
|
43743
43698
|
_selectElement(index, addDistinctHeader) {
|
|
43744
43699
|
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
@@ -43822,7 +43777,7 @@ css`
|
|
|
43822
43777
|
color: ${ICONS_COLOR};
|
|
43823
43778
|
}
|
|
43824
43779
|
.o-unhide:hover {
|
|
43825
|
-
z-index: ${
|
|
43780
|
+
z-index: ${0 + 1};
|
|
43826
43781
|
background-color: lightgrey;
|
|
43827
43782
|
}
|
|
43828
43783
|
}
|
|
@@ -43895,8 +43850,8 @@ var RowResizer = class extends AbstractResizer {
|
|
|
43895
43850
|
position: this.state.position
|
|
43896
43851
|
});
|
|
43897
43852
|
if (!result.isSuccessful) {
|
|
43898
|
-
if (result.reasons.includes(
|
|
43899
|
-
else if (result.reasons.includes(
|
|
43853
|
+
if (result.reasons.includes("WillRemoveExistingMerge")) this.env.raiseError(MergeErrorMessage);
|
|
43854
|
+
else if (result.reasons.includes("CannotMoveTableHeader")) this.env.raiseError(TableHeaderMoveErrorMessage);
|
|
43900
43855
|
}
|
|
43901
43856
|
}
|
|
43902
43857
|
_selectElement(index, addDistinctHeader) {
|
|
@@ -44354,7 +44309,7 @@ var GridRenderer = class {
|
|
|
44354
44309
|
const nextCellBorder = this.getters.getCellComputedBorder(position);
|
|
44355
44310
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44356
44311
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
44357
|
-
if (nextCell.type !==
|
|
44312
|
+
if (nextCell.type !== "empty" || this.getters.isInMerge(position) || nextCellBorder?.left || cellHasIcon || cellHasCheckbox) return col;
|
|
44358
44313
|
col++;
|
|
44359
44314
|
}
|
|
44360
44315
|
return col;
|
|
@@ -44372,7 +44327,7 @@ var GridRenderer = class {
|
|
|
44372
44327
|
const previousCellBorder = this.getters.getCellComputedBorder(position);
|
|
44373
44328
|
const cellHasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44374
44329
|
const cellHasCheckbox = this.getters.isCellValidCheckbox(position);
|
|
44375
|
-
if (previousCell.type !==
|
|
44330
|
+
if (previousCell.type !== "empty" || this.getters.isInMerge(position) || previousCellBorder?.right || cellHasIcon || cellHasCheckbox) return col;
|
|
44376
44331
|
col--;
|
|
44377
44332
|
}
|
|
44378
44333
|
return col;
|
|
@@ -44381,7 +44336,7 @@ var GridRenderer = class {
|
|
|
44381
44336
|
if (this.getters.getCell(position)?.isFormula && this.getters.shouldShowFormulas()) return "left";
|
|
44382
44337
|
const { align } = this.getters.getCellStyle(position);
|
|
44383
44338
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
44384
|
-
if (isOverflowing && evaluatedCell.type ===
|
|
44339
|
+
if (isOverflowing && evaluatedCell.type === "number") return align !== "center" ? "left" : align;
|
|
44385
44340
|
return align || evaluatedCell.defaultAlign;
|
|
44386
44341
|
}
|
|
44387
44342
|
createZoneBox(sheetId, zone, viewport) {
|
|
@@ -44406,7 +44361,7 @@ var GridRenderer = class {
|
|
|
44406
44361
|
style: this.getters.getCellComputedStyle(position),
|
|
44407
44362
|
dataBarFill: this.getters.getConditionalDataBar(position),
|
|
44408
44363
|
verticalAlign,
|
|
44409
|
-
isError: cell.type ===
|
|
44364
|
+
isError: cell.type === "error" && !!cell.message || this.getters.isDataValidationInvalid(position)
|
|
44410
44365
|
};
|
|
44411
44366
|
/** Icon */
|
|
44412
44367
|
const iconSrc = this.getters.getCellIconSrc(position);
|
|
@@ -44426,7 +44381,7 @@ var GridRenderer = class {
|
|
|
44426
44381
|
image: imageHtmlElement
|
|
44427
44382
|
};
|
|
44428
44383
|
}
|
|
44429
|
-
if (cell.type ===
|
|
44384
|
+
if (cell.type === "empty" || this.getters.isCellValidCheckbox(position)) return box;
|
|
44430
44385
|
/** Filter Header or data validation icon */
|
|
44431
44386
|
box.hasIcon = this.getters.doesCellHaveGridIcon(position);
|
|
44432
44387
|
const headerIconWidth = box.hasIcon ? 17 + 2 : 0;
|
|
@@ -44814,7 +44769,7 @@ var Corner = class extends _odoo_owl.Component {
|
|
|
44814
44769
|
//#region src/components/highlight/highlight/highlight.ts
|
|
44815
44770
|
css`
|
|
44816
44771
|
.o-highlight {
|
|
44817
|
-
z-index: ${
|
|
44772
|
+
z-index: ${5};
|
|
44818
44773
|
}
|
|
44819
44774
|
`;
|
|
44820
44775
|
var Highlight = class extends _odoo_owl.Component {
|
|
@@ -44935,7 +44890,7 @@ css`
|
|
|
44935
44890
|
.o-scrollbar {
|
|
44936
44891
|
position: absolute;
|
|
44937
44892
|
overflow: auto;
|
|
44938
|
-
z-index: ${
|
|
44893
|
+
z-index: ${15};
|
|
44939
44894
|
background-color: ${BACKGROUND_GRAY_COLOR};
|
|
44940
44895
|
|
|
44941
44896
|
&.corner {
|
|
@@ -45331,12 +45286,12 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
45331
45286
|
}
|
|
45332
45287
|
keyDownMapping = {
|
|
45333
45288
|
Enter: () => {
|
|
45334
|
-
this.env.model.getters.getActiveCell().type ===
|
|
45289
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
45335
45290
|
},
|
|
45336
45291
|
Tab: () => this.env.model.selection.moveAnchorCell("right", 1),
|
|
45337
45292
|
"Shift+Tab": () => this.env.model.selection.moveAnchorCell("left", 1),
|
|
45338
45293
|
F2: () => {
|
|
45339
|
-
this.env.model.getters.getActiveCell().type ===
|
|
45294
|
+
this.env.model.getters.getActiveCell().type === "empty" ? this.onComposerCellFocused() : this.onComposerContentFocused();
|
|
45340
45295
|
},
|
|
45341
45296
|
Delete: () => {
|
|
45342
45297
|
this.env.model.dispatch("DELETE_CONTENT", {
|
|
@@ -45567,7 +45522,7 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
45567
45522
|
sheetId,
|
|
45568
45523
|
col,
|
|
45569
45524
|
row
|
|
45570
|
-
}).type ===
|
|
45525
|
+
}).type === "empty") this.onComposerCellFocused();
|
|
45571
45526
|
else this.onComposerContentFocused();
|
|
45572
45527
|
}
|
|
45573
45528
|
processArrows(ev) {
|
|
@@ -45639,8 +45594,8 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
45639
45594
|
const clipboardData = ev.clipboardData;
|
|
45640
45595
|
if (!clipboardData) return;
|
|
45641
45596
|
const osClipboard = { content: {
|
|
45642
|
-
[
|
|
45643
|
-
[
|
|
45597
|
+
["text/plain"]: clipboardData?.getData("text/plain"),
|
|
45598
|
+
["text/html"]: clipboardData?.getData("text/html")
|
|
45644
45599
|
} };
|
|
45645
45600
|
const target = this.env.model.getters.getSelectedZones();
|
|
45646
45601
|
const isCutOperation = this.env.model.getters.isCutOperation();
|
|
@@ -45648,7 +45603,7 @@ var Grid = class extends _odoo_owl.Component {
|
|
|
45648
45603
|
const clipboardId = clipboardContent.data?.clipboardId;
|
|
45649
45604
|
if (this.env.model.getters.getClipboardId() === clipboardId) interactivePaste(this.env, target);
|
|
45650
45605
|
else interactivePasteFromOS(this.env, target, clipboardContent);
|
|
45651
|
-
if (isCutOperation) await this.env.clipboard.write({ [
|
|
45606
|
+
if (isCutOperation) await this.env.clipboard.write({ ["text/plain"]: "" });
|
|
45652
45607
|
}
|
|
45653
45608
|
clearFormatting() {
|
|
45654
45609
|
this.env.model.dispatch("CLEAR_FORMATTING", {
|
|
@@ -46115,7 +46070,7 @@ var BasePlugin = class {
|
|
|
46115
46070
|
* There should not be any side effects in this method.
|
|
46116
46071
|
*/
|
|
46117
46072
|
allowDispatch(command) {
|
|
46118
|
-
return
|
|
46073
|
+
return "Success";
|
|
46119
46074
|
}
|
|
46120
46075
|
/**
|
|
46121
46076
|
* This method is useful when a plugin need to perform some action before a
|
|
@@ -46151,10 +46106,10 @@ var BasePlugin = class {
|
|
|
46151
46106
|
for (const validation of validations) {
|
|
46152
46107
|
let results = validation.call(this, toValidate);
|
|
46153
46108
|
if (!Array.isArray(results)) results = [results];
|
|
46154
|
-
const cancelledReasons = results.filter((result) => result !==
|
|
46109
|
+
const cancelledReasons = results.filter((result) => result !== "Success");
|
|
46155
46110
|
if (cancelledReasons.length) return cancelledReasons;
|
|
46156
46111
|
}
|
|
46157
|
-
return
|
|
46112
|
+
return "Success";
|
|
46158
46113
|
};
|
|
46159
46114
|
}
|
|
46160
46115
|
checkValidations(command, ...validations) {
|
|
@@ -46213,7 +46168,7 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
46213
46168
|
allowDispatch(cmd) {
|
|
46214
46169
|
switch (cmd.type) {
|
|
46215
46170
|
case "SET_BORDER": return this.checkBordersUnchanged(cmd);
|
|
46216
|
-
default: return
|
|
46171
|
+
default: return "Success";
|
|
46217
46172
|
}
|
|
46218
46173
|
}
|
|
46219
46174
|
handle(cmd) {
|
|
@@ -46585,8 +46540,8 @@ var BordersPlugin = class extends CorePlugin {
|
|
|
46585
46540
|
checkBordersUnchanged(cmd) {
|
|
46586
46541
|
const currentBorder = this.getCellBorder(cmd);
|
|
46587
46542
|
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
46588
|
-
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return
|
|
46589
|
-
return
|
|
46543
|
+
if (!currentBorder && areAllNewBordersUndefined || deepEquals(currentBorder, cmd.border)) return "NoChanges";
|
|
46544
|
+
return "Success";
|
|
46590
46545
|
}
|
|
46591
46546
|
import(data) {
|
|
46592
46547
|
if (Object.keys(data.borders || {}).length) for (const sheet of data.sheets) for (const zoneXc in sheet.borders) {
|
|
@@ -46715,8 +46670,8 @@ var CellPlugin = class extends CorePlugin {
|
|
|
46715
46670
|
switch (cmd.type) {
|
|
46716
46671
|
case "UPDATE_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
46717
46672
|
case "CLEAR_CELL": return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
46718
|
-
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ?
|
|
46719
|
-
default: return
|
|
46673
|
+
case "UPDATE_CELL_POSITION": return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId] ? "Success" : "InvalidCellId";
|
|
46674
|
+
default: return "Success";
|
|
46720
46675
|
}
|
|
46721
46676
|
}
|
|
46722
46677
|
handle(cmd) {
|
|
@@ -47139,25 +47094,30 @@ var CellPlugin = class extends CorePlugin {
|
|
|
47139
47094
|
}
|
|
47140
47095
|
checkCellOutOfSheet(cmd) {
|
|
47141
47096
|
const { sheetId, col, row } = cmd;
|
|
47142
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
47143
|
-
return isInside(col, row, this.getters.getSheetZone(sheetId)) ?
|
|
47097
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
47098
|
+
return isInside(col, row, this.getters.getSheetZone(sheetId)) ? "Success" : "TargetOutOfSheet";
|
|
47144
47099
|
}
|
|
47145
47100
|
checkUselessClearCell(cmd) {
|
|
47146
47101
|
const cell = this.getters.getCell(cmd);
|
|
47147
|
-
if (!cell) return
|
|
47148
|
-
if (!cell.content && !cell.style && !cell.format) return
|
|
47149
|
-
return
|
|
47102
|
+
if (!cell) return "NoChanges";
|
|
47103
|
+
if (!cell.content && !cell.style && !cell.format) return "NoChanges";
|
|
47104
|
+
return "Success";
|
|
47150
47105
|
}
|
|
47151
47106
|
checkUselessUpdateCell(cmd) {
|
|
47152
47107
|
const cell = this.getters.getCell(cmd);
|
|
47153
47108
|
const hasContent = "content" in cmd || "formula" in cmd;
|
|
47154
47109
|
const hasStyle = "style" in cmd;
|
|
47155
47110
|
const hasFormat = "format" in cmd;
|
|
47156
|
-
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return
|
|
47157
|
-
return
|
|
47111
|
+
if ((!hasContent || cell?.content === cmd.content) && (!hasStyle || deepEquals(cell?.style, cmd.style)) && (!hasFormat || cell?.format === cmd.format)) return "NoChanges";
|
|
47112
|
+
return "Success";
|
|
47158
47113
|
}
|
|
47159
47114
|
};
|
|
47160
47115
|
var FormulaCellWithDependencies = class {
|
|
47116
|
+
id;
|
|
47117
|
+
format;
|
|
47118
|
+
style;
|
|
47119
|
+
sheetId;
|
|
47120
|
+
getRangeString;
|
|
47161
47121
|
isFormula = true;
|
|
47162
47122
|
compiledFormula;
|
|
47163
47123
|
constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
|
|
@@ -47192,6 +47152,10 @@ var FormulaCellWithDependencies = class {
|
|
|
47192
47152
|
}
|
|
47193
47153
|
};
|
|
47194
47154
|
var RangeReferenceToken = class {
|
|
47155
|
+
ranges;
|
|
47156
|
+
rangeIndex;
|
|
47157
|
+
sheetId;
|
|
47158
|
+
getRangeString;
|
|
47195
47159
|
type = "REFERENCE";
|
|
47196
47160
|
constructor(ranges, rangeIndex, sheetId, getRangeString) {
|
|
47197
47161
|
this.ranges = ranges;
|
|
@@ -47226,7 +47190,7 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
47226
47190
|
switch (cmd.type) {
|
|
47227
47191
|
case "CREATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
47228
47192
|
case "UPDATE_CHART": return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
47229
|
-
default: return
|
|
47193
|
+
default: return "Success";
|
|
47230
47194
|
}
|
|
47231
47195
|
}
|
|
47232
47196
|
handle(cmd) {
|
|
@@ -47345,10 +47309,10 @@ var ChartPlugin = class extends CorePlugin {
|
|
|
47345
47309
|
if (sheetId) this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
47346
47310
|
}
|
|
47347
47311
|
checkChartDuplicate(cmd) {
|
|
47348
|
-
return this.getters.getFigureSheetId(cmd.id) ?
|
|
47312
|
+
return this.getters.getFigureSheetId(cmd.id) ? "DuplicatedChartId" : "Success";
|
|
47349
47313
|
}
|
|
47350
47314
|
checkChartExists(cmd) {
|
|
47351
|
-
return this.isChartDefined(cmd.id) ?
|
|
47315
|
+
return this.isChartDefined(cmd.id) ? "Success" : "ChartDoesNotExist";
|
|
47352
47316
|
}
|
|
47353
47317
|
};
|
|
47354
47318
|
|
|
@@ -47407,7 +47371,7 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47407
47371
|
case "ADD_CONDITIONAL_FORMAT": return this.checkValidations(cmd, this.checkCFRule, this.checkEmptyRange);
|
|
47408
47372
|
case "CHANGE_CONDITIONAL_FORMAT_PRIORITY": return this.checkValidPriorityChange(cmd.cfId, cmd.delta, cmd.sheetId);
|
|
47409
47373
|
}
|
|
47410
|
-
return
|
|
47374
|
+
return "Success";
|
|
47411
47375
|
}
|
|
47412
47376
|
handle(cmd) {
|
|
47413
47377
|
switch (cmd.type) {
|
|
@@ -47540,21 +47504,21 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47540
47504
|
this.history.update("cfRules", sheet, currentCF);
|
|
47541
47505
|
}
|
|
47542
47506
|
checkValidPriorityChange(cfId, delta, sheetId) {
|
|
47543
|
-
if (!this.cfRules[sheetId]) return
|
|
47507
|
+
if (!this.cfRules[sheetId]) return "InvalidSheetId";
|
|
47544
47508
|
const ruleIndex = this.cfRules[sheetId].findIndex((cf) => cf.id === cfId);
|
|
47545
|
-
if (ruleIndex === -1) return
|
|
47509
|
+
if (ruleIndex === -1) return "InvalidConditionalFormatId";
|
|
47546
47510
|
const cfIndex2 = ruleIndex - delta;
|
|
47547
|
-
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return
|
|
47548
|
-
return
|
|
47511
|
+
if (cfIndex2 < 0 || cfIndex2 >= this.cfRules[sheetId].length) return "InvalidConditionalFormatId";
|
|
47512
|
+
return "Success";
|
|
47549
47513
|
}
|
|
47550
47514
|
checkEmptyRange(cmd) {
|
|
47551
|
-
return cmd.ranges.length ?
|
|
47515
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
47552
47516
|
}
|
|
47553
47517
|
checkCFRule(cmd) {
|
|
47554
47518
|
const rule = cmd.cf.rule;
|
|
47555
47519
|
switch (rule.type) {
|
|
47556
47520
|
case "CellIsRule":
|
|
47557
|
-
if (!CellIsOperators[rule.operator]) return
|
|
47521
|
+
if (!CellIsOperators[rule.operator]) return "InvalidConditionalFormatType";
|
|
47558
47522
|
return this.checkValidations(rule, this.checkOperatorArgsNumber(2, ["Between", "NotBetween"]), this.checkOperatorArgsNumber(1, [
|
|
47559
47523
|
"BeginsWith",
|
|
47560
47524
|
"ContainsText",
|
|
@@ -47569,9 +47533,9 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47569
47533
|
]), this.checkOperatorArgsNumber(0, ["IsEmpty", "IsNotEmpty"]), this.checkCFValues);
|
|
47570
47534
|
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)));
|
|
47571
47535
|
case "IconSetRule": return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
|
|
47572
|
-
case "DataBarRule": return
|
|
47536
|
+
case "DataBarRule": return "Success";
|
|
47573
47537
|
}
|
|
47574
|
-
return
|
|
47538
|
+
return "InvalidConditionalFormatType";
|
|
47575
47539
|
}
|
|
47576
47540
|
checkOperatorArgsNumber(expectedNumber, operators) {
|
|
47577
47541
|
if (expectedNumber > 2) throw new Error("Checking more than 2 arguments is currently not supported. Add the appropriate CommandResult if you want to.");
|
|
@@ -47579,11 +47543,11 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47579
47543
|
if (operators.includes(rule.operator)) {
|
|
47580
47544
|
const errors = [];
|
|
47581
47545
|
const isEmpty = (value) => value === void 0 || value === "";
|
|
47582
|
-
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push(
|
|
47583
|
-
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push(
|
|
47584
|
-
return errors.length ? errors :
|
|
47546
|
+
if (expectedNumber >= 1 && isEmpty(rule.values[0])) errors.push("FirstArgMissing");
|
|
47547
|
+
if (expectedNumber >= 2 && isEmpty(rule.values[1])) errors.push("SecondArgMissing");
|
|
47548
|
+
return errors.length ? errors : "Success";
|
|
47585
47549
|
}
|
|
47586
|
-
return
|
|
47550
|
+
return "Success";
|
|
47587
47551
|
};
|
|
47588
47552
|
}
|
|
47589
47553
|
checkNaN(threshold, thresholdName) {
|
|
@@ -47592,27 +47556,27 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47592
47556
|
"percentage",
|
|
47593
47557
|
"percentile"
|
|
47594
47558
|
].includes(threshold.type) && (threshold.value === "" || isNaN(threshold.value))) switch (thresholdName) {
|
|
47595
|
-
case "min": return
|
|
47596
|
-
case "max": return
|
|
47597
|
-
case "mid": return
|
|
47598
|
-
case "upperInflectionPoint": return
|
|
47599
|
-
case "lowerInflectionPoint": return
|
|
47559
|
+
case "min": return "MinNaN";
|
|
47560
|
+
case "max": return "MaxNaN";
|
|
47561
|
+
case "mid": return "MidNaN";
|
|
47562
|
+
case "upperInflectionPoint": return "ValueUpperInflectionNaN";
|
|
47563
|
+
case "lowerInflectionPoint": return "ValueLowerInflectionNaN";
|
|
47600
47564
|
}
|
|
47601
|
-
return
|
|
47565
|
+
return "Success";
|
|
47602
47566
|
}
|
|
47603
47567
|
checkFormulaCompilation(threshold, thresholdName) {
|
|
47604
|
-
if (threshold.type !== "formula") return
|
|
47568
|
+
if (threshold.type !== "formula") return "Success";
|
|
47605
47569
|
if (compile(threshold.value || "").isBadExpression) switch (thresholdName) {
|
|
47606
|
-
case "min": return
|
|
47607
|
-
case "max": return
|
|
47608
|
-
case "mid": return
|
|
47609
|
-
case "upperInflectionPoint": return
|
|
47610
|
-
case "lowerInflectionPoint": return
|
|
47570
|
+
case "min": return "MinInvalidFormula";
|
|
47571
|
+
case "max": return "MaxInvalidFormula";
|
|
47572
|
+
case "mid": return "MidInvalidFormula";
|
|
47573
|
+
case "upperInflectionPoint": return "ValueUpperInvalidFormula";
|
|
47574
|
+
case "lowerInflectionPoint": return "ValueLowerInvalidFormula";
|
|
47611
47575
|
}
|
|
47612
|
-
return
|
|
47576
|
+
return "Success";
|
|
47613
47577
|
}
|
|
47614
47578
|
checkThresholds(check) {
|
|
47615
|
-
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") :
|
|
47579
|
+
return this.batchValidations((rule) => check(rule.minimum, "min"), (rule) => check(rule.maximum, "max"), (rule) => rule.midpoint ? check(rule.midpoint, "mid") : "Success");
|
|
47616
47580
|
}
|
|
47617
47581
|
checkInflectionPoints(check) {
|
|
47618
47582
|
return this.batchValidations((rule) => check(rule.lowerInflectionPoint, "lowerInflectionPoint"), (rule) => check(rule.upperInflectionPoint, "upperInflectionPoint"));
|
|
@@ -47624,8 +47588,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47624
47588
|
"number",
|
|
47625
47589
|
"percentage",
|
|
47626
47590
|
"percentile"
|
|
47627
|
-
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return
|
|
47628
|
-
return
|
|
47591
|
+
].includes(rule.lowerInflectionPoint.type) && rule.lowerInflectionPoint.type === rule.upperInflectionPoint.type && Number(minValue) > Number(maxValue)) return "LowerBiggerThanUpper";
|
|
47592
|
+
return "Success";
|
|
47629
47593
|
}
|
|
47630
47594
|
checkMinBiggerThanMax(rule) {
|
|
47631
47595
|
const minValue = rule.minimum.value;
|
|
@@ -47634,8 +47598,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47634
47598
|
"number",
|
|
47635
47599
|
"percentage",
|
|
47636
47600
|
"percentile"
|
|
47637
|
-
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return
|
|
47638
|
-
return
|
|
47601
|
+
].includes(rule.minimum.type) && rule.minimum.type === rule.maximum.type && stringToNumber(minValue) >= stringToNumber(maxValue)) return "MinBiggerThanMax";
|
|
47602
|
+
return "Success";
|
|
47639
47603
|
}
|
|
47640
47604
|
checkMidBiggerThanMax(rule) {
|
|
47641
47605
|
const midValue = rule.midpoint?.value;
|
|
@@ -47644,8 +47608,8 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47644
47608
|
"number",
|
|
47645
47609
|
"percentage",
|
|
47646
47610
|
"percentile"
|
|
47647
|
-
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return
|
|
47648
|
-
return
|
|
47611
|
+
].includes(rule.midpoint.type) && rule.midpoint.type === rule.maximum.type && stringToNumber(midValue) >= stringToNumber(maxValue)) return "MidBiggerThanMax";
|
|
47612
|
+
return "Success";
|
|
47649
47613
|
}
|
|
47650
47614
|
checkMinBiggerThanMid(rule) {
|
|
47651
47615
|
const minValue = rule.minimum.value;
|
|
@@ -47654,15 +47618,15 @@ var ConditionalFormatPlugin = class extends CorePlugin {
|
|
|
47654
47618
|
"number",
|
|
47655
47619
|
"percentage",
|
|
47656
47620
|
"percentile"
|
|
47657
|
-
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return
|
|
47658
|
-
return
|
|
47621
|
+
].includes(rule.midpoint.type) && rule.minimum.type === rule.midpoint.type && stringToNumber(minValue) >= stringToNumber(midValue)) return "MinBiggerThanMid";
|
|
47622
|
+
return "Success";
|
|
47659
47623
|
}
|
|
47660
47624
|
checkCFValues(rule) {
|
|
47661
47625
|
for (const value of rule.values) {
|
|
47662
47626
|
if (!value.startsWith("=")) continue;
|
|
47663
|
-
if (compile(value || "").isBadExpression) return
|
|
47627
|
+
if (compile(value || "").isBadExpression) return "ValueCellIsInvalidFormula";
|
|
47664
47628
|
}
|
|
47665
|
-
return
|
|
47629
|
+
return "Success";
|
|
47666
47630
|
}
|
|
47667
47631
|
removeConditionalFormatting(id, sheet) {
|
|
47668
47632
|
const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
|
|
@@ -47725,14 +47689,14 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47725
47689
|
allowDispatch(cmd) {
|
|
47726
47690
|
switch (cmd.type) {
|
|
47727
47691
|
case "ADD_DATA_VALIDATION_RULE":
|
|
47728
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
47692
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
47729
47693
|
return this.checkValidations(cmd, this.chainValidations(this.checkEmptyRange, this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
47730
47694
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
47731
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
47732
|
-
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return
|
|
47695
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
47696
|
+
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) return "UnknownDataValidationRule";
|
|
47733
47697
|
break;
|
|
47734
47698
|
}
|
|
47735
|
-
return
|
|
47699
|
+
return "Success";
|
|
47736
47700
|
}
|
|
47737
47701
|
handle(cmd) {
|
|
47738
47702
|
switch (cmd.type) {
|
|
@@ -47841,7 +47805,7 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47841
47805
|
}
|
|
47842
47806
|
}
|
|
47843
47807
|
checkEmptyRange(cmd) {
|
|
47844
|
-
return cmd.ranges.length ?
|
|
47808
|
+
return cmd.ranges.length ? "Success" : "EmptyRange";
|
|
47845
47809
|
}
|
|
47846
47810
|
import(data) {
|
|
47847
47811
|
for (const sheet of data.sheets) {
|
|
@@ -47884,13 +47848,13 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47884
47848
|
}
|
|
47885
47849
|
}
|
|
47886
47850
|
checkCriterionTypeIsValid(cmd) {
|
|
47887
|
-
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ?
|
|
47851
|
+
return dataValidationEvaluatorRegistry.contains(cmd.rule.criterion.type) ? "Success" : "UnknownDataValidationCriterionType";
|
|
47888
47852
|
}
|
|
47889
47853
|
checkCriterionHasValidNumberOfValues(cmd) {
|
|
47890
47854
|
const criterion = cmd.rule.criterion;
|
|
47891
47855
|
const expectedNumberOfValues = dataValidationEvaluatorRegistry.get(criterion.type).numberOfValues(criterion);
|
|
47892
|
-
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return
|
|
47893
|
-
return
|
|
47856
|
+
if (expectedNumberOfValues !== void 0 && criterion.values.length !== expectedNumberOfValues) return "InvalidNumberOfCriterionValues";
|
|
47857
|
+
return "Success";
|
|
47894
47858
|
}
|
|
47895
47859
|
checkCriterionValuesAreValid(cmd) {
|
|
47896
47860
|
const criterion = cmd.rule.criterion;
|
|
@@ -47899,8 +47863,8 @@ var DataValidationPlugin = class extends CorePlugin {
|
|
|
47899
47863
|
if (value.startsWith("=")) return evaluator.allowedValues === "onlyLiterals";
|
|
47900
47864
|
else if (evaluator.allowedValues === "onlyFormulas") return true;
|
|
47901
47865
|
else return !evaluator.isCriterionValueValid(value);
|
|
47902
|
-
})) return
|
|
47903
|
-
return
|
|
47866
|
+
})) return "InvalidDataValidationCriterionValue";
|
|
47867
|
+
return "Success";
|
|
47904
47868
|
}
|
|
47905
47869
|
};
|
|
47906
47870
|
|
|
@@ -47919,7 +47883,7 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
47919
47883
|
case "CREATE_FIGURE": return this.checkFigureDuplicate(cmd.figure.id);
|
|
47920
47884
|
case "UPDATE_FIGURE":
|
|
47921
47885
|
case "DELETE_FIGURE": return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
47922
|
-
default: return
|
|
47886
|
+
default: return "Success";
|
|
47923
47887
|
}
|
|
47924
47888
|
}
|
|
47925
47889
|
beforeHandle(cmd) {
|
|
@@ -48013,12 +47977,12 @@ var FigurePlugin = class extends CorePlugin {
|
|
|
48013
47977
|
this.history.update("figures", sheetId, id, void 0);
|
|
48014
47978
|
}
|
|
48015
47979
|
checkFigureExists(sheetId, figureId) {
|
|
48016
|
-
if (this.figures[sheetId]?.[figureId] === void 0) return
|
|
48017
|
-
return
|
|
47980
|
+
if (this.figures[sheetId]?.[figureId] === void 0) return "FigureDoesNotExist";
|
|
47981
|
+
return "Success";
|
|
48018
47982
|
}
|
|
48019
47983
|
checkFigureDuplicate(figureId) {
|
|
48020
|
-
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return
|
|
48021
|
-
return
|
|
47984
|
+
if (Object.values(this.figures).find((sheet) => sheet?.[figureId])) return "DuplicatedFigureId";
|
|
47985
|
+
return "Success";
|
|
48022
47986
|
}
|
|
48023
47987
|
getFigures(sheetId) {
|
|
48024
47988
|
const figures = [];
|
|
@@ -48152,19 +48116,19 @@ var HeaderVisibilityPlugin = class extends CorePlugin {
|
|
|
48152
48116
|
allowDispatch(cmd) {
|
|
48153
48117
|
switch (cmd.type) {
|
|
48154
48118
|
case "HIDE_COLUMNS_ROWS": {
|
|
48155
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
48119
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
48156
48120
|
const hiddenGroup = cmd.dimension === "COL" ? this.getHiddenColsGroups(cmd.sheetId) : this.getHiddenRowsGroups(cmd.sheetId);
|
|
48157
48121
|
const elements = cmd.dimension === "COL" ? this.getters.getNumberCols(cmd.sheetId) : this.getters.getNumberRows(cmd.sheetId);
|
|
48158
|
-
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return
|
|
48159
|
-
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return
|
|
48160
|
-
else return
|
|
48122
|
+
if (new Set((hiddenGroup || []).flat().concat(cmd.elements)).size >= elements) return "TooManyHiddenElements";
|
|
48123
|
+
else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) return "InvalidHeaderIndex";
|
|
48124
|
+
else return "Success";
|
|
48161
48125
|
}
|
|
48162
48126
|
case "REMOVE_COLUMNS_ROWS":
|
|
48163
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
48164
|
-
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
48165
|
-
return
|
|
48127
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
48128
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
48129
|
+
return "Success";
|
|
48166
48130
|
}
|
|
48167
|
-
return
|
|
48131
|
+
return "Success";
|
|
48168
48132
|
}
|
|
48169
48133
|
handle(cmd) {
|
|
48170
48134
|
switch (cmd.type) {
|
|
@@ -48292,9 +48256,9 @@ var ImagePlugin = class extends CorePlugin {
|
|
|
48292
48256
|
allowDispatch(cmd) {
|
|
48293
48257
|
switch (cmd.type) {
|
|
48294
48258
|
case "CREATE_IMAGE":
|
|
48295
|
-
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return
|
|
48296
|
-
return
|
|
48297
|
-
default: return
|
|
48259
|
+
if (this.getters.getFigure(cmd.sheetId, cmd.figureId)) return "InvalidFigureId";
|
|
48260
|
+
return "Success";
|
|
48261
|
+
default: return "Success";
|
|
48298
48262
|
}
|
|
48299
48263
|
}
|
|
48300
48264
|
handle(cmd) {
|
|
@@ -48435,7 +48399,7 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48435
48399
|
return this.checkValidations(cmd, this.checkDestructiveMerge, this.checkOverlap, this.checkFrozenPanes);
|
|
48436
48400
|
case "UPDATE_CELL": return this.checkMergedContentUpdate(cmd);
|
|
48437
48401
|
case "REMOVE_MERGE": return this.checkMergeExists(cmd);
|
|
48438
|
-
default: return
|
|
48402
|
+
default: return "Success";
|
|
48439
48403
|
}
|
|
48440
48404
|
}
|
|
48441
48405
|
handle(cmd) {
|
|
@@ -48615,18 +48579,18 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48615
48579
|
return range !== void 0 ? rangeToMerge(mergeId, range) : void 0;
|
|
48616
48580
|
}
|
|
48617
48581
|
checkDestructiveMerge({ sheetId, target }) {
|
|
48618
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
48619
|
-
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ?
|
|
48582
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
48583
|
+
return target.some((zone) => this.isMergeDestructive(sheetId, zone)) ? "MergeIsDestructive" : "Success";
|
|
48620
48584
|
}
|
|
48621
48585
|
checkOverlap({ target }) {
|
|
48622
|
-
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return
|
|
48623
|
-
return
|
|
48586
|
+
for (const zone of target) for (const zone2 of target) if (zone !== zone2 && overlap(zone, zone2)) return "MergeOverlap";
|
|
48587
|
+
return "Success";
|
|
48624
48588
|
}
|
|
48625
48589
|
checkFrozenPanes({ sheetId, target }) {
|
|
48626
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
48590
|
+
if (!this.getters.tryGetSheet(sheetId)) return "Success";
|
|
48627
48591
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
48628
|
-
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return
|
|
48629
|
-
return
|
|
48592
|
+
for (const zone of target) if (zone.left < xSplit && zone.right >= xSplit || zone.top < ySplit && zone.bottom >= ySplit) return "FrozenPaneOverlap";
|
|
48593
|
+
return "Success";
|
|
48630
48594
|
}
|
|
48631
48595
|
/**
|
|
48632
48596
|
* The content of a merged cell should always be empty.
|
|
@@ -48634,10 +48598,10 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48634
48598
|
*/
|
|
48635
48599
|
checkMergedContentUpdate(cmd) {
|
|
48636
48600
|
const { col, row, content } = cmd;
|
|
48637
|
-
if (content === void 0) return
|
|
48601
|
+
if (content === void 0) return "Success";
|
|
48638
48602
|
const { col: mainCol, row: mainRow } = this.getMainCellPosition(cmd);
|
|
48639
|
-
if (mainCol === col && mainRow === row) return
|
|
48640
|
-
return
|
|
48603
|
+
if (mainCol === col && mainRow === row) return "Success";
|
|
48604
|
+
return "CellIsMerged";
|
|
48641
48605
|
}
|
|
48642
48606
|
checkMergeExists(cmd) {
|
|
48643
48607
|
const { sheetId, target } = cmd;
|
|
@@ -48648,9 +48612,9 @@ var MergePlugin = class extends CorePlugin {
|
|
|
48648
48612
|
col: left,
|
|
48649
48613
|
row: top
|
|
48650
48614
|
});
|
|
48651
|
-
if (merge === void 0 || !isEqual(zone, merge)) return
|
|
48615
|
+
if (merge === void 0 || !isEqual(zone, merge)) return "InvalidTarget";
|
|
48652
48616
|
}
|
|
48653
|
-
return
|
|
48617
|
+
return "Success";
|
|
48654
48618
|
}
|
|
48655
48619
|
/**
|
|
48656
48620
|
* Merge the current selection. Note that:
|
|
@@ -48798,8 +48762,8 @@ var RangeAdapter = class {
|
|
|
48798
48762
|
"removeRangesSheetPrefix"
|
|
48799
48763
|
];
|
|
48800
48764
|
allowDispatch(cmd) {
|
|
48801
|
-
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ?
|
|
48802
|
-
return
|
|
48765
|
+
if (cmd.type === "MOVE_RANGES") return cmd.target.length === 1 ? "Success" : "InvalidZones";
|
|
48766
|
+
return "Success";
|
|
48803
48767
|
}
|
|
48804
48768
|
beforeHandle(command) {}
|
|
48805
48769
|
handle(cmd) {
|
|
@@ -49208,40 +49172,40 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49208
49172
|
cellPosition = {};
|
|
49209
49173
|
allowDispatch(cmd) {
|
|
49210
49174
|
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
49211
|
-
if (genericChecks !==
|
|
49175
|
+
if (genericChecks !== "Success") return genericChecks;
|
|
49212
49176
|
switch (cmd.type) {
|
|
49213
49177
|
case "HIDE_SHEET":
|
|
49214
|
-
if (this.getVisibleSheetIds().length === 1) return
|
|
49215
|
-
return
|
|
49178
|
+
if (this.getVisibleSheetIds().length === 1) return "NotEnoughSheets";
|
|
49179
|
+
return "Success";
|
|
49216
49180
|
case "CREATE_SHEET": return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
49217
49181
|
case "DUPLICATE_SHEET":
|
|
49218
|
-
if (this.sheets[cmd.sheetIdTo]) return
|
|
49219
|
-
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return
|
|
49220
|
-
return
|
|
49182
|
+
if (this.sheets[cmd.sheetIdTo]) return "DuplicatedSheetId";
|
|
49183
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo)) return "DuplicatedSheetName";
|
|
49184
|
+
return "Success";
|
|
49221
49185
|
case "MOVE_SHEET": try {
|
|
49222
49186
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
49223
49187
|
this.findIndexOfTargetSheet(currentIndex, cmd.delta);
|
|
49224
|
-
return
|
|
49188
|
+
return "Success";
|
|
49225
49189
|
} catch (e) {
|
|
49226
|
-
return
|
|
49190
|
+
return "WrongSheetMove";
|
|
49227
49191
|
}
|
|
49228
49192
|
case "RENAME_SHEET": return this.isRenameAllowed(cmd);
|
|
49229
|
-
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ?
|
|
49230
|
-
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ?
|
|
49193
|
+
case "COLOR_SHEET": return !cmd.color || isColorValid(cmd.color) ? "Success" : "InvalidColor";
|
|
49194
|
+
case "DELETE_SHEET": return this.getVisibleSheetIds().length > 1 ? "Success" : "NotEnoughSheets";
|
|
49231
49195
|
case "ADD_COLUMNS_ROWS":
|
|
49232
|
-
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return
|
|
49233
|
-
else if (cmd.quantity <= 0) return
|
|
49234
|
-
return
|
|
49196
|
+
if (!this.doesHeaderExist(cmd.sheetId, cmd.dimension, cmd.base)) return "InvalidHeaderIndex";
|
|
49197
|
+
else if (cmd.quantity <= 0) return "InvalidQuantity";
|
|
49198
|
+
return "Success";
|
|
49235
49199
|
case "REMOVE_COLUMNS_ROWS": {
|
|
49236
49200
|
const min = largeMin(cmd.elements);
|
|
49237
49201
|
const max = largeMax(cmd.elements);
|
|
49238
|
-
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return
|
|
49239
|
-
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return
|
|
49240
|
-
else return
|
|
49202
|
+
if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) return "InvalidHeaderIndex";
|
|
49203
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) return "NotEnoughElements";
|
|
49204
|
+
else return "Success";
|
|
49241
49205
|
}
|
|
49242
49206
|
case "FREEZE_ROWS": return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
|
|
49243
49207
|
case "FREEZE_COLUMNS": return this.checkValidations(cmd, this.checkColFreezeQuantity, this.checkColFreezeOverlapMerge);
|
|
49244
|
-
default: return
|
|
49208
|
+
default: return "Success";
|
|
49245
49209
|
}
|
|
49246
49210
|
}
|
|
49247
49211
|
handle(cmd) {
|
|
@@ -49504,12 +49468,12 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49504
49468
|
* not outside the sheet.
|
|
49505
49469
|
*/
|
|
49506
49470
|
checkZonesExistInSheet(sheetId, zones) {
|
|
49507
|
-
if (!zones.every(isZoneValid)) return
|
|
49471
|
+
if (!zones.every(isZoneValid)) return "InvalidRange";
|
|
49508
49472
|
if (zones.length) {
|
|
49509
49473
|
const sheetZone = this.getSheetZone(sheetId);
|
|
49510
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone)) ?
|
|
49474
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone)) ? "Success" : "TargetOutOfSheet";
|
|
49511
49475
|
}
|
|
49512
|
-
return
|
|
49476
|
+
return "Success";
|
|
49513
49477
|
}
|
|
49514
49478
|
updateCellPosition(cmd) {
|
|
49515
49479
|
const { sheetId, cellId, col, row } = cmd;
|
|
@@ -49583,36 +49547,36 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49583
49547
|
}
|
|
49584
49548
|
checkSheetName(cmd) {
|
|
49585
49549
|
const originalSheetName = this.getters.tryGetSheetName(cmd.sheetId);
|
|
49586
|
-
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return
|
|
49550
|
+
if (originalSheetName !== void 0 && cmd.name === originalSheetName) return "UnchangedSheetName";
|
|
49587
49551
|
const { orderedSheetIds, sheets } = this;
|
|
49588
49552
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
49589
|
-
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return
|
|
49590
|
-
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return
|
|
49591
|
-
return
|
|
49553
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) return "DuplicatedSheetName";
|
|
49554
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) return "ForbiddenCharactersInSheetName";
|
|
49555
|
+
return "Success";
|
|
49592
49556
|
}
|
|
49593
49557
|
checkSheetPosition(cmd) {
|
|
49594
49558
|
const { orderedSheetIds } = this;
|
|
49595
|
-
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return
|
|
49596
|
-
return
|
|
49559
|
+
if (cmd.position > orderedSheetIds.length || cmd.position < 0) return "WrongSheetPosition";
|
|
49560
|
+
return "Success";
|
|
49597
49561
|
}
|
|
49598
49562
|
checkRowFreezeQuantity(cmd) {
|
|
49599
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ?
|
|
49563
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberRows(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
49600
49564
|
}
|
|
49601
49565
|
checkColFreezeQuantity(cmd) {
|
|
49602
|
-
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ?
|
|
49566
|
+
return cmd.quantity >= 1 && cmd.quantity < this.getNumberCols(cmd.sheetId) ? "Success" : "InvalidFreezeQuantity";
|
|
49603
49567
|
}
|
|
49604
49568
|
checkRowFreezeOverlapMerge(cmd) {
|
|
49605
49569
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
49606
|
-
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return
|
|
49607
|
-
return
|
|
49570
|
+
for (const merge of merges) if (merge.top < cmd.quantity && cmd.quantity <= merge.bottom) return "MergeOverlap";
|
|
49571
|
+
return "Success";
|
|
49608
49572
|
}
|
|
49609
49573
|
checkColFreezeOverlapMerge(cmd) {
|
|
49610
49574
|
const merges = this.getters.getMerges(cmd.sheetId);
|
|
49611
|
-
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return
|
|
49612
|
-
return
|
|
49575
|
+
for (const merge of merges) if (merge.left < cmd.quantity && cmd.quantity <= merge.right) return "MergeOverlap";
|
|
49576
|
+
return "Success";
|
|
49613
49577
|
}
|
|
49614
49578
|
isRenameAllowed(cmd) {
|
|
49615
|
-
if (!(cmd.name && cmd.name.trim().toLowerCase())) return
|
|
49579
|
+
if (!(cmd.name && cmd.name.trim().toLowerCase())) return "MissingSheetName";
|
|
49616
49580
|
return this.checkSheetName(cmd);
|
|
49617
49581
|
}
|
|
49618
49582
|
renameSheet(sheet, name) {
|
|
@@ -49834,17 +49798,17 @@ var SheetPlugin = class extends CorePlugin {
|
|
|
49834
49798
|
* sheet.
|
|
49835
49799
|
*/
|
|
49836
49800
|
checkSheetExists(cmd) {
|
|
49837
|
-
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return
|
|
49838
|
-
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return
|
|
49839
|
-
return
|
|
49801
|
+
if (cmd.type !== "CREATE_SHEET" && "sheetId" in cmd && this.sheets[cmd.sheetId] === void 0) return "InvalidSheetId";
|
|
49802
|
+
else if (cmd.type === "CREATE_SHEET" && this.sheets[cmd.sheetId] !== void 0) return "DuplicatedSheetId";
|
|
49803
|
+
return "Success";
|
|
49840
49804
|
}
|
|
49841
49805
|
/**
|
|
49842
49806
|
* Check if zones in the command are well formed and
|
|
49843
49807
|
* not outside the sheet.
|
|
49844
49808
|
*/
|
|
49845
49809
|
checkZonesAreInSheet(cmd) {
|
|
49846
|
-
if (!("sheetId" in cmd)) return
|
|
49847
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
49810
|
+
if (!("sheetId" in cmd)) return "Success";
|
|
49811
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
49848
49812
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
49849
49813
|
}
|
|
49850
49814
|
};
|
|
@@ -49866,21 +49830,21 @@ var TablePlugin = class extends CorePlugin {
|
|
|
49866
49830
|
allowDispatch(cmd) {
|
|
49867
49831
|
switch (cmd.type) {
|
|
49868
49832
|
case "CREATE_TABLE":
|
|
49869
|
-
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return
|
|
49833
|
+
if (cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId) || rangeData._sheetId !== cmd.sheetId)) return "InvalidSheetId";
|
|
49870
49834
|
const zones = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone);
|
|
49871
|
-
if (!areZonesContinuous(zones)) return
|
|
49872
|
-
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ?
|
|
49835
|
+
if (!areZonesContinuous(zones)) return "NonContinuousTargets";
|
|
49836
|
+
return this.checkValidations(cmd, (cmd) => this.getTablesOverlappingZones(cmd.sheetId, zones).length ? "TableOverlap" : "Success", (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
49873
49837
|
case "UPDATE_TABLE":
|
|
49874
|
-
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return
|
|
49838
|
+
if (!this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone)) return "TableNotFound";
|
|
49875
49839
|
return this.checkValidations(cmd, this.checkUpdatedTableZoneIsValid, (cmd) => this.checkTableConfigUpdateIsValid(cmd.config));
|
|
49876
49840
|
case "ADD_MERGE":
|
|
49877
49841
|
for (const table of this.getCoreTables(cmd.sheetId)) {
|
|
49878
49842
|
const tableZone = table.range.zone;
|
|
49879
|
-
for (const merge of cmd.target) if (overlap(tableZone, merge)) return
|
|
49843
|
+
for (const merge of cmd.target) if (overlap(tableZone, merge)) return "MergeInTable";
|
|
49880
49844
|
}
|
|
49881
49845
|
break;
|
|
49882
49846
|
}
|
|
49883
|
-
return
|
|
49847
|
+
return "Success";
|
|
49884
49848
|
}
|
|
49885
49849
|
handle(cmd) {
|
|
49886
49850
|
switch (cmd.type) {
|
|
@@ -50018,19 +49982,19 @@ var TablePlugin = class extends CorePlugin {
|
|
|
50018
49982
|
}
|
|
50019
49983
|
}
|
|
50020
49984
|
checkUpdatedTableZoneIsValid(cmd) {
|
|
50021
|
-
if (!cmd.newTableRange) return
|
|
49985
|
+
if (!cmd.newTableRange) return "Success";
|
|
50022
49986
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
50023
49987
|
const zoneIsInSheet = this.getters.checkZonesExistInSheet(cmd.sheetId, [newTableZone]);
|
|
50024
|
-
if (zoneIsInSheet !==
|
|
49988
|
+
if (zoneIsInSheet !== "Success") return zoneIsInSheet;
|
|
50025
49989
|
const updatedTable = this.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
50026
|
-
if (!updatedTable) return
|
|
50027
|
-
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ?
|
|
49990
|
+
if (!updatedTable) return "TableNotFound";
|
|
49991
|
+
return this.getTablesOverlappingZones(cmd.sheetId, [newTableZone]).filter((table) => table.id !== updatedTable.id).length ? "TableOverlap" : "Success";
|
|
50028
49992
|
}
|
|
50029
49993
|
checkTableConfigUpdateIsValid(config) {
|
|
50030
|
-
if (!config) return
|
|
50031
|
-
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return
|
|
50032
|
-
if (config.hasFilters && config.numberOfHeaders === 0) return
|
|
50033
|
-
return
|
|
49994
|
+
if (!config) return "Success";
|
|
49995
|
+
if (config.numberOfHeaders !== void 0 && config.numberOfHeaders < 0) return "InvalidTableConfig";
|
|
49996
|
+
if (config.hasFilters && config.numberOfHeaders === 0) return "InvalidTableConfig";
|
|
49997
|
+
return "Success";
|
|
50034
49998
|
}
|
|
50035
49999
|
createStaticTable(id, type, tableRange, config, filters) {
|
|
50036
50000
|
const zone = tableRange.zone;
|
|
@@ -50261,28 +50225,28 @@ var HeaderGroupingPlugin = class extends CorePlugin {
|
|
|
50261
50225
|
switch (cmd.type) {
|
|
50262
50226
|
case "GROUP_HEADERS": {
|
|
50263
50227
|
const { start, end, sheetId } = cmd;
|
|
50264
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50265
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
50266
|
-
if (start > end) return
|
|
50267
|
-
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return
|
|
50228
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50229
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
50230
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
50231
|
+
if (this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, start, end)) return "HeaderGroupAlreadyExists";
|
|
50268
50232
|
break;
|
|
50269
50233
|
}
|
|
50270
50234
|
case "UNGROUP_HEADERS": {
|
|
50271
50235
|
const { start, end, sheetId } = cmd;
|
|
50272
|
-
if (!this.getters.tryGetSheet(sheetId)) return
|
|
50273
|
-
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return
|
|
50274
|
-
if (start > end) return
|
|
50236
|
+
if (!this.getters.tryGetSheet(sheetId)) return "InvalidSheetId";
|
|
50237
|
+
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) return "InvalidHeaderGroupStartEnd";
|
|
50238
|
+
if (start > end) return "InvalidHeaderGroupStartEnd";
|
|
50275
50239
|
break;
|
|
50276
50240
|
}
|
|
50277
50241
|
case "UNFOLD_HEADER_GROUP":
|
|
50278
50242
|
case "FOLD_HEADER_GROUP":
|
|
50279
|
-
if (!this.getters.tryGetSheet(cmd.sheetId)) return
|
|
50243
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) return "InvalidSheetId";
|
|
50280
50244
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
50281
|
-
if (!group) return
|
|
50282
|
-
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
|
|
50245
|
+
if (!group) return "UnknownHeaderGroup";
|
|
50246
|
+
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";
|
|
50283
50247
|
break;
|
|
50284
50248
|
}
|
|
50285
|
-
return
|
|
50249
|
+
return "Success";
|
|
50286
50250
|
}
|
|
50287
50251
|
handle(cmd) {
|
|
50288
50252
|
switch (cmd.type) {
|
|
@@ -50611,22 +50575,22 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
50611
50575
|
switch (cmd.type) {
|
|
50612
50576
|
case "ADD_PIVOT": return this.checkDuplicatedMeasureIds(cmd.pivot);
|
|
50613
50577
|
case "UPDATE_PIVOT":
|
|
50614
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50615
|
-
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return
|
|
50616
|
-
if (cmd.pivot.name === "") return
|
|
50578
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50579
|
+
if (deepEquals(cmd.pivot, this.pivots[cmd.pivotId]?.definition)) return "NoChanges";
|
|
50580
|
+
if (cmd.pivot.name === "") return "EmptyName";
|
|
50617
50581
|
return this.checkDuplicatedMeasureIds(cmd.pivot);
|
|
50618
50582
|
case "RENAME_PIVOT":
|
|
50619
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50620
|
-
if (cmd.name === "") return
|
|
50583
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50584
|
+
if (cmd.name === "") return "EmptyName";
|
|
50621
50585
|
break;
|
|
50622
50586
|
case "REMOVE_PIVOT":
|
|
50623
50587
|
case "DUPLICATE_PIVOT":
|
|
50624
50588
|
case "INSERT_PIVOT":
|
|
50625
|
-
if (!(cmd.pivotId in this.pivots)) return
|
|
50589
|
+
if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50626
50590
|
break;
|
|
50627
|
-
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return
|
|
50591
|
+
case "DUPLICATE_PIVOT": if (!(cmd.pivotId in this.pivots)) return "PivotIdNotFound";
|
|
50628
50592
|
}
|
|
50629
|
-
return
|
|
50593
|
+
return "Success";
|
|
50630
50594
|
}
|
|
50631
50595
|
handle(cmd) {
|
|
50632
50596
|
switch (cmd.type) {
|
|
@@ -50824,8 +50788,8 @@ var PivotCorePlugin = class extends CorePlugin {
|
|
|
50824
50788
|
}
|
|
50825
50789
|
checkDuplicatedMeasureIds(definition) {
|
|
50826
50790
|
const uniqueIds = new Set(definition.measures.map((m) => m.id));
|
|
50827
|
-
if (definition.measures.length !== uniqueIds.size) return
|
|
50828
|
-
return
|
|
50791
|
+
if (definition.measures.length !== uniqueIds.size) return "InvalidDefinition";
|
|
50792
|
+
return "Success";
|
|
50829
50793
|
}
|
|
50830
50794
|
/**
|
|
50831
50795
|
* Import the pivots
|
|
@@ -50854,9 +50818,9 @@ var SettingsPlugin = class extends CorePlugin {
|
|
|
50854
50818
|
locale = DEFAULT_LOCALE;
|
|
50855
50819
|
allowDispatch(cmd) {
|
|
50856
50820
|
switch (cmd.type) {
|
|
50857
|
-
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ?
|
|
50821
|
+
case "UPDATE_LOCALE": return isValidLocale(cmd.locale) ? "Success" : "InvalidLocale";
|
|
50858
50822
|
}
|
|
50859
|
-
return
|
|
50823
|
+
return "Success";
|
|
50860
50824
|
}
|
|
50861
50825
|
handle(cmd) {
|
|
50862
50826
|
switch (cmd.type) {
|
|
@@ -50906,15 +50870,15 @@ var SpreadsheetPivotCorePlugin = class extends CorePlugin {
|
|
|
50906
50870
|
const definition = cmd.pivot;
|
|
50907
50871
|
return this.checkDataSetValidity(definition);
|
|
50908
50872
|
}
|
|
50909
|
-
return
|
|
50873
|
+
return "Success";
|
|
50910
50874
|
}
|
|
50911
50875
|
checkDataSetValidity(definition) {
|
|
50912
50876
|
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
50913
50877
|
const { zone, sheetId } = definition.dataSet;
|
|
50914
|
-
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return
|
|
50878
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) return "InvalidDataSet";
|
|
50915
50879
|
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
50916
50880
|
}
|
|
50917
|
-
return
|
|
50881
|
+
return "Success";
|
|
50918
50882
|
}
|
|
50919
50883
|
};
|
|
50920
50884
|
|
|
@@ -50932,18 +50896,18 @@ var TableStylePlugin = class extends CorePlugin {
|
|
|
50932
50896
|
switch (cmd.type) {
|
|
50933
50897
|
case "CREATE_TABLE":
|
|
50934
50898
|
case "UPDATE_TABLE":
|
|
50935
|
-
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return
|
|
50899
|
+
if (cmd.config?.styleId && !this.styles[cmd.config.styleId]) return "InvalidTableConfig";
|
|
50936
50900
|
break;
|
|
50937
50901
|
case "CREATE_TABLE_STYLE":
|
|
50938
|
-
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return
|
|
50902
|
+
if (!TABLE_STYLES_TEMPLATES[cmd.templateName]) return "InvalidTableStyle";
|
|
50939
50903
|
try {
|
|
50940
50904
|
toHex(cmd.primaryColor);
|
|
50941
50905
|
} catch (e) {
|
|
50942
|
-
return
|
|
50906
|
+
return "InvalidTableStyle";
|
|
50943
50907
|
}
|
|
50944
50908
|
break;
|
|
50945
50909
|
}
|
|
50946
|
-
return
|
|
50910
|
+
return "Success";
|
|
50947
50911
|
}
|
|
50948
50912
|
handle(cmd) {
|
|
50949
50913
|
switch (cmd.type) {
|
|
@@ -51045,6 +51009,8 @@ function buildCompilationParameters(context, getters, computeCell) {
|
|
|
51045
51009
|
return new CompilationParametersBuilder(context, getters, computeCell).getParameters();
|
|
51046
51010
|
}
|
|
51047
51011
|
var CompilationParametersBuilder = class {
|
|
51012
|
+
getters;
|
|
51013
|
+
computeCell;
|
|
51048
51014
|
evalContext;
|
|
51049
51015
|
rangeCache = {};
|
|
51050
51016
|
constructor(context, getters, computeCell) {
|
|
@@ -51682,6 +51648,7 @@ var ZoneRBush = class extends import_rbush.default {
|
|
|
51682
51648
|
* It uses an R-Tree data structure to efficiently find dependent cells.
|
|
51683
51649
|
*/
|
|
51684
51650
|
var FormulaDependencyGraph = class {
|
|
51651
|
+
createEmptyPositionSet;
|
|
51685
51652
|
dependencies = new PositionMap();
|
|
51686
51653
|
rTree;
|
|
51687
51654
|
constructor(createEmptyPositionSet, data = []) {
|
|
@@ -51983,6 +51950,7 @@ const MAX_ITERATION = 30;
|
|
|
51983
51950
|
const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
|
|
51984
51951
|
const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
|
|
51985
51952
|
var Evaluator = class {
|
|
51953
|
+
context;
|
|
51986
51954
|
getters;
|
|
51987
51955
|
compilationParams;
|
|
51988
51956
|
evaluatedCells = new PositionMap();
|
|
@@ -52001,7 +51969,7 @@ var Evaluator = class {
|
|
|
52001
51969
|
const spreadZone = this.spreadingRelations.getArrayResultZone(position);
|
|
52002
51970
|
if (!spreadZone) return;
|
|
52003
51971
|
const evaluatedCell = this.evaluatedCells.get(position);
|
|
52004
|
-
if (evaluatedCell?.type ===
|
|
51972
|
+
if (evaluatedCell?.type === "error" && !(options.ignoreSpillError && evaluatedCell?.value === CellErrorType.SpilledBlocked)) return positionToZone(position);
|
|
52005
51973
|
return union(positionToZone(position), spreadZone);
|
|
52006
51974
|
}
|
|
52007
51975
|
getEvaluatedPositions() {
|
|
@@ -52011,7 +51979,7 @@ var Evaluator = class {
|
|
|
52011
51979
|
return this.evaluatedCells.keysForSheet(sheetId);
|
|
52012
51980
|
}
|
|
52013
51981
|
getArrayFormulaSpreadingOn(position) {
|
|
52014
|
-
if (this.getEvaluatedCell(position).type ===
|
|
51982
|
+
if (this.getEvaluatedCell(position).type === "empty") return;
|
|
52015
51983
|
const arrayFormulas = this.spreadingRelations.searchFormulaPositionsSpreadingOn(position.sheetId, positionToZone(position));
|
|
52016
51984
|
return Array.from(arrayFormulas).find((position) => !this.blockedArrayFormulas.has(position));
|
|
52017
51985
|
}
|
|
@@ -52244,7 +52212,7 @@ var Evaluator = class {
|
|
|
52244
52212
|
col: i + col,
|
|
52245
52213
|
row: j + row
|
|
52246
52214
|
};
|
|
52247
|
-
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !==
|
|
52215
|
+
if (this.getters.getCell(position)?.content || this.getters.getEvaluatedCell(position).type !== "empty") {
|
|
52248
52216
|
this.blockedArrayFormulas.add(formulaPosition);
|
|
52249
52217
|
throw new SplillBlockedError(_t("Array result was not expanded because it would overwrite data in %s.", toXC(position.col, position.row)));
|
|
52250
52218
|
}
|
|
@@ -52470,7 +52438,7 @@ var EvaluationPlugin = class extends UIPlugin {
|
|
|
52470
52438
|
sheetId,
|
|
52471
52439
|
col,
|
|
52472
52440
|
row
|
|
52473
|
-
})).every((cell) => cell.type ===
|
|
52441
|
+
})).every((cell) => cell.type === "empty");
|
|
52474
52442
|
}
|
|
52475
52443
|
/**
|
|
52476
52444
|
* Maps the visible positions of a range according to a provided callback
|
|
@@ -52924,7 +52892,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52924
52892
|
return computedDataBars;
|
|
52925
52893
|
}
|
|
52926
52894
|
parsePoint(sheetId, range, threshold, functionName) {
|
|
52927
|
-
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type ===
|
|
52895
|
+
const rangeValues = this.getters.getEvaluatedCellsInZone(sheetId, this.getters.getRangeFromSheetXC(sheetId, range).zone).filter((cell) => cell.type === "number").map((cell) => cell.value);
|
|
52928
52896
|
switch (threshold.type) {
|
|
52929
52897
|
case "value": return functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
|
|
52930
52898
|
case "number": return Number(threshold.value);
|
|
@@ -52955,7 +52923,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52955
52923
|
col,
|
|
52956
52924
|
row
|
|
52957
52925
|
});
|
|
52958
|
-
if (cell.type !==
|
|
52926
|
+
if (cell.type !== "number") continue;
|
|
52959
52927
|
const icon = this.computeIcon(cell.value, upperInflectionPoint, rule.upperInflectionPoint.operator, lowerInflectionPoint, rule.lowerInflectionPoint.operator, iconSet);
|
|
52960
52928
|
if (!computedIcons[col]) computedIcons[col] = [];
|
|
52961
52929
|
computedIcons[col][row] = icon;
|
|
@@ -52968,7 +52936,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52968
52936
|
}
|
|
52969
52937
|
applyDataBar(sheetId, range, rule, computedDataBars) {
|
|
52970
52938
|
const rangeValues = this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues || range);
|
|
52971
|
-
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type ===
|
|
52939
|
+
const max = largeMax(this.getters.getEvaluatedCellsInZone(sheetId, rangeValues.zone).filter((cell) => cell.type === "number").map((cell) => cell.value));
|
|
52972
52940
|
if (max <= 0) return;
|
|
52973
52941
|
const color = rule.color;
|
|
52974
52942
|
const zone = this.getters.getRangeFromSheetXC(sheetId, range).zone;
|
|
@@ -52981,7 +52949,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
52981
52949
|
col: targetCol,
|
|
52982
52950
|
row: targetRow
|
|
52983
52951
|
});
|
|
52984
|
-
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !==
|
|
52952
|
+
if (!isInside(targetCol, targetRow, zoneOfValues) || cell.type !== "number" || cell.value <= 0) continue;
|
|
52985
52953
|
if (!computedDataBars[col]) computedDataBars[col] = [];
|
|
52986
52954
|
computedDataBars[col][row] = {
|
|
52987
52955
|
color: colorNumberString(color),
|
|
@@ -53019,7 +52987,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
53019
52987
|
col,
|
|
53020
52988
|
row
|
|
53021
52989
|
});
|
|
53022
|
-
if (cell.type ===
|
|
52990
|
+
if (cell.type === "number") {
|
|
53023
52991
|
const value = clip(cell.value, minValue, maxValue);
|
|
53024
52992
|
let color;
|
|
53025
52993
|
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);
|
|
@@ -53053,7 +53021,7 @@ var EvaluationConditionalFormatPlugin = class extends UIPlugin {
|
|
|
53053
53021
|
*/
|
|
53054
53022
|
rulePredicate = { CellIsRule: (target, rule) => {
|
|
53055
53023
|
const cell = this.getters.getEvaluatedCell(target);
|
|
53056
|
-
if (cell.type ===
|
|
53024
|
+
if (cell.type === "error") return false;
|
|
53057
53025
|
let [value0, value1] = rule.values.map((val) => {
|
|
53058
53026
|
if (val.startsWith("=")) return this.getters.evaluateFormula(target.sheetId, val) ?? "";
|
|
53059
53027
|
return parseLiteral(val, DEFAULT_LOCALE);
|
|
@@ -53163,7 +53131,7 @@ var EvaluationDataValidationPlugin = class extends UIPlugin {
|
|
|
53163
53131
|
if (!validationResults[col]) validationResults[col] = [];
|
|
53164
53132
|
validationResults[col][row] = lazy(() => {
|
|
53165
53133
|
const evaluatedCell = this.getters.getEvaluatedCell(cellPosition);
|
|
53166
|
-
if (evaluatedCell.type ===
|
|
53134
|
+
if (evaluatedCell.type === "empty") return VALID_RESULT;
|
|
53167
53135
|
return this.getValidationResultForCellValue(evaluatedCell.value, cellPosition);
|
|
53168
53136
|
});
|
|
53169
53137
|
}
|
|
@@ -53978,6 +53946,7 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
53978
53946
|
"getPivot",
|
|
53979
53947
|
"getFirstPivotFunction",
|
|
53980
53948
|
"getPivotIdFromPosition",
|
|
53949
|
+
"getPivotIdsFromPosition",
|
|
53981
53950
|
"getPivotCellFromPosition",
|
|
53982
53951
|
"generateNewCalculatedMeasureName",
|
|
53983
53952
|
"isPivotUnused",
|
|
@@ -54035,37 +54004,52 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
54035
54004
|
}
|
|
54036
54005
|
}
|
|
54037
54006
|
/**
|
|
54038
|
-
* Get the id of the pivot at the given position. Returns undefined if there
|
|
54007
|
+
* Get the id of the first pivot in the formula at the given position. Returns undefined if there
|
|
54039
54008
|
* is no pivot at this position
|
|
54040
54009
|
*/
|
|
54041
54010
|
getPivotIdFromPosition(position) {
|
|
54011
|
+
return this.getPivotIdsFromPosition(position)[0];
|
|
54012
|
+
}
|
|
54013
|
+
/**
|
|
54014
|
+
* Get all of the ids of the pivot present in the formula at the given position.
|
|
54015
|
+
*/
|
|
54016
|
+
getPivotIdsFromPosition(position) {
|
|
54042
54017
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54043
|
-
if (cell && cell.isFormula)
|
|
54044
|
-
|
|
54045
|
-
|
|
54046
|
-
|
|
54047
|
-
|
|
54048
|
-
|
|
54049
|
-
|
|
54018
|
+
if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
|
|
54019
|
+
return [];
|
|
54020
|
+
}
|
|
54021
|
+
getPivotIdsFromFormula(sheetId, formula) {
|
|
54022
|
+
return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
|
|
54023
|
+
const pivotId = pivotFunction.args[0]?.toString();
|
|
54024
|
+
return pivotId && this.getters.getPivotId(pivotId);
|
|
54025
|
+
}).filter(isDefined);
|
|
54050
54026
|
}
|
|
54051
54027
|
isSpillPivotFormula(position) {
|
|
54052
54028
|
const cell = this.getters.getCorrespondingFormulaCell(position);
|
|
54053
54029
|
if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
|
|
54054
54030
|
return false;
|
|
54055
54031
|
}
|
|
54056
|
-
|
|
54057
|
-
const
|
|
54058
|
-
if (!
|
|
54059
|
-
const
|
|
54060
|
-
|
|
54061
|
-
functionName,
|
|
54062
|
-
|
|
54032
|
+
getPivotFunctions(sheetId, tokens) {
|
|
54033
|
+
const pivotFunctions = getPivotFunctions(tokens);
|
|
54034
|
+
if (!pivotFunctions.length) return [];
|
|
54035
|
+
const evaluatedPivotFunctions = [];
|
|
54036
|
+
for (const pivotFunction of pivotFunctions) {
|
|
54037
|
+
const { functionName, args } = pivotFunction;
|
|
54038
|
+
const evaluatedArgs = args.map((argAst) => {
|
|
54063
54039
|
if (argAst.type === "EMPTY") return;
|
|
54064
54040
|
else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
|
|
54065
54041
|
const argsString = astToFormula(argAst);
|
|
54066
54042
|
return this.getters.evaluateFormula(sheetId, argsString);
|
|
54067
|
-
})
|
|
54068
|
-
|
|
54043
|
+
});
|
|
54044
|
+
evaluatedPivotFunctions.push({
|
|
54045
|
+
functionName,
|
|
54046
|
+
args: evaluatedArgs
|
|
54047
|
+
});
|
|
54048
|
+
}
|
|
54049
|
+
return evaluatedPivotFunctions;
|
|
54050
|
+
}
|
|
54051
|
+
getFirstPivotFunction(sheetId, tokens) {
|
|
54052
|
+
return this.getPivotFunctions(sheetId, tokens)[0];
|
|
54069
54053
|
}
|
|
54070
54054
|
/**
|
|
54071
54055
|
* Returns the domain args of a pivot formula from a position.
|
|
@@ -54165,8 +54149,8 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
54165
54149
|
const unusedPivots = new Set(this.getters.getPivotIds());
|
|
54166
54150
|
for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
|
|
54167
54151
|
const position = this.getters.getCellPosition(cellId);
|
|
54168
|
-
const
|
|
54169
|
-
|
|
54152
|
+
const pivotIds = this.getPivotIdsFromPosition(position);
|
|
54153
|
+
for (const pivotId of pivotIds) {
|
|
54170
54154
|
unusedPivots.delete(pivotId);
|
|
54171
54155
|
if (!unusedPivots.size) {
|
|
54172
54156
|
this.unusedPivots = [];
|
|
@@ -54174,6 +54158,21 @@ var PivotUIPlugin = class extends UIPlugin {
|
|
|
54174
54158
|
}
|
|
54175
54159
|
}
|
|
54176
54160
|
}
|
|
54161
|
+
for (const pivotId of this.getters.getPivotIds()) {
|
|
54162
|
+
const pivot = this.getters.getPivot(pivotId);
|
|
54163
|
+
for (const measure of pivot.definition.measures) if (measure.computedBy) {
|
|
54164
|
+
const { sheetId } = measure.computedBy;
|
|
54165
|
+
const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
|
|
54166
|
+
const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
|
|
54167
|
+
for (const relatedPivotId of relatedPivotIds) {
|
|
54168
|
+
unusedPivots.delete(relatedPivotId);
|
|
54169
|
+
if (!unusedPivots.size) {
|
|
54170
|
+
this.unusedPivots = [];
|
|
54171
|
+
return [];
|
|
54172
|
+
}
|
|
54173
|
+
}
|
|
54174
|
+
}
|
|
54175
|
+
}
|
|
54177
54176
|
this.unusedPivots = [...unusedPivots];
|
|
54178
54177
|
return this.unusedPivots;
|
|
54179
54178
|
}
|
|
@@ -54250,10 +54249,10 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54250
54249
|
const sheetId = this.getters.getActiveSheetId();
|
|
54251
54250
|
this.lastCellSelected.col = cmd.col === -1 ? this.lastCellSelected.col : clip(cmd.col, 0, this.getters.getNumberCols(sheetId));
|
|
54252
54251
|
this.lastCellSelected.row = cmd.row === -1 ? this.lastCellSelected.row : clip(cmd.row, 0, this.getters.getNumberRows(sheetId));
|
|
54253
|
-
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return
|
|
54254
|
-
return
|
|
54252
|
+
if (this.lastCellSelected.col !== void 0 && this.lastCellSelected.row !== void 0) return "Success";
|
|
54253
|
+
return "InvalidAutofillSelection";
|
|
54255
54254
|
}
|
|
54256
|
-
return
|
|
54255
|
+
return "Success";
|
|
54257
54256
|
}
|
|
54258
54257
|
handle(cmd) {
|
|
54259
54258
|
switch (cmd.type) {
|
|
@@ -54285,7 +54284,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54285
54284
|
const target = this.autofillZone;
|
|
54286
54285
|
const autofillCellsData = [];
|
|
54287
54286
|
switch (this.direction) {
|
|
54288
|
-
case
|
|
54287
|
+
case "down":
|
|
54289
54288
|
for (let col = source.left; col <= source.right; col++) {
|
|
54290
54289
|
const xcs = [];
|
|
54291
54290
|
for (let row = source.top; row <= source.bottom; row++) xcs.push(toXC(col, row));
|
|
@@ -54293,7 +54292,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54293
54292
|
for (let row = target.top; row <= target.bottom; row++) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54294
54293
|
}
|
|
54295
54294
|
break;
|
|
54296
|
-
case
|
|
54295
|
+
case "up":
|
|
54297
54296
|
for (let col = source.left; col <= source.right; col++) {
|
|
54298
54297
|
const xcs = [];
|
|
54299
54298
|
for (let row = source.bottom; row >= source.top; row--) xcs.push(toXC(col, row));
|
|
@@ -54301,7 +54300,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54301
54300
|
for (let row = target.bottom; row >= target.top; row--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54302
54301
|
}
|
|
54303
54302
|
break;
|
|
54304
|
-
case
|
|
54303
|
+
case "left":
|
|
54305
54304
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54306
54305
|
const xcs = [];
|
|
54307
54306
|
for (let col = source.right; col >= source.left; col--) xcs.push(toXC(col, row));
|
|
@@ -54309,7 +54308,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54309
54308
|
for (let col = target.right; col >= target.left; col--) autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
54310
54309
|
}
|
|
54311
54310
|
break;
|
|
54312
|
-
case
|
|
54311
|
+
case "right":
|
|
54313
54312
|
for (let row = source.top; row <= source.bottom; row++) {
|
|
54314
54313
|
const xcs = [];
|
|
54315
54314
|
for (let col = source.left; col <= source.right; col++) xcs.push(toXC(col, row));
|
|
@@ -54435,19 +54434,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54435
54434
|
}
|
|
54436
54435
|
this.direction = this.getDirection(col, row);
|
|
54437
54436
|
switch (this.direction) {
|
|
54438
|
-
case
|
|
54437
|
+
case "up":
|
|
54439
54438
|
this.saveZone(row, source.top - 1, source.left, source.right);
|
|
54440
54439
|
this.steps = source.top - row;
|
|
54441
54440
|
break;
|
|
54442
|
-
case
|
|
54441
|
+
case "down":
|
|
54443
54442
|
this.saveZone(source.bottom + 1, row, source.left, source.right);
|
|
54444
54443
|
this.steps = row - source.bottom;
|
|
54445
54444
|
break;
|
|
54446
|
-
case
|
|
54445
|
+
case "left":
|
|
54447
54446
|
this.saveZone(source.top, source.bottom, col, source.left - 1);
|
|
54448
54447
|
this.steps = source.left - col;
|
|
54449
54448
|
break;
|
|
54450
|
-
case
|
|
54449
|
+
case "right":
|
|
54451
54450
|
this.saveZone(source.top, source.bottom, source.right + 1, col);
|
|
54452
54451
|
this.steps = col - source.right;
|
|
54453
54452
|
break;
|
|
@@ -54466,7 +54465,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54466
54465
|
for (let row = selection.bottom + 1; row <= autofillRow; row++) if (this.getters.getEvaluatedCell({
|
|
54467
54466
|
...activePosition,
|
|
54468
54467
|
row
|
|
54469
|
-
}).type !==
|
|
54468
|
+
}).type !== "empty") {
|
|
54470
54469
|
autofillRow = row - 1;
|
|
54471
54470
|
break;
|
|
54472
54471
|
}
|
|
@@ -54486,7 +54485,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54486
54485
|
col: col - 1,
|
|
54487
54486
|
row
|
|
54488
54487
|
};
|
|
54489
|
-
while (this.getters.getEvaluatedCell(leftPosition).type !==
|
|
54488
|
+
while (this.getters.getEvaluatedCell(leftPosition).type !== "empty") {
|
|
54490
54489
|
row += 1;
|
|
54491
54490
|
leftPosition = {
|
|
54492
54491
|
sheetId,
|
|
@@ -54503,7 +54502,7 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54503
54502
|
col: col + 1,
|
|
54504
54503
|
row
|
|
54505
54504
|
};
|
|
54506
|
-
while (this.getters.getEvaluatedCell(rightPosition).type !==
|
|
54505
|
+
while (this.getters.getEvaluatedCell(rightPosition).type !== "empty") {
|
|
54507
54506
|
row += 1;
|
|
54508
54507
|
rightPosition = {
|
|
54509
54508
|
sheetId,
|
|
@@ -54593,19 +54592,19 @@ var AutofillPlugin = class extends UIPlugin {
|
|
|
54593
54592
|
const position = {
|
|
54594
54593
|
up: {
|
|
54595
54594
|
number: source.top - row,
|
|
54596
|
-
value:
|
|
54595
|
+
value: "up"
|
|
54597
54596
|
},
|
|
54598
54597
|
down: {
|
|
54599
54598
|
number: row - source.bottom,
|
|
54600
|
-
value:
|
|
54599
|
+
value: "down"
|
|
54601
54600
|
},
|
|
54602
54601
|
left: {
|
|
54603
54602
|
number: source.left - col,
|
|
54604
|
-
value:
|
|
54603
|
+
value: "left"
|
|
54605
54604
|
},
|
|
54606
54605
|
right: {
|
|
54607
54606
|
number: col - source.right,
|
|
54608
|
-
value:
|
|
54607
|
+
value: "right"
|
|
54609
54608
|
}
|
|
54610
54609
|
};
|
|
54611
54610
|
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;
|
|
@@ -54808,7 +54807,7 @@ var AutomaticSumPlugin = class extends UIPlugin {
|
|
|
54808
54807
|
return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
|
|
54809
54808
|
}
|
|
54810
54809
|
isNumber(cell) {
|
|
54811
|
-
return cell.type ===
|
|
54810
|
+
return cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format));
|
|
54812
54811
|
}
|
|
54813
54812
|
isZoneValid(zone) {
|
|
54814
54813
|
return zone.bottom >= zone.top && zone.right >= zone.left;
|
|
@@ -55302,6 +55301,8 @@ function transformPositionWithMerge(toTransform, executed) {
|
|
|
55302
55301
|
//#endregion
|
|
55303
55302
|
//#region src/collaborative/revisions.ts
|
|
55304
55303
|
var Revision = class {
|
|
55304
|
+
rootCommand;
|
|
55305
|
+
timestamp;
|
|
55305
55306
|
id;
|
|
55306
55307
|
clientId;
|
|
55307
55308
|
_commands = [];
|
|
@@ -55338,6 +55339,9 @@ var Revision = class {
|
|
|
55338
55339
|
//#region src/collaborative/session.ts
|
|
55339
55340
|
var ClientDisconnectedError = class extends Error {};
|
|
55340
55341
|
var Session = class extends EventBus {
|
|
55342
|
+
revisions;
|
|
55343
|
+
transportService;
|
|
55344
|
+
serverRevisionId;
|
|
55341
55345
|
/**
|
|
55342
55346
|
* Positions of the others client.
|
|
55343
55347
|
*/
|
|
@@ -55803,7 +55807,7 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
55803
55807
|
switch (cmd.type) {
|
|
55804
55808
|
case "REMOVE_DUPLICATES": return this.checkValidations(cmd, this.chainValidations(this.checkSingleRangeSelected, this.checkNoMergeInZone, this.checkRangeContainsValues, this.checkColumnsIncludedInZone), this.chainValidations(this.checkNoColumnProvided, this.checkColumnsAreUnique));
|
|
55805
55809
|
}
|
|
55806
|
-
return
|
|
55810
|
+
return "Success";
|
|
55807
55811
|
}
|
|
55808
55812
|
handle(cmd) {
|
|
55809
55813
|
switch (cmd.type) {
|
|
@@ -55886,34 +55890,34 @@ var DataCleanupPlugin = class extends UIPlugin {
|
|
|
55886
55890
|
});
|
|
55887
55891
|
}
|
|
55888
55892
|
checkSingleRangeSelected() {
|
|
55889
|
-
if (this.getters.getSelectedZones().length !== 1) return
|
|
55890
|
-
return
|
|
55893
|
+
if (this.getters.getSelectedZones().length !== 1) return "MoreThanOneRangeSelected";
|
|
55894
|
+
return "Success";
|
|
55891
55895
|
}
|
|
55892
55896
|
checkNoMergeInZone() {
|
|
55893
55897
|
const sheetId = this.getters.getActiveSheetId();
|
|
55894
55898
|
const zone = this.getters.getSelectedZone();
|
|
55895
|
-
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return
|
|
55896
|
-
return
|
|
55899
|
+
if (this.getters.getMergesInZone(sheetId, zone).length > 0) return "WillRemoveExistingMerge";
|
|
55900
|
+
return "Success";
|
|
55897
55901
|
}
|
|
55898
55902
|
checkRangeContainsValues(cmd) {
|
|
55899
55903
|
const sheetId = this.getters.getActiveSheetId();
|
|
55900
55904
|
const zone = this.getters.getSelectedZone();
|
|
55901
55905
|
if (cmd.hasHeader) zone.top += 1;
|
|
55902
|
-
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return
|
|
55903
|
-
return
|
|
55906
|
+
if (this.getters.getEvaluatedCellsInZone(sheetId, zone).every((evaluatedCel) => evaluatedCel.type === "empty")) return "EmptyTarget";
|
|
55907
|
+
return "Success";
|
|
55904
55908
|
}
|
|
55905
55909
|
checkNoColumnProvided(cmd) {
|
|
55906
|
-
if (cmd.columns.length === 0) return
|
|
55907
|
-
return
|
|
55910
|
+
if (cmd.columns.length === 0) return "NoColumnsProvided";
|
|
55911
|
+
return "Success";
|
|
55908
55912
|
}
|
|
55909
55913
|
checkColumnsIncludedInZone(cmd) {
|
|
55910
55914
|
const zone = this.getters.getSelectedZone();
|
|
55911
|
-
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return
|
|
55912
|
-
return
|
|
55915
|
+
if (cmd.columns.some((colIndex) => colIndex < zone.left || colIndex > zone.right)) return "ColumnsNotIncludedInZone";
|
|
55916
|
+
return "Success";
|
|
55913
55917
|
}
|
|
55914
55918
|
checkColumnsAreUnique(cmd) {
|
|
55915
|
-
if (cmd.columns.length !== new Set(cmd.columns).size) return
|
|
55916
|
-
return
|
|
55919
|
+
if (cmd.columns.length !== new Set(cmd.columns).size) return "DuplicatesColumnsSelected";
|
|
55920
|
+
return "Success";
|
|
55917
55921
|
}
|
|
55918
55922
|
trimWhitespace() {
|
|
55919
55923
|
const zones = recomputeZones(this.getters.getSelectedZones());
|
|
@@ -56046,7 +56050,7 @@ var FormatPlugin = class extends UIPlugin {
|
|
|
56046
56050
|
getCellNumberFormat(position) {
|
|
56047
56051
|
for (const pos of [position]) {
|
|
56048
56052
|
const cell = this.getters.getEvaluatedCell(pos);
|
|
56049
|
-
if (cell.type ===
|
|
56053
|
+
if (cell.type === "number" && !(cell.format && isDateTimeFormat(cell.format))) return cell.format || createDefaultFormat(cell.value);
|
|
56050
56054
|
}
|
|
56051
56055
|
}
|
|
56052
56056
|
};
|
|
@@ -56114,11 +56118,11 @@ var InsertPivotPlugin = class extends UIPlugin {
|
|
|
56114
56118
|
allowDispatch(cmd) {
|
|
56115
56119
|
switch (cmd.type) {
|
|
56116
56120
|
case "DUPLICATE_PIVOT_IN_NEW_SHEET":
|
|
56117
|
-
if (!this.getters.isExistingPivot(cmd.pivotId)) return
|
|
56118
|
-
if (!this.getters.getPivot(cmd.pivotId).isValid()) return
|
|
56121
|
+
if (!this.getters.isExistingPivot(cmd.pivotId)) return "PivotIdNotFound";
|
|
56122
|
+
if (!this.getters.getPivot(cmd.pivotId).isValid()) return "PivotInError";
|
|
56119
56123
|
break;
|
|
56120
56124
|
}
|
|
56121
|
-
return
|
|
56125
|
+
return "Success";
|
|
56122
56126
|
}
|
|
56123
56127
|
handle(cmd) {
|
|
56124
56128
|
switch (cmd.type) {
|
|
@@ -56319,7 +56323,7 @@ var SortPlugin = class extends UIPlugin {
|
|
|
56319
56323
|
if (!isInside(cmd.col, cmd.row, cmd.zone)) throw new Error(_t("The anchor must be part of the provided zone"));
|
|
56320
56324
|
return this.checkValidations(cmd, this.checkMerge, this.checkMergeSizes);
|
|
56321
56325
|
}
|
|
56322
|
-
return
|
|
56326
|
+
return "Success";
|
|
56323
56327
|
}
|
|
56324
56328
|
handle(cmd) {
|
|
56325
56329
|
switch (cmd.type) {
|
|
@@ -56329,24 +56333,24 @@ var SortPlugin = class extends UIPlugin {
|
|
|
56329
56333
|
}
|
|
56330
56334
|
}
|
|
56331
56335
|
checkMerge({ sheetId, zone }) {
|
|
56332
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56336
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56333
56337
|
if (positions(zone).some(({ col, row }) => !this.getters.isInMerge({
|
|
56334
56338
|
sheetId,
|
|
56335
56339
|
col,
|
|
56336
56340
|
row
|
|
56337
|
-
}))) return
|
|
56338
|
-
return
|
|
56341
|
+
}))) return "InvalidSortZone";
|
|
56342
|
+
return "Success";
|
|
56339
56343
|
}
|
|
56340
56344
|
checkMergeSizes({ sheetId, zone }) {
|
|
56341
|
-
if (!this.getters.doesIntersectMerge(sheetId, zone)) return
|
|
56345
|
+
if (!this.getters.doesIntersectMerge(sheetId, zone)) return "Success";
|
|
56342
56346
|
const merges = this.getters.getMerges(sheetId).filter((merge) => overlap(merge, zone));
|
|
56343
56347
|
const mergeDimension = zoneToDimension(merges[0]);
|
|
56344
56348
|
const [widthFirst, heightFirst] = [mergeDimension.numberOfCols, mergeDimension.numberOfRows];
|
|
56345
56349
|
if (!merges.every((merge) => {
|
|
56346
56350
|
const [widthCurrent, heightCurrent] = [merge.right - merge.left + 1, merge.bottom - merge.top + 1];
|
|
56347
56351
|
return widthCurrent === widthFirst && heightCurrent === heightFirst;
|
|
56348
|
-
})) return
|
|
56349
|
-
return
|
|
56352
|
+
})) return "InvalidSortZone";
|
|
56353
|
+
return "Success";
|
|
56350
56354
|
}
|
|
56351
56355
|
/**
|
|
56352
56356
|
* This function evaluates if the top row of a provided zone can be considered as a `header`
|
|
@@ -56364,9 +56368,9 @@ var SortPlugin = class extends UIPlugin {
|
|
|
56364
56368
|
col,
|
|
56365
56369
|
row
|
|
56366
56370
|
}).type));
|
|
56367
|
-
if (cells[0][0] ===
|
|
56368
|
-
if (cells.some((item) => item[0] ===
|
|
56369
|
-
else if (cells.some((item) => item[1] !==
|
|
56371
|
+
if (cells[0][0] === "empty") cells = cells.slice(1);
|
|
56372
|
+
if (cells.some((item) => item[0] === "empty")) return false;
|
|
56373
|
+
else if (cells.some((item) => item[1] !== "empty" && item[0] !== item[1])) return true;
|
|
56370
56374
|
else return false;
|
|
56371
56375
|
}
|
|
56372
56376
|
sortZone(sheetId, anchor, zone, sortDirection, options) {
|
|
@@ -56624,7 +56628,7 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
56624
56628
|
*/
|
|
56625
56629
|
isCellEmpty(position) {
|
|
56626
56630
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
56627
|
-
return this.getters.getEvaluatedCell(mainPosition).type ===
|
|
56631
|
+
return this.getters.getEvaluatedCell(mainPosition).type === "empty";
|
|
56628
56632
|
}
|
|
56629
56633
|
getColMaxWidth(sheetId, index) {
|
|
56630
56634
|
const sizes = positions(this.getters.getColsZone(sheetId, index, index)).map((position) => this.getCellWidth({
|
|
@@ -56638,8 +56642,8 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
56638
56642
|
* sheet.
|
|
56639
56643
|
*/
|
|
56640
56644
|
checkSheetExists(cmd) {
|
|
56641
|
-
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return
|
|
56642
|
-
return
|
|
56645
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === void 0) return "InvalidSheetId";
|
|
56646
|
+
return "Success";
|
|
56643
56647
|
}
|
|
56644
56648
|
/**
|
|
56645
56649
|
* Check if zones in the command are well formed and
|
|
@@ -56647,11 +56651,11 @@ var SheetUIPlugin = class extends UIPlugin {
|
|
|
56647
56651
|
*/
|
|
56648
56652
|
checkZonesAreInSheet(cmd) {
|
|
56649
56653
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
56650
|
-
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return
|
|
56654
|
+
if ("ranges" in cmd && cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) return "InvalidSheetId";
|
|
56651
56655
|
const zones = this.getters.getCommandZones(cmd);
|
|
56652
|
-
if (!sheetId && zones.length > 0) return
|
|
56656
|
+
if (!sheetId && zones.length > 0) return "NoActiveSheet";
|
|
56653
56657
|
if (sheetId && zones.length > 0) return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
56654
|
-
return
|
|
56658
|
+
return "Success";
|
|
56655
56659
|
}
|
|
56656
56660
|
autoResizeRows(sheetId, rows) {
|
|
56657
56661
|
const rowSizes = [];
|
|
@@ -56899,7 +56903,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
56899
56903
|
...position,
|
|
56900
56904
|
content: "FALSE"
|
|
56901
56905
|
});
|
|
56902
|
-
else if (cell?.content && evaluatedCell.type ===
|
|
56906
|
+
else if (cell?.content && evaluatedCell.type === "empty") {
|
|
56903
56907
|
let value;
|
|
56904
56908
|
if (cell.content.startsWith("=")) {
|
|
56905
56909
|
const result = this.getters.evaluateFormula(position.sheetId, cell.content);
|
|
@@ -56909,7 +56913,7 @@ var DataValidationInsertionPlugin = class extends UIPlugin {
|
|
|
56909
56913
|
...position,
|
|
56910
56914
|
content: "FALSE"
|
|
56911
56915
|
});
|
|
56912
|
-
} else if (evaluatedCell.type !==
|
|
56916
|
+
} else if (evaluatedCell.type !== "boolean") this.dispatch("UPDATE_CELL", {
|
|
56913
56917
|
...position,
|
|
56914
56918
|
content: "FALSE"
|
|
56915
56919
|
});
|
|
@@ -57162,13 +57166,13 @@ var HistoryPlugin = class extends UIPlugin {
|
|
|
57162
57166
|
allowDispatch(cmd) {
|
|
57163
57167
|
switch (cmd.type) {
|
|
57164
57168
|
case "REQUEST_UNDO":
|
|
57165
|
-
if (!this.canUndo()) return
|
|
57169
|
+
if (!this.canUndo()) return "EmptyUndoStack";
|
|
57166
57170
|
break;
|
|
57167
57171
|
case "REQUEST_REDO":
|
|
57168
|
-
if (!this.canRedo()) return
|
|
57172
|
+
if (!this.canRedo()) return "EmptyRedoStack";
|
|
57169
57173
|
break;
|
|
57170
57174
|
}
|
|
57171
|
-
return
|
|
57175
|
+
return "Success";
|
|
57172
57176
|
}
|
|
57173
57177
|
handle(cmd) {
|
|
57174
57178
|
switch (cmd.type) {
|
|
@@ -57285,7 +57289,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
57285
57289
|
switch (cmd.type) {
|
|
57286
57290
|
case "SPLIT_TEXT_INTO_COLUMNS": return this.chainValidations(this.batchValidations(this.checkSingleColSelected, this.checkNonEmptySelector), this.batchValidations(this.checkNotOverwritingContent, this.checkSeparatorInSelection))(cmd);
|
|
57287
57291
|
}
|
|
57288
|
-
return
|
|
57292
|
+
return "Success";
|
|
57289
57293
|
}
|
|
57290
57294
|
handle(cmd) {
|
|
57291
57295
|
switch (cmd.type) {
|
|
@@ -57296,7 +57300,7 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
57296
57300
|
}
|
|
57297
57301
|
getAutomaticSeparator() {
|
|
57298
57302
|
const cells = this.getters.getSelectedCells();
|
|
57299
|
-
for (const cell of cells) if (cell.value && cell.type ===
|
|
57303
|
+
for (const cell of cells) if (cell.value && cell.type === "text") {
|
|
57300
57304
|
const separator = this.getAutoSeparatorForString(cell.value);
|
|
57301
57305
|
if (separator) return separator;
|
|
57302
57306
|
}
|
|
@@ -57432,24 +57436,24 @@ var SplitToColumnsPlugin = class extends UIPlugin {
|
|
|
57432
57436
|
});
|
|
57433
57437
|
}
|
|
57434
57438
|
checkSingleColSelected() {
|
|
57435
|
-
if (!this.getters.isSingleColSelected()) return
|
|
57436
|
-
return
|
|
57439
|
+
if (!this.getters.isSingleColSelected()) return "MoreThanOneColumnSelected";
|
|
57440
|
+
return "Success";
|
|
57437
57441
|
}
|
|
57438
57442
|
checkNonEmptySelector(cmd) {
|
|
57439
|
-
if (cmd.separator === "") return
|
|
57440
|
-
return
|
|
57443
|
+
if (cmd.separator === "") return "EmptySplitSeparator";
|
|
57444
|
+
return "Success";
|
|
57441
57445
|
}
|
|
57442
57446
|
checkNotOverwritingContent(cmd) {
|
|
57443
|
-
if (cmd.addNewColumns || cmd.force) return
|
|
57447
|
+
if (cmd.addNewColumns || cmd.force) return "Success";
|
|
57444
57448
|
const selection = this.getters.getSelectedZones()[0];
|
|
57445
57449
|
const splitted = this.getSplittedCols(selection, cmd.separator);
|
|
57446
|
-
if (this.willSplittedColsOverwriteContent(selection, splitted)) return
|
|
57447
|
-
return
|
|
57450
|
+
if (this.willSplittedColsOverwriteContent(selection, splitted)) return "SplitWillOverwriteContent";
|
|
57451
|
+
return "Success";
|
|
57448
57452
|
}
|
|
57449
57453
|
checkSeparatorInSelection({ separator }) {
|
|
57450
57454
|
const cells = this.getters.getSelectedCells();
|
|
57451
|
-
for (const cell of cells) if (cell.formattedValue.includes(separator)) return
|
|
57452
|
-
return
|
|
57455
|
+
for (const cell of cells) if (cell.formattedValue.includes(separator)) return "Success";
|
|
57456
|
+
return "NoSplitSeparatorInSelection";
|
|
57453
57457
|
}
|
|
57454
57458
|
};
|
|
57455
57459
|
|
|
@@ -57486,7 +57490,7 @@ var TableAutofillPlugin = class extends UIPlugin {
|
|
|
57486
57490
|
col,
|
|
57487
57491
|
row: r,
|
|
57488
57492
|
sheetId
|
|
57489
|
-
}).type !==
|
|
57493
|
+
}).type !== "empty") return;
|
|
57490
57494
|
}
|
|
57491
57495
|
const oldSelection = {
|
|
57492
57496
|
zone: this.getters.getSelectedZone(),
|
|
@@ -57515,13 +57519,13 @@ var TableResizeUI = class extends UIPlugin {
|
|
|
57515
57519
|
switch (cmd.type) {
|
|
57516
57520
|
case "RESIZE_TABLE":
|
|
57517
57521
|
const table = this.getters.getCoreTableMatchingTopLeft(cmd.sheetId, cmd.zone);
|
|
57518
|
-
if (!table) return
|
|
57522
|
+
if (!table) return "TableNotFound";
|
|
57519
57523
|
const oldTableZone = table.range.zone;
|
|
57520
57524
|
const newTableZone = this.getters.getRangeFromRangeData(cmd.newTableRange).zone;
|
|
57521
|
-
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return
|
|
57525
|
+
if (newTableZone.top !== oldTableZone.top || newTableZone.left !== oldTableZone.left) return "InvalidTableResize";
|
|
57522
57526
|
return this.canDispatch("UPDATE_TABLE", { ...cmd }).reasons;
|
|
57523
57527
|
}
|
|
57524
|
-
return
|
|
57528
|
+
return "Success";
|
|
57525
57529
|
}
|
|
57526
57530
|
handle(cmd) {
|
|
57527
57531
|
switch (cmd.type) {
|
|
@@ -57586,7 +57590,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57586
57590
|
});
|
|
57587
57591
|
}
|
|
57588
57592
|
case "PASTE": {
|
|
57589
|
-
if (!this.copiedData) return
|
|
57593
|
+
if (!this.copiedData) return "EmptyClipboard";
|
|
57590
57594
|
const pasteOption = cmd.pasteOption;
|
|
57591
57595
|
return this.isPasteAllowed(cmd.target, this.copiedData, {
|
|
57592
57596
|
pasteOption,
|
|
@@ -57595,12 +57599,12 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57595
57599
|
}
|
|
57596
57600
|
case "COPY_PASTE_CELLS_ABOVE": {
|
|
57597
57601
|
const zones = this.getters.getSelectedZones();
|
|
57598
|
-
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return
|
|
57602
|
+
if (zones.length > 1 || zones[0].top === 0 && zones[0].bottom === 0) return "InvalidCopyPasteSelection";
|
|
57599
57603
|
break;
|
|
57600
57604
|
}
|
|
57601
57605
|
case "COPY_PASTE_CELLS_ON_LEFT": {
|
|
57602
57606
|
const zones = this.getters.getSelectedZones();
|
|
57603
|
-
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return
|
|
57607
|
+
if (zones.length > 1 || zones[0].left === 0 && zones[0].right === 0) return "InvalidCopyPasteSelection";
|
|
57604
57608
|
break;
|
|
57605
57609
|
}
|
|
57606
57610
|
case "INSERT_CELL": {
|
|
@@ -57614,7 +57618,7 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57614
57618
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
57615
57619
|
}
|
|
57616
57620
|
}
|
|
57617
|
-
return
|
|
57621
|
+
return "Success";
|
|
57618
57622
|
}
|
|
57619
57623
|
handle(cmd) {
|
|
57620
57624
|
switch (cmd.type) {
|
|
@@ -57772,16 +57776,16 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57772
57776
|
const clipboardData = this.getClipboardData(zones);
|
|
57773
57777
|
for (const { handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
57774
57778
|
const result = handler.isCutAllowed(clipboardData);
|
|
57775
|
-
if (result !==
|
|
57779
|
+
if (result !== "Success") return result;
|
|
57776
57780
|
}
|
|
57777
|
-
return
|
|
57781
|
+
return "Success";
|
|
57778
57782
|
}
|
|
57779
57783
|
isPasteAllowed(target, copiedData, options) {
|
|
57780
57784
|
for (const { handler } of this.selectClipboardHandlers(copiedData)) {
|
|
57781
57785
|
const result = handler.isPasteAllowed(this.getters.getActiveSheetId(), target, copiedData, { ...options });
|
|
57782
|
-
if (result !==
|
|
57786
|
+
if (result !== "Success") return result;
|
|
57783
57787
|
}
|
|
57784
|
-
return
|
|
57788
|
+
return "Success";
|
|
57785
57789
|
}
|
|
57786
57790
|
isColRowDirtyingClipboard(position, dimension) {
|
|
57787
57791
|
if (!this.copiedData || !this.copiedData.zones) return false;
|
|
@@ -57858,8 +57862,8 @@ var ClipboardPlugin = class extends UIPlugin {
|
|
|
57858
57862
|
}
|
|
57859
57863
|
getClipboardContent() {
|
|
57860
57864
|
return {
|
|
57861
|
-
[
|
|
57862
|
-
[
|
|
57865
|
+
["text/plain"]: this.getPlainTextContent(),
|
|
57866
|
+
["text/html"]: this.getHTMLContent()
|
|
57863
57867
|
};
|
|
57864
57868
|
}
|
|
57865
57869
|
getSheetData() {
|
|
@@ -57992,10 +57996,10 @@ var FilterEvaluationPlugin = class extends UIPlugin {
|
|
|
57992
57996
|
allowDispatch(cmd) {
|
|
57993
57997
|
switch (cmd.type) {
|
|
57994
57998
|
case "UPDATE_FILTER":
|
|
57995
|
-
if (!this.getters.getFilterId(cmd)) return
|
|
57999
|
+
if (!this.getters.getFilterId(cmd)) return "FilterNotFound";
|
|
57996
58000
|
break;
|
|
57997
58001
|
}
|
|
57998
|
-
return
|
|
58002
|
+
return "Success";
|
|
57999
58003
|
}
|
|
58000
58004
|
handle(cmd) {
|
|
58001
58005
|
switch (cmd.type) {
|
|
@@ -58209,14 +58213,14 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58209
58213
|
allowDispatch(cmd) {
|
|
58210
58214
|
switch (cmd.type) {
|
|
58211
58215
|
case "ACTIVATE_SHEET": try {
|
|
58212
|
-
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return
|
|
58216
|
+
if (!this.getters.getSheet(cmd.sheetIdTo).isVisible) return "SheetIsHidden";
|
|
58213
58217
|
break;
|
|
58214
58218
|
} catch (error) {
|
|
58215
|
-
return
|
|
58219
|
+
return "InvalidSheetId";
|
|
58216
58220
|
}
|
|
58217
58221
|
case "MOVE_COLUMNS_ROWS": return this.isMoveElementAllowed(cmd);
|
|
58218
58222
|
}
|
|
58219
|
-
return
|
|
58223
|
+
return "Success";
|
|
58220
58224
|
}
|
|
58221
58225
|
handleEvent(event) {
|
|
58222
58226
|
const anchor = event.anchor;
|
|
@@ -58505,7 +58509,8 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58505
58509
|
}, [zone]);
|
|
58506
58510
|
}
|
|
58507
58511
|
setActiveSheet(id) {
|
|
58508
|
-
|
|
58512
|
+
const sheet = this.getters.getSheet(id);
|
|
58513
|
+
this.activeSheet = sheet;
|
|
58509
58514
|
}
|
|
58510
58515
|
activateNextSheet(direction) {
|
|
58511
58516
|
const sheetIds = this.getters.getSheetIds();
|
|
@@ -58643,12 +58648,12 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58643
58648
|
const end = cmd.elements[cmd.elements.length - 1];
|
|
58644
58649
|
const id = cmd.sheetId;
|
|
58645
58650
|
const doesElementsHaveCommonMerges = isCol ? this.getters.doesColumnsHaveCommonMerges : this.getters.doesRowsHaveCommonMerges;
|
|
58646
|
-
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return
|
|
58651
|
+
if (doesElementsHaveCommonMerges(id, start - 1, start) || doesElementsHaveCommonMerges(id, end, end + 1) || doesElementsHaveCommonMerges(id, cmd.base - 1, cmd.base)) return "WillRemoveExistingMerge";
|
|
58647
58652
|
const headers = [cmd.base, ...cmd.elements];
|
|
58648
58653
|
const maxHeaderValue = isCol ? this.getters.getNumberCols(id) : this.getters.getNumberRows(id);
|
|
58649
|
-
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return
|
|
58650
|
-
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return
|
|
58651
|
-
return
|
|
58654
|
+
if (headers.some((h) => h < 0 || h >= maxHeaderValue)) return "InvalidHeaderIndex";
|
|
58655
|
+
if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) return "CannotMoveTableHeader";
|
|
58656
|
+
return "Success";
|
|
58652
58657
|
}
|
|
58653
58658
|
isTableRowMoveAllowed(sheetId, selectedRows) {
|
|
58654
58659
|
const tables = this.getters.getCoreTables(sheetId);
|
|
@@ -58741,6 +58746,9 @@ var GridSelectionPlugin = class extends UIPlugin {
|
|
|
58741
58746
|
//#endregion
|
|
58742
58747
|
//#region src/helpers/internal_viewport.ts
|
|
58743
58748
|
var InternalViewport = class {
|
|
58749
|
+
getters;
|
|
58750
|
+
sheetId;
|
|
58751
|
+
boundaries;
|
|
58744
58752
|
top;
|
|
58745
58753
|
bottom;
|
|
58746
58754
|
left;
|
|
@@ -59078,7 +59086,7 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
59078
59086
|
switch (cmd.type) {
|
|
59079
59087
|
case "SET_VIEWPORT_OFFSET": return this.chainValidations(this.checkScrollingDirection, this.checkIfViewportsWillChange)(cmd);
|
|
59080
59088
|
case "RESIZE_SHEETVIEW": return this.chainValidations(this.checkValuesAreDifferent, this.checkPositiveDimension)(cmd);
|
|
59081
|
-
default: return
|
|
59089
|
+
default: return "Success";
|
|
59082
59090
|
}
|
|
59083
59091
|
}
|
|
59084
59092
|
handleEvent(event) {
|
|
@@ -59486,23 +59494,23 @@ var SheetViewPlugin = class extends UIPlugin {
|
|
|
59486
59494
|
return Object.values(this.viewports[sheetId]).filter(isDefined);
|
|
59487
59495
|
}
|
|
59488
59496
|
checkPositiveDimension(cmd) {
|
|
59489
|
-
if (cmd.width < 0 || cmd.height < 0) return
|
|
59490
|
-
return
|
|
59497
|
+
if (cmd.width < 0 || cmd.height < 0) return "InvalidViewportSize";
|
|
59498
|
+
return "Success";
|
|
59491
59499
|
}
|
|
59492
59500
|
checkValuesAreDifferent(cmd) {
|
|
59493
59501
|
const { height, width } = this.getSheetViewDimension();
|
|
59494
|
-
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return
|
|
59495
|
-
return
|
|
59502
|
+
if (cmd.gridOffsetX === this.gridOffsetX && cmd.gridOffsetY === this.gridOffsetY && cmd.width === width && cmd.height === height) return "ValuesNotChanged";
|
|
59503
|
+
return "Success";
|
|
59496
59504
|
}
|
|
59497
59505
|
checkScrollingDirection({ offsetX, offsetY }) {
|
|
59498
59506
|
const pane = this.getMainInternalViewport(this.getters.getActiveSheetId());
|
|
59499
|
-
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return
|
|
59500
|
-
return
|
|
59507
|
+
if (!pane.canScrollHorizontally && offsetX > 0 || !pane.canScrollVertically && offsetY > 0) return "InvalidScrollingDirection";
|
|
59508
|
+
return "Success";
|
|
59501
59509
|
}
|
|
59502
59510
|
checkIfViewportsWillChange({ offsetX, offsetY }) {
|
|
59503
59511
|
const sheetId = this.getters.getActiveSheetId();
|
|
59504
59512
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
59505
|
-
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ?
|
|
59513
|
+
return this.getSubViewports(sheetId).some((viewport) => viewport.willNewOffsetScrollViewport(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY))) ? "Success" : "ViewportScrollLimitsReached";
|
|
59506
59514
|
}
|
|
59507
59515
|
getMainViewport(sheetId) {
|
|
59508
59516
|
const viewport = this.getMainInternalViewport(sheetId);
|
|
@@ -60087,9 +60095,9 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
60087
60095
|
sheetId,
|
|
60088
60096
|
name
|
|
60089
60097
|
});
|
|
60090
|
-
if (result.reasons.includes(
|
|
60091
|
-
else if (result.reasons.includes(
|
|
60092
|
-
else if (result.reasons.includes(
|
|
60098
|
+
if (result.reasons.includes("MissingSheetName")) env.raiseError(_t("The sheet name cannot be empty."), errorCallback);
|
|
60099
|
+
else if (result.reasons.includes("DuplicatedSheetName")) env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
60100
|
+
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);
|
|
60093
60101
|
}
|
|
60094
60102
|
|
|
60095
60103
|
//#endregion
|
|
@@ -60301,41 +60309,41 @@ var BottomBarSheet = class extends _odoo_owl.Component {
|
|
|
60301
60309
|
const selectionStatisticFunctions = [
|
|
60302
60310
|
{
|
|
60303
60311
|
name: _t("Sum"),
|
|
60304
|
-
types: [
|
|
60312
|
+
types: ["number"],
|
|
60305
60313
|
compute: (values, locale) => sum([[values]], locale)
|
|
60306
60314
|
},
|
|
60307
60315
|
{
|
|
60308
60316
|
name: _t("Avg"),
|
|
60309
|
-
types: [
|
|
60317
|
+
types: ["number"],
|
|
60310
60318
|
compute: (values, locale) => average([[values]], locale)
|
|
60311
60319
|
},
|
|
60312
60320
|
{
|
|
60313
60321
|
name: _t("Min"),
|
|
60314
|
-
types: [
|
|
60322
|
+
types: ["number"],
|
|
60315
60323
|
compute: (values, locale) => min([[values]], locale).value
|
|
60316
60324
|
},
|
|
60317
60325
|
{
|
|
60318
60326
|
name: _t("Max"),
|
|
60319
|
-
types: [
|
|
60327
|
+
types: ["number"],
|
|
60320
60328
|
compute: (values, locale) => max([[values]], locale).value
|
|
60321
60329
|
},
|
|
60322
60330
|
{
|
|
60323
60331
|
name: _t("Count"),
|
|
60324
60332
|
types: [
|
|
60325
|
-
|
|
60326
|
-
|
|
60327
|
-
|
|
60328
|
-
|
|
60333
|
+
"number",
|
|
60334
|
+
"text",
|
|
60335
|
+
"boolean",
|
|
60336
|
+
"error"
|
|
60329
60337
|
],
|
|
60330
60338
|
compute: (values) => countAny([[values]])
|
|
60331
60339
|
},
|
|
60332
60340
|
{
|
|
60333
60341
|
name: _t("Count Numbers"),
|
|
60334
60342
|
types: [
|
|
60335
|
-
|
|
60336
|
-
|
|
60337
|
-
|
|
60338
|
-
|
|
60343
|
+
"number",
|
|
60344
|
+
"text",
|
|
60345
|
+
"boolean",
|
|
60346
|
+
"error"
|
|
60339
60347
|
],
|
|
60340
60348
|
compute: (values, locale) => countNumbers([[values]], locale)
|
|
60341
60349
|
}
|
|
@@ -60385,7 +60393,7 @@ var AggregateStatisticsStore = class extends SpreadsheetStore {
|
|
|
60385
60393
|
col,
|
|
60386
60394
|
row
|
|
60387
60395
|
});
|
|
60388
|
-
if (evaluatedCell.type !==
|
|
60396
|
+
if (evaluatedCell.type !== "empty") cells.push(evaluatedCell);
|
|
60389
60397
|
}
|
|
60390
60398
|
const locale = getters.getLocale();
|
|
60391
60399
|
const statisticFnResults = {};
|
|
@@ -60870,7 +60878,7 @@ var SpreadsheetDashboard = class extends _odoo_owl.Component {
|
|
|
60870
60878
|
css`
|
|
60871
60879
|
.o-header-group {
|
|
60872
60880
|
.o-header-group-header {
|
|
60873
|
-
z-index: ${
|
|
60881
|
+
z-index: ${6};
|
|
60874
60882
|
.o-group-fold-button {
|
|
60875
60883
|
cursor: pointer;
|
|
60876
60884
|
width: 13px;
|
|
@@ -61656,7 +61664,7 @@ var TopBarComposer = class extends _odoo_owl.Component {
|
|
|
61656
61664
|
});
|
|
61657
61665
|
return cssPropertiesToCss({
|
|
61658
61666
|
"border-color": SELECTION_BORDER_COLOR,
|
|
61659
|
-
"z-index": String(
|
|
61667
|
+
"z-index": String(30)
|
|
61660
61668
|
});
|
|
61661
61669
|
}
|
|
61662
61670
|
onFocus(selection) {
|
|
@@ -61892,7 +61900,7 @@ css`
|
|
|
61892
61900
|
overflow-y: auto;
|
|
61893
61901
|
overflow-x: hidden;
|
|
61894
61902
|
padding: 2px;
|
|
61895
|
-
z-index: ${
|
|
61903
|
+
z-index: ${21};
|
|
61896
61904
|
box-shadow: 1px 2px 5px 2px rgba(51, 51, 51, 0.15);
|
|
61897
61905
|
background-color: white;
|
|
61898
61906
|
|
|
@@ -62031,6 +62039,7 @@ function instantiateClipboard() {
|
|
|
62031
62039
|
return new WebClipboardWrapper(navigator.clipboard);
|
|
62032
62040
|
}
|
|
62033
62041
|
var WebClipboardWrapper = class {
|
|
62042
|
+
clipboard;
|
|
62034
62043
|
constructor(clipboard) {
|
|
62035
62044
|
this.clipboard = clipboard;
|
|
62036
62045
|
}
|
|
@@ -62045,12 +62054,12 @@ var WebClipboardWrapper = class {
|
|
|
62045
62054
|
*/
|
|
62046
62055
|
try {
|
|
62047
62056
|
await this.clipboard?.write([new ClipboardItem({
|
|
62048
|
-
[
|
|
62049
|
-
[
|
|
62057
|
+
["text/plain"]: this.getBlob(clipboardContent, "text/plain"),
|
|
62058
|
+
["text/html"]: this.getBlob(clipboardContent, "text/html")
|
|
62050
62059
|
})]);
|
|
62051
62060
|
} catch (e) {}
|
|
62052
62061
|
}
|
|
62053
|
-
else await this.writeText(clipboardContent[
|
|
62062
|
+
else await this.writeText(clipboardContent["text/plain"] ?? "");
|
|
62054
62063
|
}
|
|
62055
62064
|
async writeText(text) {
|
|
62056
62065
|
try {
|
|
@@ -62075,13 +62084,13 @@ var WebClipboardWrapper = class {
|
|
|
62075
62084
|
}
|
|
62076
62085
|
else return {
|
|
62077
62086
|
status: "ok",
|
|
62078
|
-
content: { [
|
|
62087
|
+
content: { ["text/plain"]: await this.clipboard?.readText() }
|
|
62079
62088
|
};
|
|
62080
62089
|
}
|
|
62081
62090
|
getClipboardItems(content) {
|
|
62082
62091
|
const clipboardItemData = {
|
|
62083
|
-
[
|
|
62084
|
-
[
|
|
62092
|
+
["text/plain"]: this.getBlob(content, "text/plain"),
|
|
62093
|
+
["text/html"]: this.getBlob(content, "text/html")
|
|
62085
62094
|
};
|
|
62086
62095
|
return [new ClipboardItem(clipboardItemData)];
|
|
62087
62096
|
}
|
|
@@ -62539,6 +62548,8 @@ function inverseCommand(cmd) {
|
|
|
62539
62548
|
* @param operations initial operations
|
|
62540
62549
|
*/
|
|
62541
62550
|
var Branch = class Branch {
|
|
62551
|
+
buildTransformation;
|
|
62552
|
+
operations;
|
|
62542
62553
|
constructor(buildTransformation, operations = []) {
|
|
62543
62554
|
this.buildTransformation = buildTransformation;
|
|
62544
62555
|
this.operations = operations;
|
|
@@ -62655,6 +62666,8 @@ var Branch = class Branch {
|
|
|
62655
62666
|
* to revert it).
|
|
62656
62667
|
*/
|
|
62657
62668
|
var Operation = class {
|
|
62669
|
+
id;
|
|
62670
|
+
data;
|
|
62658
62671
|
constructor(id, data) {
|
|
62659
62672
|
this.id = id;
|
|
62660
62673
|
this.data = data;
|
|
@@ -62664,6 +62677,8 @@ var Operation = class {
|
|
|
62664
62677
|
}
|
|
62665
62678
|
};
|
|
62666
62679
|
var LazyOperation = class LazyOperation {
|
|
62680
|
+
id;
|
|
62681
|
+
lazyData;
|
|
62667
62682
|
constructor(id, lazyData) {
|
|
62668
62683
|
this.id = id;
|
|
62669
62684
|
this.lazyData = lazyData;
|
|
@@ -62689,6 +62704,7 @@ var LazyOperation = class LazyOperation {
|
|
|
62689
62704
|
* ```
|
|
62690
62705
|
*/
|
|
62691
62706
|
var OperationSequence = class OperationSequence {
|
|
62707
|
+
operations;
|
|
62692
62708
|
constructor(operations) {
|
|
62693
62709
|
this.operations = operations;
|
|
62694
62710
|
}
|
|
@@ -62764,6 +62780,7 @@ var OperationSequence = class OperationSequence {
|
|
|
62764
62780
|
*
|
|
62765
62781
|
*/
|
|
62766
62782
|
var Tree = class {
|
|
62783
|
+
buildTransformation;
|
|
62767
62784
|
branches;
|
|
62768
62785
|
branchingOperationIds = /* @__PURE__ */ new Map();
|
|
62769
62786
|
constructor(buildTransformation, initialBranch) {
|
|
@@ -63346,6 +63363,7 @@ var EventStream = class {
|
|
|
63346
63363
|
* with the new selected anchor
|
|
63347
63364
|
*/
|
|
63348
63365
|
var SelectionStreamProcessorImpl = class {
|
|
63366
|
+
getters;
|
|
63349
63367
|
stream;
|
|
63350
63368
|
/**
|
|
63351
63369
|
* "Active" anchor used as a reference to compute new anchors
|
|
@@ -63444,7 +63462,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63444
63462
|
* Set the selection to one of the cells adjacent to the current anchor cell.
|
|
63445
63463
|
*/
|
|
63446
63464
|
moveAnchorCell(direction, step = 1) {
|
|
63447
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63465
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63448
63466
|
const { col, row } = this.getNextAvailablePosition(direction, step);
|
|
63449
63467
|
return this.selectCell(col, row);
|
|
63450
63468
|
}
|
|
@@ -63506,7 +63524,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63506
63524
|
* of the anchor zone which moves.
|
|
63507
63525
|
*/
|
|
63508
63526
|
resizeAnchorZone(direction, step = 1) {
|
|
63509
|
-
if (step !== "end" && step <= 0) return new DispatchResult(
|
|
63527
|
+
if (step !== "end" && step <= 0) return new DispatchResult("InvalidSelectionStep");
|
|
63510
63528
|
const sheetId = this.getters.getActiveSheetId();
|
|
63511
63529
|
const anchor = this.anchor;
|
|
63512
63530
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
@@ -63753,7 +63771,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63753
63771
|
previousAnchor: deepCopy(this.anchor)
|
|
63754
63772
|
};
|
|
63755
63773
|
const commandResult = this.checkEventAnchorZone(event);
|
|
63756
|
-
if (commandResult !==
|
|
63774
|
+
if (commandResult !== "Success") return new DispatchResult(commandResult);
|
|
63757
63775
|
this.anchor = event.anchor;
|
|
63758
63776
|
this.stream.send(event);
|
|
63759
63777
|
return DispatchResult.Success;
|
|
@@ -63763,15 +63781,15 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63763
63781
|
}
|
|
63764
63782
|
checkAnchorZone(anchor) {
|
|
63765
63783
|
const { cell, zone } = anchor;
|
|
63766
|
-
if (!isInside(cell.col, cell.row, zone)) return
|
|
63784
|
+
if (!isInside(cell.col, cell.row, zone)) return "InvalidAnchorZone";
|
|
63767
63785
|
const { left, right, top, bottom } = zone;
|
|
63768
63786
|
const sheetId = this.getters.getActiveSheetId();
|
|
63769
63787
|
const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
|
|
63770
|
-
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return
|
|
63771
|
-
return
|
|
63788
|
+
if (this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) === void 0 || refCol === void 0) return "SelectionOutOfBound";
|
|
63789
|
+
return "Success";
|
|
63772
63790
|
}
|
|
63773
63791
|
checkAnchorZoneOrThrow(anchor) {
|
|
63774
|
-
if (this.checkAnchorZone(anchor) ===
|
|
63792
|
+
if (this.checkAnchorZone(anchor) === "InvalidAnchorZone") throw new Error(_t("The provided anchor is invalid. The cell must be part of the zone."));
|
|
63775
63793
|
}
|
|
63776
63794
|
/**
|
|
63777
63795
|
* ---- PRIVATE ----
|
|
@@ -63928,7 +63946,7 @@ var SelectionStreamProcessorImpl = class {
|
|
|
63928
63946
|
isCellSkippableInCluster(position) {
|
|
63929
63947
|
const mainPosition = this.getters.getMainCellPosition(position);
|
|
63930
63948
|
const cell = this.getters.getEvaluatedCell(mainPosition);
|
|
63931
|
-
return cell.type ===
|
|
63949
|
+
return cell.type === "empty" || cell.type === "text" && cell.value === "";
|
|
63932
63950
|
}
|
|
63933
63951
|
};
|
|
63934
63952
|
|
|
@@ -65851,13 +65869,6 @@ function purgeSingleRowTables(data) {
|
|
|
65851
65869
|
|
|
65852
65870
|
//#endregion
|
|
65853
65871
|
//#region src/model.ts
|
|
65854
|
-
var Status = /* @__PURE__ */ function(Status) {
|
|
65855
|
-
Status[Status["Ready"] = 0] = "Ready";
|
|
65856
|
-
Status[Status["Running"] = 1] = "Running";
|
|
65857
|
-
Status[Status["RunningCore"] = 2] = "RunningCore";
|
|
65858
|
-
Status[Status["Finalizing"] = 3] = "Finalizing";
|
|
65859
|
-
return Status;
|
|
65860
|
-
}(Status || {});
|
|
65861
65872
|
var Model = class extends EventBus {
|
|
65862
65873
|
corePlugins = [];
|
|
65863
65874
|
featurePlugins = [];
|
|
@@ -65881,7 +65892,7 @@ var Model = class extends EventBus {
|
|
|
65881
65892
|
/**
|
|
65882
65893
|
* Internal status of the model. Important for command handling coordination
|
|
65883
65894
|
*/
|
|
65884
|
-
status =
|
|
65895
|
+
status = 0;
|
|
65885
65896
|
/**
|
|
65886
65897
|
* The config object contains some configuration flag and callbacks
|
|
65887
65898
|
*/
|
|
@@ -66018,7 +66029,7 @@ var Model = class extends EventBus {
|
|
|
66018
66029
|
onRemoteRevisionReceived({ commands }) {
|
|
66019
66030
|
for (const command of commands) {
|
|
66020
66031
|
const previousStatus = this.status;
|
|
66021
|
-
this.status =
|
|
66032
|
+
this.status = 2;
|
|
66022
66033
|
this.dispatchToHandlers(this.statefulUIPlugins, command);
|
|
66023
66034
|
this.status = previousStatus;
|
|
66024
66035
|
}
|
|
@@ -66116,7 +66127,7 @@ var Model = class extends EventBus {
|
|
|
66116
66127
|
*/
|
|
66117
66128
|
checkDispatchAllowed(command) {
|
|
66118
66129
|
const results = isCoreCommand(command) ? this.checkDispatchAllowedCoreCommand(command) : this.checkDispatchAllowedLocalCommand(command);
|
|
66119
|
-
if (results.some((r) => r !==
|
|
66130
|
+
if (results.some((r) => r !== "Success")) return new DispatchResult(results.flat());
|
|
66120
66131
|
return DispatchResult.Success;
|
|
66121
66132
|
}
|
|
66122
66133
|
checkDispatchAllowedCoreCommand(command) {
|
|
@@ -66128,9 +66139,9 @@ var Model = class extends EventBus {
|
|
|
66128
66139
|
return this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
66129
66140
|
}
|
|
66130
66141
|
finalize() {
|
|
66131
|
-
this.status =
|
|
66142
|
+
this.status = 3;
|
|
66132
66143
|
for (const h of this.handlers) h.finalize();
|
|
66133
|
-
this.status =
|
|
66144
|
+
this.status = 0;
|
|
66134
66145
|
this.trigger("command-finalized");
|
|
66135
66146
|
}
|
|
66136
66147
|
/**
|
|
@@ -66157,16 +66168,16 @@ var Model = class extends EventBus {
|
|
|
66157
66168
|
dispatch = (type, payload) => {
|
|
66158
66169
|
const command = createCommand(type, payload);
|
|
66159
66170
|
const status = this.status;
|
|
66160
|
-
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult(
|
|
66161
|
-
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult(
|
|
66171
|
+
if (this.getters.isReadonly() && !canExecuteInReadonly(command)) return new DispatchResult("Readonly");
|
|
66172
|
+
if (!this.session.canApplyOptimisticUpdate()) return new DispatchResult("WaitingSessionConfirmation");
|
|
66162
66173
|
switch (status) {
|
|
66163
|
-
case
|
|
66174
|
+
case 0:
|
|
66164
66175
|
const result = this.checkDispatchAllowed(command);
|
|
66165
66176
|
if (!result.isSuccessful) {
|
|
66166
66177
|
this.trigger("update");
|
|
66167
66178
|
return result;
|
|
66168
66179
|
}
|
|
66169
|
-
this.status =
|
|
66180
|
+
this.status = 1;
|
|
66170
66181
|
const { changes, commands } = this.state.recordChanges(() => {
|
|
66171
66182
|
const start = performance.now();
|
|
66172
66183
|
if (isCoreCommand(command)) this.state.addCommand(command);
|
|
@@ -66176,10 +66187,10 @@ var Model = class extends EventBus {
|
|
|
66176
66187
|
if (time > 5) console.debug(type, time, "ms");
|
|
66177
66188
|
});
|
|
66178
66189
|
this.session.save(command, commands, changes);
|
|
66179
|
-
this.status =
|
|
66190
|
+
this.status = 0;
|
|
66180
66191
|
this.trigger("update");
|
|
66181
66192
|
break;
|
|
66182
|
-
case
|
|
66193
|
+
case 1:
|
|
66183
66194
|
if (isCoreCommand(command)) {
|
|
66184
66195
|
const dispatchResult = this.checkDispatchAllowed(command);
|
|
66185
66196
|
if (!dispatchResult.isSuccessful) return dispatchResult;
|
|
@@ -66187,8 +66198,8 @@ var Model = class extends EventBus {
|
|
|
66187
66198
|
}
|
|
66188
66199
|
this.dispatchToHandlers(this.handlers, command);
|
|
66189
66200
|
break;
|
|
66190
|
-
case
|
|
66191
|
-
case
|
|
66201
|
+
case 3: throw new Error("Cannot dispatch commands in the finalize state");
|
|
66202
|
+
case 2:
|
|
66192
66203
|
if (isCoreCommand(command)) throw new Error(`A UI plugin cannot dispatch ${type} while handling a core command`);
|
|
66193
66204
|
this.dispatchToHandlers(this.handlers, command);
|
|
66194
66205
|
}
|
|
@@ -66201,7 +66212,7 @@ var Model = class extends EventBus {
|
|
|
66201
66212
|
dispatchFromCorePlugin = (type, payload) => {
|
|
66202
66213
|
const command = createCommand(type, payload);
|
|
66203
66214
|
const previousStatus = this.status;
|
|
66204
|
-
this.status =
|
|
66215
|
+
this.status = 2;
|
|
66205
66216
|
const handlers = this.isReplayingCommand ? this.coreHandlers : this.handlers;
|
|
66206
66217
|
this.dispatchToHandlers(handlers, command);
|
|
66207
66218
|
this.status = previousStatus;
|
|
@@ -66545,6 +66556,6 @@ exports.stores = stores;
|
|
|
66545
66556
|
exports.tokenColors = tokenColors;
|
|
66546
66557
|
exports.tokenize = tokenize;
|
|
66547
66558
|
|
|
66548
|
-
__info__.version = "18.0.
|
|
66549
|
-
__info__.date = "2026-05-
|
|
66550
|
-
__info__.hash = "
|
|
66559
|
+
__info__.version = "18.0.69";
|
|
66560
|
+
__info__.date = "2026-05-27T05:57:08.710Z";
|
|
66561
|
+
__info__.hash = "50b85ba";
|