@odoo/o-spreadsheet 18.0.36 → 18.0.37
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 +117 -40
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +117 -40
- package/dist/o-spreadsheet.iife.js +117 -40
- package/dist/o-spreadsheet.iife.min.js +364 -364
- 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.0.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.37
|
|
6
|
+
* @date 2025-07-11T11:11:13.394Z
|
|
7
|
+
* @hash bc6f00d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -818,6 +818,7 @@
|
|
|
818
818
|
];
|
|
819
819
|
const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
|
|
820
820
|
const newLineRegexp = /(\r\n|\r)/g;
|
|
821
|
+
const whiteSpaceCharacters = specialWhiteSpaceSpecialCharacters.concat([" "]);
|
|
821
822
|
/**
|
|
822
823
|
* Replace all different newlines characters by \n
|
|
823
824
|
*/
|
|
@@ -2661,8 +2662,9 @@
|
|
|
2661
2662
|
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
2662
2663
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
2663
2664
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
2664
|
-
const
|
|
2665
|
-
const
|
|
2665
|
+
const whiteSpaceChars = whiteSpaceCharacters.join("");
|
|
2666
|
+
const dateSeparatorsRegex = new RegExp(`\/|-|${whiteSpaceCharacters.join("|")}`);
|
|
2667
|
+
const dateRegexp = new RegExp(`^(\\d{1,4})[\/${whiteSpaceChars}\-](\\d{1,4})([\/${whiteSpaceChars}\-](\\d{1,4}))?$`);
|
|
2666
2668
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
2667
2669
|
/** Convert a value number representing a date, or return undefined if it isn't possible */
|
|
2668
2670
|
function valueToDateNumber(value, locale) {
|
|
@@ -6365,6 +6367,8 @@
|
|
|
6365
6367
|
function splitTextToWidth(ctx, text, style, width) {
|
|
6366
6368
|
if (!style)
|
|
6367
6369
|
style = {};
|
|
6370
|
+
if (isMarkdownLink(text))
|
|
6371
|
+
text = parseMarkdownLink(text).label;
|
|
6368
6372
|
const brokenText = [];
|
|
6369
6373
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
6370
6374
|
// but 5-10x faster if it doesn't
|
|
@@ -8318,6 +8322,10 @@
|
|
|
8318
8322
|
if (groupValue === null || groupValue === "null") {
|
|
8319
8323
|
return null;
|
|
8320
8324
|
}
|
|
8325
|
+
const extractedGroupValue = typeof groupValue === "object" ? groupValue.value : groupValue;
|
|
8326
|
+
if (isEvaluationError(extractedGroupValue)) {
|
|
8327
|
+
return extractedGroupValue;
|
|
8328
|
+
}
|
|
8321
8329
|
const groupValueString = typeof groupValue === "boolean"
|
|
8322
8330
|
? toString(groupValue).toLocaleLowerCase()
|
|
8323
8331
|
: toString(groupValue);
|
|
@@ -12965,38 +12973,111 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12965
12973
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
12966
12974
|
*/
|
|
12967
12975
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
12976
|
+
let deconstructedSheets = null;
|
|
12968
12977
|
for (let tableSheet of convertedSheets) {
|
|
12969
12978
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
12979
|
+
if (!tables || tables.length === 0) {
|
|
12980
|
+
continue;
|
|
12981
|
+
}
|
|
12982
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
12983
|
+
if (!deconstructedSheets) {
|
|
12984
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
12985
|
+
}
|
|
12970
12986
|
for (let table of tables) {
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
for (let xc in
|
|
12974
|
-
const
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
let openBrackets = 1;
|
|
12980
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
12981
|
-
if (cell.content[endIndex] === "[") {
|
|
12982
|
-
openBrackets++;
|
|
12983
|
-
}
|
|
12984
|
-
else if (cell.content[endIndex] === "]") {
|
|
12985
|
-
openBrackets--;
|
|
12986
|
-
}
|
|
12987
|
-
endIndex++;
|
|
12988
|
-
}
|
|
12989
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
12990
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
12991
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
12992
|
-
cell.content =
|
|
12993
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
12987
|
+
for (let sheetId in deconstructedSheets) {
|
|
12988
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
12989
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
12990
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
12991
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
12992
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
12993
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
12994
|
+
continue;
|
|
12994
12995
|
}
|
|
12996
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
12997
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
12998
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
12999
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
13000
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
13001
|
+
convertedRef +
|
|
13002
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
13003
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
13004
|
+
}
|
|
13005
|
+
}
|
|
13006
|
+
}
|
|
13007
|
+
}
|
|
13008
|
+
}
|
|
13009
|
+
if (!deconstructedSheets) {
|
|
13010
|
+
return;
|
|
13011
|
+
}
|
|
13012
|
+
for (let sheetId in deconstructedSheets) {
|
|
13013
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
13014
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
13015
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
13016
|
+
if (deconstructedCell.length === 1) {
|
|
13017
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
13018
|
+
continue;
|
|
13019
|
+
}
|
|
13020
|
+
let newContent = "";
|
|
13021
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
13022
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
13023
|
+
}
|
|
13024
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
13025
|
+
sheet.cells[xc].content = newContent;
|
|
13026
|
+
}
|
|
13027
|
+
}
|
|
13028
|
+
}
|
|
13029
|
+
/**
|
|
13030
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
13031
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
13032
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
13033
|
+
*/
|
|
13034
|
+
function deconstructSheets(convertedSheets) {
|
|
13035
|
+
const deconstructedSheets = {};
|
|
13036
|
+
for (let sheet of convertedSheets) {
|
|
13037
|
+
for (let xc in sheet.cells) {
|
|
13038
|
+
const cellContent = sheet.cells[xc]?.content;
|
|
13039
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
13040
|
+
continue;
|
|
13041
|
+
}
|
|
13042
|
+
const startIndex = cellContent.indexOf("[");
|
|
13043
|
+
if (startIndex === -1) {
|
|
13044
|
+
continue;
|
|
13045
|
+
}
|
|
13046
|
+
const deconstructedCell = [];
|
|
13047
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
13048
|
+
let possibleRef = "";
|
|
13049
|
+
let openBrackets = 1;
|
|
13050
|
+
let mainPossibleTableIndex = 0;
|
|
13051
|
+
let mainOpenBracketIndex = startIndex;
|
|
13052
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
13053
|
+
if (cellContent[index] === "[") {
|
|
13054
|
+
if (openBrackets === 0) {
|
|
13055
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
13056
|
+
mainOpenBracketIndex = index;
|
|
13057
|
+
}
|
|
13058
|
+
openBrackets++;
|
|
13059
|
+
continue;
|
|
13060
|
+
}
|
|
13061
|
+
if (cellContent[index] === "]") {
|
|
13062
|
+
openBrackets--;
|
|
13063
|
+
if (openBrackets === 0) {
|
|
13064
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
13065
|
+
deconstructedCell.push(possibleTable);
|
|
13066
|
+
deconstructedCell.push(possibleRef);
|
|
13067
|
+
mainPossibleTableIndex = index + 1;
|
|
12995
13068
|
}
|
|
12996
13069
|
}
|
|
12997
13070
|
}
|
|
13071
|
+
if (deconstructedCell.length) {
|
|
13072
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
13073
|
+
deconstructedSheets[sheet.id] = {};
|
|
13074
|
+
}
|
|
13075
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
13076
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
13077
|
+
}
|
|
12998
13078
|
}
|
|
12999
13079
|
}
|
|
13080
|
+
return deconstructedSheets;
|
|
13000
13081
|
}
|
|
13001
13082
|
/**
|
|
13002
13083
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -44567,10 +44648,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44567
44648
|
if (finalCell.value === null) {
|
|
44568
44649
|
return { value: _t("(Undefined)") };
|
|
44569
44650
|
}
|
|
44570
|
-
return
|
|
44571
|
-
value: finalCell.value,
|
|
44572
|
-
format: finalCell.format,
|
|
44573
|
-
};
|
|
44651
|
+
return finalCell;
|
|
44574
44652
|
}
|
|
44575
44653
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
44576
44654
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -44801,7 +44879,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44801
44879
|
ui: SpreadsheetPivot,
|
|
44802
44880
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
44803
44881
|
externalData: false,
|
|
44804
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
44805
44882
|
dateGranularities: [...dateGranularities],
|
|
44806
44883
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
44807
44884
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -57472,7 +57549,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57472
57549
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
57473
57550
|
for (const pivotId of getters.getPivotIds()) {
|
|
57474
57551
|
const pivot = getters.getPivot(pivotId);
|
|
57475
|
-
|
|
57552
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
57476
57553
|
}
|
|
57477
57554
|
});
|
|
57478
57555
|
|
|
@@ -60509,13 +60586,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60509
60586
|
super(custom, params);
|
|
60510
60587
|
this.getters = params.getters;
|
|
60511
60588
|
}
|
|
60512
|
-
|
|
60589
|
+
markAsDirtyForEvaluation() {
|
|
60513
60590
|
this.cache = {};
|
|
60514
60591
|
this.rankAsc = {};
|
|
60515
60592
|
this.rankDesc = {};
|
|
60516
60593
|
this.runningTotal = {};
|
|
60517
60594
|
this.runningTotalInPercent = {};
|
|
60518
|
-
super.
|
|
60595
|
+
super.markAsDirtyForEvaluation?.();
|
|
60519
60596
|
}
|
|
60520
60597
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
60521
60598
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -60640,7 +60717,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60640
60717
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
60641
60718
|
}
|
|
60642
60719
|
}
|
|
60643
|
-
return
|
|
60720
|
+
return [];
|
|
60644
60721
|
}
|
|
60645
60722
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
60646
60723
|
const domains = [];
|
|
@@ -74513,9 +74590,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74513
74590
|
exports.tokenize = tokenize;
|
|
74514
74591
|
|
|
74515
74592
|
|
|
74516
|
-
__info__.version = "18.0.
|
|
74517
|
-
__info__.date = "2025-
|
|
74518
|
-
__info__.hash = "
|
|
74593
|
+
__info__.version = "18.0.37";
|
|
74594
|
+
__info__.date = "2025-07-11T11:11:13.394Z";
|
|
74595
|
+
__info__.hash = "bc6f00d";
|
|
74519
74596
|
|
|
74520
74597
|
|
|
74521
74598
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|