@odoo/o-spreadsheet 18.2.21 → 18.2.22

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.21
6
- * @date 2025-07-11T11:11:48.661Z
7
- * @hash 1c32303
5
+ * @version 18.2.22
6
+ * @date 2025-07-28T13:37:29.067Z
7
+ * @hash 0e414b1
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -11308,6 +11308,7 @@ stores.inject(MyMetaStore, storeInstance);
11308
11308
 
11309
11309
  autoCompleteProviders.add("dataValidation", {
11310
11310
  displayAllOnInitialContent: true,
11311
+ canBeToggled: false,
11311
11312
  getProposals(tokenAtCursor, content) {
11312
11313
  if (content.startsWith("=")) {
11313
11314
  return [];
@@ -19110,11 +19111,17 @@ stores.inject(MyMetaStore, storeInstance);
19110
19111
  if (isEvaluationError(cellReference?.value)) {
19111
19112
  return cellReference;
19112
19113
  }
19113
- const column = cellReference === undefined
19114
- ? this.__originCellPosition?.col
19115
- : toZone(cellReference.value).left;
19116
- assert(() => column !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
19117
- return column + 1;
19114
+ if (cellReference === undefined) {
19115
+ assert(() => this.__originCellPosition?.col !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
19116
+ return this.__originCellPosition.col + 1;
19117
+ }
19118
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
19119
+ if (zone.left === zone.right) {
19120
+ return zone.left + 1;
19121
+ }
19122
+ return generateMatrix(zone.right - zone.left + 1, 1, (col, row) => ({
19123
+ value: zone.left + col + 1,
19124
+ }));
19118
19125
  },
19119
19126
  isExported: true,
19120
19127
  };
@@ -19333,11 +19340,17 @@ stores.inject(MyMetaStore, storeInstance);
19333
19340
  if (isEvaluationError(cellReference?.value)) {
19334
19341
  return cellReference;
19335
19342
  }
19336
- const row = cellReference === undefined
19337
- ? this.__originCellPosition?.row
19338
- : toZone(cellReference.value).top;
19339
- assert(() => row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
19340
- return row + 1;
19343
+ if (cellReference === undefined) {
19344
+ assert(() => this.__originCellPosition?.row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
19345
+ return this.__originCellPosition.row + 1;
19346
+ }
19347
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
19348
+ if (zone.top === zone.bottom) {
19349
+ return zone.top + 1;
19350
+ }
19351
+ return generateMatrix(1, zone.bottom - zone.top + 1, (col, row) => ({
19352
+ value: zone.top + row + 1,
19353
+ }));
19341
19354
  },
19342
19355
  isExported: true,
19343
19356
  };
@@ -21613,6 +21626,7 @@ stores.inject(MyMetaStore, storeInstance);
21613
21626
  proposals,
21614
21627
  selectProposal: provider.selectProposal,
21615
21628
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
21629
+ canBeToggled: provider.canBeToggled,
21616
21630
  };
21617
21631
  }
21618
21632
  if (exactMatch && this._currentContent !== this.initialContent) {
@@ -21635,6 +21649,7 @@ stores.inject(MyMetaStore, storeInstance);
21635
21649
  proposals,
21636
21650
  selectProposal: provider.selectProposal,
21637
21651
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
21652
+ canBeToggled: provider.canBeToggled,
21638
21653
  };
21639
21654
  }
21640
21655
  }
@@ -41306,9 +41321,13 @@ stores.inject(MyMetaStore, storeInstance);
41306
41321
  }
41307
41322
  }
41308
41323
  closeAssistant() {
41324
+ if (!this.canBeToggled)
41325
+ return;
41309
41326
  this.assistant.forcedClosed = true;
41310
41327
  }
41311
41328
  openAssistant() {
41329
+ if (!this.canBeToggled)
41330
+ return;
41312
41331
  this.assistant.forcedClosed = false;
41313
41332
  }
41314
41333
  onWheel(event) {
@@ -41318,6 +41337,9 @@ stores.inject(MyMetaStore, storeInstance);
41318
41337
  event.stopPropagation();
41319
41338
  }
41320
41339
  }
41340
+ get canBeToggled() {
41341
+ return this.autoCompleteState.provider?.canBeToggled ?? true;
41342
+ }
41321
41343
  // ---------------------------------------------------------------------------
