@odoo/o-spreadsheet 18.1.11 → 18.1.12

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.1.11
6
- * @date 2025-03-12T15:31:44.276Z
7
- * @hash 7de2363
5
+ * @version 18.1.12
6
+ * @date 2025-03-19T08:23:50.676Z
7
+ * @hash 32f788f
8
8
  */
9
9
 
10
10
  'use strict';
@@ -6278,11 +6278,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
6278
6278
  if (!cell || (!cell.isFormula && !cell.content)) {
6279
6279
  return DEFAULT_CELL_HEIGHT;
6280
6280
  }
6281
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6282
- const numberOfLines = cell.isFormula
6283
- ? 1
6284
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
6285
- const fontSize = computeTextFontSizeInPixels(cell.style);
6281
+ const content = cell.isFormula ? "" : cell.content;
6282
+ return getCellContentHeight(ctx, content, cell.style, colSize);
6283
+ }
6284
+ function getCellContentHeight(ctx, content, style, colSize) {
6285
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6286
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
6287
+ const fontSize = computeTextFontSizeInPixels(style);
6286
6288
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
6287
6289
  }
6288
6290
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -8478,13 +8480,6 @@ class CellClipboardHandler extends AbstractCellClipboardHandler {
8478
8480
  this.clearClippedZones(content);
8479
8481
  const selection = target[0];
8480
8482
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
8481
- this.dispatch("MOVE_RANGES", {
8482
- target: content.zones,
8483
- sheetId: content.sheetId,
8484
- targetSheetId: sheetId,
8485
- col: selection.left,
8486
- row: selection.top,
8487
- });
8488
8483
  }
8489
8484
  /**
8490
8485
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -8993,14 +8988,15 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
8993
8988
  }
8994
8989
  merges.push(mergesInRow);
8995
8990
  }
8996
- return { merges };
8991
+ return { merges, sheetId };
8997
8992
  }
8998
8993
  /**
8999
8994
  * Paste the clipboard content in the given target
9000
8995
  */
9001
8996
  paste(target, content, options) {
9002
8997
  if (options.isCutOperation) {
9003
- return;
8998
+ const copiedMerges = content.merges.flat().filter(isDefined);
8999
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
9004
9000
  }
9005
9001
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
9006
9002
  }
@@ -9035,6 +9031,27 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
9035
9031
  }
9036
9032
  }
9037
9033
 
