@odoo/o-spreadsheet 18.1.27 → 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 +144 -55
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +144 -55
- package/dist/o-spreadsheet.iife.js +144 -55
- 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);
|
|
@@ -21026,7 +21034,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21026
21034
|
}
|
|
21027
21035
|
captureSelection(zone, col, row) {
|
|
21028
21036
|
this.model.selection.capture(this, {
|
|
21029
|
-
cell: { col: col
|
|
21037
|
+
cell: { col: col ?? zone.left, row: row ?? zone.right },
|
|
21030
21038
|
zone,
|
|
21031
21039
|
}, {
|
|
21032
21040
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -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,
|
|
@@ -42798,6 +42878,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42798
42878
|
this.switchToList();
|
|
42799
42879
|
}
|
|
42800
42880
|
}
|
|
42881
|
+
else if (!this.editedCF) {
|
|
42882
|
+
this.switchToList();
|
|
42883
|
+
}
|
|
42801
42884
|
});
|
|
42802
42885
|
}
|
|
42803
42886
|
get conditionalFormats() {
|
|
@@ -46716,10 +46799,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46716
46799
|
if (finalCell.value === null) {
|
|
46717
46800
|
return { value: _t("(Undefined)") };
|
|
46718
46801
|
}
|
|
46719
|
-
return
|
|
46720
|
-
value: finalCell.value,
|
|
46721
|
-
format: finalCell.format,
|
|
46722
|
-
};
|
|
46802
|
+
return finalCell;
|
|
46723
46803
|
}
|
|
46724
46804
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
46725
46805
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -46950,7 +47030,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46950
47030
|
ui: SpreadsheetPivot,
|
|
46951
47031
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
46952
47032
|
externalData: false,
|
|
46953
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
46954
47033
|
dateGranularities: [...dateGranularities],
|
|
46955
47034
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
46956
47035
|
isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
|
|
@@ -59584,7 +59663,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59584
59663
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
59585
59664
|
for (const pivotId of getters.getPivotIds()) {
|
|
59586
59665
|
const pivot = getters.getPivot(pivotId);
|
|
59587
|
-
|
|
59666
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
59588
59667
|
}
|
|
59589
59668
|
});
|
|
59590
59669
|
|
|
@@ -62583,13 +62662,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62583
62662
|
super(custom, params);
|
|
62584
62663
|
this.getters = params.getters;
|
|
62585
62664
|
}
|
|
62586
|
-
|
|
62665
|
+
markAsDirtyForEvaluation() {
|
|
62587
62666
|
this.cache = {};
|
|
62588
62667
|
this.rankAsc = {};
|
|
62589
62668
|
this.rankDesc = {};
|
|
62590
62669
|
this.runningTotal = {};
|
|
62591
62670
|
this.runningTotalInPercent = {};
|
|
62592
|
-
super.
|
|
62671
|
+
super.markAsDirtyForEvaluation?.();
|
|
62593
62672
|
}
|
|
62594
62673
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
62595
62674
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -62714,7 +62793,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62714
62793
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
62715
62794
|
}
|
|
62716
62795
|
}
|
|
62717
|
-
return
|
|
62796
|
+
return [];
|
|
62718
62797
|
}
|
|
62719
62798
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
62720
62799
|
const domains = [];
|
|
@@ -73246,26 +73325,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
73246
73325
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
73247
73326
|
};
|
|
73248
73327
|
};
|
|
73249
|
-
const {
|
|
73328
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
73329
|
+
const { col: refCol, row: refRow } = refCell;
|
|
73250
73330
|
// check if we can shrink selection
|
|
73251
73331
|
let n = 0;
|
|
73252
73332
|
while (result !== null) {
|
|
73253
73333
|
n++;
|
|
73254
73334
|
if (deltaCol < 0) {
|
|
73255
73335
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
73256
|
-
result =
|
|
73336
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
73257
73337
|
}
|
|
73258
73338
|
if (deltaCol > 0) {
|
|
73259
73339
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
73260
|
-
result = left + n <=
|
|
73340
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
73261
73341
|
}
|
|
73262
73342
|
if (deltaRow < 0) {
|
|
73263
73343
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
73264
|
-
result =
|
|
73344
|
+
result =
|
|
73345
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
73265
73346
|
}
|
|
73266
73347
|
if (deltaRow > 0) {
|
|
73267
73348
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
73268
|
-
result = top + n <=
|
|
73349
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
73269
73350
|
}
|
|
73270
73351
|
result = result ? reorderZone(result) : result;
|
|
73271
73352
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -73495,18 +73576,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
73495
73576
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
73496
73577
|
* find a visible cell.
|
|
73497
73578
|
*/
|
|
73498
|
-
|
|
73579
|
+
getReferenceAnchor() {
|
|
73499
73580
|
const sheetId = this.getters.getActiveSheetId();
|
|
73500
73581
|
const anchor = this.anchor;
|
|
73501
73582
|
const { left, right, top, bottom } = anchor.zone;
|
|
73502
73583
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
73584
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
73585
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
73586
|
+
: anchorCol;
|
|
73587
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
73588
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73589
|
+
: anchorRow;
|
|
73590
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
73591
|
+
left: col,
|
|
73592
|
+
right: col,
|
|
73593
|
+
top: row,
|
|
73594
|
+
bottom: row,
|
|
73595
|
+
});
|
|
73503
73596
|
return {
|
|
73504
|
-
|
|
73505
|
-
|
|
73506
|
-
: anchorCol,
|
|
73507
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
73508
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73509
|
-
: anchorRow,
|
|
73597
|
+
cell: { col, row },
|
|
73598
|
+
zone,
|
|
73510
73599
|
};
|
|
73511
73600
|
}
|
|
73512
73601
|
deltaToTarget(position, direction, step) {
|
|
@@ -76616,9 +76705,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76616
76705
|
exports.tokenize = tokenize;
|
|
76617
76706
|
|
|
76618
76707
|
|
|
76619
|
-
__info__.version = "18.1.
|
|
76620
|
-
__info__.date = "2025-
|
|
76621
|
-
__info__.hash = "
|
|
76708
|
+
__info__.version = "18.1.29";
|
|
76709
|
+
__info__.date = "2025-07-11T11:11:55.442Z";
|
|
76710
|
+
__info__.hash = "3456a93";
|
|
76622
76711
|
|
|
76623
76712
|
|
|
76624
76713
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|