@odoo/o-spreadsheet 17.4.26 → 17.4.27

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.
@@ -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.4.26
6
- * @date 2025-03-12T15:31:45.184Z
7
- * @hash a18429e
5
+ * @version 17.4.27
6
+ * @date 2025-03-19T08:27:27.414Z
7
+ * @hash a87c1da
8
8
  */
9
9
 
10
10
  'use strict';
@@ -5199,11 +5199,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
5199
5199
  if (!cell || (!cell.isFormula && !cell.content)) {
5200
5200
  return DEFAULT_CELL_HEIGHT;
5201
5201
  }
5202
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
5203
- const numberOfLines = cell.isFormula
5204
- ? 1
5205
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
5206
- const fontSize = computeTextFontSizeInPixels(cell.style);
5202
+ const content = cell.isFormula ? "" : cell.content;
5203
+ return getCellContentHeight(ctx, content, cell.style, colSize);
5204
+ }
5205
+ function getCellContentHeight(ctx, content, style, colSize) {
5206
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
5207
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
5208
+ const fontSize = computeTextFontSizeInPixels(style);
5207
5209
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
5208
5210
  }
5209
5211
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -6789,13 +6791,6 @@ class CellClipboardHandler extends AbstractCellClipboardHandler {
6789
6791
  this.clearClippedZones(content);
6790
6792
  const selection = target[0];
6791
6793
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
6792
- this.dispatch("MOVE_RANGES", {
6793
- target: content.zones,
6794
- sheetId: content.sheetId,
6795
- targetSheetId: sheetId,
6796
- col: selection.left,
6797
- row: selection.top,
6798
- });
6799
6794
  }
6800
6795
  /**
6801
6796
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -7256,14 +7251,15 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
7256
7251
  }
7257
7252
  merges.push(mergesInRow);
7258
7253
  }
7259
- return { merges };
7254
+ return { merges, sheetId };
7260
7255
  }
7261
7256
  /**
7262
7257
  * Paste the clipboard content in the given target
7263
7258
  */
7264
7259
  paste(target, content, options) {
7265
7260
  if (options.isCutOperation) {
7266
- return;
7261
+ const copiedMerges = content.merges.flat().filter(isDefined);
7262
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
7267
7263
  }
7268
7264
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
7269
7265
  }
@@ -7298,6 +7294,27 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
7298
7294
  }
7299
7295
  }
7300
7296
 