9034
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
9035
+ copy(data) {
9036
+ return {
9037
+ zones: data.clippedZones,
9038
+ sheetId: data.sheetId,
9039
+ };
9040
+ }
9041
+ paste(target, content, options) {
9042
+ if (options.isCutOperation) {
9043
+ const selection = target.zones[0];
9044
+ this.dispatch("MOVE_RANGES", {
9045
+ target: content.zones,
9046
+ sheetId: content.sheetId,
9047
+ targetSheetId: target.sheetId,
9048
+ col: selection.left,
9049
+ row: selection.top,
9050
+ });
9051
+ }
9052
+ }
9053
+ }
9054
+
9038
9055
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
9039
9056
  isPasteAllowed(sheetId, target, content, options) {
9040
9057
  if (!("cells" in content)) {
@@ -9198,7 +9215,8 @@ clipboardHandlersRegistries.cellHandlers
9198
9215
  .add("merge", MergeClipboardHandler)
9199
9216
  .add("border", BorderClipboardHandler)
9200
9217
  .add("table", TableClipboardHandler)
9201
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
9218
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
9219
+ .add("references", ReferenceClipboardHandler);
9202
9220
 
9203
9221
  function transformZone(zone, executed) {
9204
9222
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -20995,8 +21013,8 @@ class AbstractComposerStore extends SpreadsheetStore {
20995
21013
  this.computeParenthesisRelatedToCursor();
20996
21014
  }
20997
21015
  cancelEdition() {
20998
- this.cancelEditionAndActivateSheet();
20999
21016
  this.resetContent();
21017
+ this.cancelEditionAndActivateSheet();
21000
21018
  }
21001
21019
  setCurrentContent(content, selection) {
21002
21020
  if (selection && !this.isSelectionValid(content.length, selection.start, selection.end)) {
@@ -21014,8 +21032,8 @@ class AbstractComposerStore extends SpreadsheetStore {
21014
21032
  switch (cmd.type) {
21015
21033
  case "SELECT_FIGURE":
21016
21034
  if (cmd.id) {
21017
- this.cancelEditionAndActivateSheet();
21018
21035
  this.resetContent();
21036
+ this.cancelEditionAndActivateSheet();
21019
21037
  }
21020
21038
  break;
21021
21039
  case "START_CHANGE_HIGHLIGHT":
@@ -22331,7 +22349,7 @@ autoCompleteProviders.add("pivot_group_values", {
22331
22349
  text,
22332
22350
  description: usedLabel,
22333
22351
  htmlContent: [{ value: text, color }],
22334
- fuzzySearchKey: value + usedLabel,
22352
+ fuzzySearchKey: text + usedLabel,
22335
22353
  };
22336
22354
  });
22337
22355
  },
@@ -46838,6 +46856,7 @@ class RemoveDuplicatesPanel extends owl.Component {
46838
46856
  columns: {},
46839
46857
  });
46840
46858
  setup() {
46859
+ this.updateColumns();
46841
46860
  owl.onWillUpdateProps(() => this.updateColumns());
46842
46861
  }
46843
46862
  toggleHasHeader() {
@@ -48625,8 +48644,8 @@ class CellComposerStore extends AbstractComposerStore {
48625
48644
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
48626
48645
  if (!sheetIdExists && this.editionMode !== "inactive") {
48627
48646
  this.sheetId = this.getters.getActiveSheetId();
48628
- this.cancelEditionAndActivateSheet();
48629
48647
  this.resetContent();
48648
+ this.cancelEditionAndActivateSheet();
48630
48649
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
48631
48650
  }
48632
48651
  break;
@@ -64913,12 +64932,7 @@ class SheetUIPlugin extends UIPlugin {
64913
64932
  }
64914
64933
  break;
64915
64934
  case "AUTORESIZE_ROWS":
64916
- this.dispatch("RESIZE_COLUMNS_ROWS", {
64917
- elements: cmd.rows,
64918
- dimension: "ROW",
64919
- size: null,
64920
- sheetId: cmd.sheetId,
64921
- });
64935
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
64922
64936
  break;
64923
64937
  }
64924
64938
  }
@@ -65082,6 +65096,48 @@ class SheetUIPlugin extends UIPlugin {
65082
65096
  }
65083
65097
  return "Success" /* CommandResult.Success */;
65084
65098
  }
65099
+ autoResizeRows(sheetId, rows) {
65100
+ const rowSizes = [];
65101
+ for (const row of rows) {
65102
+ let evaluatedRowSize = 0;
65103
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
65104
+ const cell = this.getters.getCellById(cellId);
65105
+ if (!cell) {
65106
+ continue;
65107
+ }
65108
+ const position = this.getters.getCellPosition(cell.id);
65109
+ const colSize = this.getters.getColSize(sheetId, position.col);
65110
+ if (cell.isFormula) {
65111
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
65112
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65113
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
65114
+ evaluatedRowSize = evaluatedSize;
65115
+ }
65116
+ }
65117
+ else {
65118
+ const content = cell.content;
65119
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65120
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
65121
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
65122
+ evaluatedRowSize = 0;
65123
+ }
65124
+ }
65125
+ }
65126
+ rowSizes.push(evaluatedRowSize || null);
65127
+ }
65128
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
65129
+ for (let i = 0; i < rowSizes.length; i++) {
65130
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
65131
+ }
65132
+ for (const [size, rows] of groupedSizes) {
65133
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
65134
+ elements: rows,
65135
+ dimension: "ROW",
65136
+ size,
65137
+ sheetId,
65138
+ });
65139
+ }
65140
+ }
65085
65141
  }
65086
65142
 
