@odoo/o-spreadsheet 18.0.37 → 18.0.38

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.0.37
6
- * @date 2025-07-11T11:11:13.394Z
7
- * @hash bc6f00d
5
+ * @version 18.0.38
6
+ * @date 2025-07-28T13:29:40.841Z
7
+ * @hash 0f3b11a
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -17376,6 +17376,7 @@ stores.inject(MyMetaStore, storeInstance);
17376
17376
 
17377
17377
  autoCompleteProviders.add("dataValidation", {
17378
17378
  displayAllOnInitialContent: true,
17379
+ canBeToggled: false,
17379
17380
  getProposals(tokenAtCursor, content) {
17380
17381
  if (content.startsWith("=")) {
17381
17382
  return [];
@@ -25031,11 +25032,17 @@ stores.inject(MyMetaStore, storeInstance);
25031
25032
  if (isEvaluationError(cellReference?.value)) {
25032
25033
  return cellReference;
25033
25034
  }
25034
- const column = cellReference === undefined
25035
- ? this.__originCellPosition?.col
25036
- : toZone(cellReference.value).left;
25037
- assert(() => column !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
25038
- return column + 1;
25035
+ if (cellReference === undefined) {
25036
+ assert(() => this.__originCellPosition?.col !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
25037
+ return this.__originCellPosition.col + 1;
25038
+ }
25039
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
25040
+ if (zone.left === zone.right) {
25041
+ return zone.left + 1;
25042
+ }
25043
+ return generateMatrix(zone.right - zone.left + 1, 1, (col, row) => ({
25044
+ value: zone.left + col + 1,
25045
+ }));
25039
25046
  },
25040
25047
  isExported: true,
25041
25048
  };
@@ -25254,11 +25261,17 @@ stores.inject(MyMetaStore, storeInstance);
25254
25261
  if (isEvaluationError(cellReference?.value)) {
25255
25262
  return cellReference;
25256
25263
  }
25257
- const row = cellReference === undefined
25258
- ? this.__originCellPosition?.row
25259
- : toZone(cellReference.value).top;
25260
- assert(() => row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
25261
- return row + 1;
25264
+ if (cellReference === undefined) {
25265
+ assert(() => this.__originCellPosition?.row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
25266
+ return this.__originCellPosition.row + 1;
25267
+ }
25268
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
25269
+ if (zone.top === zone.bottom) {
25270
+ return zone.top + 1;
25271
+ }
25272
+ return generateMatrix(1, zone.bottom - zone.top + 1, (col, row) => ({
25273
+ value: zone.top + row + 1,
25274
+ }));
25262
25275
  },
25263
25276
  isExported: true,
25264
25277
  };
@@ -27914,9 +27927,13 @@ stores.inject(MyMetaStore, storeInstance);
27914
27927
  }
27915
27928
  }
27916
27929
  closeAssistant() {
27930
+ if (!this.canBeToggled)
27931
+ return;
27917
27932
  this.assistant.forcedClosed = true;
27918
27933
  }
27919
27934
  openAssistant() {
27935
+ if (!this.canBeToggled)
27936
+ return;
27920
27937
  this.assistant.forcedClosed = false;
27921
27938
  }
27922
27939
  onWheel(event) {
@@ -27926,6 +27943,9 @@ stores.inject(MyMetaStore, storeInstance);
27926
27943
  event.stopPropagation();
27927
27944
  }
27928
27945
  }
27946
+ get canBeToggled() {
27947
+ return this.autoCompleteState.provider?.canBeToggled ?? true;
27948
+ }
27929
27949
  // ---------------------------------------------------------------------------
27930
27950
  // Private
27931
27951
  // ---------------------------------------------------------------------------
@@ -28108,7 +28128,7 @@ stores.inject(MyMetaStore, storeInstance);
28108
28128
  }
28109
28129
  }
28110
28130
  autoComplete(value) {
28111
- if (!value || this.assistant.forcedClosed) {
28131
+ if (!value || (this.assistant.forcedClosed && this.canBeToggled)) {
28112
28132
  return;
28113
28133
  }
28114
28134
  this.autoCompleteState.provider?.selectProposal(value);
@@ -39680,6 +39700,7 @@ stores.inject(MyMetaStore, storeInstance);
39680
39700
  proposals,
39681
39701
  selectProposal: provider.selectProposal,
39682
39702
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
39703
+ canBeToggled: provider.canBeToggled,
39683
39704
  };
39684
39705
  }
