@odoo/o-spreadsheet 17.0.53 → 17.0.54
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 +77 -64
- package/dist/o-spreadsheet.d.ts +1 -0
- package/dist/o-spreadsheet.esm.js +77 -64
- package/dist/o-spreadsheet.iife.js +77 -64
- package/dist/o-spreadsheet.iife.min.js +287 -287
- package/dist/o_spreadsheet.xml +4 -4
- package/package.json +1 -1
|
@@ -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-03-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.54
|
|
6
|
+
* @date 2025-03-19T08:14:16.001Z
|
|
7
|
+
* @hash 945b375
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -4494,11 +4494,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
|
|
|
4494
4494
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4495
4495
|
return DEFAULT_CELL_HEIGHT;
|
|
4496
4496
|
}
|
|
4497
|
-
const
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
const
|
|
4497
|
+
const content = cell.isFormula ? "" : cell.content;
|
|
4498
|
+
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
4499
|
+
}
|
|
4500
|
+
function getCellContentHeight(ctx, content, style, colSize) {
|
|
4501
|
+
const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
4502
|
+
const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
|
|
4503
|
+
const fontSize = computeTextFontSizeInPixels(style);
|
|
4502
4504
|
return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
|
|
4503
4505
|
}
|
|
4504
4506
|
const textWidthCache = {};
|
|
@@ -7769,7 +7771,7 @@ function isValidLocale(locale) {
|
|
|
7769
7771
|
*/
|
|
7770
7772
|
function canonicalizeNumberContent(content, locale) {
|
|
7771
7773
|
return content.startsWith("=")
|
|
7772
|
-
? canonicalizeFormula
|
|
7774
|
+
? canonicalizeFormula(content, locale)
|
|
7773
7775
|
: canonicalizeNumberLiteral(content, locale);
|
|
7774
7776
|
}
|
|
7775
7777
|
/**
|
|
@@ -7784,7 +7786,7 @@ function canonicalizeNumberContent(content, locale) {
|
|
|
7784
7786
|
*/
|
|
7785
7787
|
function canonicalizeContent(content, locale) {
|
|
7786
7788
|
return content.startsWith("=")
|
|
7787
|
-
? canonicalizeFormula
|
|
7789
|
+
? canonicalizeFormula(content, locale)
|
|
7788
7790
|
: canonicalizeLiteral(content, locale);
|
|
7789
7791
|
}
|
|
7790
7792
|
/**
|
|
@@ -7800,15 +7802,21 @@ function localizeContent(content, locale) {
|
|
|
7800
7802
|
? localizeFormula(content, locale)
|
|
7801
7803
|
: localizeLiteral(content, locale);
|
|
7802
7804
|
}
|
|
7805
|
+
/** Change a number string to its canonical form (en_US locale) */
|
|
7806
|
+
function canonicalizeNumberValue(content, locale) {
|
|
7807
|
+
return content.startsWith("=")
|
|
7808
|
+
? canonicalizeFormula(content, locale)
|
|
7809
|
+
: canonicalizeNumberLiteral(content, locale);
|
|
7810
|
+
}
|
|
7803
7811
|
/** Change a formula to its canonical form (en_US locale) */
|
|
7804
|
-
function canonicalizeFormula
|
|
7805
|
-
return _localizeFormula
|
|
7812
|
+
function canonicalizeFormula(formula, locale) {
|
|
7813
|
+
return _localizeFormula(formula, locale, DEFAULT_LOCALE);
|
|
7806
7814
|
}
|
|
7807
7815
|
/** Change a formula from the canonical form to the given locale */
|
|
7808
7816
|
function localizeFormula(formula, locale) {
|
|
7809
|
-
return _localizeFormula
|
|
7817
|
+
return _localizeFormula(formula, DEFAULT_LOCALE, locale);
|
|
7810
7818
|
}
|
|
7811
|
-
function _localizeFormula
|
|
7819
|
+
function _localizeFormula(formula, fromLocale, toLocale) {
|
|
7812
7820
|
if (fromLocale.formulaArgSeparator === toLocale.formulaArgSeparator &&
|
|
7813
7821
|
fromLocale.decimalSeparator === toLocale.decimalSeparator) {
|
|
7814
7822
|
return formula;
|
|
@@ -24292,6 +24300,7 @@ class RemoveDuplicatesPanel extends owl.Component {
|
|
|
24292
24300
|
columns: {},
|
|
24293
24301
|
});
|
|
24294
24302
|
setup() {
|
|
24303
|
+
this.updateColumns();
|
|
24295
24304
|
owl.onWillUpdateProps(() => this.updateColumns());
|
|
24296
24305
|
}
|
|
24297
24306
|
toggleHasHeader() {
|
|
@@ -45470,12 +45479,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45470
45479
|
continue;
|
|
45471
45480
|
}
|
|
45472
45481
|
const position = { col: col + c, row: row + r, sheetId: sheetId };
|
|
45473
|
-
|
|
45474
|
-
// MOVE_RANGES in pasteFromCut. Adding a condition on the operation type here
|
|
45475
|
-
// is not appropriate
|
|
45476
|
-
if (this.operation !== "CUT") {
|
|
45477
|
-
this.pasteMergeIfExist(origin.position, position);
|
|
45478
|
-
}
|
|
45482
|
+
this.pasteMergeIfExist(origin.position, position, this.operation);
|
|
45479
45483
|
this.pasteCell(origin, position, this.operation, clipboardOptions);
|
|
45480
45484
|
if (shouldPasteCF) {
|
|
45481
45485
|
this.pasteCf(origin.position, position);
|
|
@@ -45532,7 +45536,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45532
45536
|
* If the origin position given is the top left of a merge, merge the target
|
|
45533
45537
|
* position.
|
|
45534
45538
|
*/
|
|
45535
|
-
pasteMergeIfExist(origin, target) {
|
|
45539
|
+
pasteMergeIfExist(origin, target, operation) {
|
|
45536
45540
|
let { sheetId, col, row } = origin;
|
|
45537
45541
|
const { col: mainCellColOrigin, row: mainCellRowOrigin } = this.getters.getMainCellPosition(origin);
|
|
45538
45542
|
if (mainCellColOrigin === col && mainCellRowOrigin === row) {
|
|
@@ -45540,6 +45544,9 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45540
45544
|
if (!merge) {
|
|
45541
45545
|
return;
|
|
45542
45546
|
}
|
|
45547
|
+
if (operation === "CUT") {
|
|
45548
|
+
this.dispatch("REMOVE_MERGE", { sheetId, target: [merge] });
|
|
45549
|
+
}
|
|
45543
45550
|
({ sheetId, col, row } = target);
|
|
45544
45551
|
this.dispatch("ADD_MERGE", {
|
|
45545
45552
|
sheetId,
|
|
@@ -47831,12 +47838,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
47831
47838
|
}
|
|
47832
47839
|
break;
|
|
47833
47840
|
case "AUTORESIZE_ROWS":
|
|
47834
|
-
this.
|
|
47835
|
-
elements: cmd.rows,
|
|
47836
|
-
dimension: "ROW",
|
|
47837
|
-
size: null,
|
|
47838
|
-
sheetId: cmd.sheetId,
|
|
47839
|
-
});
|
|
47841
|
+
this.autoResizeRows(cmd.sheetId, cmd.rows);
|
|
47840
47842
|
break;
|
|
47841
47843
|
}
|
|
47842
47844
|
}
|
|
@@ -47934,6 +47936,48 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
47934
47936
|
}
|
|
47935
47937
|
return "Success" /* CommandResult.Success */;
|
|
47936
47938
|
}
|
|
47939
|
+
autoResizeRows(sheetId, rows) {
|
|
47940
|
+
const rowSizes = [];
|
|
47941
|
+
for (const row of rows) {
|
|
47942
|
+
let evaluatedRowSize = 0;
|
|
47943
|
+
for (const cellId of this.getters.getRowCells(sheetId, row)) {
|
|
47944
|
+
const cell = this.getters.getCellById(cellId);
|
|
47945
|
+
if (!cell) {
|
|
47946
|
+
continue;
|
|
47947
|
+
}
|
|
47948
|
+
const position = this.getters.getCellPosition(cell.id);
|
|
47949
|
+
const colSize = this.getters.getColSize(sheetId, position.col);
|
|
47950
|
+
if (cell.isFormula) {
|
|
47951
|
+
const content = this.getters.getEvaluatedCell(position).formattedValue;
|
|
47952
|
+
const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
|
|
47953
|
+
if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
|
|
47954
|
+
evaluatedRowSize = evaluatedSize;
|
|
47955
|
+
}
|
|
47956
|
+
}
|
|
47957
|
+
else {
|
|
47958
|
+
const content = cell.content;
|
|
47959
|
+
const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
|
|
47960
|
+
// Only keep the size of evaluated cells if it's bigger than the dynamic row size
|
|
47961
|
+
if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
|
|
47962
|
+
evaluatedRowSize = 0;
|
|
47963
|
+
}
|
|
47964
|
+
}
|
|
47965
|
+
}
|
|
47966
|
+
rowSizes.push(evaluatedRowSize || null);
|
|
47967
|
+
}
|
|
47968
|
+
const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
|
|
47969
|
+
for (let i = 0; i < rowSizes.length; i++) {
|
|
47970
|
+
groupedSizes.get(rowSizes[i])?.push(rows[i]);
|
|
47971
|
+
}
|
|
47972
|
+
for (const [size, rows] of groupedSizes) {
|
|
47973
|
+
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
47974
|
+
elements: rows,
|
|
47975
|
+
dimension: "ROW",
|
|
47976
|
+
size,
|
|
47977
|
+
sheetId,
|
|
47978
|
+
});
|
|
47979
|
+
}
|
|
47980
|
+
}
|
|
47937
47981
|
}
|
|
47938
47982
|
|
|
47939
47983
|
const genericRepeatsTransforms = [
|
|
@@ -48583,37 +48627,6 @@ class ClipboardFigureImage {
|
|
|
48583
48627
|
}
|
|
48584
48628
|
}
|
|
48585
48629
|
|
|
48586
|
-
/** Change a number string to its canonical form (en_US locale) */
|
|
48587
|
-
function canonicalizeNumberValue(content, locale) {
|
|
48588
|
-
return content.startsWith("=")
|
|
48589
|
-
? canonicalizeFormula(content, locale)
|
|
48590
|
-
: canonicalizeNumberLiteral(content, locale);
|
|
48591
|
-
}
|
|
48592
|
-
/** Change a formula to its canonical form (en_US locale) */
|
|
48593
|
-
function canonicalizeFormula(formula, locale) {
|
|
48594
|
-
return _localizeFormula(formula, locale, DEFAULT_LOCALE);
|
|
48595
|
-
}
|
|
48596
|
-
function _localizeFormula(formula, fromLocale, toLocale) {
|
|
48597
|
-
if (fromLocale.formulaArgSeparator === toLocale.formulaArgSeparator &&
|
|
48598
|
-
fromLocale.decimalSeparator === toLocale.decimalSeparator) {
|
|
48599
|
-
return formula;
|
|
48600
|
-
}
|
|
48601
|
-
const tokens = tokenize(formula, fromLocale);
|
|
48602
|
-
let localizedFormula = "";
|
|
48603
|
-
for (const token of tokens) {
|
|
48604
|
-
if (token.type === "NUMBER") {
|
|
48605
|
-
localizedFormula += token.value.replace(fromLocale.decimalSeparator, toLocale.decimalSeparator);
|
|
48606
|
-
}
|
|
48607
|
-
else if (token.type === "ARG_SEPARATOR") {
|
|
48608
|
-
localizedFormula += toLocale.formulaArgSeparator;
|
|
48609
|
-
}
|
|
48610
|
-
else {
|
|
48611
|
-
localizedFormula += token.value;
|
|
48612
|
-
}
|
|
48613
|
-
}
|
|
48614
|
-
return localizedFormula;
|
|
48615
|
-
}
|
|
48616
|
-
|
|
48617
48630
|
/** State of the clipboard when copying/cutting from the OS clipboard*/
|
|
48618
48631
|
class ClipboardOsState extends ClipboardCellsAbstractState {
|
|
48619
48632
|
values;
|
|
@@ -49190,8 +49203,8 @@ class EditionPlugin extends UIPlugin {
|
|
|
49190
49203
|
this.colorIndexByRange = {};
|
|
49191
49204
|
break;
|
|
49192
49205
|
case "CANCEL_EDITION":
|
|
49193
|
-
this.cancelEditionAndActivateSheet();
|
|
49194
49206
|
this.resetContent();
|
|
49207
|
+
this.cancelEditionAndActivateSheet();
|
|
49195
49208
|
this.colorIndexByRange = {};
|
|
49196
49209
|
break;
|
|
49197
49210
|
case "SET_CURRENT_CONTENT":
|
|
@@ -49202,8 +49215,8 @@ class EditionPlugin extends UIPlugin {
|
|
|
49202
49215
|
this.replaceSelection(cmd.text);
|
|
49203
49216
|
break;
|
|
49204
49217
|
case "SELECT_FIGURE":
|
|
49205
|
-
this.cancelEditionAndActivateSheet();
|
|
49206
49218
|
this.resetContent();
|
|
49219
|
+
this.cancelEditionAndActivateSheet();
|
|
49207
49220
|
break;
|
|
49208
49221
|
case "ADD_COLUMNS_ROWS":
|
|
49209
49222
|
this.onAddElements(cmd);
|
|
@@ -49246,8 +49259,8 @@ class EditionPlugin extends UIPlugin {
|
|
|
49246
49259
|
const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
|
|
49247
49260
|
if (!sheetIdExists && this.mode !== "inactive") {
|
|
49248
49261
|
this.sheetId = this.getters.getActiveSheetId();
|
|
49249
|
-
this.cancelEditionAndActivateSheet();
|
|
49250
49262
|
this.resetContent();
|
|
49263
|
+
this.cancelEditionAndActivateSheet();
|
|
49251
49264
|
this.ui.raiseBlockingErrorUI(CELL_DELETED_MESSAGE);
|
|
49252
49265
|
}
|
|
49253
49266
|
break;
|
|
@@ -58069,6 +58082,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
58069
58082
|
exports.tokenize = tokenize;
|
|
58070
58083
|
|
|
58071
58084
|
|
|
58072
|
-
__info__.version = "17.0.
|
|
58073
|
-
__info__.date = "2025-03-
|
|
58074
|
-
__info__.hash = "
|
|
58085
|
+
__info__.version = "17.0.54";
|
|
58086
|
+
__info__.date = "2025-03-19T08:14:16.001Z";
|
|
58087
|
+
__info__.hash = "945b375";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -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-03-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.54
|
|
6
|
+
* @date 2025-03-19T08:14:16.001Z
|
|
7
|
+
* @hash 945b375
|
|
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';
|
|
@@ -4492,11 +4492,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
|
|
|
4492
4492
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
4493
4493
|
return DEFAULT_CELL_HEIGHT;
|
|
4494
4494
|
}
|
|
4495
|
-
const
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
const
|
|
4495
|
+
const content = cell.isFormula ? "" : cell.content;
|
|
4496
|
+
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
4497
|
+
}
|
|
4498
|
+
function getCellContentHeight(ctx, content, style, colSize) {
|
|
4499
|
+
const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
4500
|
+
const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
|
|
4501
|
+
const fontSize = computeTextFontSizeInPixels(style);
|
|
4500
4502
|
return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
|
|
4501
4503
|
}
|
|
4502
4504
|
const textWidthCache = {};
|
|
@@ -7767,7 +7769,7 @@ function isValidLocale(locale) {
|
|
|
7767
7769
|
*/
|
|
7768
7770
|
function canonicalizeNumberContent(content, locale) {
|
|
7769
7771
|
return content.startsWith("=")
|
|
7770
|
-
? canonicalizeFormula
|
|
7772
|
+
? canonicalizeFormula(content, locale)
|
|
7771
7773
|
: canonicalizeNumberLiteral(content, locale);
|
|
7772
7774
|
}
|
|
7773
7775
|
/**
|
|
@@ -7782,7 +7784,7 @@ function canonicalizeNumberContent(content, locale) {
|
|
|
7782
7784
|
*/
|
|
7783
7785
|
function canonicalizeContent(content, locale) {
|
|
7784
7786
|
return content.startsWith("=")
|
|
7785
|
-
? canonicalizeFormula
|
|
7787
|
+
? canonicalizeFormula(content, locale)
|
|
7786
7788
|
: canonicalizeLiteral(content, locale);
|
|
7787
7789
|
}
|
|
7788
7790
|
/**
|
|
@@ -7798,15 +7800,21 @@ function localizeContent(content, locale) {
|
|
|
7798
7800
|
? localizeFormula(content, locale)
|
|
7799
7801
|
: localizeLiteral(content, locale);
|
|
7800
7802
|
}
|
|
7803
|
+
/** Change a number string to its canonical form (en_US locale) */
|
|
7804
|
+
function canonicalizeNumberValue(content, locale) {
|
|
7805
|
+
return content.startsWith("=")
|
|
7806
|
+
? canonicalizeFormula(content, locale)
|
|
7807
|
+
: canonicalizeNumberLiteral(content, locale);
|
|
7808
|
+
}
|
|
7801
7809
|
/** Change a formula to its canonical form (en_US locale) */
|
|
7802
|
-
function canonicalizeFormula
|
|
7803
|
-
return _localizeFormula
|
|
7810
|
+
function canonicalizeFormula(formula, locale) {
|
|
7811
|
+
return _localizeFormula(formula, locale, DEFAULT_LOCALE);
|
|
7804
7812
|
}
|
|
7805
7813
|
/** Change a formula from the canonical form to the given locale */
|
|
7806
7814
|
function localizeFormula(formula, locale) {
|
|
7807
|
-
return _localizeFormula
|
|
7815
|
+
return _localizeFormula(formula, DEFAULT_LOCALE, locale);
|
|
7808
7816
|
}
|
|
7809
|
-
function _localizeFormula
|
|
7817
|
+
function _localizeFormula(formula, fromLocale, toLocale) {
|
|
7810
7818
|
if (fromLocale.formulaArgSeparator === toLocale.formulaArgSeparator &&
|
|
7811
7819
|
fromLocale.decimalSeparator === toLocale.decimalSeparator) {
|
|
7812
7820
|
return formula;
|
|
@@ -24290,6 +24298,7 @@ class RemoveDuplicatesPanel extends Component {
|
|
|
24290
24298
|
columns: {},
|
|
24291
24299
|
});
|
|
24292
24300
|
setup() {
|
|
24301
|
+
this.updateColumns();
|
|
24293
24302
|
onWillUpdateProps(() => this.updateColumns());
|
|
24294
24303
|
}
|
|
24295
24304
|
toggleHasHeader() {
|
|
@@ -45468,12 +45477,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45468
45477
|
continue;
|
|
45469
45478
|
}
|
|
45470
45479
|
const position = { col: col + c, row: row + r, sheetId: sheetId };
|
|
45471
|
-
|
|
45472
|
-
// MOVE_RANGES in pasteFromCut. Adding a condition on the operation type here
|
|
45473
|
-
// is not appropriate
|
|
45474
|
-
if (this.operation !== "CUT") {
|
|
45475
|
-
this.pasteMergeIfExist(origin.position, position);
|
|
45476
|
-
}
|
|
45480
|
+
this.pasteMergeIfExist(origin.position, position, this.operation);
|
|
45477
45481
|
this.pasteCell(origin, position, this.operation, clipboardOptions);
|
|
45478
45482
|
if (shouldPasteCF) {
|
|
45479
45483
|
this.pasteCf(origin.position, position);
|
|
@@ -45530,7 +45534,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45530
45534
|
* If the origin position given is the top left of a merge, merge the target
|
|
45531
45535
|
* position.
|
|
45532
45536
|
*/
|
|
45533
|
-
pasteMergeIfExist(origin, target) {
|
|
45537
|
+
pasteMergeIfExist(origin, target, operation) {
|
|
45534
45538
|
let { sheetId, col, row } = origin;
|
|
45535
45539
|
const { col: mainCellColOrigin, row: mainCellRowOrigin } = this.getters.getMainCellPosition(origin);
|
|
45536
45540
|
if (mainCellColOrigin === col && mainCellRowOrigin === row) {
|
|
@@ -45538,6 +45542,9 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45538
45542
|
if (!merge) {
|
|
45539
45543
|
return;
|
|
45540
45544
|
}
|
|
45545
|
+
if (operation === "CUT") {
|
|
45546
|
+
this.dispatch("REMOVE_MERGE", { sheetId, target: [merge] });
|
|
45547
|
+
}
|
|
45541
45548
|
({ sheetId, col, row } = target);
|
|
45542
45549
|
this.dispatch("ADD_MERGE", {
|
|
45543
45550
|
sheetId,
|
|
@@ -47829,12 +47836,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
47829
47836
|
}
|
|
47830
47837
|
break;
|
|
47831
47838
|
case "AUTORESIZE_ROWS":
|
|
47832
|
-
this.
|
|
47833
|
-
elements: cmd.rows,
|
|
47834
|
-
dimension: "ROW",
|
|
47835
|
-
size: null,
|
|
47836
|
-
sheetId: cmd.sheetId,
|
|
47837
|
-
});
|
|
47839
|
+
this.autoResizeRows(cmd.sheetId, cmd.rows);
|
|
47838
47840
|
break;
|
|
47839
47841
|
}
|
|
47840
47842
|
}
|
|
@@ -47932,6 +47934,48 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
47932
47934
|
}
|
|
47933
47935
|
return "Success" /* CommandResult.Success */;
|
|
47934
47936
|
}
|
|
47937
|
+
autoResizeRows(sheetId, rows) {
|
|
47938
|
+
const rowSizes = [];
|
|
47939
|
+
for (const row of rows) {
|
|
47940
|
+
let evaluatedRowSize = 0;
|
|
47941
|
+
for (const cellId of this.getters.getRowCells(sheetId, row)) {
|
|
47942
|
+
const cell = this.getters.getCellById(cellId);
|
|
47943
|
+
if (!cell) {
|
|
47944
|
+
continue;
|
|
47945
|
+
}
|
|
47946
|
+
const position = this.getters.getCellPosition(cell.id);
|
|
47947
|
+
const colSize = this.getters.getColSize(sheetId, position.col);
|
|
47948
|
+
if (cell.isFormula) {
|
|
47949
|
+
const content = this.getters.getEvaluatedCell(position).formattedValue;
|
|
47950
|
+
const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
|
|
47951
|
+
if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
|
|
47952
|
+
evaluatedRowSize = evaluatedSize;
|
|
47953
|
+
}
|
|
47954
|
+
}
|
|
47955
|
+
else {
|
|
47956
|
+
const content = cell.content;
|
|
47957
|
+
const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
|
|
47958
|
+
// Only keep the size of evaluated cells if it's bigger than the dynamic row size
|
|
47959
|
+
if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
|
|
47960
|
+
evaluatedRowSize = 0;
|
|
47961
|
+
}
|
|
47962
|
+
}
|
|
47963
|
+
}
|
|
47964
|
+
rowSizes.push(evaluatedRowSize || null);
|
|
47965
|
+
}
|
|
47966
|
+
const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
|
|
47967
|
+
for (let i = 0; i < rowSizes.length; i++) {
|
|
47968
|
+
groupedSizes.get(rowSizes[i])?.push(rows[i]);
|
|
47969
|
+
}
|
|
47970
|
+
for (const [size, rows] of groupedSizes) {
|
|
47971
|
+
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
47972
|
+
elements: rows,
|
|
47973
|
+
dimension: "ROW",
|
|
47974
|
+
size,
|
|
47975
|
+
sheetId,
|
|
47976
|
+
});
|
|
47977
|
+
}
|
|
47978
|
+
}
|
|
47935
47979
|
}
|
|
47936
47980
|
|
|
47937
47981
|
const genericRepeatsTransforms = [
|
|
@@ -48581,37 +48625,6 @@ class ClipboardFigureImage {
|
|
|
48581
48625
|
}
|
|
48582
48626
|
}
|
|
48583
48627
|
|
|
48584
|
-
/** Change a number string to its canonical form (en_US locale) */
|
|
48585
|
-
function canonicalizeNumberValue(content, locale) {
|
|
48586
|
-
return content.startsWith("=")
|
|
48587
|
-
? canonicalizeFormula(content, locale)
|
|
48588
|
-
: canonicalizeNumberLiteral(content, locale);
|
|
48589
|
-
}
|
|
48590
|
-
/** Change a formula to its canonical form (en_US locale) */
|
|
48591
|
-
function canonicalizeFormula(formula, locale) {
|
|
48592
|
-
return _localizeFormula(formula, locale, DEFAULT_LOCALE);
|
|
48593
|
-
}
|
|
48594
|
-
function _localizeFormula(formula, fromLocale, toLocale) {
|
|
48595
|
-
if (fromLocale.formulaArgSeparator === toLocale.formulaArgSeparator &&
|
|
48596
|
-
fromLocale.decimalSeparator === toLocale.decimalSeparator) {
|
|
48597
|
-
return formula;
|
|
48598
|
-
}
|
|
48599
|
-
const tokens = tokenize(formula, fromLocale);
|
|
48600
|
-
let localizedFormula = "";
|
|
48601
|
-
for (const token of tokens) {
|
|
48602
|
-
if (token.type === "NUMBER") {
|
|
48603
|
-
localizedFormula += token.value.replace(fromLocale.decimalSeparator, toLocale.decimalSeparator);
|
|
48604
|
-
}
|
|
48605
|
-
else if (token.type === "ARG_SEPARATOR") {
|
|
48606
|
-
localizedFormula += toLocale.formulaArgSeparator;
|
|
48607
|
-
}
|
|
48608
|
-
else {
|
|
48609
|
-
localizedFormula += token.value;
|
|
48610
|
-
}
|
|
48611
|
-
}
|
|
48612
|
-
return localizedFormula;
|
|
48613
|
-
}
|
|
48614
|
-
|
|
48615
48628
|
/** State of the clipboard when copying/cutting from the OS clipboard*/
|
|
48616
48629
|
class ClipboardOsState extends ClipboardCellsAbstractState {
|
|
48617
48630
|
values;
|
|
@@ -49188,8 +49201,8 @@ class EditionPlugin extends UIPlugin {
|
|
|
49188
49201
|
this.colorIndexByRange = {};
|
|
49189
49202
|
break;
|
|
49190
49203
|
case "CANCEL_EDITION":
|
|
49191
|
-
this.cancelEditionAndActivateSheet();
|
|
49192
49204
|
this.resetContent();
|
|
49205
|
+
this.cancelEditionAndActivateSheet();
|
|
49193
49206
|
this.colorIndexByRange = {};
|
|
49194
49207
|
break;
|
|
49195
49208
|
case "SET_CURRENT_CONTENT":
|
|
@@ -49200,8 +49213,8 @@ class EditionPlugin extends UIPlugin {
|
|
|
49200
49213
|
this.replaceSelection(cmd.text);
|
|
49201
49214
|
break;
|
|
49202
49215
|
case "SELECT_FIGURE":
|
|
49203
|
-
this.cancelEditionAndActivateSheet();
|
|
49204
49216
|
this.resetContent();
|
|
49217
|
+
this.cancelEditionAndActivateSheet();
|
|
49205
49218
|
break;
|
|
49206
49219
|
case "ADD_COLUMNS_ROWS":
|
|
49207
49220
|
this.onAddElements(cmd);
|
|
@@ -49244,8 +49257,8 @@ class EditionPlugin extends UIPlugin {
|
|
|
49244
49257
|
const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
|
|
49245
49258
|
if (!sheetIdExists && this.mode !== "inactive") {
|
|
49246
49259
|
this.sheetId = this.getters.getActiveSheetId();
|
|
49247
|
-
this.cancelEditionAndActivateSheet();
|
|
49248
49260
|
this.resetContent();
|
|
49261
|
+
this.cancelEditionAndActivateSheet();
|
|
49249
49262
|
this.ui.raiseBlockingErrorUI(CELL_DELETED_MESSAGE);
|
|
49250
49263
|
}
|
|
49251
49264
|
break;
|
|
@@ -58032,6 +58045,6 @@ const constants = {
|
|
|
58032
58045
|
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 };
|
|
58033
58046
|
|
|
58034
58047
|
|
|
58035
|
-
__info__.version = "17.0.
|
|
58036
|
-
__info__.date = "2025-03-
|
|
58037
|
-
__info__.hash = "
|
|
58048
|
+
__info__.version = "17.0.54";
|
|
58049
|
+
__info__.date = "2025-03-19T08:14:16.001Z";
|
|
58050
|
+
__info__.hash = "945b375";
|