7297
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
7298
+ copy(data) {
7299
+ return {
7300
+ zones: data.clippedZones,
7301
+ sheetId: data.sheetId,
7302
+ };
7303
+ }
7304
+ paste(target, content, options) {
7305
+ if (options.isCutOperation) {
7306
+ const selection = target.zones[0];
7307
+ this.dispatch("MOVE_RANGES", {
7308
+ target: content.zones,
7309
+ sheetId: content.sheetId,
7310
+ targetSheetId: target.sheetId,
7311
+ col: selection.left,
7312
+ row: selection.top,
7313
+ });
7314
+ }
7315
+ }
7316
+ }
7317
+
7301
7318
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
7302
7319
  isPasteAllowed(sheetId, target, content, options) {
7303
7320
  if (!("cells" in content)) {
@@ -7465,7 +7482,8 @@ clipboardHandlersRegistries.cellHandlers
7465
7482
  .add("merge", MergeClipboardHandler)
7466
7483
  .add("border", BorderClipboardHandler)
7467
7484
  .add("table", TableClipboardHandler)
7468
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
7485
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
7486
+ .add("references", ReferenceClipboardHandler);
7469
7487
 
7470
7488
  function transformZone(zone, executed) {
7471
7489
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -9622,8 +9640,8 @@ class ComposerStore extends SpreadsheetStore {
9622
9640
  this.colorIndexByRange = {};
9623
9641
  }
9624
9642
  cancelEdition() {
9625
- this.cancelEditionAndActivateSheet();
9626
9643
  this.resetContent();
9644
+ this.cancelEditionAndActivateSheet();
9627
9645
  this.colorIndexByRange = {};
9628
9646
  }
9629
9647
  setCurrentContent(content, selection) {
@@ -9640,8 +9658,8 @@ class ComposerStore extends SpreadsheetStore {
9640
9658
  switch (cmd.type) {
9641
9659
  case "SELECT_FIGURE":
9642
9660
  if (cmd.id) {
9643
- this.cancelEditionAndActivateSheet();
9644
9661
  this.resetContent();
9662
+ this.cancelEditionAndActivateSheet();
9645
9663
  }
9646
9664
  break;
9647
9665
  case "SET_FORMATTING":
@@ -9691,8 +9709,8 @@ class ComposerStore extends SpreadsheetStore {
9691
9709
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
9692
9710
  if (!sheetIdExists && this.editionMode !== "inactive") {
9693
9711
  this.sheetId = this.getters.getActiveSheetId();
9694
- this.cancelEditionAndActivateSheet();
9695
9712
  this.resetContent();
9713
+ this.cancelEditionAndActivateSheet();
9696
9714
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
9697
9715
  }
9698
9716
  break;
@@ -37676,6 +37694,7 @@ class RemoveDuplicatesPanel extends owl.Component {
37676
37694
  columns: {},
37677
37695
  });
37678
37696
  setup() {
37697
+ this.updateColumns();
37679
37698
  owl.onWillUpdateProps(() => this.updateColumns());
37680
37699
  }
37681
37700
  toggleHasHeader() {
@@ -58763,12 +58782,7 @@ class SheetUIPlugin extends UIPlugin {
58763
58782
  }
58764
58783
  break;
58765
58784
  case "AUTORESIZE_ROWS":
58766
- this.dispatch("RESIZE_COLUMNS_ROWS", {
58767
- elements: cmd.rows,
58768
- dimension: "ROW",
58769
- size: null,
58770
- sheetId: cmd.sheetId,
58771
- });
58785
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
58772
58786
  break;
58773
58787
  }
58774
58788
  }
@@ -58918,6 +58932,48 @@ class SheetUIPlugin extends UIPlugin {
58918
58932
  }
58919
58933
  return "Success" /* CommandResult.Success */;
58920
58934
  }
58935
+ autoResizeRows(sheetId, rows) {
58936
+ const rowSizes = [];
58937
+ for (const row of rows) {
58938
+ let evaluatedRowSize = 0;
58939
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
58940
+ const cell = this.getters.getCellById(cellId);
58941
+ if (!cell) {
58942
+ continue;
58943
+ }
58944
+ const position = this.getters.getCellPosition(cell.id);
58945
+ const colSize = this.getters.getColSize(sheetId, position.col);
58946
+ if (cell.isFormula) {
58947
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
58948
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
58949
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
58950
+ evaluatedRowSize = evaluatedSize;
58951
+ }
58952
+ }
58953
+ else {
58954
+ const content = cell.content;
58955
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
58956
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
58957
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
58958
+ evaluatedRowSize = 0;
58959
+ }
58960
+ }
58961
+ }
58962
+ rowSizes.push(evaluatedRowSize || null);
58963
+ }
58964
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
58965
+ for (let i = 0; i < rowSizes.length; i++) {
58966
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
58967
+ }
58968
+ for (const [size, rows] of groupedSizes) {
58969
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
58970
+ elements: rows,
58971
+ dimension: "ROW",
58972
+ size,
58973
+ sheetId,
58974
+ });
58975
+ }
58976
+ }
58921
58977
  }
58922
58978
 
