@odoo/o-spreadsheet 18.2.3 → 18.2.4

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 18.2.3
6
- * @date 2025-03-12T15:32:36.274Z
7
- * @hash 81b0e08
5
+ * @version 18.2.4
6
+ * @date 2025-03-19T08:20:57.717Z
7
+ * @hash 958936a
8
8
  */
9
9
 
10
10
  'use strict';
@@ -6287,11 +6287,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
6287
6287
  if (!cell || (!cell.isFormula && !cell.content)) {
6288
6288
  return DEFAULT_CELL_HEIGHT;
6289
6289
  }
6290
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6291
- const numberOfLines = cell.isFormula
6292
- ? 1
6293
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
6294
- const fontSize = computeTextFontSizeInPixels(cell.style);
6290
+ const content = cell.isFormula ? "" : cell.content;
6291
+ return getCellContentHeight(ctx, content, cell.style, colSize);
6292
+ }
6293
+ function getCellContentHeight(ctx, content, style, colSize) {
6294
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6295
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
6296
+ const fontSize = computeTextFontSizeInPixels(style);
6295
6297
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
6296
6298
  }
6297
6299
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -8488,13 +8490,6 @@ class CellClipboardHandler extends AbstractCellClipboardHandler {
8488
8490
  this.clearClippedZones(content);
8489
8491
  const selection = target[0];
8490
8492
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
8491
- this.dispatch("MOVE_RANGES", {
8492
- target: content.zones,
8493
- sheetId: content.sheetId,
8494
- targetSheetId: sheetId,
8495
- col: selection.left,
8496
- row: selection.top,
8497
- });
8498
8493
  }
8499
8494
  /**
8500
8495
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -9003,14 +8998,15 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
9003
8998
  }
9004
8999
  merges.push(mergesInRow);
9005
9000
  }
9006
- return { merges };
9001
+ return { merges, sheetId };
9007
9002
  }
9008
9003
  /**
9009
9004
  * Paste the clipboard content in the given target
9010
9005
  */
9011
9006
  paste(target, content, options) {
9012
9007
  if (options.isCutOperation) {
9013
- return;
9008
+ const copiedMerges = content.merges.flat().filter(isDefined);
9009
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
9014
9010
  }
9015
9011
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
9016
9012
  }
@@ -9045,6 +9041,27 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
9045
9041
  }
9046
9042
  }
9047
9043
 
