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