58923
58979
  class TableComputedStylePlugin extends UIPlugin {
@@ -69173,6 +69229,6 @@ exports.tokenColors = tokenColors;
69173
69229
  exports.tokenize = tokenize;
69174
69230
 
69175
69231
 
69176
- __info__.version = "17.4.26";
69177
- __info__.date = "2025-03-12T15:31:45.184Z";
69178
- __info__.hash = "a18429e";
69232
+ __info__.version = "17.4.27";
69233
+ __info__.date = "2025-03-19T08:27:27.414Z";
69234
+ __info__.hash = "a87c1da";
@@ -4721,6 +4721,7 @@ declare class SheetUIPlugin extends UIPlugin {
4721
4721
  * not outside the sheet.
4722
4722
  */
4723
4723
  private checkZonesAreInSheet;
4724
+ private autoResizeRows;
4724
4725
  }
4725
4726
 
4726
4727
  /**
@@ -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.4.26
6
- * @date 2025-03-12T15:31:45.184Z
7
- * @hash a18429e
5
+ * @version 17.4.27
6
+ * @date 2025-03-19T08:27:27.414Z
7
+ * @hash a87c1da
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -5197,11 +5197,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
5197
5197
  if (!cell || (!cell.isFormula && !cell.content)) {
5198
5198
  return DEFAULT_CELL_HEIGHT;
5199
5199
  }
5200
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
5201
- const numberOfLines = cell.isFormula
5202
- ? 1
5203
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
5204
- const fontSize = computeTextFontSizeInPixels(cell.style);
5200
+ const content = cell.isFormula ? "" : cell.content;
5201
+ return getCellContentHeight(ctx, content, cell.style, colSize);
5202
+ }
5203
+ function getCellContentHeight(ctx, content, style, colSize) {
5204
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
5205
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
5206
+ const fontSize = computeTextFontSizeInPixels(style);
5205
5207
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
5206
5208
  }
5207
5209
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -6787,13 +6789,6 @@ class CellClipboardHandler extends AbstractCellClipboardHandler {
6787
6789
  this.clearClippedZones(content);
6788
6790
  const selection = target[0];
6789
6791
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
6790
- this.dispatch("MOVE_RANGES", {
6791
- target: content.zones,
6792
- sheetId: content.sheetId,
6793
- targetSheetId: sheetId,
6794
- col: selection.left,
6795
- row: selection.top,
6796
- });
6797
6792
  }
6798
6793
  /**
6799
6794
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -7254,14 +7249,15 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
7254
7249
  }
7255
7250
  merges.push(mergesInRow);
7256
7251
  }
7257
- return { merges };
7252
+ return { merges, sheetId };
7258
7253
  }
7259
7254
  /**
7260
7255
  * Paste the clipboard content in the given target
7261
7256
  */
7262
7257
  paste(target, content, options) {
7263
7258
  if (options.isCutOperation) {
7264
- return;
7259
+ const copiedMerges = content.merges.flat().filter(isDefined);
7260
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
7265
7261
  }
7266
7262
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
7267
7263
  }
@@ -7296,6 +7292,27 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
7296
7292
  }
7297
7293
  }
7298
7294
 
