@odoo/o-spreadsheet 18.0.48 → 18.0.50

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.48
6
- * @date 2025-11-12T14:15:38.406Z
7
- * @hash d1efb0b
5
+ * @version 18.0.50
6
+ * @date 2025-12-02T05:32:00.480Z
7
+ * @hash 7ed20c4
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3271,7 +3271,6 @@
3271
3271
  "REDO",
3272
3272
  "ADD_MERGE",
3273
3273
  "REMOVE_MERGE",
3274
- "DUPLICATE_SHEET",
3275
3274
  "UPDATE_LOCALE",
3276
3275
  "ADD_PIVOT",
3277
3276
  "UPDATE_PIVOT",
@@ -28372,7 +28371,6 @@ stores.inject(MyMetaStore, storeInstance);
28372
28371
  return;
28373
28372
  }
28374
28373
  const newSelection = this.contentHelper.getCurrentSelection();
28375
- this.props.composerStore.stopComposerRangeSelection();
28376
28374
  this.props.onComposerContentFocused();
28377
28375
  this.props.composerStore.changeComposerCursorSelection(newSelection.start, newSelection.end);
28378
28376
  this.processTokenAtCursor();
@@ -28655,7 +28653,6 @@ stores.inject(MyMetaStore, storeInstance);
28655
28653
  // replace the whole token
28656
28654
  start = tokenAtCursor.start;
28657
28655
  }
28658
- this.composer.stopComposerRangeSelection();
28659
28656
  this.composer.changeComposerCursorSelection(start, end);
28660
28657
  this.composer.replaceComposerCursorSelection(value);
28661
28658
  }
@@ -28673,7 +28670,6 @@ stores.inject(MyMetaStore, storeInstance);
28673
28670
  // replace the whole token
28674
28671
  start = tokenAtCursor.start;
28675
28672
  }
28676
- this.composer.stopComposerRangeSelection();
28677
28673
  this.composer.changeComposerCursorSelection(start, end);
28678
28674
  this.composer.replaceComposerCursorSelection(value);
28679
28675
  }
@@ -31851,7 +31847,6 @@ stores.inject(MyMetaStore, storeInstance);
31851
31847
  static template = "o-spreadsheet-ChartFigure";
31852
31848
  static props = {
31853
31849
  figure: Object,
31854
- onFigureDeleted: Function,
31855
31850
  };
31856
31851
  static components = {};
31857
31852
  onDoubleClick() {
@@ -31875,7 +31870,6 @@ stores.inject(MyMetaStore, storeInstance);
31875
31870
  static template = "o-spreadsheet-ImageFigure";
31876
31871
  static props = {
31877
31872
  figure: Object,
31878
- onFigureDeleted: Function,
31879
31873
  };
31880
31874
  static components = {};
31881
31875
  // ---------------------------------------------------------------------------
@@ -31933,7 +31927,7 @@ stores.inject(MyMetaStore, storeInstance);
31933
31927
  borderWidth: 0,
31934
31928
  menuBuilder: getImageMenuRegistry,
31935
31929
  });
31936
- function getChartMenu(figureId, onFigureDeleted, env) {
31930
+ function getChartMenu(figureId, env) {
31937
31931
  const menuItemSpecs = [
31938
31932
  {
31939
31933
  id: "edit",
@@ -31947,11 +31941,11 @@ stores.inject(MyMetaStore, storeInstance);
31947
31941
  },
31948
31942
  getCopyMenuItem(figureId, env),
31949
31943
  getCutMenuItem(figureId, env),
31950
- getDeleteMenuItem(figureId, onFigureDeleted, env),
31944
+ getDeleteMenuItem(figureId, env),
31951
31945
  ];
31952
31946
  return createActions(menuItemSpecs);
31953
31947
  }
31954
- function getImageMenuRegistry(figureId, onFigureDeleted, env) {
31948
+ function getImageMenuRegistry(figureId, env) {
31955
31949
  const menuItemSpecs = [
31956
31950
  getCopyMenuItem(figureId, env),
31957
31951
  getCutMenuItem(figureId, env),
@@ -31977,7 +31971,7 @@ stores.inject(MyMetaStore, storeInstance);
31977
31971
  },
31978
31972
  icon: "o-spreadsheet-Icon.REFRESH",
31979
31973
  },
31980
- getDeleteMenuItem(figureId, onFigureDeleted, env),
31974
+ getDeleteMenuItem(figureId, env),
31981
31975
  ];
31982
31976
  return createActions(menuItemSpecs);
31983
31977
  }
