@odoo/o-spreadsheet 18.3.10 → 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 +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 +384 -384
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +2 -4
|
@@ -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);
|
|
@@ -23096,7 +23104,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
23096
23104
|
}
|
|
23097
23105
|
captureSelection(zone, col, row) {
|
|
23098
23106
|
this.model.selection.capture(this, {
|
|
23099
|
-
cell: { col: col
|
|
23107
|
+
cell: { col: col ?? zone.left, row: row ?? zone.right },
|
|
23100
23108
|
zone,
|
|
23101
23109
|
}, {
|
|
23102
23110
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -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)) {
|
|
@@ -45857,6 +45940,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45857
45940
|
this.switchToList();
|
|
45858
45941
|
}
|
|
45859
45942
|
}
|
|
45943
|
+
else if (!this.editedCF) {
|
|
45944
|
+
this.switchToList();
|
|
45945
|
+
}
|
|
45860
45946
|
});
|
|
45861
45947
|
}
|
|
45862
45948
|
get conditionalFormats() {
|
|
@@ -49775,10 +49861,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49775
49861
|
if (finalCell.value === null) {
|
|
49776
49862
|
return { value: _t("(Undefined)") };
|
|
49777
49863
|
}
|
|
49778
|
-
return
|
|
49779
|
-
value: finalCell.value,
|
|
49780
|
-
format: finalCell.format,
|
|
49781
|
-
};
|
|
49864
|
+
return finalCell;
|
|
49782
49865
|
}
|
|
49783
49866
|
getPivotCellValueAndFormat(measureId, domain) {
|
|
49784
49867
|
const dataEntries = this.filterDataEntriesFromDomain(this.dataEntries, domain);
|
|
@@ -50007,7 +50090,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50007
50090
|
ui: SpreadsheetPivot,
|
|
50008
50091
|
definition: SpreadsheetPivotRuntimeDefinition,
|
|
50009
50092
|
externalData: false,
|
|
50010
|
-
onIterationEndEvaluation: (pivot) => pivot.markAsDirtyForEvaluation(),
|
|
50011
50093
|
dateGranularities: [...dateGranularities],
|
|
50012
50094
|
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
|
|
50013
50095
|
isMeasureCandidate: (field) => field.type !== "boolean",
|
|
@@ -62961,7 +63043,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62961
63043
|
onIterationEndEvaluationRegistry.add("pivots", (getters) => {
|
|
62962
63044
|
for (const pivotId of getters.getPivotIds()) {
|
|
62963
63045
|
const pivot = getters.getPivot(pivotId);
|
|
62964
|
-
|
|
63046
|
+
pivot.markAsDirtyForEvaluation?.();
|
|
62965
63047
|
}
|
|
62966
63048
|
});
|
|
62967
63049
|
|
|
@@ -65983,13 +66065,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65983
66065
|
super(custom, params);
|
|
65984
66066
|
this.getters = params.getters;
|
|
65985
66067
|
}
|
|
65986
|
-
|
|
66068
|
+
markAsDirtyForEvaluation() {
|
|
65987
66069
|
this.cache = {};
|
|
65988
66070
|
this.rankAsc = {};
|
|
65989
66071
|
this.rankDesc = {};
|
|
65990
66072
|
this.runningTotal = {};
|
|
65991
66073
|
this.runningTotalInPercent = {};
|
|
65992
|
-
super.
|
|
66074
|
+
super.markAsDirtyForEvaluation?.();
|
|
65993
66075
|
}
|
|
65994
66076
|
getPivotCellValueAndFormat(measureName, domain) {
|
|
65995
66077
|
return this.getMeasureDisplayValue(measureName, domain);
|
|
@@ -66114,7 +66196,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66114
66196
|
return this.getSubTreeMatchingDomain(node.children, domain, domainLevel + 1);
|
|
66115
66197
|
}
|
|
66116
66198
|
}
|
|
66117
|
-
return
|
|
66199
|
+
return [];
|
|
66118
66200
|
}
|
|
66119
66201
|
treeToLeafDomains(tree, parentDomain = []) {
|
|
66120
66202
|
const domains = [];
|
|
@@ -77341,26 +77423,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77341
77423
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
77342
77424
|
};
|
|
77343
77425
|
};
|
|
77344
|
-
const {
|
|
77426
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
77427
|
+
const { col: refCol, row: refRow } = refCell;
|
|
77345
77428
|
// check if we can shrink selection
|
|
77346
77429
|
let n = 0;
|
|
77347
77430
|
while (result !== null) {
|
|
77348
77431
|
n++;
|
|
77349
77432
|
if (deltaCol < 0) {
|
|
77350
77433
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
77351
|
-
result =
|
|
77434
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
77352
77435
|
}
|
|
77353
77436
|
if (deltaCol > 0) {
|
|
77354
77437
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
77355
|
-
result = left + n <=
|
|
77438
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
77356
77439
|
}
|
|
77357
77440
|
if (deltaRow < 0) {
|
|
77358
77441
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
77359
|
-
result =
|
|
77442
|
+
result =
|
|
77443
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
77360
77444
|
}
|
|
77361
77445
|
if (deltaRow > 0) {
|
|
77362
77446
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
77363
|
-
result = top + n <=
|
|
77447
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
77364
77448
|
}
|
|
77365
77449
|
result = result ? reorderZone(result) : result;
|
|
77366
77450
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -77590,18 +77674,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77590
77674
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
77591
77675
|
* find a visible cell.
|
|
77592
77676
|
*/
|
|
77593
|
-
|
|
77677
|
+
getReferenceAnchor() {
|
|
77594
77678
|
const sheetId = this.getters.getActiveSheetId();
|
|
77595
77679
|
const anchor = this.anchor;
|
|
77596
77680
|
const { left, right, top, bottom } = anchor.zone;
|
|
77597
77681
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
77682
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
77683
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
77684
|
+
: anchorCol;
|
|
77685
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
77686
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
77687
|
+
: anchorRow;
|
|
77688
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
77689
|
+
left: col,
|
|
77690
|
+
right: col,
|
|
77691
|
+
top: row,
|
|
77692
|
+
bottom: row,
|
|
77693
|
+
});
|
|
77598
77694
|
return {
|
|
77599
|
-
|
|
77600
|
-
|
|
77601
|
-
: anchorCol,
|
|
77602
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
77603
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
77604
|
-
: anchorRow,
|
|
77695
|
+
cell: { col, row },
|
|
77696
|
+
zone,
|
|
77605
77697
|
};
|
|
77606
77698
|
}
|
|
77607
77699
|
deltaToTarget(position, direction, step) {
|
|
@@ -80757,9 +80849,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80757
80849
|
exports.tokenize = tokenize;
|
|
80758
80850
|
|
|
80759
80851
|
|
|
80760
|
-
__info__.version = "18.3.
|
|
80761
|
-
__info__.date = "2025-
|
|
80762
|
-
__info__.hash = "
|
|
80852
|
+
__info__.version = "18.3.12";
|
|
80853
|
+
__info__.date = "2025-07-11T11:11:58.998Z";
|
|
80854
|
+
__info__.hash = "d14dc96";
|
|
80763
80855
|
|
|
80764
80856
|
|
|
80765
80857
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|