39685
39706
  if (exactMatch && this._currentContent !== this.initialContent) {
@@ -39702,6 +39723,7 @@ stores.inject(MyMetaStore, storeInstance);
39702
39723
  proposals,
39703
39724
  selectProposal: provider.selectProposal,
39704
39725
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
39726
+ canBeToggled: provider.canBeToggled,
39705
39727
  };
39706
39728
  }
39707
39729
  }
@@ -44741,9 +44763,15 @@ stores.inject(MyMetaStore, storeInstance);
44741
44763
  return domain.reduce((current, acc) => this.filterDataEntriesFromDomainNode(current, acc), dataEntries);
44742
44764
  }
44743
44765
  filterDataEntriesFromDomainNode(dataEntries, domain) {
44744
- const { field, value } = domain;
44766
+ const { field, value, type } = domain;
44745
44767
  const { nameWithGranularity } = this.getDimension(field);
44746
- return dataEntries.filter((entry) => entry[nameWithGranularity]?.value === value);
44768
+ return dataEntries.filter((entry) => {
44769
+ const cellValue = entry[nameWithGranularity]?.value;
44770
+ if (type === "char") {
44771
+ return String(cellValue) === String(value);
44772
+ }
44773
+ return cellValue === value;
44774
+ });
44747
44775
  }
44748
44776
  getDimension(nameWithGranularity) {
44749
44777
  return this.definition.getDimension(nameWithGranularity);
@@ -47218,6 +47246,11 @@ stores.inject(MyMetaStore, storeInstance);
47218
47246
  rect = this.defaultRect;
47219
47247
  isEditing = false;
47220
47248
  isCellReferenceVisible = false;
47249
+ currentEditedCell = {
47250
+ col: 0,
47251
+ row: 0,
47252
+ sheetId: this.env.model.getters.getActiveSheetId(),
47253
+ };
47221
47254
  composerStore;
47222
47255
  composerFocusStore;
47223
47256
  composerInterface;
@@ -47247,7 +47280,7 @@ stores.inject(MyMetaStore, storeInstance);
47247
47280
  return this.isCellReferenceVisible;
47248
47281
  }
47249
47282
  get cellReference() {
47250
- const { col, row, sheetId } = this.composerStore.currentEditedCell;
47283
+ const { col, row, sheetId } = this.currentEditedCell;
47251
47284
  const prefixSheet = sheetId !== this.env.model.getters.getActiveSheetId();
47252
47285
  return getFullReference(prefixSheet ? this.env.model.getters.getSheetName(sheetId) : undefined, toXC(col, row));
47253
47286
  }
@@ -47340,12 +47373,17 @@ stores.inject(MyMetaStore, storeInstance);
47340
47373
  if (!isEditing && this.composerFocusStore.activeComposer !== this.composerInterface) {
47341
47374
  this.composerFocusStore.focusComposer(this.composerInterface, { focusMode: "inactive" });
47342
47375
  }
