@odoo/o-spreadsheet 18.1.29 → 18.1.30

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.29
6
- * @date 2025-07-11T11:11:55.442Z
7
- * @hash 3456a93
5
+ * @version 18.1.30
6
+ * @date 2025-07-28T13:37:30.885Z
7
+ * @hash d42e484
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -11135,6 +11135,7 @@ stores.inject(MyMetaStore, storeInstance);
11135
11135
 
11136
11136
  autoCompleteProviders.add("dataValidation", {
11137
11137
  displayAllOnInitialContent: true,
11138
+ canBeToggled: false,
11138
11139
  getProposals(tokenAtCursor, content) {
11139
11140
  if (content.startsWith("=")) {
11140
11141
  return [];
@@ -18937,11 +18938,17 @@ stores.inject(MyMetaStore, storeInstance);
18937
18938
  if (isEvaluationError(cellReference?.value)) {
18938
18939
  return cellReference;
18939
18940
  }
18940
- const column = cellReference === undefined
18941
- ? this.__originCellPosition?.col
18942
- : toZone(cellReference.value).left;
18943
- assert(() => column !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
18944
- return column + 1;
18941
+ if (cellReference === undefined) {
18942
+ assert(() => this.__originCellPosition?.col !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
18943
+ return this.__originCellPosition.col + 1;
18944
+ }
18945
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
18946
+ if (zone.left === zone.right) {
18947
+ return zone.left + 1;
18948
+ }
18949
+ return generateMatrix(zone.right - zone.left + 1, 1, (col, row) => ({
18950
+ value: zone.left + col + 1,
18951
+ }));
18945
18952
  },
18946
18953
  isExported: true,
18947
18954
  };
@@ -19160,11 +19167,17 @@ stores.inject(MyMetaStore, storeInstance);
19160
19167
  if (isEvaluationError(cellReference?.value)) {
19161
19168
  return cellReference;
19162
19169
  }
19163
- const row = cellReference === undefined
19164
- ? this.__originCellPosition?.row
19165
- : toZone(cellReference.value).top;
19166
- assert(() => row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
19167
- return row + 1;
19170
+ if (cellReference === undefined) {
19171
+ assert(() => this.__originCellPosition?.row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
19172
+ return this.__originCellPosition.row + 1;
19173
+ }
19174
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
19175
+ if (zone.top === zone.bottom) {
19176
+ return zone.top + 1;
19177
+ }
19178
+ return generateMatrix(1, zone.bottom - zone.top + 1, (col, row) => ({
19179
+ value: zone.top + row + 1,
19180
+ }));
19168
19181
  },
19169
19182
  isExported: true,
19170
19183
  };
@@ -21440,6 +21453,7 @@ stores.inject(MyMetaStore, storeInstance);
21440
21453
  proposals,
21441
21454
  selectProposal: provider.selectProposal,
21442
21455
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
21456
+ canBeToggled: provider.canBeToggled,
21443
21457
  };
21444
21458
  }
21445
21459
  if (exactMatch && this._currentContent !== this.initialContent) {
@@ -21462,6 +21476,7 @@ stores.inject(MyMetaStore, storeInstance);
21462
21476
  proposals,
21463
21477
  selectProposal: provider.selectProposal,
21464
21478
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
21479
+ canBeToggled: provider.canBeToggled,
21465
21480
  };
21466
21481
  }
21467
21482
  }
@@ -41500,9 +41515,13 @@ stores.inject(MyMetaStore, storeInstance);
41500
41515
  }
41501
41516
  }
41502
41517
  closeAssistant() {
41518
+ if (!this.canBeToggled)
41519
+ return;
41503
41520
  this.assistant.forcedClosed = true;
41504
41521
  }
41505
41522
  openAssistant() {
41523
+ if (!this.canBeToggled)
41524
+ return;
41506
41525
  this.assistant.forcedClosed = false;
41507
41526
  }
41508
41527
  onWheel(event) {
@@ -41512,6 +41531,9 @@ stores.inject(MyMetaStore, storeInstance);
41512
41531
  event.stopPropagation();
41513
41532
  }
41514
41533
  }
41534
+ get canBeToggled() {
41535
+ return this.autoCompleteState.provider?.canBeToggled ?? true;
41536
+ }
41515
41537
  // ---------------------------------------------------------------------------
