@odoo/o-spreadsheet 18.1.28 → 18.1.29
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 +118 -42
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +118 -42
- package/dist/o-spreadsheet.iife.js +118 -42
- package/dist/o-spreadsheet.iife.min.js +380 -380
- 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.1.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.29
|
|
6
|
+
* @date 2025-07-11T11:11:55.442Z
|
|
7
|
+
* @hash 3456a93
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -821,6 +821,7 @@
|
|
|
821
821
|
];
|
|
822
822
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
823
823
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
824
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
824
825
|
/**
|
|
825
826
|
* Replace all different newlines characters by \n
|
|
826
827
|
*/
|
|
@@ -2827,8 +2828,9 @@
|
|
|
2827
2828
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2828
2829
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2829
2830
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2830
|
-
const
|
|
2831
|
-
const
|
|
2831
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2832
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2833
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2832
2834
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2833
2835
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2834
2836
|
function valueToDateNumber(value, locale) {
|
|
@@ -6533,6 +6535,8 @@
|
|
|
6533
6535
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6534
6536
|
if (!style)
|
|
6535
6537
|
style = {};
|
|
6538
|
+
if (isMarkdownLink(text))
|
|
6539
|
+
text = parseMarkdownLink(text).label;
|
|
6536
6540
|
const brokenText = [];
|
|
6537
6541
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6538
6542
|
// but 5-10x faster if it doesn't
|
|
@@ -8496,6 +8500,10 @@
|
|
|
8496
8500
|
if (groupValue === null || groupValue === "null") {
|
|
8497
8501
|
return null;
|
|
8498
8502
|
}
|
|
8503
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8504
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8505
|
+
return extractedGroupValue;
|
|
8506
|
+
}
|
|
8499
8507
|
const groupValueString = typeof groupValue === "boolean"
|
|
8500
8508
|
? toString(groupValue).toLocaleLowerCase()
|
|
8501
8509
|
: toString(groupValue);
|
|
@@ -25786,40 +25794,112 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25786
25794
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25787
25795
|
*/
|
|
25788
25796
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25797
|
+
let deconstructedSheets = null;
|
|
25789
25798
|
for (let tableSheet of convertedSheets) {
|
|
25790
25799
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25800
|
+
if (!tables || tables.length === 0) {
|
|
25801
|
+
continue;
|
|
25802
|
+
}
|
|
25803
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25804
|
+
if (!deconstructedSheets) {
|
|
25805
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25806
|
+
}
|
|
25791
25807
|
for (let table of tables) {
|
|
25792
|
-
|
|
25793
|
-
|
|
25794
|
-
for (let xc in
|
|
25795
|
-
const
|
|
25796
|
-
let
|
|
25797
|
-
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
let endIndex = refIndex + tabRef.length;
|
|
25801
|
-
let openBrackets = 1;
|
|
25802
|
-
while (openBrackets > 0 && endIndex < cellContent.length) {
|
|
25803
|
-
if (cellContent[endIndex] === "[") {
|
|
25804
|
-
openBrackets++;
|
|
25805
|
-
}
|
|
25806
|
-
else if (cellContent[endIndex] === "]") {
|
|
25807
|
-
openBrackets--;
|
|
25808
|
-
}
|
|
25809
|
-
endIndex++;
|
|
25810
|
-
}
|
|
25811
|
-
let reference = cellContent.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25812
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25813
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25814
|
-
cellContent =
|
|
25815
|
-
cellContent.slice(0, refIndex) + convertedRef + cellContent.slice(endIndex);
|
|
25808
|
+
for (let sheetId in deconstructedSheets) {
|
|
25809
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25810
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25811
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25812
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25813
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25814
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25815
|
+
continue;
|
|
25816
25816
|
}
|
|
25817
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25818
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25819
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25820
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25821
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25822
|
+
convertedRef +
|
|
25823
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25824
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25817
25825
|
}
|
|
25818
|
-
sheet.cells[xc] = cellContent;
|
|
25826
|
+
// sheet.cells[xc] = cellContent;
|
|
25819
25827
|
}
|
|
25820
25828
|
}
|
|
25821
25829
|
}
|
|
25822
25830
|
}
|
|
25831
|
+
if (!deconstructedSheets) {
|
|
25832
|
+
return;
|
|
25833
|
+
}
|
|
25834
|
+
for (let sheetId in deconstructedSheets) {
|
|
25835
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25836
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25837
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25838
|
+
if (deconstructedCell.length === 1) {
|
|
25839
|
+
sheet.cells[xc] = deconstructedCell[0];
|
|
25840
|
+
continue;
|
|
25841
|
+
}
|
|
25842
|
+
let newContent = "";
|
|
25843
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25844
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25845
|
+
}
|
|
25846
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25847
|
+
sheet.cells[xc] = newContent;
|
|
25848
|
+
}
|
|
25849
|
+
}
|
|
25850
|
+
}
|
|
25851
|
+
/**
|
|
25852
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25853
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25854
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25855
|
+
*/
|
|
25856
|
+
function deconstructSheets(convertedSheets) {
|
|
25857
|
+
const deconstructedSheets = {};
|
|
25858
|
+
for (let sheet of convertedSheets) {
|
|
25859
|
+
for (let xc in sheet.cells) {
|
|
25860
|
+
const cellContent = sheet.cells[xc];
|
|
25861
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25862
|
+
continue;
|
|
25863
|
+
}
|
|
25864
|
+
const startIndex = cellContent.indexOf("[");
|
|
25865
|
+
if (startIndex === -1) {
|
|
25866
|
+
continue;
|
|
25867
|
+
}
|
|
25868
|
+
const deconstructedCell = [];
|
|
25869
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25870
|
+
let possibleRef = "";
|
|
25871
|
+
let openBrackets = 1;
|
|
25872
|
+
let mainPossibleTableIndex = 0;
|
|
25873
|
+
let mainOpenBracketIndex = startIndex;
|
|
25874
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25875
|
+
if (cellContent[index] === "[") {
|
|
25876
|
+
if (openBrackets === 0) {
|
|
25877
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25878
|
+
mainOpenBracketIndex = index;
|
|
25879
|
+
}
|
|
25880
|
+
openBrackets++;
|
|
25881
|
+
continue;
|
|
25882
|
+
}
|
|
25883
|
+
if (cellContent[index] === "]") {
|
|
25884
|
+
openBrackets--;
|
|
25885
|
+
if (openBrackets === 0) {
|
|
25886
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25887
|
+
deconstructedCell.push(possibleTable);
|
|
25888
|
+
deconstructedCell.push(possibleRef);
|
|
25889
|
+
mainPossibleTableIndex = index + 1;
|
|
25890
|
+
}
|
|
25891
|
+
}
|
|
25892
|
+
}
|
|
25893
|
+
if (deconstructedCell.length) {
|
|
25894
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25895
|
+
deconstructedSheets[sheet.id] = {};
|
|
25896
|
+
}
|
|
25897
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25898
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25899
|
+
}
|
|
25900
|
+
}
|
|
25901
|
+
}
|
|
25902
|
+
return deconstructedSheets;
|
|
25823
25903
|
}
|
|
25824
25904
|
/**
|
|
25825
25905
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -46719,10 +46799,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46719
46799
|
if (finalCell.value === null) {
|
|
46720
46800
|
return { value: _t("(Undefined)") };
|
|
46721
46801
|
}
|
|
46722
|
-
return
|
|
46723
|
-
value: finalCell.value,
|
|
46724
|
-
format: finalCell.format,
|
|
46725
|
-
};
|
|
46802
|
+
return finalCell;
|
|
46726
46803
|
}
|
|
46727
46804
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
46728
46805
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -46953,7 +47030,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46953
47030
|
ui: SpreadsheetPivot,
|
|
46954
47031
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
46955
47032
|
externalData: false,
|
|
46956
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
46957
47033
|
dateGranularities: [...dateGranularities],
|
|
46958
47034
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
46959
47035
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -59587,7 +59663,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59587
59663
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
59588
59664
|
for (const pivotId of getters.getPivotIds()) {
|
|
59589
59665
|
const pivot = getters.getPivot(pivotId);
|
|
59590
|
-
|
|
59666
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
59591
59667
|
}
|
|
59592
59668
|
});
|
|
59593
59669
|
|
|
@@ -62586,13 +62662,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62586
62662
|
super(custom, params);
|
|
62587
62663
|
this.getters = params.getters;
|
|
62588
62664
|
}
|
|
62589
|
-
|
|
62665
|
+
markAsDirtyForEvaluation() {
|
|
62590
62666
|
this.cache = {};
|
|
62591
62667
|
this.rankAsc = {};
|
|
62592
62668
|
this.rankDesc = {};
|
|
62593
62669
|
this.runningTotal = {};
|
|
62594
62670
|
this.runningTotalInPercent = {};
|
|
62595
|
-
super.
|
|
62671
|
+
super.markAsDirtyForEvaluation?.();
|
|
62596
62672
|
}
|
|
62597
62673
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
62598
62674
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -62717,7 +62793,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62717
62793
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
62718
62794
|
}
|
|
62719
62795
|
}
|
|
62720
|
-
return
|
|
62796
|
+
return [];
|
|
62721
62797
|
}
|
|
62722
62798
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
62723
62799
|
const domains = [];
|
|
@@ -76629,9 +76705,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76629
76705
|
exports.tokenize = tokenize;
|
|
76630
76706
|
|
|
76631
76707
|
|
|
76632
|
-
__info__.version = "18.1.
|
|
76633
|
-
__info__.date = "2025-
|
|
76634
|
-
__info__.hash = "
|
|
76708
|
+
__info__.version = "18.1.29";
|
|
76709
|
+
__info__.date = "2025-07-11T11:11:55.442Z";
|
|
76710
|
+
__info__.hash = "3456a93";
|
|
76635
76711
|
|
|
76636
76712
|
|
|
76637
76713
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|