7295
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
7296
+ copy(data) {
7297
+ return {
7298
+ zones: data.clippedZones,
7299
+ sheetId: data.sheetId,
7300
+ };
7301
+ }
7302
+ paste(target, content, options) {
7303
+ if (options.isCutOperation) {
7304
+ const selection = target.zones[0];
7305
+ this.dispatch("MOVE_RANGES", {
7306
+ target: content.zones,
7307
+ sheetId: content.sheetId,
7308
+ targetSheetId: target.sheetId,
7309
+ col: selection.left,
7310
+ row: selection.top,
7311
+ });
7312
+ }
7313
+ }
7314
+ }
7315
+
7299
7316
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
7300
7317
  isPasteAllowed(sheetId, target, content, options) {
7301
7318
  if (!("cells" in content)) {
@@ -7463,7 +7480,8 @@ clipboardHandlersRegistries.cellHandlers
7463
7480
  .add("merge", MergeClipboardHandler)
7464
7481
  .add("border", BorderClipboardHandler)
7465
7482
  .add("table", TableClipboardHandler)
7466
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
7483
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
7484
+ .add("references", ReferenceClipboardHandler);
7467
7485
 
7468
7486
  function transformZone(zone, executed) {
7469
7487
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -9620,8 +9638,8 @@ class ComposerStore extends SpreadsheetStore {
9620
9638
  this.colorIndexByRange = {};
9621
9639
  }
9622
9640
  cancelEdition() {
9623
- this.cancelEditionAndActivateSheet();
9624
9641
  this.resetContent();
9642
+ this.cancelEditionAndActivateSheet();
9625
9643
  this.colorIndexByRange = {};
9626
9644
  }
9627
9645
  setCurrentContent(content, selection) {
@@ -9638,8 +9656,8 @@ class ComposerStore extends SpreadsheetStore {
9638
9656
  switch (cmd.type) {
9639
9657
  case "SELECT_FIGURE":
9640
9658
  if (cmd.id) {
9641
- this.cancelEditionAndActivateSheet();
9642
9659
  this.resetContent();
9660
+ this.cancelEditionAndActivateSheet();
9643
9661
  }
9644
9662
  break;
9645
9663
  case "SET_FORMATTING":
@@ -9689,8 +9707,8 @@ class ComposerStore extends SpreadsheetStore {
9689
9707
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
9690
9708
  if (!sheetIdExists && this.editionMode !== "inactive") {
9691
9709
  this.sheetId = this.getters.getActiveSheetId();
9692
- this.cancelEditionAndActivateSheet();
9693
9710
  this.resetContent();
9711
+ this.cancelEditionAndActivateSheet();
9694
9712
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
9695
9713
  }
9696
9714
  break;
@@ -37674,6 +37692,7 @@ class RemoveDuplicatesPanel extends Component {
37674
37692
  columns: {},
37675
37693
  });
37676
37694
  setup() {
37695
+ this.updateColumns();
37677
37696
  onWillUpdateProps(() => this.updateColumns());
37678
37697
  }
37679
37698
  toggleHasHeader() {
@@ -58761,12 +58780,7 @@ class SheetUIPlugin extends UIPlugin {
58761
58780
  }
58762
58781
  break;
58763
58782
  case "AUTORESIZE_ROWS":
58764
- this.dispatch("RESIZE_COLUMNS_ROWS", {
58765
- elements: cmd.rows,
58766
- dimension: "ROW",
58767
- size: null,
58768
- sheetId: cmd.sheetId,
58769
- });
58783
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
58770
58784
  break;
58771
58785
  }
58772
58786
  }
@@ -58916,6 +58930,48 @@ class SheetUIPlugin extends UIPlugin {
58916
58930
  }
58917
58931
  return "Success" /* CommandResult.Success */;
58918
58932
  }
58933
+ autoResizeRows(sheetId, rows) {
58934
+ const rowSizes = [];
58935
+ for (const row of rows) {
58936
+ let evaluatedRowSize = 0;
58937
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
58938
+ const cell = this.getters.getCellById(cellId);
58939
+ if (!cell) {
58940
+ continue;
58941
+ }
58942
+ const position = this.getters.getCellPosition(cell.id);
58943
+ const colSize = this.getters.getColSize(sheetId, position.col);
58944
+ if (cell.isFormula) {
58945
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
58946
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
58947
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
58948
+ evaluatedRowSize = evaluatedSize;
58949
+ }
58950
+ }
58951
+ else {
58952
+ const content = cell.content;
58953
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
58954
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
58955
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
58956
+ evaluatedRowSize = 0;
58957
+ }
58958
+ }
58959
+ }
58960
+ rowSizes.push(evaluatedRowSize || null);
58961
+ }
58962
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
58963
+ for (let i = 0; i < rowSizes.length; i++) {
58964
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
58965
+ }
58966
+ for (const [size, rows] of groupedSizes) {
58967
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
58968
+ elements: rows,
58969
+ dimension: "ROW",
58970
+ size,
58971
+ sheetId,
58972
+ });
58973
+ }
58974
+ }
58919
58975
  }
58920
58976
 
