@odoo/o-spreadsheet 17.0.67 → 17.0.69
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 +128 -45
- package/dist/o-spreadsheet.esm.js +128 -45
- package/dist/o-spreadsheet.iife.js +128 -45
- package/dist/o-spreadsheet.iife.min.js +200 -200
- package/dist/o_spreadsheet.xml +5 -5
- 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 17.0.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.69
|
|
6
|
+
* @date 2025-07-11T11:06:35.446Z
|
|
7
|
+
* @hash 8c0d3da
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -4586,6 +4586,8 @@
|
|
|
4586
4586
|
function splitTextToWidth(ctx, text, style, width) {
|
|
4587
4587
|
if (!style)
|
|
4588
4588
|
style = {};
|
|
4589
|
+
if (isMarkdownLink(text))
|
|
4590
|
+
text = parseMarkdownLink(text).label;
|
|
4589
4591
|
const brokenText = [];
|
|
4590
4592
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
4591
4593
|
// but 5-10x faster if it doesn't
|
|
@@ -32340,38 +32342,111 @@
|
|
|
32340
32342
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
32341
32343
|
*/
|
|
32342
32344
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
32345
|
+
let deconstructedSheets = null;
|
|
32343
32346
|
for (let tableSheet of convertedSheets) {
|
|
32344
32347
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
32348
|
+
if (!tables || tables.length === 0) {
|
|
32349
|
+
continue;
|
|
32350
|
+
}
|
|
32351
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
32352
|
+
if (!deconstructedSheets) {
|
|
32353
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
32354
|
+
}
|
|
32345
32355
|
for (let table of tables) {
|
|
32346
|
-
|
|
32347
|
-
|
|
32348
|
-
for (let xc in
|
|
32349
|
-
const
|
|
32350
|
-
|
|
32351
|
-
|
|
32352
|
-
|
|
32353
|
-
|
|
32354
|
-
let openBrackets = 1;
|
|
32355
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
32356
|
-
if (cell.content[endIndex] === "[") {
|
|
32357
|
-
openBrackets++;
|
|
32358
|
-
}
|
|
32359
|
-
else if (cell.content[endIndex] === "]") {
|
|
32360
|
-
openBrackets--;
|
|
32361
|
-
}
|
|
32362
|
-
endIndex++;
|
|
32363
|
-
}
|
|
32364
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
32365
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32366
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
32367
|
-
cell.content =
|
|
32368
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
32356
|
+
for (let sheetId in deconstructedSheets) {
|
|
32357
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32358
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32359
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32360
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
32361
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
32362
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
32363
|
+
continue;
|
|
32369
32364
|
}
|
|
32365
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
32366
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32367
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
32368
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
32369
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
32370
|
+
convertedRef +
|
|
32371
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
32372
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
32373
|
+
}
|
|
32374
|
+
}
|
|
32375
|
+
}
|
|
32376
|
+
}
|
|
32377
|
+
}
|
|
32378
|
+
if (!deconstructedSheets) {
|
|
32379
|
+
return;
|
|
32380
|
+
}
|
|
32381
|
+
for (let sheetId in deconstructedSheets) {
|
|
32382
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32383
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32384
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32385
|
+
if (deconstructedCell.length === 1) {
|
|
32386
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
32387
|
+
continue;
|
|
32388
|
+
}
|
|
32389
|
+
let newContent = "";
|
|
32390
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
32391
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
32392
|
+
}
|
|
32393
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
32394
|
+
sheet.cells[xc].content = newContent;
|
|
32395
|
+
}
|
|
32396
|
+
}
|
|
32397
|
+
}
|
|
32398
|
+
/**
|
|
32399
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
32400
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
32401
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
32402
|
+
*/
|
|
32403
|
+
function deconstructSheets(convertedSheets) {
|
|
32404
|
+
const deconstructedSheets = {};
|
|
32405
|
+
for (let sheet of convertedSheets) {
|
|
32406
|
+
for (let xc in sheet.cells) {
|
|
32407
|
+
const cellContent = sheet.cells[xc]?.content;
|
|
32408
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
32409
|
+
continue;
|
|
32410
|
+
}
|
|
32411
|
+
const startIndex = cellContent.indexOf("[");
|
|
32412
|
+
if (startIndex === -1) {
|
|
32413
|
+
continue;
|
|
32414
|
+
}
|
|
32415
|
+
const deconstructedCell = [];
|
|
32416
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
32417
|
+
let possibleRef = "";
|
|
32418
|
+
let openBrackets = 1;
|
|
32419
|
+
let mainPossibleTableIndex = 0;
|
|
32420
|
+
let mainOpenBracketIndex = startIndex;
|
|
32421
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
32422
|
+
if (cellContent[index] === "[") {
|
|
32423
|
+
if (openBrackets === 0) {
|
|
32424
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
32425
|
+
mainOpenBracketIndex = index;
|
|
32426
|
+
}
|
|
32427
|
+
openBrackets++;
|
|
32428
|
+
continue;
|
|
32429
|
+
}
|
|
32430
|
+
if (cellContent[index] === "]") {
|
|
32431
|
+
openBrackets--;
|
|
32432
|
+
if (openBrackets === 0) {
|
|
32433
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
32434
|
+
deconstructedCell.push(possibleTable);
|
|
32435
|
+
deconstructedCell.push(possibleRef);
|
|
32436
|
+
mainPossibleTableIndex = index + 1;
|
|
32370
32437
|
}
|
|
32371
32438
|
}
|
|
32372
32439
|
}
|
|
32440
|
+
if (deconstructedCell.length) {
|
|
32441
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
32442
|
+
deconstructedSheets[sheet.id] = {};
|
|
32443
|
+
}
|
|
32444
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
32445
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
32446
|
+
}
|
|
32373
32447
|
}
|
|
32374
32448
|
}
|
|
32449
|
+
return deconstructedSheets;
|
|
32375
32450
|
}
|
|
32376
32451
|
/**
|
|
32377
32452
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -52502,14 +52577,12 @@
|
|
|
52502
52577
|
this.editionState = "initializing";
|
|
52503
52578
|
}
|
|
52504
52579
|
stopEdition() {
|
|
52505
|
-
|
|
52506
|
-
if (!this.state.isEditing || !input)
|
|
52580
|
+
if (!this.state.isEditing || !this.sheetNameRef.el)
|
|
52507
52581
|
return;
|
|
52508
52582
|
this.state.isEditing = false;
|
|
52509
52583
|
this.editionState = "initializing";
|
|
52510
|
-
|
|
52584
|
+
this.sheetNameRef.el.blur();
|
|
52511
52585
|
const inputValue = this.getInputContent() || "";
|
|
52512
|
-
input.innerText = inputValue;
|
|
52513
52586
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
52514
52587
|
}
|
|
52515
52588
|
cancelEdition() {
|
|
@@ -55628,26 +55701,28 @@
|
|
|
55628
55701
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
55629
55702
|
};
|
|
55630
55703
|
};
|
|
55631
|
-
const {
|
|
55704
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
55705
|
+
const { col: refCol, row: refRow } = refCell;
|
|
55632
55706
|
// check if we can shrink selection
|
|
55633
55707
|
let n = 0;
|
|
55634
55708
|
while (result !== null) {
|
|
55635
55709
|
n++;
|
|
55636
55710
|
if (deltaCol < 0) {
|
|
55637
55711
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
55638
|
-
result =
|
|
55712
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
55639
55713
|
}
|
|
55640
55714
|
if (deltaCol > 0) {
|
|
55641
55715
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
55642
|
-
result = left + n <=
|
|
55716
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
55643
55717
|
}
|
|
55644
55718
|
if (deltaRow < 0) {
|
|
55645
55719
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
55646
|
-
result =
|
|
55720
|
+
result =
|
|
55721
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
55647
55722
|
}
|
|
55648
55723
|
if (deltaRow > 0) {
|
|
55649
55724
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
55650
|
-
result = top + n <=
|
|
55725
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
55651
55726
|
}
|
|
55652
55727
|
result = result ? organizeZone(result) : result;
|
|
55653
55728
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -55876,18 +55951,26 @@
|
|
|
55876
55951
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
55877
55952
|
* find a visible cell.
|
|
55878
55953
|
*/
|
|
55879
|
-
|
|
55954
|
+
getReferenceAnchor() {
|
|
55880
55955
|
const sheetId = this.getters.getActiveSheetId();
|
|
55881
55956
|
const anchor = this.anchor;
|
|
55882
55957
|
const { left, right, top, bottom } = anchor.zone;
|
|
55883
55958
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
55959
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
55960
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
55961
|
+
: anchorCol;
|
|
55962
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
55963
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
55964
|
+
: anchorRow;
|
|
55965
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
55966
|
+
left: col,
|
|
55967
|
+
right: col,
|
|
55968
|
+
top: row,
|
|
55969
|
+
bottom: row,
|
|
55970
|
+
});
|
|
55884
55971
|
return {
|
|
55885
|
-
|
|
55886
|
-
|
|
55887
|
-
: anchorCol,
|
|
55888
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
55889
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
55890
|
-
: anchorRow,
|
|
55972
|
+
cell: { col, row },
|
|
55973
|
+
zone,
|
|
55891
55974
|
};
|
|
55892
55975
|
}
|
|
55893
55976
|
deltaToTarget(position, direction, step) {
|
|
@@ -58352,9 +58435,9 @@
|
|
|
58352
58435
|
exports.tokenize = tokenize;
|
|
58353
58436
|
|
|
58354
58437
|
|
|
58355
|
-
__info__.version = "17.0.
|
|
58356
|
-
__info__.date = "2025-
|
|
58357
|
-
__info__.hash = "
|
|
58438
|
+
__info__.version = "17.0.69";
|
|
58439
|
+
__info__.date = "2025-07-11T11:06:35.446Z";
|
|
58440
|
+
__info__.hash = "8c0d3da";
|
|
58358
58441
|
|
|
58359
58442
|
|
|
58360
58443
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|