@odoo/o-spreadsheet 18.2.19 → 18.2.21
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 +147 -55
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +147 -55
- package/dist/o-spreadsheet.iife.js +147 -55
- package/dist/o-spreadsheet.iife.min.js +389 -389
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -3
|
@@ -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.2.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.21
|
|
6
|
+
* @date 2025-07-11T11:11:48.661Z
|
|
7
|
+
* @hash 1c32303
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -822,6 +822,7 @@
|
|
|
822
822
|
];
|
|
823
823
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
824
824
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
825
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
825
826
|
/**
|
|
826
827
|
* Replace all different newlines characters by \n
|
|
827
828
|
*/
|
|
@@ -2838,8 +2839,9 @@
|
|
|
2838
2839
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2839
2840
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2840
2841
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2841
|
-
const
|
|
2842
|
-
const
|
|
2842
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2843
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2844
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2843
2845
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2844
2846
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2845
2847
|
function valueToDateNumber(value, locale) {
|
|
@@ -6542,6 +6544,8 @@
|
|
|
6542
6544
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6543
6545
|
if (!style)
|
|
6544
6546
|
style = {};
|
|
6547
|
+
if (isMarkdownLink(text))
|
|
6548
|
+
text = parseMarkdownLink(text).label;
|
|
6545
6549
|
const brokenText = [];
|
|
6546
6550
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6547
6551
|
// but 5-10x faster if it doesn't
|
|
@@ -8506,6 +8510,10 @@
|
|
|
8506
8510
|
if (groupValue === null || groupValue === "null") {
|
|
8507
8511
|
return null;
|
|
8508
8512
|
}
|
|
8513
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8514
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8515
|
+
return extractedGroupValue;
|
|
8516
|
+
}
|
|
8509
8517
|
const groupValueString = typeof groupValue === "boolean"
|
|
8510
8518
|
? toString(groupValue).toLocaleLowerCase()
|
|
8511
8519
|
: toString(groupValue);
|
|
@@ -21199,7 +21207,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21199
21207
|
}
|
|
21200
21208
|
captureSelection(zone, col, row) {
|
|
21201
21209
|
this.model.selection.capture(this, {
|
|
21202
|
-
cell: { col: col
|
|
21210
|
+
cell: { col: col ?? zone.left, row: row ?? zone.right },
|
|
21203
21211
|
zone,
|
|
21204
21212
|
}, {
|
|
21205
21213
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -25810,40 +25818,112 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25810
25818
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25811
25819
|
*/
|
|
25812
25820
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25821
|
+
let deconstructedSheets = null;
|
|
25813
25822
|
for (let tableSheet of convertedSheets) {
|
|
25814
25823
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25824
|
+
if (!tables || tables.length === 0) {
|
|
25825
|
+
continue;
|
|
25826
|
+
}
|
|
25827
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25828
|
+
if (!deconstructedSheets) {
|
|
25829
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25830
|
+
}
|
|
25815
25831
|
for (let table of tables) {
|
|
25816
|
-
|
|
25817
|
-
|
|
25818
|
-
for (let xc in
|
|
25819
|
-
const
|
|
25820
|
-
let
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
let endIndex = refIndex + tabRef.length;
|
|
25825
|
-
let openBrackets = 1;
|
|
25826
|
-
while (openBrackets > 0 && endIndex < cellContent.length) {
|
|
25827
|
-
if (cellContent[endIndex] === "[") {
|
|
25828
|
-
openBrackets++;
|
|
25829
|
-
}
|
|
25830
|
-
else if (cellContent[endIndex] === "]") {
|
|
25831
|
-
openBrackets--;
|
|
25832
|
-
}
|
|
25833
|
-
endIndex++;
|
|
25834
|
-
}
|
|
25835
|
-
let reference = cellContent.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25836
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25837
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25838
|
-
cellContent =
|
|
25839
|
-
cellContent.slice(0, refIndex) + convertedRef + cellContent.slice(endIndex);
|
|
25832
|
+
for (let sheetId in deconstructedSheets) {
|
|
25833
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25834
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25835
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25836
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25837
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25838
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25839
|
+
continue;
|
|
25840
25840
|
}
|
|
25841
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25842
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25843
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25844
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25845
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25846
|
+
convertedRef +
|
|
25847
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25848
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25841
25849
|
}
|
|
25842
|
-
sheet.cells[xc] = cellContent;
|
|
25850
|
+
// sheet.cells[xc] = cellContent;
|
|
25843
25851
|
}
|
|
25844
25852
|
}
|
|
25845
25853
|
}
|
|
25846
25854
|
}
|
|
25855
|
+
if (!deconstructedSheets) {
|
|
25856
|
+
return;
|
|
25857
|
+
}
|
|
25858
|
+
for (let sheetId in deconstructedSheets) {
|
|
25859
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25860
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25861
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25862
|
+
if (deconstructedCell.length === 1) {
|
|
25863
|
+
sheet.cells[xc] = deconstructedCell[0];
|
|
25864
|
+
continue;
|
|
25865
|
+
}
|
|
25866
|
+
let newContent = "";
|
|
25867
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25868
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25869
|
+
}
|
|
25870
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25871
|
+
sheet.cells[xc] = newContent;
|
|
25872
|
+
}
|
|
25873
|
+
}
|
|
25874
|
+
}
|
|
25875
|
+
/**
|
|
25876
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25877
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25878
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25879
|
+
*/
|
|
25880
|
+
function deconstructSheets(convertedSheets) {
|
|
25881
|
+
const deconstructedSheets = {};
|
|
25882
|
+
for (let sheet of convertedSheets) {
|
|
25883
|
+
for (let xc in sheet.cells) {
|
|
25884
|
+
const cellContent = sheet.cells[xc];
|
|
25885
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25886
|
+
continue;
|
|
25887
|
+
}
|
|
25888
|
+
const startIndex = cellContent.indexOf("[");
|
|
25889
|
+
if (startIndex === -1) {
|
|
25890
|
+
continue;
|
|
25891
|
+
}
|
|
25892
|
+
const deconstructedCell = [];
|
|
25893
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25894
|
+
let possibleRef = "";
|
|
25895
|
+
let openBrackets = 1;
|
|
25896
|
+
let mainPossibleTableIndex = 0;
|
|
25897
|
+
let mainOpenBracketIndex = startIndex;
|
|
25898
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25899
|
+
if (cellContent[index] === "[") {
|
|
25900
|
+
if (openBrackets === 0) {
|
|
25901
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25902
|
+
mainOpenBracketIndex = index;
|
|
25903
|
+
}
|
|
25904
|
+
openBrackets++;
|
|
25905
|
+
continue;
|
|
25906
|
+
}
|
|
25907
|
+
if (cellContent[index] === "]") {
|
|
25908
|
+
openBrackets--;
|
|
25909
|
+
if (openBrackets === 0) {
|
|
25910
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25911
|
+
deconstructedCell.push(possibleTable);
|
|
25912
|
+
deconstructedCell.push(possibleRef);
|
|
25913
|
+
mainPossibleTableIndex = index + 1;
|
|
25914
|
+
}
|
|
25915
|
+
}
|
|
25916
|
+
}
|
|
25917
|
+
if (deconstructedCell.length) {
|
|
25918
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25919
|
+
deconstructedSheets[sheet.id] = {};
|
|
25920
|
+
}
|
|
25921
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25922
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25923
|
+
}
|
|
25924
|
+
}
|
|
25925
|
+
}
|
|
25926
|
+
return deconstructedSheets;
|
|
25847
25927
|
}
|
|
25848
25928
|
/**
|
|
25849
25929
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -33287,6 +33367,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
33287
33367
|
return undefined;
|
|
33288
33368
|
}
|
|
33289
33369
|
get errorOriginPositionString() {
|
|
33370
|
+
if (this.env.model.getters.isDashboard()) {
|
|
33371
|
+
return "";
|
|
33372
|
+
}
|
|
33290
33373
|
const evaluationError = this.evaluationError;
|
|
33291
33374
|
const position = evaluationError?.errorOriginPosition;
|
|
33292
33375
|
if (!position || deepEquals(position, this.props.cellPosition)) {
|
|
@@ -43143,6 +43226,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43143
43226
|
this.switchToList();
|
|
43144
43227
|
}
|
|
43145
43228
|
}
|
|
43229
|
+
else if (!this.editedCF) {
|
|
43230
|
+
this.switchToList();
|
|
43231
|
+
}
|
|
43146
43232
|
});
|
|
43147
43233
|
}
|
|
43148
43234
|
get conditionalFormats() {
|
|
@@ -47058,10 +47144,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47058
47144
|
if (finalCell.value === null) {
|
|
47059
47145
|
return { value: _t("(Undefined)") };
|
|
47060
47146
|
}
|
|
47061
|
-
return
|
|
47062
|
-
value: finalCell.value,
|
|
47063
|
-
format: finalCell.format,
|
|
47064
|
-
};
|
|
47147
|
+
return finalCell;
|
|
47065
47148
|
}
|
|
47066
47149
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
47067
47150
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -47290,7 +47373,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47290
47373
|
ui: SpreadsheetPivot,
|
|
47291
47374
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
47292
47375
|
externalData: false,
|
|
47293
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
47294
47376
|
dateGranularities: [...dateGranularities],
|
|
47295
47377
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
47296
47378
|
isMeasureCandidate: (field) => field.type !== "boolean",
|
|
@@ -60056,7 +60138,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60056
60138
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
60057
60139
|
for (const pivotId of getters.getPivotIds()) {
|
|
60058
60140
|
const pivot = getters.getPivot(pivotId);
|
|
60059
|
-
|
|
60141
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
60060
60142
|
}
|
|
60061
60143
|
});
|
|
60062
60144
|
|
|
@@ -63062,13 +63144,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63062
63144
|
super(custom, params);
|
|
63063
63145
|
this.getters = params.getters;
|
|
63064
63146
|
}
|
|
63065
|
-
|
|
63147
|
+
markAsDirtyForEvaluation() {
|
|
63066
63148
|
this.cache = {};
|
|
63067
63149
|
this.rankAsc = {};
|
|
63068
63150
|
this.rankDesc = {};
|
|
63069
63151
|
this.runningTotal = {};
|
|
63070
63152
|
this.runningTotalInPercent = {};
|
|
63071
|
-
super.
|
|
63153
|
+
super.markAsDirtyForEvaluation?.();
|
|
63072
63154
|
}
|
|
63073
63155
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
63074
63156
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -63193,7 +63275,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63193
63275
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
63194
63276
|
}
|
|
63195
63277
|
}
|
|
63196
|
-
return
|
|
63278
|
+
return [];
|
|
63197
63279
|
}
|
|
63198
63280
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
63199
63281
|
const domains = [];
|
|
@@ -73691,26 +73773,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
73691
73773
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
73692
73774
|
};
|
|
73693
73775
|
};
|
|
73694
|
-
const {
|
|
73776
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
73777
|
+
const { col: refCol, row: refRow } = refCell;
|
|
73695
73778
|
// check if we can shrink selection
|
|
73696
73779
|
let n = 0;
|
|
73697
73780
|
while (result !== null) {
|
|
73698
73781
|
n++;
|
|
73699
73782
|
if (deltaCol < 0) {
|
|
73700
73783
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
73701
|
-
result =
|
|
73784
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
73702
73785
|
}
|
|
73703
73786
|
if (deltaCol > 0) {
|
|
73704
73787
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
73705
|
-
result = left + n <=
|
|
73788
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
73706
73789
|
}
|
|
73707
73790
|
if (deltaRow < 0) {
|
|
73708
73791
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
73709
|
-
result =
|
|
73792
|
+
result =
|
|
73793
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
73710
73794
|
}
|
|
73711
73795
|
if (deltaRow > 0) {
|
|
73712
73796
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
73713
|
-
result = top + n <=
|
|
73797
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
73714
73798
|
}
|
|
73715
73799
|
result = result ? reorderZone(result) : result;
|
|
73716
73800
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -73940,18 +74024,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
73940
74024
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
73941
74025
|
* find a visible cell.
|
|
73942
74026
|
*/
|
|
73943
|
-
|
|
74027
|
+
getReferenceAnchor() {
|
|
73944
74028
|
const sheetId = this.getters.getActiveSheetId();
|
|
73945
74029
|
const anchor = this.anchor;
|
|
73946
74030
|
const { left, right, top, bottom } = anchor.zone;
|
|
73947
74031
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
74032
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
74033
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
74034
|
+
: anchorCol;
|
|
74035
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
74036
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
74037
|
+
: anchorRow;
|
|
74038
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
74039
|
+
left: col,
|
|
74040
|
+
right: col,
|
|
74041
|
+
top: row,
|
|
74042
|
+
bottom: row,
|
|
74043
|
+
});
|
|
73948
74044
|
return {
|
|
73949
|
-
|
|
73950
|
-
|
|
73951
|
-
: anchorCol,
|
|
73952
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
73953
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73954
|
-
: anchorRow,
|
|
74045
|
+
cell: { col, row },
|
|
74046
|
+
zone,
|
|
73955
74047
|
};
|
|
73956
74048
|
}
|
|
73957
74049
|
deltaToTarget(position, direction, step) {
|
|
@@ -77094,9 +77186,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77094
77186
|
exports.tokenize = tokenize;
|
|
77095
77187
|
|
|
77096
77188
|
|
|
77097
|
-
__info__.version = "18.2.
|
|
77098
|
-
__info__.date = "2025-
|
|
77099
|
-
__info__.hash = "
|
|
77189
|
+
__info__.version = "18.2.21";
|
|
77190
|
+
__info__.date = "2025-07-11T11:11:48.661Z";
|
|
77191
|
+
__info__.hash = "1c32303";
|
|
77100
77192
|
|
|
77101
77193
|
|
|
77102
77194
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|