@odoo/o-spreadsheet 18.3.12 → 18.3.13

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.3.12
6
- * @date 2025-07-11T11:11:58.998Z
7
- * @hash d14dc96
5
+ * @version 18.3.13
6
+ * @date 2025-07-28T13:39:23.645Z
7
+ * @hash d30327c
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -18407,11 +18407,17 @@ stores.inject(MyMetaStore, storeInstance);
18407
18407
  if (isEvaluationError(cellReference?.value)) {
18408
18408
  return cellReference;
18409
18409
  }
18410
- const column = cellReference === undefined
18411
- ? this.__originCellPosition?.col
18412
- : toZone(cellReference.value).left;
18413
- assert(() => column !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
18414
- return column + 1;
18410
+ if (cellReference === undefined) {
18411
+ assert(() => this.__originCellPosition?.col !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
18412
+ return this.__originCellPosition.col + 1;
18413
+ }
18414
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
18415
+ if (zone.left === zone.right) {
18416
+ return zone.left + 1;
18417
+ }
18418
+ return generateMatrix(zone.right - zone.left + 1, 1, (col, row) => ({
18419
+ value: zone.left + col + 1,
18420
+ }));
18415
18421
  },
18416
18422
  isExported: true,
18417
18423
  };
@@ -18630,11 +18636,17 @@ stores.inject(MyMetaStore, storeInstance);
18630
18636
  if (isEvaluationError(cellReference?.value)) {
18631
18637
  return cellReference;
18632
18638
  }
18633
- const row = cellReference === undefined
18634
- ? this.__originCellPosition?.row
18635
- : toZone(cellReference.value).top;
18636
- assert(() => row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
18637
- return row + 1;
18639
+ if (cellReference === undefined) {
18640
+ assert(() => this.__originCellPosition?.row !== undefined, "In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.");
18641
+ return this.__originCellPosition.row + 1;
18642
+ }
18643
+ const zone = this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(), cellReference.value).zone;
18644
+ if (zone.top === zone.bottom) {
18645
+ return zone.top + 1;
18646
+ }
18647
+ return generateMatrix(1, zone.bottom - zone.top + 1, (col, row) => ({
18648
+ value: zone.top + row + 1,
18649
+ }));
18638
18650
  },
18639
18651
  isExported: true,
18640
18652
  };
@@ -22614,6 +22626,7 @@ stores.inject(MyMetaStore, storeInstance);
22614
22626
 
22615
22627
  autoCompleteProviders.add("dataValidation", {
22616
22628
  displayAllOnInitialContent: true,
22629
+ canBeToggled: false,
22617
22630
  getProposals(tokenAtCursor, content) {
22618
22631
  if (isFormula(content)) {
22619
22632
  return [];
@@ -23510,6 +23523,7 @@ stores.inject(MyMetaStore, storeInstance);
23510
23523
  proposals,
23511
23524
  selectProposal: provider.selectProposal,
23512
23525
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
23526
+ canBeToggled: provider.canBeToggled,
23513
23527
  };
23514
23528
  }
23515
23529
  if (exactMatch && this._currentContent !== this.initialContent) {
@@ -23532,6 +23546,7 @@ stores.inject(MyMetaStore, storeInstance);
23532
23546
  proposals,
23533
23547
  selectProposal: provider.selectProposal,
23534
23548
  autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
23549
+ canBeToggled: provider.canBeToggled,
23535
23550
  };
23536
23551
  }
23537
23552
  }
@@ -43776,9 +43791,13 @@ stores.inject(MyMetaStore, storeInstance);
43776
43791
  }
43777
43792
  }
43778
43793
  closeAssistant() {
43794
+ if (!this.canBeToggled)
43795
+ return;
43779
43796
  this.assistant.forcedClosed = true;
43780
43797
  }
43781
43798
  openAssistant() {
43799
+ if (!this.canBeToggled)
43800
+ return;
43782
43801
  this.assistant.forcedClosed = false;
43783
43802
  }
43784
43803
  onWheel(event) {
@@ -43788,6 +43807,9 @@ stores.inject(MyMetaStore, storeInstance);
43788
43807
  event.stopPropagation();
43789
43808
  }
43790
43809
  }
43810
+ get canBeToggled() {
43811
+ return this.autoCompleteState.provider?.canBeToggled ?? true;
43812
+ }
43791
43813
  // ---------------------------------------------------------------------------