41322
41344
  // Private
41323
41345
  // ---------------------------------------------------------------------------
@@ -41453,7 +41475,7 @@ stores.inject(MyMetaStore, storeInstance);
41453
41475
  }
41454
41476
  }
41455
41477
  autoComplete(value) {
41456
- if (!value || this.assistant.forcedClosed) {
41478
+ if (!value || (this.assistant.forcedClosed && this.canBeToggled)) {
41457
41479
  return;
41458
41480
  }
41459
41481
  this.autoCompleteState.provider?.selectProposal(value);
@@ -47237,9 +47259,15 @@ stores.inject(MyMetaStore, storeInstance);
47237
47259
  return domain.reduce((current, acc) => this.filterDataEntriesFromDomainNode(current, acc), dataEntries);
47238
47260
  }
47239
47261
  filterDataEntriesFromDomainNode(dataEntries, domain) {
47240
- const { field, value } = domain;
47262
+ const { field, value, type } = domain;
47241
47263
  const { nameWithGranularity } = this.getDimension(field);
47242
- return dataEntries.filter((entry) => entry[nameWithGranularity]?.value === value);
47264
+ return dataEntries.filter((entry) => {
47265
+ const cellValue = entry[nameWithGranularity]?.value;
47266
+ if (type === "char") {
47267
+ return String(cellValue) === String(value);
47268
+ }
47269
+ return cellValue === value;
47270
+ });
47243
47271
  }
47244
47272
  getDimension(nameWithGranularity) {
47245
47273
  return this.definition.getDimension(nameWithGranularity);
@@ -49735,6 +49763,11 @@ stores.inject(MyMetaStore, storeInstance);
49735
49763
  rect = this.defaultRect;
49736
49764
  isEditing = false;
49737
49765
  isCellReferenceVisible = false;
49766
+ currentEditedCell = {
49767
+ col: 0,
49768
+ row: 0,
49769
+ sheetId: this.env.model.getters.getActiveSheetId(),
49770
+ };
49738
49771
  composerStore;
49739
49772
  composerFocusStore;
49740
49773
  composerInterface;
@@ -49764,7 +49797,7 @@ stores.inject(MyMetaStore, storeInstance);
49764
49797
  return this.isCellReferenceVisible;
49765
49798
  }
49766
49799
  get cellReference() {
49767
- const { col, row, sheetId } = this.composerStore.currentEditedCell;
49800
+ const { col, row, sheetId } = this.currentEditedCell;
49768
49801
  const prefixSheet = sheetId !== this.env.model.getters.getActiveSheetId();
49769
49802
  return getFullReference(prefixSheet ? this.env.model.getters.getSheetName(sheetId) : undefined, toXC(col, row));
49770
49803
  }
@@ -49856,12 +49889,17 @@ stores.inject(MyMetaStore, storeInstance);
49856
49889
  if (!isEditing && this.composerFocusStore.activeComposer !== this.composerInterface) {
49857
49890
  this.composerFocusStore.focusComposer(this.composerInterface, { focusMode: "inactive" });
49858
49891
  }
49892
+ let shouldRecomputeRect = isEditing && !deepEquals(this.currentEditedCell, this.composerStore.currentEditedCell);
49859
49893
  if (this.isEditing !== isEditing) {
49860
49894
  this.isEditing = isEditing;
49861
49895
  if (!isEditing) {
49862
49896
  this.rect = this.defaultRect;
49863
49897
  return;
49864
49898
  }
49899
+ this.currentEditedCell = this.composerStore.currentEditedCell;
49900
+ shouldRecomputeRect = true;
49901
+ }
49902
+ if (shouldRecomputeRect) {
49865
49903
  const position = this.env.model.getters.getActivePosition();
49866
49904
  const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
49867
49905
  this.rect = this.env.model.getters.getVisibleRect(zone);
@@ -62970,6 +63008,23 @@ stores.inject(MyMetaStore, storeInstance);
62970
63008
  static getters = ["getRowSize", "getHeaderSize"];
62971
63009
  tallestCellInRow = {};
62972
63010
  ctx = document.createElement("canvas").getContext("2d");
63011
+ beforeHandle(cmd) {
63012
+ switch (cmd.type) {
63013
+ // Ensure rows are updated before "UPDATE_CELL" is dispatched from cell plugin.
63014
+ // "UPDATE_CELL" uses the Sheet core plugin to access row data.
63015
+ // If "ADD_COLUMNS_ROWS" has not been processed yet by header_sizes_ui,
63016
+ // size updates may apply to incorrect (pre-insert) rows.
63017
+ case "ADD_COLUMNS_ROWS":
63018
+ if (cmd.dimension === "COL") {
63019
+ return;
63020
+ }
63021
+ const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
63022
+ const newCells = Array(cmd.quantity).fill(undefined);
63023
+ const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
63024
+ this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
63025
+ break;
63026
+ }
63027
+ }
62973
63028
  handle(cmd) {
62974
63029
  switch (cmd.type) {
62975
63030
  case "START":
@@ -62999,16 +63054,6 @@ stores.inject(MyMetaStore, storeInstance);
62999
63054
  this.history.update("tallestCellInRow", cmd.sheetId, tallestCells);
63000
63055
  break;
63001
63056
  }
63002
- case "ADD_COLUMNS_ROWS": {
63003
- if (cmd.dimension === "COL") {
63004
- return;
63005
- }
63006
- const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
63007
- const newCells = Array(cmd.quantity).fill(undefined);
63008
- const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
63009
- this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
63010
- break;
63011
- }
63012
63057
  case "RESIZE_COLUMNS_ROWS":
63013
63058
  {
63014
63059
  const sheetId = cmd.sheetId;
@@ -68761,6 +68806,14 @@ stores.inject(MyMetaStore, storeInstance);
68761
68806
  const isBasedBefore = cmd.base < start;
68762
68807
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
68763
68808
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
68809
+ const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
68810
+ const originalSize = Object.fromEntries(toRemove.map((element) => {
68811
+ const size = isCol
68812
+ ? this.getters.getColSize(cmd.sheetId, element)
68813
+ : this.getters.getUserRowSize(cmd.sheetId, element);
68814
+ const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
68815
+ return [element, isDefaultCol ? undefined : size];
68816
+ }));
68764
68817
  const target = [
68765
68818
  {
68766
68819
  left: isCol ? start + deltaCol : 0,
@@ -68791,13 +68844,12 @@ stores.inject(MyMetaStore, storeInstance);
68791
68844
  const col = selection.left;
68792
68845
  const row = selection.top;
68793
68846
  this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
68794
- const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
68795
68847
  let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
68796
68848
  const resizingGroups = {};
68797
68849
  for (const element of toRemove) {
68798
- const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
68850
+ const size = originalSize[element];
68799
68851
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
68800
- if (size != currentSize) {
68852
+ if (size && size != currentSize) {
68801
68853
  resizingGroups[size] ??= [];
68802
68854
  resizingGroups[size].push(currentIndex);
68803
68855
  currentIndex += 1;
@@ -70482,14 +70534,12 @@ stores.inject(MyMetaStore, storeInstance);
70482
70534
  this.editionState = "initializing";
70483
70535
  }
70484
70536
  stopEdition() {
70485
- const input = this.sheetNameRef.el;
70486
- if (!this.state.isEditing || !input)
70537
+ if (!this.state.isEditing || !this.sheetNameRef.el)
70487
70538
  return;
70488
70539
  this.state.isEditing = false;
70489
70540
  this.editionState = "initializing";
70490
- input.blur();
70541
+ this.sheetNameRef.el.blur();
70491
70542
  const inputValue = this.getInputContent() || "";
70492
- input.innerText = inputValue;
70493
70543
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
70494
70544
  }
70495
70545
  cancelEdition() {
@@ -77186,9 +77236,9 @@ stores.inject(MyMetaStore, storeInstance);
77186
77236
  exports.tokenize = tokenize;
77187
77237
 
77188
77238
 
77189
- __info__.version = "18.2.21";
77190
- __info__.date = "2025-07-11T11:11:48.661Z";
77191
- __info__.hash = "1c32303";
77239
+ __info__.version = "18.2.22";
77240
+ __info__.date = "2025-07-28T13:37:29.067Z";
77241
+ __info__.hash = "0e414b1";
77192
77242
 
77193
77243
 
77194
77244
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);