@odoo/o-spreadsheet 17.0.68 → 17.0.70
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 +132 -46
- package/dist/o-spreadsheet.d.ts +1 -0
- package/dist/o-spreadsheet.esm.js +132 -46
- package/dist/o-spreadsheet.iife.js +132 -46
- 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.70
|
|
6
|
+
* @date 2025-07-28T13:26:37.626Z
|
|
7
|
+
* @hash 2ec8d82
|
|
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);
|
|
32371
32374
|
}
|
|
32372
32375
|
}
|
|
32373
32376
|
}
|
|
32374
32377
|
}
|
|
32375
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;
|
|
32438
|
+
}
|
|
32439
|
+
}
|
|
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
|
+
}
|
|
32448
|
+
}
|
|
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,
|
|
@@ -43396,6 +43471,23 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
43396
43471
|
static getters = ["getRowSize", "getHeaderSize"];
|
|
43397
43472
|
tallestCellInRow = {};
|
|
43398
43473
|
ctx = document.createElement("canvas").getContext("2d");
|
|
43474
|
+
beforeHandle(cmd) {
|
|
43475
|
+
switch (cmd.type) {
|
|
43476
|
+
// Ensure rows are updated before "UPDATE_CELL" is dispatched from cell plugin.
|
|
43477
|
+
// "UPDATE_CELL" uses the Sheet core plugin to access row data.
|
|
43478
|
+
// If "ADD_COLUMNS_ROWS" has not been processed yet by header_sizes_ui,
|
|
43479
|
+
// size updates may apply to incorrect (pre-insert) rows.
|
|
43480
|
+
case "ADD_COLUMNS_ROWS":
|
|
43481
|
+
if (cmd.dimension === "COL") {
|
|
43482
|
+
return;
|
|
43483
|
+
}
|
|
43484
|
+
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
43485
|
+
const newCells = Array(cmd.quantity).fill(undefined);
|
|
43486
|
+
const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
|
|
43487
|
+
this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
|
|
43488
|
+
break;
|
|
43489
|
+
}
|
|
43490
|
+
}
|
|
43399
43491
|
handle(cmd) {
|
|
43400
43492
|
switch (cmd.type) {
|
|
43401
43493
|
case "START":
|
|
@@ -43425,16 +43517,6 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
43425
43517
|
this.history.update("tallestCellInRow", cmd.sheetId, tallestCells);
|
|
43426
43518
|
break;
|
|
43427
43519
|
}
|
|
43428
|
-
case "ADD_COLUMNS_ROWS": {
|
|
43429
|
-
if (cmd.dimension === "COL") {
|
|
43430
|
-
return;
|
|
43431
|
-
}
|
|
43432
|
-
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
43433
|
-
const newCells = Array(cmd.quantity).fill(undefined);
|
|
43434
|
-
const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
|
|
43435
|
-
this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
|
|
43436
|
-
break;
|
|
43437
|
-
}
|
|
43438
43520
|
case "RESIZE_COLUMNS_ROWS":
|
|
43439
43521
|
{
|
|
43440
43522
|
const sheetId = cmd.sheetId;
|
|
@@ -50799,6 +50881,14 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
50799
50881
|
const isBasedBefore = cmd.base < start;
|
|
50800
50882
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
50801
50883
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
50884
|
+
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
50885
|
+
const originalSize = Object.fromEntries(toRemove.map((element) => {
|
|
50886
|
+
const size = isCol
|
|
50887
|
+
? this.getters.getColSize(cmd.sheetId, element)
|
|
50888
|
+
: this.getters.getUserRowSize(cmd.sheetId, element);
|
|
50889
|
+
const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
|
|
50890
|
+
return [element, isDefaultCol || size === undefined ? null : size];
|
|
50891
|
+
}));
|
|
50802
50892
|
const target = [
|
|
50803
50893
|
{
|
|
50804
50894
|
left: isCol ? start + deltaCol : 0,
|
|
@@ -50818,14 +50908,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
50818
50908
|
},
|
|
50819
50909
|
];
|
|
50820
50910
|
state.paste(pasteTarget, { selectTarget: true });
|
|
50821
|
-
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
50822
50911
|
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
50823
50912
|
for (const element of toRemove) {
|
|
50824
|
-
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
50825
50913
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
50826
50914
|
dimension: cmd.dimension,
|
|
50827
50915
|
sheetId: cmd.sheetId,
|
|
50828
|
-
size,
|
|
50916
|
+
size: originalSize[element],
|
|
50829
50917
|
elements: [currentIndex],
|
|
50830
50918
|
});
|
|
50831
50919
|
currentIndex += 1;
|
|
@@ -52503,14 +52591,12 @@ class BottomBarSheet extends owl.Component {
|
|
|
52503
52591
|
this.editionState = "initializing";
|
|
52504
52592
|
}
|
|
52505
52593
|
stopEdition() {
|
|
52506
|
-
|
|
52507
|
-
if (!this.state.isEditing || !input)
|
|
52594
|
+
if (!this.state.isEditing || !this.sheetNameRef.el)
|
|
52508
52595
|
return;
|
|
52509
52596
|
this.state.isEditing = false;
|
|
52510
52597
|
this.editionState = "initializing";
|
|
52511
|
-
|
|
52598
|
+
this.sheetNameRef.el.blur();
|
|
52512
52599
|
const inputValue = this.getInputContent() || "";
|
|
52513
|
-
input.innerText = inputValue;
|
|
52514
52600
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
52515
52601
|
}
|
|
52516
52602
|
cancelEdition() {
|
|
@@ -58363,6 +58449,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
58363
58449
|
exports.tokenize = tokenize;
|
|
58364
58450
|
|
|
58365
58451
|
|
|
58366
|
-
__info__.version = "17.0.
|
|
58367
|
-
__info__.date = "2025-
|
|
58368
|
-
__info__.hash = "
|
|
58452
|
+
__info__.version = "17.0.70";
|
|
58453
|
+
__info__.date = "2025-07-28T13:26:37.626Z";
|
|
58454
|
+
__info__.hash = "2ec8d82";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4337,6 +4337,7 @@ declare class HeaderSizeUIPlugin extends UIPlugin<HeaderSizeState> implements He
|
|
|
4337
4337
|
static getters: readonly ["getRowSize", "getHeaderSize"];
|
|
4338
4338
|
readonly tallestCellInRow: Immutable<Record<UID, Array<CellWithSize | undefined>>>;
|
|
4339
4339
|
private ctx;
|
|
4340
|
+
beforeHandle(cmd: Command): void;
|
|
4340
4341
|
handle(cmd: Command): void;
|
|
4341
4342
|
getRowSize(sheetId: UID, row: HeaderIndex): Pixel;
|
|
4342
4343
|
getHeaderSize(sheetId: UID, dimension: Dimension, index: HeaderIndex): Pixel;
|
|
@@ -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.70
|
|
6
|
+
* @date 2025-07-28T13:26:37.626Z
|
|
7
|
+
* @hash 2ec8d82
|
|
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);
|
|
32369
32372
|
}
|
|
32370
32373
|
}
|
|
32371
32374
|
}
|
|
32372
32375
|
}
|
|
32373
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;
|
|
32436
|
+
}
|
|
32437
|
+
}
|
|
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
|
+
}
|
|
32446
|
+
}
|
|
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,
|
|
@@ -43394,6 +43469,23 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
43394
43469
|
static getters = ["getRowSize", "getHeaderSize"];
|
|
43395
43470
|
tallestCellInRow = {};
|
|
43396
43471
|
ctx = document.createElement("canvas").getContext("2d");
|
|
43472
|
+
beforeHandle(cmd) {
|
|
43473
|
+
switch (cmd.type) {
|
|
43474
|
+
// Ensure rows are updated before "UPDATE_CELL" is dispatched from cell plugin.
|
|
43475
|
+
// "UPDATE_CELL" uses the Sheet core plugin to access row data.
|
|
43476
|
+
// If "ADD_COLUMNS_ROWS" has not been processed yet by header_sizes_ui,
|
|
43477
|
+
// size updates may apply to incorrect (pre-insert) rows.
|
|
43478
|
+
case "ADD_COLUMNS_ROWS":
|
|
43479
|
+
if (cmd.dimension === "COL") {
|
|
43480
|
+
return;
|
|
43481
|
+
}
|
|
43482
|
+
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
43483
|
+
const newCells = Array(cmd.quantity).fill(undefined);
|
|
43484
|
+
const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
|
|
43485
|
+
this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
|
|
43486
|
+
break;
|
|
43487
|
+
}
|
|
43488
|
+
}
|
|
43397
43489
|
handle(cmd) {
|
|
43398
43490
|
switch (cmd.type) {
|
|
43399
43491
|
case "START":
|
|
@@ -43423,16 +43515,6 @@ class HeaderSizeUIPlugin extends UIPlugin {
|
|
|
43423
43515
|
this.history.update("tallestCellInRow", cmd.sheetId, tallestCells);
|
|
43424
43516
|
break;
|
|
43425
43517
|
}
|
|
43426
|
-
case "ADD_COLUMNS_ROWS": {
|
|
43427
|
-
if (cmd.dimension === "COL") {
|
|
43428
|
-
return;
|
|
43429
|
-
}
|
|
43430
|
-
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
43431
|
-
const newCells = Array(cmd.quantity).fill(undefined);
|
|
43432
|
-
const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
|
|
43433
|
-
this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
|
|
43434
|
-
break;
|
|
43435
|
-
}
|
|
43436
43518
|
case "RESIZE_COLUMNS_ROWS":
|
|
43437
43519
|
{
|
|
43438
43520
|
const sheetId = cmd.sheetId;
|
|
@@ -50797,6 +50879,14 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
50797
50879
|
const isBasedBefore = cmd.base < start;
|
|
50798
50880
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
50799
50881
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
50882
|
+
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
50883
|
+
const originalSize = Object.fromEntries(toRemove.map((element) => {
|
|
50884
|
+
const size = isCol
|
|
50885
|
+
? this.getters.getColSize(cmd.sheetId, element)
|
|
50886
|
+
: this.getters.getUserRowSize(cmd.sheetId, element);
|
|
50887
|
+
const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
|
|
50888
|
+
return [element, isDefaultCol || size === undefined ? null : size];
|
|
50889
|
+
}));
|
|
50800
50890
|
const target = [
|
|
50801
50891
|
{
|
|
50802
50892
|
left: isCol ? start + deltaCol : 0,
|
|
@@ -50816,14 +50906,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
50816
50906
|
},
|
|
50817
50907
|
];
|
|
50818
50908
|
state.paste(pasteTarget, { selectTarget: true });
|
|
50819
|
-
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
50820
50909
|
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
50821
50910
|
for (const element of toRemove) {
|
|
50822
|
-
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
50823
50911
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
50824
50912
|
dimension: cmd.dimension,
|
|
50825
50913
|
sheetId: cmd.sheetId,
|
|
50826
|
-
size,
|
|
50914
|
+
size: originalSize[element],
|
|
50827
50915
|
elements: [currentIndex],
|
|
50828
50916
|
});
|
|
50829
50917
|
currentIndex += 1;
|
|
@@ -52501,14 +52589,12 @@ class BottomBarSheet extends Component {
|
|
|
52501
52589
|
this.editionState = "initializing";
|
|
52502
52590
|
}
|
|
52503
52591
|
stopEdition() {
|
|
52504
|
-
|
|
52505
|
-
if (!this.state.isEditing || !input)
|
|
52592
|
+
if (!this.state.isEditing || !this.sheetNameRef.el)
|
|
52506
52593
|
return;
|
|
52507
52594
|
this.state.isEditing = false;
|
|
52508
52595
|
this.editionState = "initializing";
|
|
52509
|
-
|
|
52596
|
+
this.sheetNameRef.el.blur();
|
|
52510
52597
|
const inputValue = this.getInputContent() || "";
|
|
52511
|
-
input.innerText = inputValue;
|
|
52512
52598
|
interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
|
|
52513
52599
|
}
|
|
52514
52600
|
cancelEdition() {
|
|
@@ -58326,6 +58412,6 @@ const constants = {
|
|
|
58326
58412
|
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
58413
|
|
|
58328
58414
|
|
|
58329
|
-
__info__.version = "17.0.
|
|
58330
|
-
__info__.date = "2025-
|
|
58331
|
-
__info__.hash = "
|
|
58415
|
+
__info__.version = "17.0.70";
|
|
58416
|
+
__info__.date = "2025-07-28T13:26:37.626Z";
|
|
58417
|
+
__info__.hash = "2ec8d82";
|