@@ -32009,7 +32003,7 @@ stores.inject(MyMetaStore, storeInstance);
32009
32003
  icon: "o-spreadsheet-Icon.CUT",
32010
32004
  };
32011
32005
  }
32012
- function getDeleteMenuItem(figureId, onFigureDeleted, env) {
32006
+ function getDeleteMenuItem(figureId, env) {
32013
32007
  return {
32014
32008
  id: "delete",
32015
32009
  name: _t("Delete"),
@@ -32019,7 +32013,6 @@ stores.inject(MyMetaStore, storeInstance);
32019
32013
  sheetId: env.model.getters.getActiveSheetId(),
32020
32014
  id: figureId,
32021
32015
  });
32022
- onFigureDeleted();
32023
32016
  },
32024
32017
  icon: "o-spreadsheet-Icon.TRASH",
32025
32018
  };
@@ -39382,6 +39375,7 @@ stores.inject(MyMetaStore, storeInstance);
39382
39375
  }
39383
39376
  this.selectionStart = start;
39384
39377
  this.selectionEnd = end;
39378
+ this.stopComposerRangeSelection();
39385
39379
  }
39386
39380
  stopComposerRangeSelection() {
39387
39381
  if (this.isSelectingRange) {
@@ -44991,7 +44985,6 @@ stores.inject(MyMetaStore, storeInstance);
44991
44985
  pivotRegistry.add("SPREADSHEET", {
44992
44986
  ui: SpreadsheetPivot,
44993
44987
  definition: SpreadsheetPivotRuntimeDefinition,
44994
- externalData: false,
44995
44988
  dateGranularities: [...dateGranularities],
44996
44989
  datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
44997
44990
  isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
@@ -46612,13 +46605,11 @@ stores.inject(MyMetaStore, storeInstance);
46612
46605
  static props = {
46613
46606
  figure: Object,
46614
46607
  style: { type: String, optional: true },
46615
- onFigureDeleted: { type: Function, optional: true },
46616
46608
  onMouseDown: { type: Function, optional: true },
46617
46609
  onClickAnchor: { type: Function, optional: true },
46618
46610
  };
46619
46611
  static components = { Menu };
46620
46612
  static defaultProps = {
46621
- onFigureDeleted: () => { },
46622
46613
  onMouseDown: () => { },
46623
46614
  onClickAnchor: () => { },
46624
46615
  };
@@ -46692,9 +46683,6 @@ stores.inject(MyMetaStore, storeInstance);
46692
46683
  el?.focus({ preventScroll: true });
46693
46684
  }
46694
46685
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
46695
- owl.onWillUnmount(() => {
46696
- this.props.onFigureDeleted();
46697
- });
46698
46686
  }
46699
46687
  clickAnchor(dirX, dirY, ev) {
46700
46688
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -46712,7 +46700,6 @@ stores.inject(MyMetaStore, storeInstance);
46712
46700
  sheetId: this.env.model.getters.getActiveSheetId(),
46713
46701
  id: figure.id,
46714
46702
  });
46715
- this.props.onFigureDeleted();
46716
46703
  ev.preventDefault();
46717
46704
  ev.stopPropagation();
46718
46705
  break;
@@ -46776,7 +46763,7 @@ stores.inject(MyMetaStore, storeInstance);
46776
46763
  this.menuState.position = position;
46777
46764
  this.menuState.menuItems = figureRegistry
46778
46765
  .get(this.props.figure.tag)
46779
- .menuBuilder(this.props.figure.id, this.props.onFigureDeleted, this.env);
46766
+ .menuBuilder(this.props.figure.id, this.env);
46780
46767
  }