47376
+ let shouldRecomputeRect = isEditing && !deepEquals(this.currentEditedCell, this.composerStore.currentEditedCell);
47343
47377
  if (this.isEditing !== isEditing) {
47344
47378
  this.isEditing = isEditing;
47345
47379
  if (!isEditing) {
47346
47380
  this.rect = this.defaultRect;
47347
47381
  return;
47348
47382
  }
47383
+ this.currentEditedCell = this.composerStore.currentEditedCell;
47384
+ shouldRecomputeRect = true;
47385
+ }
47386
+ if (shouldRecomputeRect) {
47349
47387
  const position = this.env.model.getters.getActivePosition();
47350
47388
  const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
47351
47389
  this.rect = this.env.model.getters.getVisibleRect(zone);
@@ -60412,6 +60450,23 @@ stores.inject(MyMetaStore, storeInstance);
60412
60450
  static getters = ["getRowSize", "getHeaderSize"];
60413
60451
  tallestCellInRow = {};
60414
60452
  ctx = document.createElement("canvas").getContext("2d");
60453
+ beforeHandle(cmd) {
60454
+ switch (cmd.type) {
60455
+ // Ensure rows are updated before "UPDATE_CELL" is dispatched from cell plugin.
60456
+ // "UPDATE_CELL" uses the Sheet core plugin to access row data.
60457
+ // If "ADD_COLUMNS_ROWS" has not been processed yet by header_sizes_ui,
60458
+ // size updates may apply to incorrect (pre-insert) rows.
60459
+ case "ADD_COLUMNS_ROWS":
60460
+ if (cmd.dimension === "COL") {
60461
+ return;
60462
+ }
60463
+ const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
60464
+ const newCells = Array(cmd.quantity).fill(undefined);
60465
+ const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
60466
+ this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
60467
+ break;
60468
+ }
60469
+ }
60415
60470
  handle(cmd) {
60416
60471
  switch (cmd.type) {
60417
60472
  case "START":
@@ -60441,16 +60496,6 @@ stores.inject(MyMetaStore, storeInstance);
60441
60496
  this.history.update("tallestCellInRow", cmd.sheetId, tallestCells);
60442
60497
  break;
60443
60498
  }
60444
- case "ADD_COLUMNS_ROWS": {
60445
- if (cmd.dimension === "COL") {
60446
- return;
60447
- }
60448
- const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
60449
- const newCells = Array(cmd.quantity).fill(undefined);
60450
- const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
60451
- this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
60452
- break;
60453
- }
60454
60499
  case "RESIZE_COLUMNS_ROWS":
60455
60500
  {
60456
60501
  const sheetId = cmd.sheetId;
@@ -66139,6 +66184,14 @@ stores.inject(MyMetaStore, storeInstance);
66139
66184
  const isBasedBefore = cmd.base < start;
66140
66185
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
66141
66186
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
66187
+ const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
66188
+ const originalSize = Object.fromEntries(toRemove.map((element) => {
66189
+ const size = isCol
66190
+ ? this.getters.getColSize(cmd.sheetId, element)
66191
+ : this.getters.getUserRowSize(cmd.sheetId, element);
66192
+ const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
66193
+ return [element, isDefaultCol || size === undefined ? null : size];
66194
+ }));
66142
66195
  const target = [
66143
66196
  {
66144
66197
  left: isCol ? start + deltaCol : 0,
@@ -66169,14 +66222,12 @@ stores.inject(MyMetaStore, storeInstance);
66169
66222
  const col = selection.left;
66170
66223
  const row = selection.top;
66171
66224
  this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
66172
- const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
66173
66225
  let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
66174
66226
  for (const element of toRemove) {
66175
- const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
66176
66227
  this.dispatch("RESIZE_COLUMNS_ROWS", {
66177
66228
  dimension: cmd.dimension,
66178
66229
  sheetId: cmd.sheetId,
66179
- size,
66230
+ size: originalSize[element],
66180
66231
  elements: [currentIndex],
66181
66232
  });
66182
66233
  currentIndex += 1;
@@ -67888,14 +67939,12 @@ stores.inject(MyMetaStore, storeInstance);
67888
67939
  this.editionState = "initializing";
67889
67940
  }
67890
67941
  stopEdition() {
67891
- const input = this.sheetNameRef.el;
67892
- if (!this.state.isEditing || !input)
67942
+ if (!this.state.isEditing || !this.sheetNameRef.el)
67893
67943
  return;
67894
67944
  this.state.isEditing = false;
67895
67945
  this.editionState = "initializing";
67896
- input.blur();
67946
+ this.sheetNameRef.el.blur();
67897
67947
  const inputValue = this.getInputContent() || "";
67898
- input.innerText = inputValue;
67899
67948
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
67900
67949
  }
67901
67950
  cancelEdition() {
@@ -74590,9 +74639,9 @@ stores.inject(MyMetaStore, storeInstance);
74590
74639
  exports.tokenize = tokenize;
74591
74640
 
74592
74641
 
74593
- __info__.version = "18.0.37";
74594
- __info__.date = "2025-07-11T11:11:13.394Z";
74595
- __info__.hash = "bc6f00d";
74642
+ __info__.version = "18.0.38";
74643
+ __info__.date = "2025-07-28T13:29:40.841Z";
74644
+ __info__.hash = "0f3b11a";
74596
74645
 
74597
74646
 
74598
74647
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);