65087
65143
  class TableComputedStylePlugin extends UIPlugin {
@@ -75548,6 +75604,6 @@ exports.tokenColors = tokenColors;
75548
75604
  exports.tokenize = tokenize;
75549
75605
 
75550
75606
 
75551
- __info__.version = "18.1.11";
75552
- __info__.date = "2025-03-12T15:31:44.276Z";
75553
- __info__.hash = "7de2363";
75607
+ __info__.version = "18.1.12";
75608
+ __info__.date = "2025-03-19T08:23:50.676Z";
75609
+ __info__.hash = "32f788f";
@@ -5732,6 +5732,7 @@ declare class SheetUIPlugin extends UIPlugin {
5732
5732
  * not outside the sheet.
5733
5733
  */
5734
5734
  private checkZonesAreInSheet;
5735
+ private autoResizeRows;
5735
5736
  }
5736
5737
 
5737
5738
  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.1.11
6
- * @date 2025-03-12T15:31:44.276Z
7
- * @hash 7de2363
5
+ * @version 18.1.12
6
+ * @date 2025-03-19T08:23:50.676Z
7
+ * @hash 32f788f
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';
@@ -6276,11 +6276,13 @@ function getDefaultCellHeight(ctx, cell, colSize) {
6276
6276
  if (!cell || (!cell.isFormula && !cell.content)) {
6277
6277
  return DEFAULT_CELL_HEIGHT;
6278
6278
  }
6279
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6280
- const numberOfLines = cell.isFormula
6281
- ? 1
6282
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
6283
- const fontSize = computeTextFontSizeInPixels(cell.style);
6279
+ const content = cell.isFormula ? "" : cell.content;
6280
+ return getCellContentHeight(ctx, content, cell.style, colSize);
6281
+ }
6282
+ function getCellContentHeight(ctx, content, style, colSize) {
6283
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6284
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
6285
+ const fontSize = computeTextFontSizeInPixels(style);
6284
6286
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
6285
6287
  }
6286
6288
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -8476,13 +8478,6 @@ class CellClipboardHandler extends AbstractCellClipboardHandler {
8476
8478
  this.clearClippedZones(content);
8477
8479
  const selection = target[0];
8478
8480
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
8479
- this.dispatch("MOVE_RANGES", {
8480
- target: content.zones,
8481
- sheetId: content.sheetId,
8482
- targetSheetId: sheetId,
8483
- col: selection.left,
8484
- row: selection.top,
8485
- });
8486
8481
  }
8487
8482
  /**
8488
8483
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -8991,14 +8986,15 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
8991
8986
  }
8992
8987
  merges.push(mergesInRow);
8993
8988
  }
8994
- return { merges };
8989
+ return { merges, sheetId };
8995
8990
  }
8996
8991
  /**
8997
8992
  * Paste the clipboard content in the given target
8998
8993
  */
8999
8994
  paste(target, content, options) {
9000
8995
  if (options.isCutOperation) {
9001
- return;
8996
+ const copiedMerges = content.merges.flat().filter(isDefined);
8997
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
9002
8998
  }
9003
8999
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
9004
9000
  }
@@ -9033,6 +9029,27 @@ class MergeClipboardHandler extends AbstractCellClipboardHandler {
9033
9029
  }
9034
9030
  }
9035
9031
 
