@odoo/o-spreadsheet 16.0.73 → 16.0.75
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 +122 -38
- package/dist/o-spreadsheet.d.ts +1 -1
- package/dist/o-spreadsheet.esm.js +122 -38
- package/dist/o-spreadsheet.iife.js +122 -38
- package/dist/o-spreadsheet.iife.min.js +176 -176
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -3
|
@@ -25603,38 +25603,112 @@ function applyStyleToZone(appliedStyle, zone, cells, styles) {
|
|
|
25603
25603
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25604
25604
|
*/
|
|
25605
25605
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25606
|
+
let deconstructedSheets = null;
|
|
25606
25607
|
for (let tableSheet of convertedSheets) {
|
|
25607
25608
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25609
|
+
if (!tables || tables.length === 0) {
|
|
25610
|
+
continue;
|
|
25611
|
+
}
|
|
25612
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25613
|
+
if (!deconstructedSheets) {
|
|
25614
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25615
|
+
}
|
|
25608
25616
|
for (let table of tables) {
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
for (let xc in
|
|
25612
|
-
const
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
let openBrackets = 1;
|
|
25618
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
25619
|
-
if (cell.content[endIndex] === "[") {
|
|
25620
|
-
openBrackets++;
|
|
25621
|
-
}
|
|
25622
|
-
else if (cell.content[endIndex] === "]") {
|
|
25623
|
-
openBrackets--;
|
|
25624
|
-
}
|
|
25625
|
-
endIndex++;
|
|
25626
|
-
}
|
|
25627
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25628
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25629
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25630
|
-
cell.content =
|
|
25631
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
25617
|
+
for (let sheetId in deconstructedSheets) {
|
|
25618
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25619
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25620
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25621
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25622
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25623
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25624
|
+
continue;
|
|
25632
25625
|
}
|
|
25626
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25627
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25628
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25629
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25630
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25631
|
+
convertedRef +
|
|
25632
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25633
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25633
25634
|
}
|
|
25634
25635
|
}
|
|
25635
25636
|
}
|
|
25636
25637
|
}
|
|
25637
25638
|
}
|
|
25639
|
+
if (!deconstructedSheets) {
|
|
25640
|
+
return;
|
|
25641
|
+
}
|
|
25642
|
+
for (let sheetId in deconstructedSheets) {
|
|
25643
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25644
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25645
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25646
|
+
if (deconstructedCell.length === 1) {
|
|
25647
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
25648
|
+
continue;
|
|
25649
|
+
}
|
|
25650
|
+
let newContent = "";
|
|
25651
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25652
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25653
|
+
}
|
|
25654
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25655
|
+
sheet.cells[xc].content = newContent;
|
|
25656
|
+
}
|
|
25657
|
+
}
|
|
25658
|
+
}
|
|
25659
|
+
/**
|
|
25660
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25661
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25662
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25663
|
+
*/
|
|
25664
|
+
function deconstructSheets(convertedSheets) {
|
|
25665
|
+
var _a;
|
|
25666
|
+
const deconstructedSheets = {};
|
|
25667
|
+
for (let sheet of convertedSheets) {
|
|
25668
|
+
for (let xc in sheet.cells) {
|
|
25669
|
+
const cellContent = (_a = sheet.cells[xc]) === null || _a === void 0 ? void 0 : _a.content;
|
|
25670
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25671
|
+
continue;
|
|
25672
|
+
}
|
|
25673
|
+
const startIndex = cellContent.indexOf("[");
|
|
25674
|
+
if (startIndex === -1) {
|
|
25675
|
+
continue;
|
|
25676
|
+
}
|
|
25677
|
+
const deconstructedCell = [];
|
|
25678
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25679
|
+
let possibleRef = "";
|
|
25680
|
+
let openBrackets = 1;
|
|
25681
|
+
let mainPossibleTableIndex = 0;
|
|
25682
|
+
let mainOpenBracketIndex = startIndex;
|
|
25683
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25684
|
+
if (cellContent[index] === "[") {
|
|
25685
|
+
if (openBrackets === 0) {
|
|
25686
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25687
|
+
mainOpenBracketIndex = index;
|
|
25688
|
+
}
|
|
25689
|
+
openBrackets++;
|
|
25690
|
+
continue;
|
|
25691
|
+
}
|
|
25692
|
+
if (cellContent[index] === "]") {
|
|
25693
|
+
openBrackets--;
|
|
25694
|
+
if (openBrackets === 0) {
|
|
25695
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25696
|
+
deconstructedCell.push(possibleTable);
|
|
25697
|
+
deconstructedCell.push(possibleRef);
|
|
25698
|
+
mainPossibleTableIndex = index + 1;
|
|
25699
|
+
}
|
|
25700
|
+
}
|
|
25701
|
+
}
|
|
25702
|
+
if (deconstructedCell.length) {
|
|
25703
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25704
|
+
deconstructedSheets[sheet.id] = {};
|
|
25705
|
+
}
|
|
25706
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25707
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25708
|
+
}
|
|
25709
|
+
}
|
|
25710
|
+
}
|
|
25711
|
+
return deconstructedSheets;
|
|
25638
25712
|
}
|
|
25639
25713
|
/**
|
|
25640
25714
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -41487,26 +41561,28 @@ class SelectionStreamProcessor {
|
|
|
41487
41561
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
41488
41562
|
};
|
|
41489
41563
|
};
|
|
41490
|
-
const {
|
|
41564
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
41565
|
+
const { col: refCol, row: refRow } = refCell;
|
|
41491
41566
|
// check if we can shrink selection
|
|
41492
41567
|
let n = 0;
|
|
41493
41568
|
while (result !== null) {
|
|
41494
41569
|
n++;
|
|
41495
41570
|
if (deltaCol < 0) {
|
|
41496
41571
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
41497
|
-
result =
|
|
41572
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
41498
41573
|
}
|
|
41499
41574
|
if (deltaCol > 0) {
|
|
41500
41575
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
41501
|
-
result = left + n <=
|
|
41576
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
41502
41577
|
}
|
|
41503
41578
|
if (deltaRow < 0) {
|
|
41504
41579
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
41505
|
-
result =
|
|
41580
|
+
result =
|
|
41581
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
41506
41582
|
}
|
|
41507
41583
|
if (deltaRow > 0) {
|
|
41508
41584
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
41509
|
-
result = top + n <=
|
|
41585
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
41510
41586
|
}
|
|
41511
41587
|
result = result ? organizeZone(result) : result;
|
|
41512
41588
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -41742,18 +41818,26 @@ class SelectionStreamProcessor {
|
|
|
41742
41818
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
41743
41819
|
* find a visible cell.
|
|
41744
41820
|
*/
|
|
41745
|
-
|
|
41821
|
+
getReferenceAnchor() {
|
|
41746
41822
|
const sheetId = this.getters.getActiveSheetId();
|
|
41747
41823
|
const anchor = this.anchor;
|
|
41748
41824
|
const { left, right, top, bottom } = anchor.zone;
|
|
41749
41825
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
41826
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
41827
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
41828
|
+
: anchorCol;
|
|
41829
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
41830
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
41831
|
+
: anchorRow;
|
|
41832
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
41833
|
+
left: col,
|
|
41834
|
+
right: col,
|
|
41835
|
+
top: row,
|
|
41836
|
+
bottom: row,
|
|
41837
|
+
});
|
|
41750
41838
|
return {
|
|
41751
|
-
|
|
41752
|
-
|
|
41753
|
-
: anchorCol,
|
|
41754
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
41755
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
41756
|
-
: anchorRow,
|
|
41839
|
+
cell: { col, row },
|
|
41840
|
+
zone,
|
|
41757
41841
|
};
|
|
41758
41842
|
}
|
|
41759
41843
|
deltaToTarget(position, direction, step) {
|
|
@@ -43880,6 +43964,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
43880
43964
|
exports.tokenize = tokenize;
|
|
43881
43965
|
|
|
43882
43966
|
|
|
43883
|
-
__info__.version = '16.0.
|
|
43884
|
-
__info__.date = '2025-
|
|
43885
|
-
__info__.hash = '
|
|
43967
|
+
__info__.version = '16.0.75';
|
|
43968
|
+
__info__.date = '2025-07-11T11:06:44.633Z';
|
|
43969
|
+
__info__.hash = 'c6d8a41';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -522,7 +522,7 @@ declare class SelectionStreamProcessor implements SelectionProcessor, StatefulSt
|
|
|
522
522
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
523
523
|
* find a visible cell.
|
|
524
524
|
*/
|
|
525
|
-
private
|
|
525
|
+
private getReferenceAnchor;
|
|
526
526
|
private deltaToTarget;
|
|
527
527
|
private getStartingPosition;
|
|
528
528
|
/**
|
|
@@ -25599,38 +25599,112 @@ function applyStyleToZone(appliedStyle, zone, cells, styles) {
|
|
|
25599
25599
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25600
25600
|
*/
|
|
25601
25601
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25602
|
+
let deconstructedSheets = null;
|
|
25602
25603
|
for (let tableSheet of convertedSheets) {
|
|
25603
25604
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25605
|
+
if (!tables || tables.length === 0) {
|
|
25606
|
+
continue;
|
|
25607
|
+
}
|
|
25608
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25609
|
+
if (!deconstructedSheets) {
|
|
25610
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25611
|
+
}
|
|
25604
25612
|
for (let table of tables) {
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
for (let xc in
|
|
25608
|
-
const
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
let openBrackets = 1;
|
|
25614
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
25615
|
-
if (cell.content[endIndex] === "[") {
|
|
25616
|
-
openBrackets++;
|
|
25617
|
-
}
|
|
25618
|
-
else if (cell.content[endIndex] === "]") {
|
|
25619
|
-
openBrackets--;
|
|
25620
|
-
}
|
|
25621
|
-
endIndex++;
|
|
25622
|
-
}
|
|
25623
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25624
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25625
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25626
|
-
cell.content =
|
|
25627
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
25613
|
+
for (let sheetId in deconstructedSheets) {
|
|
25614
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25615
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25616
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25617
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25618
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25619
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25620
|
+
continue;
|
|
25628
25621
|
}
|
|
25622
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25623
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25624
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25625
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25626
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25627
|
+
convertedRef +
|
|
25628
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25629
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25629
25630
|
}
|
|
25630
25631
|
}
|
|
25631
25632
|
}
|
|
25632
25633
|
}
|
|
25633
25634
|
}
|
|
25635
|
+
if (!deconstructedSheets) {
|
|
25636
|
+
return;
|
|
25637
|
+
}
|
|
25638
|
+
for (let sheetId in deconstructedSheets) {
|
|
25639
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25640
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25641
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25642
|
+
if (deconstructedCell.length === 1) {
|
|
25643
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
25644
|
+
continue;
|
|
25645
|
+
}
|
|
25646
|
+
let newContent = "";
|
|
25647
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25648
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25649
|
+
}
|
|
25650
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25651
|
+
sheet.cells[xc].content = newContent;
|
|
25652
|
+
}
|
|
25653
|
+
}
|
|
25654
|
+
}
|
|
25655
|
+
/**
|
|
25656
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25657
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25658
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25659
|
+
*/
|
|
25660
|
+
function deconstructSheets(convertedSheets) {
|
|
25661
|
+
var _a;
|
|
25662
|
+
const deconstructedSheets = {};
|
|
25663
|
+
for (let sheet of convertedSheets) {
|
|
25664
|
+
for (let xc in sheet.cells) {
|
|
25665
|
+
const cellContent = (_a = sheet.cells[xc]) === null || _a === void 0 ? void 0 : _a.content;
|
|
25666
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25667
|
+
continue;
|
|
25668
|
+
}
|
|
25669
|
+
const startIndex = cellContent.indexOf("[");
|
|
25670
|
+
if (startIndex === -1) {
|
|
25671
|
+
continue;
|
|
25672
|
+
}
|
|
25673
|
+
const deconstructedCell = [];
|
|
25674
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25675
|
+
let possibleRef = "";
|
|
25676
|
+
let openBrackets = 1;
|
|
25677
|
+
let mainPossibleTableIndex = 0;
|
|
25678
|
+
let mainOpenBracketIndex = startIndex;
|
|
25679
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25680
|
+
if (cellContent[index] === "[") {
|
|
25681
|
+
if (openBrackets === 0) {
|
|
25682
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25683
|
+
mainOpenBracketIndex = index;
|
|
25684
|
+
}
|
|
25685
|
+
openBrackets++;
|
|
25686
|
+
continue;
|
|
25687
|
+
}
|
|
25688
|
+
if (cellContent[index] === "]") {
|
|
25689
|
+
openBrackets--;
|
|
25690
|
+
if (openBrackets === 0) {
|
|
25691
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25692
|
+
deconstructedCell.push(possibleTable);
|
|
25693
|
+
deconstructedCell.push(possibleRef);
|
|
25694
|
+
mainPossibleTableIndex = index + 1;
|
|
25695
|
+
}
|
|
25696
|
+
}
|
|
25697
|
+
}
|
|
25698
|
+
if (deconstructedCell.length) {
|
|
25699
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25700
|
+
deconstructedSheets[sheet.id] = {};
|
|
25701
|
+
}
|
|
25702
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25703
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25704
|
+
}
|
|
25705
|
+
}
|
|
25706
|
+
}
|
|
25707
|
+
return deconstructedSheets;
|
|
25634
25708
|
}
|
|
25635
25709
|
/**
|
|
25636
25710
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -41483,26 +41557,28 @@ class SelectionStreamProcessor {
|
|
|
41483
41557
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
41484
41558
|
};
|
|
41485
41559
|
};
|
|
41486
|
-
const {
|
|
41560
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
41561
|
+
const { col: refCol, row: refRow } = refCell;
|
|
41487
41562
|
// check if we can shrink selection
|
|
41488
41563
|
let n = 0;
|
|
41489
41564
|
while (result !== null) {
|
|
41490
41565
|
n++;
|
|
41491
41566
|
if (deltaCol < 0) {
|
|
41492
41567
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
41493
|
-
result =
|
|
41568
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
41494
41569
|
}
|
|
41495
41570
|
if (deltaCol > 0) {
|
|
41496
41571
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
41497
|
-
result = left + n <=
|
|
41572
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
41498
41573
|
}
|
|
41499
41574
|
if (deltaRow < 0) {
|
|
41500
41575
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
41501
|
-
result =
|
|
41576
|
+
result =
|
|
41577
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
41502
41578
|
}
|
|
41503
41579
|
if (deltaRow > 0) {
|
|
41504
41580
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
41505
|
-
result = top + n <=
|
|
41581
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
41506
41582
|
}
|
|
41507
41583
|
result = result ? organizeZone(result) : result;
|
|
41508
41584
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -41738,18 +41814,26 @@ class SelectionStreamProcessor {
|
|
|
41738
41814
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
41739
41815
|
* find a visible cell.
|
|
41740
41816
|
*/
|
|
41741
|
-
|
|
41817
|
+
getReferenceAnchor() {
|
|
41742
41818
|
const sheetId = this.getters.getActiveSheetId();
|
|
41743
41819
|
const anchor = this.anchor;
|
|
41744
41820
|
const { left, right, top, bottom } = anchor.zone;
|
|
41745
41821
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
41822
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
41823
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
41824
|
+
: anchorCol;
|
|
41825
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
41826
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
41827
|
+
: anchorRow;
|
|
41828
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
41829
|
+
left: col,
|
|
41830
|
+
right: col,
|
|
41831
|
+
top: row,
|
|
41832
|
+
bottom: row,
|
|
41833
|
+
});
|
|
41746
41834
|
return {
|
|
41747
|
-
|
|
41748
|
-
|
|
41749
|
-
: anchorCol,
|
|
41750
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
41751
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
41752
|
-
: anchorRow,
|
|
41835
|
+
cell: { col, row },
|
|
41836
|
+
zone,
|
|
41753
41837
|
};
|
|
41754
41838
|
}
|
|
41755
41839
|
deltaToTarget(position, direction, step) {
|
|
@@ -43848,6 +43932,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43848
43932
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43849
43933
|
|
|
43850
43934
|
|
|
43851
|
-
__info__.version = '16.0.
|
|
43852
|
-
__info__.date = '2025-
|
|
43853
|
-
__info__.hash = '
|
|
43935
|
+
__info__.version = '16.0.75';
|
|
43936
|
+
__info__.date = '2025-07-11T11:06:44.633Z';
|
|
43937
|
+
__info__.hash = 'c6d8a41';
|
|
@@ -25600,38 +25600,112 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
25600
25600
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
25601
25601
|
*/
|
|
25602
25602
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
25603
|
+
let deconstructedSheets = null;
|
|
25603
25604
|
for (let tableSheet of convertedSheets) {
|
|
25604
25605
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
25606
|
+
if (!tables || tables.length === 0) {
|
|
25607
|
+
continue;
|
|
25608
|
+
}
|
|
25609
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
25610
|
+
if (!deconstructedSheets) {
|
|
25611
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
25612
|
+
}
|
|
25605
25613
|
for (let table of tables) {
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
for (let xc in
|
|
25609
|
-
const
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
let openBrackets = 1;
|
|
25615
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
25616
|
-
if (cell.content[endIndex] === "[") {
|
|
25617
|
-
openBrackets++;
|
|
25618
|
-
}
|
|
25619
|
-
else if (cell.content[endIndex] === "]") {
|
|
25620
|
-
openBrackets--;
|
|
25621
|
-
}
|
|
25622
|
-
endIndex++;
|
|
25623
|
-
}
|
|
25624
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
25625
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25626
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
25627
|
-
cell.content =
|
|
25628
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
25614
|
+
for (let sheetId in deconstructedSheets) {
|
|
25615
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25616
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25617
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25618
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
25619
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
25620
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
25621
|
+
continue;
|
|
25629
25622
|
}
|
|
25623
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
25624
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
25625
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
25626
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
25627
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
25628
|
+
convertedRef +
|
|
25629
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
25630
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
25630
25631
|
}
|
|
25631
25632
|
}
|
|
25632
25633
|
}
|
|
25633
25634
|
}
|
|
25634
25635
|
}
|
|
25636
|
+
if (!deconstructedSheets) {
|
|
25637
|
+
return;
|
|
25638
|
+
}
|
|
25639
|
+
for (let sheetId in deconstructedSheets) {
|
|
25640
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
25641
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
25642
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
25643
|
+
if (deconstructedCell.length === 1) {
|
|
25644
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
25645
|
+
continue;
|
|
25646
|
+
}
|
|
25647
|
+
let newContent = "";
|
|
25648
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
25649
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
25650
|
+
}
|
|
25651
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
25652
|
+
sheet.cells[xc].content = newContent;
|
|
25653
|
+
}
|
|
25654
|
+
}
|
|
25655
|
+
}
|
|
25656
|
+
/**
|
|
25657
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
25658
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
25659
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
25660
|
+
*/
|
|
25661
|
+
function deconstructSheets(convertedSheets) {
|
|
25662
|
+
var _a;
|
|
25663
|
+
const deconstructedSheets = {};
|
|
25664
|
+
for (let sheet of convertedSheets) {
|
|
25665
|
+
for (let xc in sheet.cells) {
|
|
25666
|
+
const cellContent = (_a = sheet.cells[xc]) === null || _a === void 0 ? void 0 : _a.content;
|
|
25667
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
25668
|
+
continue;
|
|
25669
|
+
}
|
|
25670
|
+
const startIndex = cellContent.indexOf("[");
|
|
25671
|
+
if (startIndex === -1) {
|
|
25672
|
+
continue;
|
|
25673
|
+
}
|
|
25674
|
+
const deconstructedCell = [];
|
|
25675
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
25676
|
+
let possibleRef = "";
|
|
25677
|
+
let openBrackets = 1;
|
|
25678
|
+
let mainPossibleTableIndex = 0;
|
|
25679
|
+
let mainOpenBracketIndex = startIndex;
|
|
25680
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
25681
|
+
if (cellContent[index] === "[") {
|
|
25682
|
+
if (openBrackets === 0) {
|
|
25683
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
25684
|
+
mainOpenBracketIndex = index;
|
|
25685
|
+
}
|
|
25686
|
+
openBrackets++;
|
|
25687
|
+
continue;
|
|
25688
|
+
}
|
|
25689
|
+
if (cellContent[index] === "]") {
|
|
25690
|
+
openBrackets--;
|
|
25691
|
+
if (openBrackets === 0) {
|
|
25692
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
25693
|
+
deconstructedCell.push(possibleTable);
|
|
25694
|
+
deconstructedCell.push(possibleRef);
|
|
25695
|
+
mainPossibleTableIndex = index + 1;
|
|
25696
|
+
}
|
|
25697
|
+
}
|
|
25698
|
+
}
|
|
25699
|
+
if (deconstructedCell.length) {
|
|
25700
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
25701
|
+
deconstructedSheets[sheet.id] = {};
|
|
25702
|
+
}
|
|
25703
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
25704
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
25705
|
+
}
|
|
25706
|
+
}
|
|
25707
|
+
}
|
|
25708
|
+
return deconstructedSheets;
|
|
25635
25709
|
}
|
|
25636
25710
|
/**
|
|
25637
25711
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -41484,26 +41558,28 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
41484
41558
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
41485
41559
|
};
|
|
41486
41560
|
};
|
|
41487
|
-
const {
|
|
41561
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
41562
|
+
const { col: refCol, row: refRow } = refCell;
|
|
41488
41563
|
// check if we can shrink selection
|
|
41489
41564
|
let n = 0;
|
|
41490
41565
|
while (result !== null) {
|
|
41491
41566
|
n++;
|
|
41492
41567
|
if (deltaCol < 0) {
|
|
41493
41568
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
41494
|
-
result =
|
|
41569
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
41495
41570
|
}
|
|
41496
41571
|
if (deltaCol > 0) {
|
|
41497
41572
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
41498
|
-
result = left + n <=
|
|
41573
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
41499
41574
|
}
|
|
41500
41575
|
if (deltaRow < 0) {
|
|
41501
41576
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
41502
|
-
result =
|
|
41577
|
+
result =
|
|
41578
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
41503
41579
|
}
|
|
41504
41580
|
if (deltaRow > 0) {
|
|
41505
41581
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
41506
|
-
result = top + n <=
|
|
41582
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
41507
41583
|
}
|
|
41508
41584
|
result = result ? organizeZone(result) : result;
|
|
41509
41585
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -41739,18 +41815,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
41739
41815
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
41740
41816
|
* find a visible cell.
|
|
41741
41817
|
*/
|
|
41742
|
-
|
|
41818
|
+
getReferenceAnchor() {
|
|
41743
41819
|
const sheetId = this.getters.getActiveSheetId();
|
|
41744
41820
|
const anchor = this.anchor;
|
|
41745
41821
|
const { left, right, top, bottom } = anchor.zone;
|
|
41746
41822
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
41823
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
41824
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
41825
|
+
: anchorCol;
|
|
41826
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
41827
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
41828
|
+
: anchorRow;
|
|
41829
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
41830
|
+
left: col,
|
|
41831
|
+
right: col,
|
|
41832
|
+
top: row,
|
|
41833
|
+
bottom: row,
|
|
41834
|
+
});
|
|
41747
41835
|
return {
|
|
41748
|
-
|
|
41749
|
-
|
|
41750
|
-
: anchorCol,
|
|
41751
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
41752
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
41753
|
-
: anchorRow,
|
|
41836
|
+
cell: { col, row },
|
|
41837
|
+
zone,
|
|
41754
41838
|
};
|
|
41755
41839
|
}
|
|
41756
41840
|
deltaToTarget(position, direction, step) {
|
|
@@ -43879,9 +43963,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43879
43963
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
43880
43964
|
|
|
43881
43965
|
|
|
43882
|
-
__info__.version = '16.0.
|
|
43883
|
-
__info__.date = '2025-
|
|
43884
|
-
__info__.hash = '
|
|
43966
|
+
__info__.version = '16.0.75';
|
|
43967
|
+
__info__.date = '2025-07-11T11:06:44.633Z';
|
|
43968
|
+
__info__.hash = 'c6d8a41';
|
|
43885
43969
|
|
|
43886
43970
|
|
|
43887
43971
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|