9044
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
9045
+ copy(data) {
9046
+ return {
9047
+ zones: data.clippedZones,
9048
+ sheetId: data.sheetId,
9049
+ };
9050
+ }
9051
+ paste(target, content, options) {
9052
+ if (options.isCutOperation) {
9053
+ const selection = target.zones[0];
9054
+ this.dispatch("MOVE_RANGES", {
9055
+ target: content.zones,
9056
+ sheetId: content.sheetId,
9057
+ targetSheetId: target.sheetId,
9058
+ col: selection.left,
9059
+ row: selection.top,
9060
+ });
9061
+ }
9062
+ }
9063
+ }
9064
+
9048
9065
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
9049
9066
  isPasteAllowed(sheetId, target, content, options) {
9050
9067
  if (!("cells" in content)) {
@@ -9208,7 +9225,8 @@ clipboardHandlersRegistries.cellHandlers
9208
9225
  .add("merge", MergeClipboardHandler)
9209
9226
  .add("border", BorderClipboardHandler)
9210
9227
  .add("table", TableClipboardHandler)
9211
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
9228
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
9229
+ .add("references", ReferenceClipboardHandler);
9212
9230
 
9213
9231
  function transformZone(zone, executed) {
9214
9232
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -21159,8 +21177,8 @@ class AbstractComposerStore extends SpreadsheetStore {
21159
21177
  this.computeParenthesisRelatedToCursor();
21160
21178
  }
21161
21179
  cancelEdition() {
21162
- this.cancelEditionAndActivateSheet();
21163
21180
  this.resetContent();
21181
+ this.cancelEditionAndActivateSheet();
21164
21182
  }
21165
21183
  setCurrentContent(content, selection) {
21166
21184
  if (selection && !this.isSelectionValid(content.length, selection.start, selection.end)) {
@@ -21178,8 +21196,8 @@ class AbstractComposerStore extends SpreadsheetStore {
21178
21196
  switch (cmd.type) {
21179
21197
  case "SELECT_FIGURE":
21180
21198
  if (cmd.id) {
21181
- this.cancelEditionAndActivateSheet();
21182
21199
  this.resetContent();
21200
+ this.cancelEditionAndActivateSheet();
21183
21201
  }
21184
21202
  break;
21185
21203
  case "START_CHANGE_HIGHLIGHT":
@@ -22495,7 +22513,7 @@ autoCompleteProviders.add("pivot_group_values", {
22495
22513
  text,
22496
22514
  description: usedLabel,
22497
22515
  htmlContent: [{ value: text, color }],
22498
- fuzzySearchKey: value + usedLabel,
22516
+ fuzzySearchKey: text + usedLabel,
22499
22517
  };
22500
22518
  });
22501
22519
  },
@@ -47172,6 +47190,7 @@ class RemoveDuplicatesPanel extends owl.Component {
47172
47190
  columns: {},
47173
47191
  });
47174
47192
  setup() {
47193
+ this.updateColumns();
47175
47194
  owl.onWillUpdateProps(() => this.updateColumns());
47176
47195
  }
47177
47196
  toggleHasHeader() {
@@ -48955,8 +48974,8 @@ class CellComposerStore extends AbstractComposerStore {
48955
48974
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
48956
48975
  if (!sheetIdExists && this.editionMode !== "inactive") {
48957
48976
  this.sheetId = this.getters.getActiveSheetId();
48958
- this.cancelEditionAndActivateSheet();
48959
48977
  this.resetContent();
48978
+ this.cancelEditionAndActivateSheet();
48960
48979
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
48961
48980
  }
48962
48981
  break;
@@ -65384,12 +65403,7 @@ class SheetUIPlugin extends UIPlugin {
65384
65403
  }
65385
65404
  break;
65386
65405
  case "AUTORESIZE_ROWS":
65387
- this.dispatch("RESIZE_COLUMNS_ROWS", {
65388
- elements: cmd.rows,
65389
- dimension: "ROW",
65390
- size: null,
65391
- sheetId: cmd.sheetId,
65392
- });
65406
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
65393
65407
  break;
65394
65408
  }
65395
65409
  }
@@ -65553,6 +65567,48 @@ class SheetUIPlugin extends UIPlugin {
65553
65567
  }
65554
65568
  return "Success" /* CommandResult.Success */;
65555
65569
  }
65570
+ autoResizeRows(sheetId, rows) {
65571
+ const rowSizes = [];
65572
+ for (const row of rows) {
65573
+ let evaluatedRowSize = 0;
65574
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
65575
+ const cell = this.getters.getCellById(cellId);
65576
+ if (!cell) {
65577
+ continue;
65578
+ }
65579
+ const position = this.getters.getCellPosition(cell.id);
65580
+ const colSize = this.getters.getColSize(sheetId, position.col);
65581
+ if (cell.isFormula) {
65582
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
65583
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65584
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
65585
+ evaluatedRowSize = evaluatedSize;
65586
+ }
65587
+ }
65588
+ else {
65589
+ const content = cell.content;
65590
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65591
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
65592
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
65593
+ evaluatedRowSize = 0;
65594
+ }
65595
+ }
65596
+ }
65597
+ rowSizes.push(evaluatedRowSize || null);
65598
+ }
65599
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
65600
+ for (let i = 0; i < rowSizes.length; i++) {
65601
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
65602
+ }
65603
+ for (const [size, rows] of groupedSizes) {
65604
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
65605
+ elements: rows,
65606
+ dimension: "ROW",
65607
+ size,
65608
+ sheetId,
65609
+ });
65610
+ }
65611
+ }
65556
65612
  }
65557
65613
 