46781
46768
  }
46782
46769
 
@@ -47976,9 +47963,7 @@ stores.inject(MyMetaStore, storeInstance);
47976
47963
  */
47977
47964
  class FiguresContainer extends owl.Component {
47978
47965
  static template = "o-spreadsheet-FiguresContainer";
47979
- static props = {
47980
- onFigureDeleted: Function,
47981
- };
47966
+ static props = {};
47982
47967
  static components = { FigureComponent };
47983
47968
  dnd = owl.useState({
47984
47969
  draggedFigure: undefined,
@@ -48335,16 +48320,16 @@ stores.inject(MyMetaStore, storeInstance);
48335
48320
  `;
48336
48321
  class GridAddRowsFooter extends owl.Component {
48337
48322
  static template = "o-spreadsheet-GridAddRowsFooter";
48338
- static props = {
48339
- focusGrid: Function,
48340
- };
48323
+ static props = {};
48341
48324
  static components = { ValidationMessages };
48325
+ DOMFocusableElementStore;
48342
48326
  inputRef = owl.useRef("inputRef");
48343
48327
  state = owl.useState({
48344
48328
  inputValue: "100",
48345
48329
  errorFlag: false,
48346
48330
  });
48347
48331
  setup() {
48332
+ this.DOMFocusableElementStore = useStore(DOMFocusableElementStore);
48348
48333
  owl.useExternalListener(window, "click", this.onExternalClick, { capture: true });
48349
48334
  }
48350
48335
  get addRowsPosition() {
@@ -48362,7 +48347,7 @@ stores.inject(MyMetaStore, storeInstance);
48362
48347
  }
48363
48348
  onKeydown(ev) {
48364
48349
  if (ev.key.toUpperCase() === "ESCAPE") {
48365
- this.props.focusGrid();
48350
+ this.focusDefaultElement();
48366
48351
  }
48367
48352
  else if (ev.key.toUpperCase() === "ENTER") {
48368
48353
  this.onConfirm();
@@ -48388,7 +48373,7 @@ stores.inject(MyMetaStore, storeInstance);
48388
48373
  quantity,
48389
48374
  dimension: "ROW",
48390
48375
  });
48391
- this.props.focusGrid();
48376
+ this.focusDefaultElement();
48392
48377
  // After adding new rows, scroll down to the new last row
48393
48378
  const { scrollX } = this.env.model.getters.getActiveSheetDOMScrollInfo();
48394
48379
  const { end } = this.env.model.getters.getRowDimensions(activeSheetId, rowNumber + quantity - 1);
@@ -48401,7 +48386,12 @@ stores.inject(MyMetaStore, storeInstance);
48401
48386
  if (this.inputRef.el !== document.activeElement || ev.target === this.inputRef.el) {
48402
48387
  return;
48403
48388
  }
48404
- this.props.focusGrid();
48389
+ this.focusDefaultElement();
48390
+ }
48391
+ focusDefaultElement() {
48392
+ if (document.activeElement === this.inputRef.el) {
48393
+ this.DOMFocusableElementStore.focus();
48394
+ }
48405
48395
  }
48406
48396
  }
48407
48397
 
@@ -48590,7 +48580,6 @@ stores.inject(MyMetaStore, storeInstance);
48590
48580
  onCellClicked: { type: Function, optional: true },
48591
48581
  onCellRightClicked: { type: Function, optional: true },
48592
48582
  onGridResized: { type: Function, optional: true },
48593
- onFigureDeleted: { type: Function, optional: true },
48594
48583
  onGridMoved: Function,
48595
48584
  gridOverlayDimensions: String,
48596
48585
  };
@@ -48606,7 +48595,6 @@ stores.inject(MyMetaStore, storeInstance);
48606
48595
  onCellClicked: () => { },
48607
48596
  onCellRightClicked: () => { },
48608
48597
  onGridResized: () => { },
48609
- onFigureDeleted: () => { },
48610
48598
  };
48611
48599
  gridOverlay = owl.useRef("gridOverlay");
48612
48600
  gridOverlayRect = useAbsoluteBoundingRect(this.gridOverlay);
@@ -48767,7 +48755,10 @@ stores.inject(MyMetaStore, storeInstance);
48767
48755
  this.state.waitingForMove = false;
48768
48756
  }
48769
48757
  onMouseMove(ev) {
48770
- if (this.state.isResizing || this.state.isMoving || this.state.isSelecting) {
48758
+ if (this.env.model.getters.isReadonly() ||
48759
+ this.state.isResizing ||
48760
+ this.state.isMoving ||
48761
+ this.state.isSelecting) {
48771
48762
  return;
48772
48763
  }
48773
48764
  this._computeHandleDisplay(ev);
@@ -48820,6 +48811,10 @@ stores.inject(MyMetaStore, storeInstance);
48820
48811
  if (index < 0) {
48821
48812
  return;
48822
48813
  }
48814
+ if (this.env.model.getters.isReadonly()) {
48815
+ this._selectElement(index, false);
48816
+ return;
48817
+ }
48823
48818
  if (this.state.waitingForMove === true) {
48824
48819
  if (!this.env.model.getters.isGridSelectionActive()) {
48825
48820
  this._selectElement(index, false);
@@ -50462,24 +50457,24 @@ stores.inject(MyMetaStore, storeInstance);
50462
50457
  const MIN_SHEET_VIEW_WIDTH = 150;
50463
50458
  class SidePanelStore extends SpreadsheetStore {
50464
50459
  mutators = ["open", "toggle", "close", "changePanelSize", "resetPanelSize"];
50465
- initialPanelProps = {};
50460
+ currentPanelProps = {};
50466
50461
  componentTag = "";
50467
50462
  panelSize = DEFAULT_SIDE_PANEL_SIZE;
50468
50463
  get isOpen() {
50469
50464
  if (!this.componentTag) {
50470
50465
  return false;
50471
50466
  }
50472
- return this.computeState(this.componentTag, this.initialPanelProps).isOpen;
50467
+ return this.computeState(this.componentTag, this.currentPanelProps).isOpen;
50473
50468
  }
50474
50469
  get panelProps() {
50475
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50470
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50476
50471
  if (state.isOpen) {
50477
50472
  return state.props ?? {};
50478
50473
  }
50479
50474
  return {};
50480
50475
  }
50481
50476
  get panelKey() {
50482
- const state = this.computeState(this.componentTag, this.initialPanelProps);
50477
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
50483
50478
  if (state.isOpen) {
50484
50479
  return state.key;
50485
50480
  }
@@ -50491,10 +50486,10 @@ stores.inject(MyMetaStore, storeInstance);
50491
50486
  return;
50492
50487
  }
50493
50488
  if (this.isOpen && componentTag !== this.componentTag) {
50494
- this.initialPanelProps?.onCloseSidePanel?.();
50489
+ this.currentPanelProps?.onCloseSidePanel?.();
50495
50490
  }
50496
50491
  this.componentTag = componentTag;
50497
- this.initialPanelProps = state.props ?? {};
50492
+ this.currentPanelProps = state.props ?? {};
50498
50493
  }
50499
50494
  toggle(componentTag, panelProps) {
50500
50495
  if (this.isOpen && componentTag === this.componentTag) {
@@ -50505,8 +50500,8 @@ stores.inject(MyMetaStore, storeInstance);
50505
50500
  }
50506
50501
  }
50507
50502
  close() {
50508
- this.initialPanelProps.onCloseSidePanel?.();
50509
- this.initialPanelProps = {};
50503
+ this.currentPanelProps.onCloseSidePanel?.();
50504
+ this.currentPanelProps = {};
50510
50505
  this.componentTag = "";
50511
50506
  }
50512
50507
  changePanelSize(size, spreadsheetElWidth) {
@@ -50532,7 +50527,11 @@ stores.inject(MyMetaStore, storeInstance);
50532
50527
  };
50533
50528
  }
50534
50529
  else {
50535
- return customComputeState(this.getters, panelProps);
50530
+ const state = customComputeState(this.getters, panelProps);
50531
+ if (state.isOpen) {
50532
+ this.currentPanelProps = state.props ?? this.currentPanelProps;
50533
+ }
50534
+ return state;
50536
50535
  }
50537
50536
  }
50538
50537
  }
@@ -57387,10 +57386,17 @@ stores.inject(MyMetaStore, storeInstance);
57387
57386
  if (!pivot) {
57388
57387
  continue;
57389
57388
  }
57390
- for (const measure of pivot.definition.measures) {
57389
+ const def = deepCopy(pivot.definition);
57390
+ for (const measure of def.measures) {
57391
57391
  if (measure.computedBy?.formula === formulaString) {
57392
- const measureIndex = pivot.definition.measures.indexOf(measure);
57393
- this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
57392
+ const measureIndex = def.measures.indexOf(measure);
57393
+ if (measureIndex !== -1) {
57394
+ def.measures[measureIndex].computedBy = {
57395
+ formula: newFormulaString,
57396
+ sheetId,
57397
+ };
57398
+ }
57399
+ this.dispatch("UPDATE_PIVOT", { pivotId, pivot: def });
57394
57400
  }
57395
57401
  }
57396
57402
  }
@@ -57523,6 +57529,9 @@ stores.inject(MyMetaStore, storeInstance);
57523
57529
  const { sheetId, zone } = definition.dataSet;
57524
57530
  const range = this.getters.getRangeFromZone(sheetId, zone);
57525
57531
  const adaptedRange = adaptPivotRange(range, applyChange);
57532
+ if (adaptedRange === range) {
57533
+ return;
57534
+ }
57526
57535
  const dataSet = adaptedRange && {
57527
57536
  sheetId: adaptedRange.sheetId,
57528
57537
  zone: adaptedRange.zone,
@@ -61278,9 +61287,7 @@ stores.inject(MyMetaStore, storeInstance);
61278
61287
  handle(cmd) {
61279
61288
  if (invalidateEvaluationCommands.has(cmd.type)) {
61280
61289
  for (const pivotId of this.getters.getPivotIds()) {
61281
- if (!pivotRegistry.get(this.getters.getPivotCoreDefinition(pivotId).type).externalData) {
61282
- this.setupPivot(pivotId, { recreate: true });
61283
- }
61290
+ this.setupPivot(pivotId, { recreate: true });
61284
61291
  }
61285
61292
  }
61286
61293
  switch (cmd.type) {
@@ -61485,7 +61492,7 @@ stores.inject(MyMetaStore, storeInstance);
61485
61492
  pivot.init({ reload: true });
61486
61493
  }
61487
61494
  setupPivot(pivotId, { recreate } = { recreate: false }) {
61488
- const definition = this.getters.getPivotCoreDefinition(pivotId);
61495
+ const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
61489
61496
  if (!(pivotId in this.pivots)) {
61490
61497
  const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
61491
61498
  this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
@@ -70279,7 +70286,7 @@ stores.inject(MyMetaStore, storeInstance);
70279
70286
  document.activeElement?.contains(this.spreadsheetRef.el)) {
70280
70287
  this.focusGrid();
70281
70288
  }
70282
- }, () => [this.env.model.getters.getActiveSheetId()]);
70289
+ });
70283
70290
  owl.useExternalListener(window, "resize", () => this.render(true));
70284
70291
  // For some reason, the wheel event is not properly registered inside templates
70285
70292
  // in Chromium-based browsers based on chromium 125
@@ -74762,9 +74769,9 @@ stores.inject(MyMetaStore, storeInstance);
74762
74769
  exports.tokenize = tokenize;
74763
74770
 
74764
74771
 
74765
- __info__.version = "18.0.48";
74766
- __info__.date = "2025-11-12T14:15:38.406Z";
74767
- __info__.hash = "d1efb0b";
74772
+ __info__.version = "18.0.50";
74773
+ __info__.date = "2025-12-02T05:32:00.480Z";
74774
+ __info__.hash = "7ed20c4";
74768
74775
 
74769
74776
 
74770
74777
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);