@odoo/o-spreadsheet 17.0.68 → 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 +106 -33
- package/dist/o-spreadsheet.esm.js +106 -33
- package/dist/o-spreadsheet.iife.js +106 -33
- 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
|
'use strict';
|
|
@@ -4587,6 +4587,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
4587
4587
|
function splitTextToWidth(ctx, text, style, width) {
|
|
4588
4588
|
if (!style)
|
|
4589
4589
|
style = {};
|
|
4590
|
+
if (isMarkdownLink(text))
|
|
4591
|
+
text = parseMarkdownLink(text).label;
|
|
4590
4592
|
const brokenText = [];
|
|
4591
4593
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
4592
4594
|
// but 5-10x faster if it doesn't
|
|
@@ -32341,38 +32343,111 @@ function applyStyleToZone(appliedStyle, zone, cells, styles) {
|
|
|
32341
32343
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
32342
32344
|
*/
|
|
32343
32345
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
32346
|
+
let deconstructedSheets = null;
|
|
32344
32347
|
for (let tableSheet of convertedSheets) {
|
|
32345
32348
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
32349
|
+
if (!tables || tables.length === 0) {
|
|
32350
|
+
continue;
|
|
32351
|
+
}
|
|
32352
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
32353
|
+
if (!deconstructedSheets) {
|
|
32354
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
32355
|
+
}
|
|
32346
32356
|
for (let table of tables) {
|
|
32347
|
-
|
|
32348
|
-
|
|
32349
|
-
for (let xc in
|
|
32350
|
-
const
|
|
32351
|
-
|
|
32352
|
-
|
|
32353
|
-
|
|
32354
|
-
|
|
32355
|
-
let openBrackets = 1;
|
|
32356
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
32357
|
-
if (cell.content[endIndex] === "[") {
|
|
32358
|
-
openBrackets++;
|
|
32359
|
-
}
|
|
32360
|
-
else if (cell.content[endIndex] === "]") {
|
|
32361
|
-
openBrackets--;
|
|
32362
|
-
}
|
|
32363
|
-
endIndex++;
|
|
32364
|
-
}
|
|
32365
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
32366
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32367
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
32368
|
-
cell.content =
|
|
32369
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
32357
|
+
for (let sheetId in deconstructedSheets) {
|
|
32358
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32359
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32360
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32361
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
32362
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
32363
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
32364
|
+
continue;
|
|
32370
32365
|
}
|
|
32366
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
32367
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32368
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
32369
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
32370
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
32371
|
+
convertedRef +
|
|
32372
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
32373
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
32374
|
+
}
|
|
32375
|
+
}
|
|
32376
|
+
}
|
|
32377
|
+
}
|
|
32378
|
+
}
|
|
32379
|
+
if (!deconstructedSheets) {
|
|
32380
|
+
return;
|
|
32381
|
+
}
|
|
32382
|
+
for (let sheetId in deconstructedSheets) {
|
|
32383
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32384
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32385
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32386
|
+
if (deconstructedCell.length === 1) {
|
|
32387
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
32388
|
+
continue;
|
|
32389
|
+
}
|
|
32390
|
+
let newContent = "";
|
|
32391
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
32392
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
32393
|
+
}
|
|
32394
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
32395
|
+
sheet.cells[xc].content = newContent;
|
|
32396
|
+
}
|
|
32397
|
+
}
|
|
32398
|
+
}
|
|
32399
|
+
/**
|
|
32400
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
32401
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
32402
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
32403
|
+
*/
|
|
32404
|
+
function deconstructSheets(convertedSheets) {
|
|
32405
|
+
const deconstructedSheets = {};
|
|
32406
|
+
for (let sheet of convertedSheets) {
|
|
32407
|
+
for (let xc in sheet.cells) {
|
|
32408
|
+
const cellContent = sheet.cells[xc]?.content;
|
|
32409
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
32410
|
+
continue;
|
|
32411
|
+
}
|
|
32412
|
+
const startIndex = cellContent.indexOf("[");
|
|
32413
|
+
if (startIndex === -1) {
|
|
32414
|
+
continue;
|
|
32415
|
+
}
|
|
32416
|
+
const deconstructedCell = [];
|
|
32417
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
32418
|
+
let possibleRef = "";
|
|
32419
|
+
let openBrackets = 1;
|
|
32420
|
+
let mainPossibleTableIndex = 0;
|
|
32421
|
+
let mainOpenBracketIndex = startIndex;
|
|
32422
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
32423
|
+
if (cellContent[index] === "[") {
|
|
32424
|
+
if (openBrackets === 0) {
|
|
32425
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
32426
|
+
mainOpenBracketIndex = index;
|
|
32427
|
+
}
|
|
32428
|
+
openBrackets++;
|
|
32429
|
+
continue;
|
|
32430
|
+
}
|
|
32431
|
+
if (cellContent[index] === "]") {
|
|
32432
|
+
openBrackets--;
|
|
32433
|
+
if (openBrackets === 0) {
|
|
32434
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
32435
|
+
deconstructedCell.push(possibleTable);
|
|
32436
|
+
deconstructedCell.push(possibleRef);
|
|
32437
|
+
mainPossibleTableIndex = index + 1;
|
|
32371
32438
|
}
|
|
32372
32439
|
}
|
|
32373
32440
|
}
|
|
32441
|
+
if (deconstructedCell.length) {
|
|
32442
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
32443
|
+
deconstructedSheets[sheet.id] = {};
|
|
32444
|
+
}
|
|
32445
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
32446
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
32447
|
+
}
|
|
32374
32448
|
}
|
|
32375
32449
|
}
|
|
32450
|
+
return deconstructedSheets;
|
|
32376
32451
|
}
|
|
32377
32452
|
/**
|
|
32378
32453
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -52503,14 +52578,12 @@ class BottomBarSheet extends owl.Component {
|
|
|
52503
52578
|
this.editionState = "initializing";
|
|
52504
52579
|
}
|
|
52505
52580
|
stopEdition() {
|
|
52506
|
-
|
|
52507
|
-
if (!this.state.isEditing || !input)
|
|
52581
|
+
if (!this.state.isEditing || !this.sheetNameRef.el)
|
|
52508
52582
|
return;
|
|
52509
52583
|
this.state.isEditing = false;
|
|
52510
52584
|
this.editionState = "initializing";
|
|
52511
|
-
|
|
52585
|
+
this.sheetNameRef.el.blur();
|
|
52512
52586
|
const inputValue = this.getInputContent() || "";
|
|
52513
|
-
input.innerText = inputValue;
|
|
52514
52587
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
52515
52588
|
}
|
|
52516
52589
|
cancelEdition() {
|
|
@@ -58363,6 +58436,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
58363
58436
|
exports.tokenize = tokenize;
|
|
58364
58437
|
|
|
58365
58438
|
|
|
58366
|
-
__info__.version = "17.0.
|
|
58367
|
-
__info__.date = "2025-
|
|
58368
|
-
__info__.hash = "
|
|
58439
|
+
__info__.version = "17.0.69";
|
|
58440
|
+
__info__.date = "2025-07-11T11:06:35.446Z";
|
|
58441
|
+
__info__.hash = "8c0d3da";
|
|
@@ -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
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -4585,6 +4585,8 @@ function splitWordToSpecificWidth(ctx, word, width, style) {
|
|
|
4585
4585
|
function splitTextToWidth(ctx, text, style, width) {
|
|
4586
4586
|
if (!style)
|
|
4587
4587
|
style = {};
|
|
4588
|
+
if (isMarkdownLink(text))
|
|
4589
|
+
text = parseMarkdownLink(text).label;
|
|
4588
4590
|
const brokenText = [];
|
|
4589
4591
|
// Checking if text contains NEWLINE before split makes it very slightly slower if text contains it,
|
|
4590
4592
|
// but 5-10x faster if it doesn't
|
|
@@ -32339,38 +32341,111 @@ function applyStyleToZone(appliedStyle, zone, cells, styles) {
|
|
|
32339
32341
|
* In all the sheets, replace the table-only references in the formula cells with standard references.
|
|
32340
32342
|
*/
|
|
32341
32343
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
32344
|
+
let deconstructedSheets = null;
|
|
32342
32345
|
for (let tableSheet of convertedSheets) {
|
|
32343
32346
|
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
32347
|
+
if (!tables || tables.length === 0) {
|
|
32348
|
+
continue;
|
|
32349
|
+
}
|
|
32350
|
+
// Only deconstruct sheets if we are sure there are tables to process
|
|
32351
|
+
if (!deconstructedSheets) {
|
|
32352
|
+
deconstructedSheets = deconstructSheets(convertedSheets);
|
|
32353
|
+
}
|
|
32344
32354
|
for (let table of tables) {
|
|
32345
|
-
|
|
32346
|
-
|
|
32347
|
-
for (let xc in
|
|
32348
|
-
const
|
|
32349
|
-
|
|
32350
|
-
|
|
32351
|
-
|
|
32352
|
-
|
|
32353
|
-
let openBrackets = 1;
|
|
32354
|
-
while (openBrackets > 0 && endIndex < cell.content.length) {
|
|
32355
|
-
if (cell.content[endIndex] === "[") {
|
|
32356
|
-
openBrackets++;
|
|
32357
|
-
}
|
|
32358
|
-
else if (cell.content[endIndex] === "]") {
|
|
32359
|
-
openBrackets--;
|
|
32360
|
-
}
|
|
32361
|
-
endIndex++;
|
|
32362
|
-
}
|
|
32363
|
-
let reference = cell.content.slice(refIndex + tabRef.length, endIndex - 1);
|
|
32364
|
-
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32365
|
-
const convertedRef = convertTableReference(sheetPrefix, reference, table, xc);
|
|
32366
|
-
cell.content =
|
|
32367
|
-
cell.content.slice(0, refIndex) + convertedRef + cell.content.slice(endIndex);
|
|
32355
|
+
for (let sheetId in deconstructedSheets) {
|
|
32356
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32357
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32358
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32359
|
+
for (let i = deconstructedCell.length - 3; i >= 0; i -= 2) {
|
|
32360
|
+
const possibleTable = deconstructedSheets[sheetId][xc][i];
|
|
32361
|
+
if (!possibleTable.endsWith(table.name)) {
|
|
32362
|
+
continue;
|
|
32368
32363
|
}
|
|
32364
|
+
const possibleRef = deconstructedSheets[sheetId][xc][i + 1];
|
|
32365
|
+
const sheetPrefix = tableSheet.id === sheet.id ? "" : tableSheet.name + "!";
|
|
32366
|
+
const convertedRef = convertTableReference(sheetPrefix, possibleRef, table, xc);
|
|
32367
|
+
deconstructedSheets[sheetId][xc][i + 2] =
|
|
32368
|
+
possibleTable.slice(0, possibleTable.indexOf(table.name)) +
|
|
32369
|
+
convertedRef +
|
|
32370
|
+
deconstructedSheets[sheetId][xc][i + 2];
|
|
32371
|
+
deconstructedSheets[sheetId][xc].splice(i, 2);
|
|
32372
|
+
}
|
|
32373
|
+
}
|
|
32374
|
+
}
|
|
32375
|
+
}
|
|
32376
|
+
}
|
|
32377
|
+
if (!deconstructedSheets) {
|
|
32378
|
+
return;
|
|
32379
|
+
}
|
|
32380
|
+
for (let sheetId in deconstructedSheets) {
|
|
32381
|
+
const sheet = convertedSheets.find((s) => s.id === sheetId);
|
|
32382
|
+
for (let xc in deconstructedSheets[sheetId]) {
|
|
32383
|
+
const deconstructedCell = deconstructedSheets[sheetId][xc];
|
|
32384
|
+
if (deconstructedCell.length === 1) {
|
|
32385
|
+
sheet.cells[xc].content = deconstructedCell[0];
|
|
32386
|
+
continue;
|
|
32387
|
+
}
|
|
32388
|
+
let newContent = "";
|
|
32389
|
+
for (let i = 0; i < deconstructedCell.length; i += 2) {
|
|
32390
|
+
newContent += deconstructedCell[i] + "[" + deconstructedCell[i + 1] + "]";
|
|
32391
|
+
}
|
|
32392
|
+
newContent += deconstructedCell[deconstructedCell.length - 1];
|
|
32393
|
+
sheet.cells[xc].content = newContent;
|
|
32394
|
+
}
|
|
32395
|
+
}
|
|
32396
|
+
}
|
|
32397
|
+
/**
|
|
32398
|
+
* Deconstruct the content of the cells in the sheets to extract possible table references.
|
|
32399
|
+
* Example from "=AVERAGE(Table1[colName1])-AVERAGE(Table2[colName2])":
|
|
32400
|
+
* return --> ["=AVERAGE(Table1", "colName1", ")-AVERAGE(Table2", "colName2", ")"]
|
|
32401
|
+
*/
|
|
32402
|
+
function deconstructSheets(convertedSheets) {
|
|
32403
|
+
const deconstructedSheets = {};
|
|
32404
|
+
for (let sheet of convertedSheets) {
|
|
32405
|
+
for (let xc in sheet.cells) {
|
|
32406
|
+
const cellContent = sheet.cells[xc]?.content;
|
|
32407
|
+
if (!cellContent || !cellContent.startsWith("=")) {
|
|
32408
|
+
continue;
|
|
32409
|
+
}
|
|
32410
|
+
const startIndex = cellContent.indexOf("[");
|
|
32411
|
+
if (startIndex === -1) {
|
|
32412
|
+
continue;
|
|
32413
|
+
}
|
|
32414
|
+
const deconstructedCell = [];
|
|
32415
|
+
let possibleTable = cellContent.slice(0, startIndex);
|
|
32416
|
+
let possibleRef = "";
|
|
32417
|
+
let openBrackets = 1;
|
|
32418
|
+
let mainPossibleTableIndex = 0;
|
|
32419
|
+
let mainOpenBracketIndex = startIndex;
|
|
32420
|
+
for (let index = startIndex + 1; index < cellContent.length; index++) {
|
|
32421
|
+
if (cellContent[index] === "[") {
|
|
32422
|
+
if (openBrackets === 0) {
|
|
32423
|
+
possibleTable = cellContent.slice(mainPossibleTableIndex, index);
|
|
32424
|
+
mainOpenBracketIndex = index;
|
|
32425
|
+
}
|
|
32426
|
+
openBrackets++;
|
|
32427
|
+
continue;
|
|
32428
|
+
}
|
|
32429
|
+
if (cellContent[index] === "]") {
|
|
32430
|
+
openBrackets--;
|
|
32431
|
+
if (openBrackets === 0) {
|
|
32432
|
+
possibleRef = cellContent.slice(mainOpenBracketIndex + 1, index);
|
|
32433
|
+
deconstructedCell.push(possibleTable);
|
|
32434
|
+
deconstructedCell.push(possibleRef);
|
|
32435
|
+
mainPossibleTableIndex = index + 1;
|
|
32369
32436
|
}
|
|
32370
32437
|
}
|
|
32371
32438
|
}
|
|
32439
|
+
if (deconstructedCell.length) {
|
|
32440
|
+
if (!deconstructedSheets[sheet.id]) {
|
|
32441
|
+
deconstructedSheets[sheet.id] = {};
|
|
32442
|
+
}
|
|
32443
|
+
deconstructedCell.push(cellContent.slice(mainPossibleTableIndex));
|
|
32444
|
+
deconstructedSheets[sheet.id][xc] = [...deconstructedCell];
|
|
32445
|
+
}
|
|
32372
32446
|
}
|
|
32373
32447
|
}
|
|
32448
|
+
return deconstructedSheets;
|
|
32374
32449
|
}
|
|
32375
32450
|
/**
|
|
32376
32451
|
* Convert table-specific references in formulas into standard references. A table reference is composed of columns names,
|
|
@@ -52501,14 +52576,12 @@ class BottomBarSheet extends Component {
|
|
|
52501
52576
|
this.editionState = "initializing";
|
|
52502
52577
|
}
|
|
52503
52578
|
stopEdition() {
|
|
52504
|
-
|
|
52505
|
-
if (!this.state.isEditing || !input)
|
|
52579
|
+
if (!this.state.isEditing || !this.sheetNameRef.el)
|
|
52506
52580
|
return;
|
|
52507
52581
|
this.state.isEditing = false;
|
|
52508
52582
|
this.editionState = "initializing";
|
|
52509
|
-
|
|
52583
|
+
this.sheetNameRef.el.blur();
|
|
52510
52584
|
const inputValue = this.getInputContent() || "";
|
|
52511
|
-
input.innerText = inputValue;
|
|
52512
52585
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
52513
52586
|
}
|
|
52514
52587
|
cancelEdition() {
|
|
@@ -58326,6 +58399,6 @@ const constants = {
|
|
|
58326
58399
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
58327
58400
|
|
|
58328
58401
|
|
|
58329
|
-
__info__.version = "17.0.
|
|
58330
|
-
__info__.date = "2025-
|
|
58331
|
-
__info__.hash = "
|
|
58402
|
+
__info__.version = "17.0.69";
|
|
58403
|
+
__info__.date = "2025-07-11T11:06:35.446Z";
|
|
58404
|
+
__info__.hash = "8c0d3da";
|
|
@@ -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() {
|
|
@@ -58362,9 +58435,9 @@
|
|
|
58362
58435
|
exports.tokenize = tokenize;
|
|
58363
58436
|
|
|
58364
58437
|
|
|
58365
|
-
__info__.version = "17.0.
|
|
58366
|
-
__info__.date = "2025-
|
|
58367
|
-
__info__.hash = "
|
|
58438
|
+
__info__.version = "17.0.69";
|
|
58439
|
+
__info__.date = "2025-07-11T11:06:35.446Z";
|
|
58440
|
+
__info__.hash = "8c0d3da";
|
|
58368
58441
|
|
|
58369
58442
|
|
|
58370
58443
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|