43792
43814
  // Private
43793
43815
  // ---------------------------------------------------------------------------
@@ -43975,7 +43997,7 @@ stores.inject(MyMetaStore, storeInstance);
43975
43997
  return [...new Set(argsToFocus)];
43976
43998
  }
43977
43999
  autoComplete(value) {
43978
- if (!value || this.assistant.forcedClosed) {
44000
+ if (!value || (this.assistant.forcedClosed && this.canBeToggled)) {
43979
44001
  return;
43980
44002
  }
43981
44003
  this.autoCompleteState.provider?.selectProposal(value);
@@ -49954,9 +49976,15 @@ stores.inject(MyMetaStore, storeInstance);
49954
49976
  return domain.reduce((current, acc) => this.filterDataEntriesFromDomainNode(current, acc), dataEntries);
49955
49977
  }
49956
49978
  filterDataEntriesFromDomainNode(dataEntries, domain) {
49957
- const { field, value } = domain;
49979
+ const { field, value, type } = domain;
49958
49980
  const { nameWithGranularity } = this.getDimension(field);
49959
- return dataEntries.filter((entry) => entry[nameWithGranularity]?.value === value);
49981
+ return dataEntries.filter((entry) => {
49982
+ const cellValue = entry[nameWithGranularity]?.value;
49983
+ if (type === "char") {
49984
+ return String(cellValue) === String(value);
49985
+ }
49986
+ return cellValue === value;
49987
+ });
49960
49988
  }
49961
49989
  getDimension(nameWithGranularity) {
49962
49990
  return this.definition.getDimension(nameWithGranularity);
@@ -52622,6 +52650,11 @@ stores.inject(MyMetaStore, storeInstance);
52622
52650
  rect = this.defaultRect;
52623
52651
  isEditing = false;
52624
52652
  isCellReferenceVisible = false;
52653
+ currentEditedCell = {
52654
+ col: 0,
52655
+ row: 0,
52656
+ sheetId: this.env.model.getters.getActiveSheetId(),
52657
+ };
52625
52658
  composerStore;
52626
52659
  composerFocusStore;
52627
52660
  composerInterface;
@@ -52651,7 +52684,7 @@ stores.inject(MyMetaStore, storeInstance);
52651
52684
  return this.isCellReferenceVisible;
52652
52685
  }
52653
52686
  get cellReference() {
52654
- const { col, row, sheetId } = this.composerStore.currentEditedCell;
52687
+ const { col, row, sheetId } = this.currentEditedCell;
52655
52688
  const prefixSheet = sheetId !== this.env.model.getters.getActiveSheetId();
52656
52689
  return getFullReference(prefixSheet ? this.env.model.getters.getSheetName(sheetId) : undefined, toXC(col, row));
52657
52690
  }
@@ -52743,12 +52776,17 @@ stores.inject(MyMetaStore, storeInstance);
52743
52776
  if (!isEditing && this.composerFocusStore.activeComposer !== this.composerInterface) {
52744
52777
  this.composerFocusStore.focusComposer(this.composerInterface, { focusMode: "inactive" });
52745
52778
  }
52779
+ let shouldRecomputeRect = isEditing && !deepEquals(this.currentEditedCell, this.composerStore.currentEditedCell);
52746
52780
  if (this.isEditing !== isEditing) {
52747
52781
  this.isEditing = isEditing;
52748
52782
  if (!isEditing) {
52749
52783
  this.rect = this.defaultRect;
52750
52784
  return;
52751
52785
  }
52786
+ this.currentEditedCell = this.composerStore.currentEditedCell;
52787
+ shouldRecomputeRect = true;
52788
+ }
52789
+ if (shouldRecomputeRect) {
52752
52790
  const position = this.env.model.getters.getActivePosition();
52753
52791
  const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
52754
52792
  this.rect = this.env.model.getters.getVisibleRect(zone);
@@ -65875,6 +65913,23 @@ stores.inject(MyMetaStore, storeInstance);
65875
65913
  static getters = ["getRowSize", "getHeaderSize", "getMaxAnchorOffset"];
65876
65914
  tallestCellInRow = {};
65877
65915
  ctx = document.createElement("canvas").getContext("2d");
65916
+ beforeHandle(cmd) {
65917
+ switch (cmd.type) {
65918
+ // Ensure rows are updated before "UPDATE_CELL" is dispatched from cell plugin.
65919
+ // "UPDATE_CELL" uses the Sheet core plugin to access row data.
65920
+ // If "ADD_COLUMNS_ROWS" has not been processed yet by header_sizes_ui,
65921
+ // size updates may apply to incorrect (pre-insert) rows.
65922
+ case "ADD_COLUMNS_ROWS":
65923
+ if (cmd.dimension === "COL") {
65924
+ return;
65925
+ }
65926
+ const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
65927
+ const newCells = Array(cmd.quantity).fill(undefined);
65928
+ const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
65929
+ this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
65930
+ break;
65931
+ }
65932
+ }
65878
65933
  handle(cmd) {
65879
65934
  switch (cmd.type) {
65880
65935
  case "START":
@@ -65904,16 +65959,6 @@ stores.inject(MyMetaStore, storeInstance);
65904
65959
  this.history.update("tallestCellInRow", cmd.sheetId, tallestCells);
65905
65960
  break;
65906
65961
  }
65907
- case "ADD_COLUMNS_ROWS": {
65908
- if (cmd.dimension === "COL") {
65909
- return;
65910
- }
65911
- const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
65912
- const newCells = Array(cmd.quantity).fill(undefined);
65913
- const newTallestCells = insertItemsAtIndex(this.tallestCellInRow[cmd.sheetId], newCells, addIndex);
65914
- this.history.update("tallestCellInRow", cmd.sheetId, newTallestCells);
65915
- break;
65916
- }
65917
65962
  case "RESIZE_COLUMNS_ROWS":
65918
65963
  {
65919
65964
  const sheetId = cmd.sheetId;
@@ -71914,6 +71959,14 @@ stores.inject(MyMetaStore, storeInstance);
71914
71959
  const isBasedBefore = cmd.base < start;
71915
71960
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
71916
71961
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
71962
+ const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
71963
+ const originalSize = Object.fromEntries(toRemove.map((element) => {
71964
+ const size = isCol
71965
+ ? this.getters.getColSize(cmd.sheetId, element)
71966
+ : this.getters.getUserRowSize(cmd.sheetId, element);
71967
+ const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
71968
+ return [element, isDefaultCol ? undefined : size];
71969
+ }));
71917
71970
  const target = [
71918
71971
  {
71919
71972
  left: isCol ? start + deltaCol : 0,
@@ -71944,13 +71997,12 @@ stores.inject(MyMetaStore, storeInstance);
71944
71997
  const col = selection.left;
71945
71998
  const row = selection.top;
71946
71999
  this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
71947
- const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
71948
72000
  let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
71949
72001
  const resizingGroups = {};
71950
72002
  for (const element of toRemove) {
71951
- const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
72003
+ const size = originalSize[element];
71952
72004
  const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
71953
- if (size != currentSize) {
72005
+ if (size && size != currentSize) {
71954
72006
  resizingGroups[size] ??= [];
71955
72007
  resizingGroups[size].push(currentIndex);
71956
72008
  currentIndex += 1;
@@ -73744,14 +73796,12 @@ stores.inject(MyMetaStore, storeInstance);
73744
73796
  this.editionState = "initializing";
73745
73797
  }
73746
73798
  stopEdition() {
73747
- const input = this.sheetNameRef.el;
73748
- if (!this.state.isEditing || !input)
73799
+ if (!this.state.isEditing || !this.sheetNameRef.el)
73749
73800
  return;
73750
73801
  this.state.isEditing = false;
73751
73802
  this.editionState = "initializing";
73752
- input.blur();
73803
+ this.sheetNameRef.el.blur();
73753
73804
  const inputValue = this.getInputContent() || "";
73754
- input.innerText = inputValue;
73755
73805
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
73756
73806
  }
73757
73807
  cancelEdition() {
@@ -80849,9 +80899,9 @@ stores.inject(MyMetaStore, storeInstance);
80849
80899
  exports.tokenize = tokenize;
80850
80900
 
80851
80901
 
80852
- __info__.version = "18.3.12";
80853
- __info__.date = "2025-07-11T11:11:58.998Z";
80854
- __info__.hash = "d14dc96";
80902
+ __info__.version = "18.3.13";
80903
+ __info__.date = "2025-07-28T13:39:23.645Z";
80904
+ __info__.hash = "d30327c";
80855
80905
 
80856
80906
 
80857
80907
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);