9032
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
9033
+ copy(data) {
9034
+ return {
9035
+ zones: data.clippedZones,
9036
+ sheetId: data.sheetId,
9037
+ };
9038
+ }
9039
+ paste(target, content, options) {
9040
+ if (options.isCutOperation) {
9041
+ const selection = target.zones[0];
9042
+ this.dispatch("MOVE_RANGES", {
9043
+ target: content.zones,
9044
+ sheetId: content.sheetId,
9045
+ targetSheetId: target.sheetId,
9046
+ col: selection.left,
9047
+ row: selection.top,
9048
+ });
9049
+ }
9050
+ }
9051
+ }
9052
+
9036
9053
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
9037
9054
  isPasteAllowed(sheetId, target, content, options) {
9038
9055
  if (!("cells" in content)) {
@@ -9196,7 +9213,8 @@ clipboardHandlersRegistries.cellHandlers
9196
9213
  .add("merge", MergeClipboardHandler)
9197
9214
  .add("border", BorderClipboardHandler)
9198
9215
  .add("table", TableClipboardHandler)
9199
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
9216
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
9217
+ .add("references", ReferenceClipboardHandler);
9200
9218
 
9201
9219
  function transformZone(zone, executed) {
9202
9220
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -20993,8 +21011,8 @@ class AbstractComposerStore extends SpreadsheetStore {
20993
21011
  this.computeParenthesisRelatedToCursor();
20994
21012
  }
20995
21013
  cancelEdition() {
20996
- this.cancelEditionAndActivateSheet();
20997
21014
  this.resetContent();
21015
+ this.cancelEditionAndActivateSheet();
20998
21016
  }
20999
21017
  setCurrentContent(content, selection) {
21000
21018
  if (selection && !this.isSelectionValid(content.length, selection.start, selection.end)) {
@@ -21012,8 +21030,8 @@ class AbstractComposerStore extends SpreadsheetStore {
21012
21030
  switch (cmd.type) {
21013
21031
  case "SELECT_FIGURE":
21014
21032
  if (cmd.id) {
21015
- this.cancelEditionAndActivateSheet();
21016
21033
  this.resetContent();
21034
+ this.cancelEditionAndActivateSheet();
21017
21035
  }
21018
21036
  break;
21019
21037
  case "START_CHANGE_HIGHLIGHT":
@@ -22329,7 +22347,7 @@ autoCompleteProviders.add("pivot_group_values", {
22329
22347
  text,
22330
22348
  description: usedLabel,
22331
22349
  htmlContent: [{ value: text, color }],
22332
- fuzzySearchKey: value + usedLabel,
22350
+ fuzzySearchKey: text + usedLabel,
22333
22351
  };
22334
22352
  });
22335
22353
  },
@@ -46836,6 +46854,7 @@ class RemoveDuplicatesPanel extends Component {
46836
46854
  columns: {},
46837
46855
  });
46838
46856
  setup() {
46857
+ this.updateColumns();
46839
46858
  onWillUpdateProps(() => this.updateColumns());
46840
46859
  }
46841
46860
  toggleHasHeader() {
@@ -48623,8 +48642,8 @@ class CellComposerStore extends AbstractComposerStore {
48623
48642
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
48624
48643
  if (!sheetIdExists && this.editionMode !== "inactive") {
48625
48644
  this.sheetId = this.getters.getActiveSheetId();
48626
- this.cancelEditionAndActivateSheet();
48627
48645
  this.resetContent();
48646
+ this.cancelEditionAndActivateSheet();
48628
48647
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
48629
48648
  }
48630
48649
  break;
@@ -64911,12 +64930,7 @@ class SheetUIPlugin extends UIPlugin {
64911
64930
  }
64912
64931
  break;
64913
64932
  case "AUTORESIZE_ROWS":
64914
- this.dispatch("RESIZE_COLUMNS_ROWS", {
64915
- elements: cmd.rows,
64916
- dimension: "ROW",
64917
- size: null,
64918
- sheetId: cmd.sheetId,
64919
- });
64933
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
64920
64934
  break;
64921
64935
  }
64922
64936
  }
@@ -65080,6 +65094,48 @@ class SheetUIPlugin extends UIPlugin {
65080
65094
  }
65081
65095
  return "Success" /* CommandResult.Success */;
65082
65096
  }
65097
+ autoResizeRows(sheetId, rows) {
65098
+ const rowSizes = [];
65099
+ for (const row of rows) {
65100
+ let evaluatedRowSize = 0;
65101
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
65102
+ const cell = this.getters.getCellById(cellId);
65103
+ if (!cell) {
65104
+ continue;
65105
+ }
65106
+ const position = this.getters.getCellPosition(cell.id);
65107
+ const colSize = this.getters.getColSize(sheetId, position.col);
65108
+ if (cell.isFormula) {
65109
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
65110
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65111
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
65112
+ evaluatedRowSize = evaluatedSize;
65113
+ }
65114
+ }
65115
+ else {
65116
+ const content = cell.content;
65117
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65118
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
65119
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
65120
+ evaluatedRowSize = 0;
65121
+ }
65122
+ }
65123
+ }
65124
+ rowSizes.push(evaluatedRowSize || null);
65125
+ }
65126
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
65127
+ for (let i = 0; i < rowSizes.length; i++) {
65128
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
65129
+ }
65130
+ for (const [size, rows] of groupedSizes) {
65131
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
65132
+ elements: rows,
65133
+ dimension: "ROW",
65134
+ size,
65135
+ sheetId,
65136
+ });
65137
+ }
65138
+ }
65083
65139
  }
65084
65140
 
65085
65141
  class TableComputedStylePlugin extends UIPlugin {
@@ -75502,6 +75558,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
75502
75558
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, 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 };
75503
75559
 
75504
75560
 
75505
- __info__.version = "18.1.11";
75506
- __info__.date = "2025-03-12T15:31:44.276Z";
75507
- __info__.hash = "7de2363";
75561
+ __info__.version = "18.1.12";
75562
+ __info__.date = "2025-03-19T08:23:50.676Z";
75563
+ __info__.hash = "32f788f";
@@ -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.1.11
6
- * @date 2025-03-12T15:31:44.276Z
7
- * @hash 7de2363
5
+ * @version 18.1.12
6
+ * @date 2025-03-19T08:23:50.676Z
7
+ * @hash 32f788f
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6277,11 +6277,13 @@
6277
6277
  if (!cell || (!cell.isFormula && !cell.content)) {
6278
6278
  return DEFAULT_CELL_HEIGHT;
6279
6279
  }