58921
58977
  class TableComputedStylePlugin extends UIPlugin {
@@ -69128,6 +69184,6 @@ const constants = {
69128
69184
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
69129
69185
 
69130
69186
 
69131
- __info__.version = "17.4.26";
69132
- __info__.date = "2025-03-12T15:31:45.184Z";
69133
- __info__.hash = "a18429e";
69187
+ __info__.version = "17.4.27";
69188
+ __info__.date = "2025-03-19T08:27:27.414Z";
69189
+ __info__.hash = "a87c1da";
@@ -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.4.26
6
- * @date 2025-03-12T15:31:45.184Z
7
- * @hash a18429e
5
+ * @version 17.4.27
6
+ * @date 2025-03-19T08:27:27.414Z
7
+ * @hash a87c1da
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -5198,11 +5198,13 @@
5198
5198
  if (!cell || (!cell.isFormula && !cell.content)) {
5199
5199
  return DEFAULT_CELL_HEIGHT;
5200
5200
  }
5201
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
5202
- const numberOfLines = cell.isFormula
5203
- ? 1
5204
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
5205
- const fontSize = computeTextFontSizeInPixels(cell.style);
5201
+ const content = cell.isFormula ? "" : cell.content;
5202
+ return getCellContentHeight(ctx, content, cell.style, colSize);
5203
+ }
5204
+ function getCellContentHeight(ctx, content, style, colSize) {
5205
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
5206
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
5207
+ const fontSize = computeTextFontSizeInPixels(style);
5206
5208
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
5207
5209
  }
5208
5210
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -6788,13 +6790,6 @@
6788
6790
  this.clearClippedZones(content);
6789
6791
  const selection = target[0];
6790
6792
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
6791
- this.dispatch("MOVE_RANGES", {
6792
- target: content.zones,
6793
- sheetId: content.sheetId,
6794
- targetSheetId: sheetId,
6795
- col: selection.left,
6796
- row: selection.top,
6797
- });
6798
6793
  }
6799
6794
  /**
6800
6795
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -7255,14 +7250,15 @@
7255
7250
  }
7256
7251
  merges.push(mergesInRow);
7257
7252
  }
7258
- return { merges };
7253
+ return { merges, sheetId };
7259
7254
  }
7260
7255
  /**
7261
7256
  * Paste the clipboard content in the given target
7262
7257
  */
7263
7258
  paste(target, content, options) {
7264
7259
  if (options.isCutOperation) {
7265
- return;
7260
+ const copiedMerges = content.merges.flat().filter(isDefined);
7261
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
7266
7262
  }
7267
7263
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
7268
7264
  }
@@ -7297,6 +7293,27 @@
7297
7293
  }
7298
7294
  }
7299
7295
 