65558
65614
  class TableComputedStylePlugin extends UIPlugin {
@@ -76012,6 +76068,6 @@ exports.tokenColors = tokenColors;
76012
76068
  exports.tokenize = tokenize;
76013
76069
 
76014
76070
 
76015
- __info__.version = "18.2.3";
76016
- __info__.date = "2025-03-12T15:32:36.274Z";
76017
- __info__.hash = "81b0e08";
76071
+ __info__.version = "18.2.4";
76072
+ __info__.date = "2025-03-19T08:20:57.717Z";
76073
+ __info__.hash = "958936a";
@@ -5769,6 +5769,7 @@ declare class SheetUIPlugin extends UIPlugin {
5769
5769
  * not outside the sheet.
5770
5770
  */
5771
5771
  private checkZonesAreInSheet;
5772
+ private autoResizeRows;
5772
5773
  }
5773
5774
 
5774
5775
  declare class CellComputedStylePlugin extends UIPlugin {
@@ -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 18.2.3
6
- * @date 2025-03-12T15:32:36.274Z
7
- * @hash 81b0e08
5
+ * @version 18.2.4
6
+ * @date 2025-03-19T08:20:57.717Z
7
+ * @hash 958936a
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -6285,11 +6285,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
6285
6285
  if (!cell || (!cell.isFormula && !cell.content)) {
6286
6286
  return DEFAULT_CELL_HEIGHT;
6287
6287
  }
6288
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6289
- const numberOfLines = cell.isFormula
6290
- ? 1
6291
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
6292
- const fontSize = computeTextFontSizeInPixels(cell.style);
6288
+ const content = cell.isFormula ? "" : cell.content;
6289
+ return getCellContentHeight(ctx, content, cell.style, colSize);
6290
+ }
6291
+ function getCellContentHeight(ctx, content, style, colSize) {
6292
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6293
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
6294
+ const fontSize = computeTextFontSizeInPixels(style);
6293
6295
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
6294
6296
  }
6295
6297
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -8486,13 +8488,6 @@ class CellClipboardHandler extends AbstractCellClipboardHandler {
8486
8488
  this.clearClippedZones(content);
8487
8489
  const selection = target[0];
8488
8490
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
8489
- this.dispatch("MOVE_RANGES", {
8490
- target: content.zones,
8491
- sheetId: content.sheetId,
8492
- targetSheetId: sheetId,
8493
- col: selection.left,
8494
- row: selection.top,
8495
- });
8496
8491
  }
8497
8492
  /**
8498
8493
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -9001,14 +8996,15 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
9001
8996
  }
9002
8997
  merges.push(mergesInRow);
9003
8998
  }
9004
- return { merges };
8999
+ return { merges, sheetId };
9005
9000
  }
9006
9001
  /**
9007
9002
  * Paste the clipboard content in the given target
9008
9003
  */
9009
9004
  paste(target, content, options) {
9010
9005
  if (options.isCutOperation) {
9011
- return;
9006
+ const copiedMerges = content.merges.flat().filter(isDefined);
9007
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
9012
9008
  }
9013
9009
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
9014
9010
  }
@@ -9043,6 +9039,27 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
9043
9039
  }
9044
9040
  }
9045
9041
 
