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