@odoo/o-spreadsheet 18.3.11 → 18.3.12
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 +121 -42
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +121 -42
- package/dist/o-spreadsheet.iife.js +121 -42
- package/dist/o-spreadsheet.iife.min.js +384 -384
- 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.3.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.12
|
|
6
|
+
* @date 2025-07-11T11:11:58.998Z
|
|
7
|
+
* @hash d14dc96
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -826,6 +826,7 @@
|
|
|
826
826
|
];
|
|
827
827
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
828
828
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
829
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
829
830
|
/**
|
|
830
831
|
* Replace all different newlines characters by \n
|
|
831
832
|
*/
|
|
@@ -2801,8 +2802,9 @@
|
|
|
2801
2802
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2802
2803
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2803
2804
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2804
|
-
const
|
|
2805
|
-
const
|
|
2805
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2806
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2807
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2806
2808
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2807
2809
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2808
2810
|
function valueToDateNumber(value, locale) {
|
|
@@ -6794,6 +6796,8 @@
|
|
|
6794
6796
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6795
6797
|
if (!style)
|
|
6796
6798
|
style = {};
|
|
6799
|
+
if (isMarkdownLink(text))
|
|
6800
|
+
text = parseMarkdownLink(text).label;
|
|
6797
6801
|
const brokenText = [];
|
|
6798
6802
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6799
6803
|
// but 5-10x faster if it doesn't
|
|
@@ -8808,6 +8812,10 @@
|
|
|
8808
8812
|
if (groupValue === null || groupValue === "null") {
|
|
8809
8813
|
return null;
|
|
8810
8814
|
}
|
|
8815
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8816
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8817
|
+
return extractedGroupValue;
|
|
8818
|
+
}
|
|
8811
8819
|
const groupValueString = typeof groupValue === "boolean"
|
|
8812
8820
|
? toString(groupValue).toLocaleLowerCase()
|
|
8813
8821
|
: toString(groupValue);
|
|
@@ -32904,40 +32912,112 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32904
32912
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
32905
32913
|
*/
|
|
32906
32914
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
32915
|
+
let deconstructedSheets = null;
|
|
32907
32916
|
for (let tableSheet of convertedSheets) {
|
|
32908
32917
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
32918
|
+
if (!tables || tables.length === 0) {
|
|
32919
|
+
continue;
|
|
32920
|
+
}
|
|
32921
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
32922
|
+
if (!deconstructedSheets) {
|
|
32923
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
32924
|
+
}
|
|
32909
32925
|
for (let table of tables) {
|
|
32910
|
-
|
|
32911
|
-
|
|
32912
|
-
for (let xc in
|
|
32913
|
-
const
|
|
32914
|
-
let
|
|
32915
|
-
|
|
32916
|
-
|
|
32917
|
-
|
|
32918
|
-
let endIndex = refIndex + tabRef.length;
|
|
32919
|
-
let openBrackets = 1;
|
|
32920
|
-
while (openBrackets > 0 && endIndex < cellContent.length) {
|
|
32921
|
-
if (cellContent[endIndex] === "[") {
|
|
32922
|
-
openBrackets++;
|
|
32923
|
-
}
|
|
32924
|
-
else if (cellContent[endIndex] === "]") {
|
|
32925
|
-
openBrackets--;
|
|
32926
|
-
}
|
|
32927
|
-
endIndex++;
|
|
32928
|
-
}
|
|
32929
|
-
let reference = cellContent.slice(refIndex + tabRef.length, endIndex - 1);
|
|
32930
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32931
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
32932
|
-
cellContent =
|
|
32933
|
-
cellContent.slice(0, refIndex) + convertedRef + cellContent.slice(endIndex);
|
|
32926
|
+
for (let sheetId in deconstructedSheets) {
|
|
32927
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32928
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32929
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32930
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
32931
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
32932
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
32933
|
+
continue;
|
|
32934
32934
|
}
|
|
32935
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
32936
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32937
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
32938
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
32939
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
32940
|
+
convertedRef +
|
|
32941
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
32942
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
32935
32943
|
}
|
|
32936
|
-
sheet.cells[xc] = cellContent;
|
|
32944
|
+
// sheet.cells[xc] = cellContent;
|
|
32937
32945
|
}
|
|
32938
32946
|
}
|
|
32939
32947
|
}
|
|
32940
32948
|
}
|
|
32949
|
+
if (!deconstructedSheets) {
|
|
32950
|
+
return;
|
|
32951
|
+
}
|
|
32952
|
+
for (let sheetId in deconstructedSheets) {
|
|
32953
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32954
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32955
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32956
|
+
if (deconstructedCell.length === 1) {
|
|
32957
|
+
sheet.cells[xc] = deconstructedCell[0];
|
|
32958
|
+
continue;
|
|
32959
|
+
}
|
|
32960
|
+
let newContent = "";
|
|
32961
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
32962
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
32963
|
+
}
|
|
32964
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
32965
|
+
sheet.cells[xc] = newContent;
|
|
32966
|
+
}
|
|
32967
|
+
}
|
|
32968
|
+
}
|
|
32969
|
+
/**
|
|
32970
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
32971
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
32972
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
32973
|
+
*/
|
|
32974
|
+
function deconstructSheets(convertedSheets) {
|
|
32975
|
+
const deconstructedSheets = {};
|
|
32976
|
+
for (let sheet of convertedSheets) {
|
|
32977
|
+
for (let xc in sheet.cells) {
|
|
32978
|
+
const cellContent = sheet.cells[xc];
|
|
32979
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
32980
|
+
continue;
|
|
32981
|
+
}
|
|
32982
|
+
const startIndex = cellContent.indexOf("[");
|
|
32983
|
+
if (startIndex === -1) {
|
|
32984
|
+
continue;
|
|
32985
|
+
}
|
|
32986
|
+
const deconstructedCell = [];
|
|
32987
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
32988
|
+
let possibleRef = "";
|
|
32989
|
+
let openBrackets = 1;
|
|
32990
|
+
let mainPossibleTableIndex = 0;
|
|
32991
|
+
let mainOpenBracketIndex = startIndex;
|
|
32992
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
32993
|
+
if (cellContent[index] === "[") {
|
|
32994
|
+
if (openBrackets === 0) {
|
|
32995
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
32996
|
+
mainOpenBracketIndex = index;
|
|
32997
|
+
}
|
|
32998
|
+
openBrackets++;
|
|
32999
|
+
continue;
|
|
33000
|
+
}
|
|
33001
|
+
if (cellContent[index] === "]") {
|
|
33002
|
+
openBrackets--;
|
|
33003
|
+
if (openBrackets === 0) {
|
|
33004
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
33005
|
+
deconstructedCell.push(possibleTable);
|
|
33006
|
+
deconstructedCell.push(possibleRef);
|
|
33007
|
+
mainPossibleTableIndex = index + 1;
|
|
33008
|
+
}
|
|
33009
|
+
}
|
|
33010
|
+
}
|
|
33011
|
+
if (deconstructedCell.length) {
|
|
33012
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
33013
|
+
deconstructedSheets[sheet.id] = {};
|
|
33014
|
+
}
|
|
33015
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
33016
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
33017
|
+
}
|
|
33018
|
+
}
|
|
33019
|
+
}
|
|
33020
|
+
return deconstructedSheets;
|
|
32941
33021
|
}
|
|
32942
33022
|
/**
|
|
32943
33023
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -35999,6 +36079,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
35999
36079
|
return undefined;
|
|
36000
36080
|
}
|
|
36001
36081
|
get errorOriginPositionString() {
|
|
36082
|
+
if (this.env.model.getters.isDashboard()) {
|
|
36083
|
+
return "";
|
|
36084
|
+
}
|
|
36002
36085
|
const evaluationError = this.evaluationError;
|
|
36003
36086
|
const position = evaluationError?.errorOriginPosition;
|
|
36004
36087
|
if (!position || deepEquals(position, this.props.cellPosition)) {
|
|
@@ -49778,10 +49861,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49778
49861
|
if (finalCell.value === null) {
|
|
49779
49862
|
return { value: _t("(Undefined)") };
|
|
49780
49863
|
}
|
|
49781
|
-
return
|
|
49782
|
-
value: finalCell.value,
|
|
49783
|
-
format: finalCell.format,
|
|
49784
|
-
};
|
|
49864
|
+
return finalCell;
|
|
49785
49865
|
}
|
|
49786
49866
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
49787
49867
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -50010,7 +50090,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50010
50090
|
ui: SpreadsheetPivot,
|
|
50011
50091
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
50012
50092
|
externalData: false,
|
|
50013
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
50014
50093
|
dateGranularities: [...dateGranularities],
|
|
50015
50094
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
50016
50095
|
isMeasureCandidate: (field) => field.type !== "boolean",
|
|
@@ -62964,7 +63043,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62964
63043
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
62965
63044
|
for (const pivotId of getters.getPivotIds()) {
|
|
62966
63045
|
const pivot = getters.getPivot(pivotId);
|
|
62967
|
-
|
|
63046
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
62968
63047
|
}
|
|
62969
63048
|
});
|
|
62970
63049
|
|
|
@@ -65986,13 +66065,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65986
66065
|
super(custom, params);
|
|
65987
66066
|
this.getters = params.getters;
|
|
65988
66067
|
}
|
|
65989
|
-
|
|
66068
|
+
markAsDirtyForEvaluation() {
|
|
65990
66069
|
this.cache = {};
|
|
65991
66070
|
this.rankAsc = {};
|
|
65992
66071
|
this.rankDesc = {};
|
|
65993
66072
|
this.runningTotal = {};
|
|
65994
66073
|
this.runningTotalInPercent = {};
|
|
65995
|
-
super.
|
|
66074
|
+
super.markAsDirtyForEvaluation?.();
|
|
65996
66075
|
}
|
|
65997
66076
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
65998
66077
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -66117,7 +66196,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66117
66196
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
66118
66197
|
}
|
|
66119
66198
|
}
|
|
66120
|
-
return
|
|
66199
|
+
return [];
|
|
66121
66200
|
}
|
|
66122
66201
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
66123
66202
|
const domains = [];
|
|
@@ -80770,9 +80849,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80770
80849
|
exports.tokenize = tokenize;
|
|
80771
80850
|
|
|
80772
80851
|
|
|
80773
|
-
__info__.version = "18.3.
|
|
80774
|
-
__info__.date = "2025-
|
|
80775
|
-
__info__.hash = "
|
|
80852
|
+
__info__.version = "18.3.12";
|
|
80853
|
+
__info__.date = "2025-07-11T11:11:58.998Z";
|
|
80854
|
+
__info__.hash = "d14dc96";
|
|
80776
80855
|
|
|
80777
80856
|
|
|
80778
80857
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|