9042
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
9043
+ copy(data) {
9044
+ return {
9045
+ zones: data.clippedZones,
9046
+ sheetId: data.sheetId,
9047
+ };
9048
+ }
9049
+ paste(target, content, options) {
9050
+ if (options.isCutOperation) {
9051
+ const selection = target.zones[0];
9052
+ this.dispatch("MOVE_RANGES", {
9053
+ target: content.zones,
9054
+ sheetId: content.sheetId,
9055
+ targetSheetId: target.sheetId,
9056
+ col: selection.left,
9057
+ row: selection.top,
9058
+ });
9059
+ }
9060
+ }
9061
+ }
9062
+
9046
9063
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
9047
9064
  isPasteAllowed(sheetId, target, content, options) {
9048
9065
  if (!("cells" in content)) {
@@ -9206,7 +9223,8 @@ clipboardHandlersRegistries.cellHandlers
9206
9223
  .add("merge", MergeClipboardHandler)
9207
9224
  .add("border", BorderClipboardHandler)
9208
9225
  .add("table", TableClipboardHandler)
9209
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
9226
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
9227
+ .add("references", ReferenceClipboardHandler);
9210
9228
 
9211
9229
  function transformZone(zone, executed) {
9212
9230
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -21157,8 +21175,8 @@ class AbstractComposerStore extends SpreadsheetStore {
21157
21175
  this.computeParenthesisRelatedToCursor();
21158
21176
  }
21159
21177
  cancelEdition() {
21160
- this.cancelEditionAndActivateSheet();
21161
21178
  this.resetContent();
21179
+ this.cancelEditionAndActivateSheet();
21162
21180
  }
21163
21181
  setCurrentContent(content, selection) {
21164
21182
  if (selection && !this.isSelectionValid(content.length, selection.start, selection.end)) {
@@ -21176,8 +21194,8 @@ class AbstractComposerStore extends SpreadsheetStore {
21176
21194
  switch (cmd.type) {
21177
21195
  case "SELECT_FIGURE":
21178
21196
  if (cmd.id) {
21179
- this.cancelEditionAndActivateSheet();
21180
21197
  this.resetContent();
21198
+ this.cancelEditionAndActivateSheet();
21181
21199
  }
21182
21200
  break;
21183
21201
  case "START_CHANGE_HIGHLIGHT":
@@ -22493,7 +22511,7 @@ autoCompleteProviders.add("pivot_group_values", {
22493
22511
  text,
22494
22512
  description: usedLabel,
22495
22513
  htmlContent: [{ value: text, color }],
22496
- fuzzySearchKey: value + usedLabel,
22514
+ fuzzySearchKey: text + usedLabel,
22497
22515
  };
22498
22516
  });
22499
22517
  },
@@ -47170,6 +47188,7 @@ class RemoveDuplicatesPanel extends Component {
47170
47188
  columns: {},
47171
47189
  });
47172
47190
  setup() {
47191
+ this.updateColumns();
47173
47192
  onWillUpdateProps(() => this.updateColumns());
47174
47193
  }
47175
47194
  toggleHasHeader() {
@@ -48953,8 +48972,8 @@ class CellComposerStore extends AbstractComposerStore {
48953
48972
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
48954
48973
  if (!sheetIdExists && this.editionMode !== "inactive") {
48955
48974
  this.sheetId = this.getters.getActiveSheetId();
48956
- this.cancelEditionAndActivateSheet();
48957
48975
  this.resetContent();
48976
+ this.cancelEditionAndActivateSheet();
48958
48977
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
48959
48978
  }
48960
48979
  break;
@@ -65382,12 +65401,7 @@ class SheetUIPlugin extends UIPlugin {
65382
65401
  }
65383
65402
  break;
65384
65403
  case "AUTORESIZE_ROWS":
65385
- this.dispatch("RESIZE_COLUMNS_ROWS", {
65386
- elements: cmd.rows,
65387
- dimension: "ROW",
65388
- size: null,
65389
- sheetId: cmd.sheetId,
65390
- });
65404
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
65391
65405
  break;
65392
65406
  }
65393
65407
  }
@@ -65551,6 +65565,48 @@ class SheetUIPlugin extends UIPlugin {
65551
65565
  }
65552
65566
  return "Success" /* CommandResult.Success */;
65553
65567
  }
65568
+ autoResizeRows(sheetId, rows) {
65569
+ const rowSizes = [];
65570
+ for (const row of rows) {
65571
+ let evaluatedRowSize = 0;
65572
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
65573
+ const cell = this.getters.getCellById(cellId);
65574
+ if (!cell) {
65575
+ continue;
65576
+ }
65577
+ const position = this.getters.getCellPosition(cell.id);
65578
+ const colSize = this.getters.getColSize(sheetId, position.col);
65579
+ if (cell.isFormula) {
65580
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
65581
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65582
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
65583
+ evaluatedRowSize = evaluatedSize;
65584
+ }
65585
+ }
65586
+ else {
65587
+ const content = cell.content;
65588
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65589
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
65590
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
65591
+ evaluatedRowSize = 0;
65592
+ }
65593
+ }
65594
+ }
65595
+ rowSizes.push(evaluatedRowSize || null);
65596
+ }
65597
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
65598
+ for (let i = 0; i < rowSizes.length; i++) {
65599
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
65600
+ }
65601
+ for (const [size, rows] of groupedSizes) {
65602
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
65603
+ elements: rows,
65604
+ dimension: "ROW",
65605
+ size,
65606
+ sheetId,
65607
+ });
65608
+ }
65609
+ }
65554
65610
  }
65555
65611
 
65556
65612
  class TableComputedStylePlugin extends UIPlugin {
@@ -75965,6 +76021,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
75965
76021
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, 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 };
75966
76022
 
75967
76023
 