41516
41538
  // Private
41517
41539
  // ---------------------------------------------------------------------------
@@ -41647,7 +41669,7 @@ stores.inject(MyMetaStore, storeInstance);
41647
41669
  }
41648
41670
  }
41649
41671
  autoComplete(value) {
41650
- if (!value || this.assistant.forcedClosed) {
41672
+ if (!value || (this.assistant.forcedClosed && this.canBeToggled)) {
41651
41673
  return;
41652
41674
  }
41653
41675
  this.autoCompleteState.provider?.selectProposal(value);
@@ -46892,9 +46914,15 @@ stores.inject(MyMetaStore, storeInstance);
46892
46914
  return domain.reduce((current, acc) => this.filterDataEntriesFromDomainNode(current, acc), dataEntries);
46893
46915
  }
46894
46916
  filterDataEntriesFromDomainNode(dataEntries, domain) {
46895
- const { field, value } = domain;
46917
+ const { field, value, type } = domain;
46896
46918
  const { nameWithGranularity } = this.getDimension(field);
46897
- return dataEntries.filter((entry) => entry[nameWithGranularity]?.value === value);
46919
+ return dataEntries.filter((entry) => {
46920
+ const cellValue = entry[nameWithGranularity]?.value;
46921
+ if (type === "char") {
46922
+ return String(cellValue) === String(value);
46923
+ }
46924
+ return cellValue === value;
46925
+ });
46898
46926
  }
46899
46927
  getDimension(nameWithGranularity) {
46900
46928
  return this.definition.getDimension(nameWithGranularity);
@@ -49394,6 +49422,11 @@ stores.inject(MyMetaStore, storeInstance);
49394
49422
  rect = this.defaultRect;
49395
49423
  isEditing = false;
49396
49424
  isCellReferenceVisible = false;
49425
+ currentEditedCell = {
49426
+ col: 0,
49427
+ row: 0,
49428
+ sheetId: this.env.model.getters.getActiveSheetId(),
49429
+ };
49397
49430
  composerStore;
49398
49431
  composerFocusStore;
49399
49432
  composerInterface;
@@ -49423,7 +49456,7 @@ stores.inject(MyMetaStore, storeInstance);
49423
49456
  return this.isCellReferenceVisible;
49424
49457
  }
49425
49458
  get cellReference() {
49426
- const { col, row, sheetId } = this.composerStore.currentEditedCell;
49459
+ const { col, row, sheetId } = this.currentEditedCell;
49427
49460
  const prefixSheet = sheetId !== this.env.model.getters.getActiveSheetId();
49428
49461
  return getFullReference(prefixSheet ? this.env.model.getters.getSheetName(sheetId) : undefined, toXC(col, row));
49429
49462
  }
@@ -49515,12 +49548,17 @@ stores.inject(MyMetaStore, storeInstance);
49515
49548
  if (!isEditing && this.composerFocusStore.activeComposer !== this.composerInterface) {
49516
49549
  this.composerFocusStore.focusComposer(this.composerInterface, { focusMode: "inactive" });
49517
49550
  }
49551
+ let shouldRecomputeRect = isEditing && !deepEquals(this.currentEditedCell, this.composerStore.currentEditedCell);
49518
49552
  if (this.isEditing !== isEditing) {
49519
49553
  this.isEditing = isEditing;
49520
49554
  if (!isEditing) {
49521
49555
  this.rect = this.defaultRect;
49522
49556
  return;
49523
49557
  }
49558
+ this.currentEditedCell = this.composerStore.currentEditedCell;
49559
+ shouldRecomputeRect = true;
49560
+ }
49561
+ if (shouldRecomputeRect) {
49524
49562
  const position = this.env.model.getters.getActivePosition();
49525
49563
  const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
49526
49564
  this.rect = this.env.model.getters.getVisibleRect(zone);
@@ -62488,6 +62526,23 @@ stores.inject(MyMetaStore, storeInstance);
62488
62526
  static getters = ["getRowSize", "getHeaderSize"];
62489
62527
  tallestCellInRow = {};
62490
62528
  ctx = document.createElement("canvas").getContext("2d");
62529
+ beforeHandle(cmd) {
62530
+ switch (cmd.type) {
62531
+ // Ensure rows are updated before "UPDATE_CELL" is dispatched from cell plugin.
62532
+ // "UPDATE_CELL" uses the Sheet core plugin to access row data.
62533
+ // If "ADD_COLUMNS_ROWS" has not been processed yet by header_sizes_ui,
62534
+ // size updates may apply to incorrect (pre-insert) rows.
62535
+ case "ADD_COLUMNS_ROWS":
62536
+ if (cmd.dimension === "COL") {
62537
+ return;
62538
+ }
62539
+ const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
62540
+ const newCells = Array(cmd.quantity).fill(undefined);
62541
+ const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
62542
+ this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
62543
+ break;
62544
+ }
62545
+ }
62491
62546
  handle(cmd) {
62492
62547
  switch (cmd.type) {
62493
62548
  case "START":
@@ -62517,16 +62572,6 @@ stores.inject(MyMetaStore, storeInstance);
62517
62572
  this.history.update("tallestCellInRow", cmd.sheetId, tallestCells);
62518
62573
  break;
62519
62574
  }
62520
- case "ADD_COLUMNS_ROWS": {
62521
- if (cmd.dimension === "COL") {
62522
- return;
62523
- }
62524
- const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
62525
- const newCells = Array(cmd.quantity).fill(undefined);
62526
- const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
62527
- this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
62528
- break;
62529
- }
62530
62575
  case "RESIZE_COLUMNS_ROWS":
62531
62576
  {
62532
62577
  const sheetId = cmd.sheetId;
@@ -68267,6 +68312,14 @@ stores.inject(MyMetaStore, storeInstance);
68267
68312
  const isBasedBefore = cmd.base < start;
68268
68313
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
68269
68314
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
68315
+ const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
68316
+ const originalSize = Object.fromEntries(toRemove.map((element) => {
68317
+ const size = isCol
68318
+ ? this.getters.getColSize(cmd.sheetId, element)
68319
+ : this.getters.getUserRowSize(cmd.sheetId, element);
68320
+ const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
68321
+ return [element, isDefaultCol ? undefined : size];
68322
+ }));
68270
68323
  const target = [
68271
68324
  {
68272
68325
  left: isCol ? start + deltaCol : 0,
@@ -68297,13 +68350,12 @@ stores.inject(MyMetaStore, storeInstance);
68297
68350
  const col = selection.left;
68298
68351
  const row = selection.top;
68299
68352
  this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
68300
- const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
68301
68353
  let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
68302
68354
  const resizingGroups = {};
68303
68355
  for (const element of toRemove) {
68304
- const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
68356
+ const size = originalSize[element];
68305
68357
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
68306
- if (size != currentSize) {
68358
+ if (size && size != currentSize) {
68307
68359
  resizingGroups[size] ??= [];
68308
68360
  resizingGroups[size].push(currentIndex);
68309
68361
  currentIndex += 1;
@@ -70022,14 +70074,12 @@ stores.inject(MyMetaStore, storeInstance);
70022
70074
  this.editionState = "initializing";
70023
70075
  }
70024
70076
  stopEdition() {
70025
- const input = this.sheetNameRef.el;
70026
- if (!this.state.isEditing || !input)
70077
+ if (!this.state.isEditing || !this.sheetNameRef.el)
70027
70078
  return;
70028
70079
  this.state.isEditing = false;
70029
70080
  this.editionState = "initializing";
70030
- input.blur();
70081
+ this.sheetNameRef.el.blur();
70031
70082
  const inputValue = this.getInputContent() || "";
70032
- input.innerText = inputValue;
70033
70083
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
70034
70084
  }
70035
70085
  cancelEdition() {
@@ -76705,9 +76755,9 @@ stores.inject(MyMetaStore, storeInstance);
76705
76755
  exports.tokenize = tokenize;
76706
76756
 
76707
76757
 
76708
- __info__.version = "18.1.29";
76709
- __info__.date = "2025-07-11T11:11:55.442Z";
76710
- __info__.hash = "3456a93";
76758
+ __info__.version = "18.1.30";
76759
+ __info__.date = "2025-07-28T13:37:30.885Z";
76760
+ __info__.hash = "d42e484";
76711
76761
 
76712
76762
 
76713
76763
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);