7296
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
7297
+ copy(data) {
7298
+ return {
7299
+ zones: data.clippedZones,
7300
+ sheetId: data.sheetId,
7301
+ };
7302
+ }
7303
+ paste(target, content, options) {
7304
+ if (options.isCutOperation) {
7305
+ const selection = target.zones[0];
7306
+ this.dispatch("MOVE_RANGES", {
7307
+ target: content.zones,
7308
+ sheetId: content.sheetId,
7309
+ targetSheetId: target.sheetId,
7310
+ col: selection.left,
7311
+ row: selection.top,
7312
+ });
7313
+ }
7314
+ }
7315
+ }
7316
+
7300
7317
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
7301
7318
  isPasteAllowed(sheetId, target, content, options) {
7302
7319
  if (!("cells" in content)) {
@@ -7464,7 +7481,8 @@
7464
7481
  .add("merge", MergeClipboardHandler)
7465
7482
  .add("border", BorderClipboardHandler)
7466
7483
  .add("table", TableClipboardHandler)
7467
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
7484
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
7485
+ .add("references", ReferenceClipboardHandler);
7468
7486
 
7469
7487
  function transformZone(zone, executed) {
7470
7488
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -9621,8 +9639,8 @@ stores.inject(MyMetaStore, storeInstance);
9621
9639
  this.colorIndexByRange = {};
9622
9640
  }
9623
9641
  cancelEdition() {
9624
- this.cancelEditionAndActivateSheet();
9625
9642
  this.resetContent();
9643
+ this.cancelEditionAndActivateSheet();
9626
9644
  this.colorIndexByRange = {};
9627
9645
  }
9628
9646
  setCurrentContent(content, selection) {
@@ -9639,8 +9657,8 @@ stores.inject(MyMetaStore, storeInstance);
9639
9657
  switch (cmd.type) {
9640
9658
  case "SELECT_FIGURE":
9641
9659
  if (cmd.id) {
9642
- this.cancelEditionAndActivateSheet();
9643
9660
  this.resetContent();
9661
+ this.cancelEditionAndActivateSheet();
9644
9662
  }
9645
9663
  break;
9646
9664
  case "SET_FORMATTING":
@@ -9690,8 +9708,8 @@ stores.inject(MyMetaStore, storeInstance);
9690
9708
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
9691
9709
  if (!sheetIdExists && this.editionMode !== "inactive") {
9692
9710
  this.sheetId = this.getters.getActiveSheetId();
9693
- this.cancelEditionAndActivateSheet();
9694
9711
  this.resetContent();
9712
+ this.cancelEditionAndActivateSheet();
9695
9713
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
9696
9714
  }
9697
9715
  break;
@@ -37675,6 +37693,7 @@ stores.inject(MyMetaStore, storeInstance);
37675
37693
  columns: {},
37676
37694
  });
37677
37695
  setup() {
37696
+ this.updateColumns();
37678
37697
  owl.onWillUpdateProps(() => this.updateColumns());
37679
37698
  }
37680
37699
  toggleHasHeader() {
@@ -58762,12 +58781,7 @@ stores.inject(MyMetaStore, storeInstance);
58762
58781
  }
58763
58782
  break;
58764
58783
  case "AUTORESIZE_ROWS":
58765
- this.dispatch("RESIZE_COLUMNS_ROWS", {
58766
- elements: cmd.rows,
58767
- dimension: "ROW",
58768
- size: null,
58769
- sheetId: cmd.sheetId,
58770
- });
58784
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
58771
58785
  break;
58772
58786
  }
58773
58787
  }
@@ -58917,6 +58931,48 @@ stores.inject(MyMetaStore, storeInstance);
58917
58931
  }
58918
58932
  return "Success" /* CommandResult.Success */;
58919
58933
  }
58934
+ autoResizeRows(sheetId, rows) {
58935
+ const rowSizes = [];
58936
+ for (const row of rows) {
58937
+ let evaluatedRowSize = 0;
58938
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
58939
+ const cell = this.getters.getCellById(cellId);
58940
+ if (!cell) {
58941
+ continue;
58942
+ }
58943
+ const position = this.getters.getCellPosition(cell.id);
58944
+ const colSize = this.getters.getColSize(sheetId, position.col);
58945
+ if (cell.isFormula) {
58946
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
58947
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
58948
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
58949
+ evaluatedRowSize = evaluatedSize;
58950
+ }
58951
+ }
58952
+ else {
58953
+ const content = cell.content;
58954
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
58955
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
58956
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
58957
+ evaluatedRowSize = 0;
58958
+ }
58959
+ }
58960
+ }
58961
+ rowSizes.push(evaluatedRowSize || null);
58962
+ }
58963
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
58964
+ for (let i = 0; i < rowSizes.length; i++) {
58965
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
58966
+ }
58967
+ for (const [size, rows] of groupedSizes) {
58968
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
58969
+ elements: rows,
58970
+ dimension: "ROW",
58971
+ size,
58972
+ sheetId,
58973
+ });
58974
+ }
58975
+ }
58920
58976
  }
58921
58977
 
58922
58978
  class TableComputedStylePlugin extends UIPlugin {
@@ -69172,9 +69228,9 @@ stores.inject(MyMetaStore, storeInstance);
69172
69228
  exports.tokenize = tokenize;
69173
69229
 
69174
69230
 
69175
- __info__.version = "17.4.26";
69176
- __info__.date = "2025-03-12T15:31:45.184Z";
69177
- __info__.hash = "a18429e";
69231
+ __info__.version = "17.4.27";
69232
+ __info__.date = "2025-03-19T08:27:27.414Z";
69233
+ __info__.hash = "a87c1da";
69178
69234
 
69179
69235
 
69180
69236
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);