75968
- __info__.version = "18.2.3";
75969
- __info__.date = "2025-03-12T15:32:36.274Z";
75970
- __info__.hash = "81b0e08";
76024
+ __info__.version = "18.2.4";
76025
+ __info__.date = "2025-03-19T08:20:57.717Z";
76026
+ __info__.hash = "958936a";
@@ -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 18.2.3
6
- * @date 2025-03-12T15:32:36.274Z
7
- * @hash 81b0e08
5
+ * @version 18.2.4
6
+ * @date 2025-03-19T08:20:57.717Z
7
+ * @hash 958936a
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6286,11 +6286,13 @@
6286
6286
  if (!cell || (!cell.isFormula && !cell.content)) {
6287
6287
  return DEFAULT_CELL_HEIGHT;
6288
6288
  }
6289
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6290
- const numberOfLines = cell.isFormula
6291
- ? 1
6292
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
6293
- const fontSize = computeTextFontSizeInPixels(cell.style);
6289
+ const content = cell.isFormula ? "" : cell.content;
6290
+ return getCellContentHeight(ctx, content, cell.style, colSize);
6291
+ }
6292
+ function getCellContentHeight(ctx, content, style, colSize) {
6293
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6294
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
6295
+ const fontSize = computeTextFontSizeInPixels(style);
6294
6296
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
6295
6297
  }
6296
6298
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -8487,13 +8489,6 @@
8487
8489
  this.clearClippedZones(content);
8488
8490
  const selection = target[0];
8489
8491
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
8490
- this.dispatch("MOVE_RANGES", {
8491
- target: content.zones,
8492
- sheetId: content.sheetId,
8493
- targetSheetId: sheetId,
8494
- col: selection.left,
8495
- row: selection.top,
8496
- });
8497
8492
  }
8498
8493
  /**
8499
8494
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -9002,14 +8997,15 @@
9002
8997
  }
9003
8998
  merges.push(mergesInRow);
9004
8999
  }
9005
- return { merges };
9000
+ return { merges, sheetId };
9006
9001
  }
9007
9002
  /**
9008
9003
  * Paste the clipboard content in the given target
9009
9004
  */
9010
9005
  paste(target, content, options) {
9011
9006
  if (options.isCutOperation) {
9012
- return;
9007
+ const copiedMerges = content.merges.flat().filter(isDefined);
9008
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
9013
9009
  }
9014
9010
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
9015
9011
  }
@@ -9044,6 +9040,27 @@
9044
9040
  }
9045
9041
  }
9046
9042
 
9043
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
9044
+ copy(data) {
9045
+ return {
9046
+ zones: data.clippedZones,
9047
+ sheetId: data.sheetId,
9048
+ };
9049
+ }
9050
+ paste(target, content, options) {
9051
+ if (options.isCutOperation) {
9052
+ const selection = target.zones[0];
9053
+ this.dispatch("MOVE_RANGES", {
9054
+ target: content.zones,
9055
+ sheetId: content.sheetId,
9056
+ targetSheetId: target.sheetId,
9057
+ col: selection.left,
9058
+ row: selection.top,
9059
+ });
9060
+ }
9061
+ }
9062
+ }
9063
+
9047
9064
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
9048
9065
  isPasteAllowed(sheetId, target, content, options) {
9049
9066
  if (!("cells" in content)) {
@@ -9207,7 +9224,8 @@
9207
9224
  .add("merge", MergeClipboardHandler)
9208
9225
  .add("border", BorderClipboardHandler)
9209
9226
  .add("table", TableClipboardHandler)
9210
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
9227
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
9228
+ .add("references", ReferenceClipboardHandler);
9211
9229
 
9212
9230
  function transformZone(zone, executed) {
9213
9231
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -21158,8 +21176,8 @@ stores.inject(MyMetaStore, storeInstance);
21158
21176
  this.computeParenthesisRelatedToCursor();
21159
21177
  }
21160
21178
  cancelEdition() {
21161
- this.cancelEditionAndActivateSheet();
21162
21179
  this.resetContent();
21180
+ this.cancelEditionAndActivateSheet();
21163
21181
  }
21164
21182
  setCurrentContent(content, selection) {
21165
21183
  if (selection && !this.isSelectionValid(content.length, selection.start, selection.end)) {
@@ -21177,8 +21195,8 @@ stores.inject(MyMetaStore, storeInstance);
21177
21195
  switch (cmd.type) {
21178
21196
  case "SELECT_FIGURE":
21179
21197
  if (cmd.id) {
21180
- this.cancelEditionAndActivateSheet();
21181
21198
  this.resetContent();
21199
+ this.cancelEditionAndActivateSheet();
21182
21200
  }
21183
21201
  break;
21184
21202
  case "START_CHANGE_HIGHLIGHT":
@@ -22494,7 +22512,7 @@ stores.inject(MyMetaStore, storeInstance);
22494
22512
  text,
22495
22513
  description: usedLabel,
22496
22514
  htmlContent: [{ value: text, color }],
22497
- fuzzySearchKey: value + usedLabel,
22515
+ fuzzySearchKey: text + usedLabel,
22498
22516
  };
22499
22517
  });
22500
22518
  },
@@ -47171,6 +47189,7 @@ stores.inject(MyMetaStore, storeInstance);
47171
47189
  columns: {},
47172
47190
  });