6280
- const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6281
- const numberOfLines = cell.isFormula
6282
- ? 1
6283
- : splitTextToWidth(ctx, cell.content, cell.style, maxWidth).length;
6284
- const fontSize = computeTextFontSizeInPixels(cell.style);
6280
+ const content = cell.isFormula ? "" : cell.content;
6281
+ return getCellContentHeight(ctx, content, cell.style, colSize);
6282
+ }
6283
+ function getCellContentHeight(ctx, content, style, colSize) {
6284
+ const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
6285
+ const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
6286
+ const fontSize = computeTextFontSizeInPixels(style);
6285
6287
  return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
6286
6288
  }
6287
6289
  function getDefaultContextFont(fontSize, bold = false, italic = false) {
@@ -8477,13 +8479,6 @@
8477
8479
  this.clearClippedZones(content);
8478
8480
  const selection = target[0];
8479
8481
  this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
8480
- this.dispatch("MOVE_RANGES", {
8481
- target: content.zones,
8482
- sheetId: content.sheetId,
8483
- targetSheetId: sheetId,
8484
- col: selection.left,
8485
- row: selection.top,
8486
- });
8487
8482
  }
8488
8483
  /**
8489
8484
  * Clear the clipped zones: remove the cells and clear the formatting
@@ -8992,14 +8987,15 @@
8992
8987
  }
8993
8988
  merges.push(mergesInRow);
8994
8989
  }
8995
- return { merges };
8990
+ return { merges, sheetId };
8996
8991
  }
8997
8992
  /**
8998
8993
  * Paste the clipboard content in the given target
8999
8994
  */
9000
8995
  paste(target, content, options) {
9001
8996
  if (options.isCutOperation) {
9002
- return;
8997
+ const copiedMerges = content.merges.flat().filter(isDefined);
8998
+ this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
9003
8999
  }
9004
9000
  this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
9005
9001
  }
@@ -9034,6 +9030,27 @@
9034
9030
  }
9035
9031
  }
9036
9032
 
9033
+ class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
9034
+ copy(data) {
9035
+ return {
9036
+ zones: data.clippedZones,
9037
+ sheetId: data.sheetId,
9038
+ };
9039
+ }
9040
+ paste(target, content, options) {
9041
+ if (options.isCutOperation) {
9042
+ const selection = target.zones[0];
9043
+ this.dispatch("MOVE_RANGES", {
9044
+ target: content.zones,
9045
+ sheetId: content.sheetId,
9046
+ targetSheetId: target.sheetId,
9047
+ col: selection.left,
9048
+ row: selection.top,
9049
+ });
9050
+ }
9051
+ }
9052
+ }
9053
+
9037
9054
  class SheetClipboardHandler extends AbstractCellClipboardHandler {
9038
9055
  isPasteAllowed(sheetId, target, content, options) {
9039
9056
  if (!("cells" in content)) {
@@ -9197,7 +9214,8 @@
9197
9214
  .add("merge", MergeClipboardHandler)
9198
9215
  .add("border", BorderClipboardHandler)
9199
9216
  .add("table", TableClipboardHandler)
9200
- .add("conditionalFormat", ConditionalFormatClipboardHandler);
9217
+ .add("conditionalFormat", ConditionalFormatClipboardHandler)
9218
+ .add("references", ReferenceClipboardHandler);
9201
9219
 
9202
9220
  function transformZone(zone, executed) {
9203
9221
  if (executed.type === "REMOVE_COLUMNS_ROWS") {
@@ -20994,8 +21012,8 @@ stores.inject(MyMetaStore, storeInstance);
20994
21012
  this.computeParenthesisRelatedToCursor();
20995
21013
  }
20996
21014
  cancelEdition() {
20997
- this.cancelEditionAndActivateSheet();
20998
21015
  this.resetContent();
21016
+ this.cancelEditionAndActivateSheet();
20999
21017
  }
21000
21018
  setCurrentContent(content, selection) {
21001
21019
  if (selection && !this.isSelectionValid(content.length, selection.start, selection.end)) {
@@ -21013,8 +21031,8 @@ stores.inject(MyMetaStore, storeInstance);
21013
21031
  switch (cmd.type) {
21014
21032
  case "SELECT_FIGURE":
21015
21033
  if (cmd.id) {
21016
- this.cancelEditionAndActivateSheet();
21017
21034
  this.resetContent();
21035
+ this.cancelEditionAndActivateSheet();
21018
21036
  }
21019
21037
  break;
21020
21038
  case "START_CHANGE_HIGHLIGHT":
@@ -22330,7 +22348,7 @@ stores.inject(MyMetaStore, storeInstance);
22330
22348
  text,
22331
22349
  description: usedLabel,
22332
22350
  htmlContent: [{ value: text, color }],
22333
- fuzzySearchKey: value + usedLabel,
22351
+ fuzzySearchKey: text + usedLabel,
22334
22352
  };
22335
22353
  });
22336
22354
  },
@@ -46837,6 +46855,7 @@ stores.inject(MyMetaStore, storeInstance);
46837
46855
  columns: {},
46838
46856
  });
46839
46857
  setup() {
46858
+ this.updateColumns();
46840
46859
  owl.onWillUpdateProps(() => this.updateColumns());
46841
46860
  }
46842
46861
  toggleHasHeader() {
@@ -48624,8 +48643,8 @@ stores.inject(MyMetaStore, storeInstance);
48624
48643
  const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
48625
48644
  if (!sheetIdExists && this.editionMode !== "inactive") {
48626
48645
  this.sheetId = this.getters.getActiveSheetId();
48627
- this.cancelEditionAndActivateSheet();
48628
48646
  this.resetContent();
48647
+ this.cancelEditionAndActivateSheet();
48629
48648
  this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
48630
48649
  }
48631
48650
  break;
@@ -64912,12 +64931,7 @@ stores.inject(MyMetaStore, storeInstance);
64912
64931
  }
64913
64932
  break;
64914
64933
  case "AUTORESIZE_ROWS":
64915
- this.dispatch("RESIZE_COLUMNS_ROWS", {
64916
- elements: cmd.rows,
64917
- dimension: "ROW",
64918
- size: null,
64919
- sheetId: cmd.sheetId,
64920
- });
64934
+ this.autoResizeRows(cmd.sheetId, cmd.rows);
64921
64935
  break;
64922
64936
  }
64923
64937
  }
@@ -65081,6 +65095,48 @@ stores.inject(MyMetaStore, storeInstance);
65081
65095
  }
65082
65096
  return "Success" /* CommandResult.Success */;
65083
65097
  }
65098
+ autoResizeRows(sheetId, rows) {
65099
+ const rowSizes = [];
65100
+ for (const row of rows) {
65101
+ let evaluatedRowSize = 0;
65102
+ for (const cellId of this.getters.getRowCells(sheetId, row)) {
65103
+ const cell = this.getters.getCellById(cellId);
65104
+ if (!cell) {
65105
+ continue;
65106
+ }
65107
+ const position = this.getters.getCellPosition(cell.id);
65108
+ const colSize = this.getters.getColSize(sheetId, position.col);
65109
+ if (cell.isFormula) {
65110
+ const content = this.getters.getEvaluatedCell(position).formattedValue;
65111
+ const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65112
+ if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
65113
+ evaluatedRowSize = evaluatedSize;
65114
+ }
65115
+ }
65116
+ else {
65117
+ const content = cell.content;
65118
+ const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
65119
+ // Only keep the size of evaluated cells if it's bigger than the dynamic row size
65120
+ if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
65121
+ evaluatedRowSize = 0;
65122
+ }
65123
+ }
65124
+ }
65125
+ rowSizes.push(evaluatedRowSize || null);
65126
+ }
65127
+ const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
65128
+ for (let i = 0; i < rowSizes.length; i++) {
65129
+ groupedSizes.get(rowSizes[i])?.push(rows[i]);
65130
+ }
65131
+ for (const [size, rows] of groupedSizes) {
65132
+ this.dispatch("RESIZE_COLUMNS_ROWS", {
65133
+ elements: rows,
65134
+ dimension: "ROW",
65135
+ size,
65136
+ sheetId,
65137
+ });
65138
+ }
65139
+ }
65084
65140
  }
65085
65141
 
65086
65142
  class TableComputedStylePlugin extends UIPlugin {
@@ -75547,9 +75603,9 @@ stores.inject(MyMetaStore, storeInstance);
75547
75603
  exports.tokenize = tokenize;
75548
75604
 
75549
75605
 
75550
- __info__.version = "18.1.11";
75551
- __info__.date = "2025-03-12T15:31:44.276Z";
75552
- __info__.hash = "7de2363";
75606
+ __info__.version = "18.1.12";
75607
+ __info__.date = "2025-03-19T08:23:50.676Z";
75608
+ __info__.hash = "32f788f";
75553
75609
 
75554
75610
 
75555
75611
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);