47173
47191
  setup() {
47192
+ this.updateColumns();
47174
47193
  owl.onWillUpdateProps(() => this.updateColumns());
47175
47194
  }
47176
47195
  toggleHasHeader() {
@@ -48954,8 +48973,8 @@ stores.inject(MyMetaStore, storeInstance);
48954
48973
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
48955
48974
  if (!sheetIdExists && this.editionMode !== "inactive") {
48956
48975
  this.sheetId = this.getters.getActiveSheetId();
48957
- this.cancelEditionAndActivateSheet();
48958
48976
  this.resetContent();
48977
+ this.cancelEditionAndActivateSheet();
48959
48978
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
48960
48979
  }
48961
48980
  break;
@@ -65383,12 +65402,7 @@ stores.inject(MyMetaStore, storeInstance);
65383
65402
  }
65384
65403
  break;
65385
65404
  case "AUTORESIZE_ROWS":
65386
- this.dispatch("RESIZE_COLUMNS_ROWS", {
65387
- elements: cmd.rows,
65388
- dimension: "ROW",
65389
- size: null,
65390
- sheetId: cmd.sheetId,
65391
- });
65405
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
65392
65406
  break;
65393
65407
  }
65394
65408
  }
@@ -65552,6 +65566,48 @@ stores.inject(MyMetaStore, storeInstance);
65552
65566
  }
65553
65567
  return "Success" /* CommandResult.Success */;
65554
65568
  }
65569
+ autoResizeRows(sheetId, rows) {
65570
+ const rowSizes = [];
65571
+ for (const row of rows) {
65572
+ let evaluatedRowSize = 0;
65573
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
65574
+ const cell = this.getters.getCellById(cellId);
65575
+ if (!cell) {
65576
+ continue;
65577
+ }
65578
+ const position = this.getters.getCellPosition(cell.id);
65579
+ const colSize = this.getters.getColSize(sheetId, position.col);
65580
+ if (cell.isFormula) {
65581
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
65582
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65583
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
65584
+ evaluatedRowSize = evaluatedSize;
65585
+ }
65586
+ }
65587
+ else {
65588
+ const content = cell.content;
65589
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65590
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
65591
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
65592
+ evaluatedRowSize = 0;
65593
+ }
65594
+ }
65595
+ }
65596
+ rowSizes.push(evaluatedRowSize || null);
65597
+ }
65598
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
65599
+ for (let i = 0; i < rowSizes.length; i++) {
65600
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
65601
+ }
65602
+ for (const [size, rows] of groupedSizes) {
65603
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
65604
+ elements: rows,
65605
+ dimension: "ROW",
65606
+ size,
65607
+ sheetId,
65608
+ });
65609
+ }
65610
+ }
65555
65611
  }
65556
65612
 
65557
65613
  class TableComputedStylePlugin extends UIPlugin {
@@ -76011,9 +76067,9 @@ stores.inject(MyMetaStore, storeInstance);
76011
76067
  exports.tokenize = tokenize;
76012
76068
 
76013
76069
 
76014
- __info__.version = "18.2.3";
76015
- __info__.date = "2025-03-12T15:32:36.274Z";
76016
- __info__.hash = "81b0e08";
76070
+ __info__.version = "18.2.4";
76071
+ __info__.date = "2025-03-19T08:20:57.717Z";
76072
+ __info__.hash = "958936a";
76017
76073
 
76018
76074
 
76019
76075
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);