@odoo/o-spreadsheet 18.0.49 → 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.49
6
- * @date 2025-11-24T07:40:04.646Z
7
- * @hash b4ef5b7
5
+ * @version 18.0.50
6
+ * @date 2025-12-02T05:32:00.480Z
7
+ * @hash 7ed20c4
8
8
  */
9
9
 
10
10
  'use strict';
@@ -3272,7 +3272,6 @@ const invalidateEvaluationCommands = new Set([
3272
3272
  "REDO",
3273
3273
  "ADD_MERGE",
3274
3274
  "REMOVE_MERGE",
3275
- "DUPLICATE_SHEET",
3276
3275
  "UPDATE_LOCALE",
3277
3276
  "ADD_PIVOT",
3278
3277
  "UPDATE_PIVOT",
@@ -31849,7 +31848,6 @@ class ChartFigure extends owl.Component {
31849
31848
  static template = "o-spreadsheet-ChartFigure";
31850
31849
  static props = {
31851
31850
  figure: Object,
31852
- onFigureDeleted: Function,
31853
31851
  };
31854
31852
  static components = {};
31855
31853
  onDoubleClick() {
@@ -31873,7 +31871,6 @@ class ImageFigure extends owl.Component {
31873
31871
  static template = "o-spreadsheet-ImageFigure";
31874
31872
  static props = {
31875
31873
  figure: Object,
31876
- onFigureDeleted: Function,
31877
31874
  };
31878
31875
  static components = {};
31879
31876
  // ---------------------------------------------------------------------------
@@ -31931,7 +31928,7 @@ figureRegistry.add("image", {
31931
31928
  borderWidth: 0,
31932
31929
  menuBuilder: getImageMenuRegistry,
31933
31930
  });
31934
- function getChartMenu(figureId, onFigureDeleted, env) {
31931
+ function getChartMenu(figureId, env) {
31935
31932
  const menuItemSpecs = [
31936
31933
  {
31937
31934
  id: "edit",
@@ -31945,11 +31942,11 @@ function getChartMenu(figureId, onFigureDeleted, env) {
31945
31942
  },
31946
31943
  getCopyMenuItem(figureId, env),
31947
31944
  getCutMenuItem(figureId, env),
31948
- getDeleteMenuItem(figureId, onFigureDeleted, env),
31945
+ getDeleteMenuItem(figureId, env),
31949
31946
  ];
31950
31947
  return createActions(menuItemSpecs);
31951
31948
  }
31952
- function getImageMenuRegistry(figureId, onFigureDeleted, env) {
31949
+ function getImageMenuRegistry(figureId, env) {
31953
31950
  const menuItemSpecs = [
31954
31951
  getCopyMenuItem(figureId, env),
31955
31952
  getCutMenuItem(figureId, env),
@@ -31975,7 +31972,7 @@ function getImageMenuRegistry(figureId, onFigureDeleted, env) {
31975
31972
  },
31976
31973
  icon: "o-spreadsheet-Icon.REFRESH",
31977
31974
  },
31978
- getDeleteMenuItem(figureId, onFigureDeleted, env),
31975
+ getDeleteMenuItem(figureId, env),
31979
31976
  ];
31980
31977
  return createActions(menuItemSpecs);
31981
31978
  }
@@ -32007,7 +32004,7 @@ function getCutMenuItem(figureId, env) {
32007
32004
  icon: "o-spreadsheet-Icon.CUT",
32008
32005
  };
32009
32006
  }
32010
- function getDeleteMenuItem(figureId, onFigureDeleted, env) {
32007
+ function getDeleteMenuItem(figureId, env) {
32011
32008
  return {
32012
32009
  id: "delete",
32013
32010
  name: _t("Delete"),
@@ -32017,7 +32014,6 @@ function getDeleteMenuItem(figureId, onFigureDeleted, env) {
32017
32014
  sheetId: env.model.getters.getActiveSheetId(),
32018
32015
  id: figureId,
32019
32016
  });
32020
- onFigureDeleted();
32021
32017
  },
32022
32018
  icon: "o-spreadsheet-Icon.TRASH",
32023
32019
  };
@@ -39380,7 +39376,7 @@ class AbstractComposerStore extends SpreadsheetStore {
39380
39376
  }
39381
39377
  this.selectionStart = start;
39382
39378
  this.selectionEnd = end;
39383
- this.editionMode = "editing";
39379
+ this.stopComposerRangeSelection();
39384
39380
  }
39385
39381
  stopComposerRangeSelection() {
39386
39382
  if (this.isSelectingRange) {
@@ -44990,7 +44986,6 @@ const dateGranularities = [
44990
44986
  pivotRegistry.add("SPREADSHEET", {
44991
44987
  ui: SpreadsheetPivot,
44992
44988
  definition: SpreadsheetPivotRuntimeDefinition,
44993
- externalData: false,
44994
44989
  dateGranularities: [...dateGranularities],
44995
44990
  datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
44996
44991
  isMeasureCandidate: (field) => !["datetime", "boolean"].includes(field.type),
@@ -46611,13 +46606,11 @@ class FigureComponent extends owl.Component {
46611
46606
  static props = {
46612
46607
  figure: Object,
46613
46608
  style: { type: String, optional: true },
46614
- onFigureDeleted: { type: Function, optional: true },
46615
46609
  onMouseDown: { type: Function, optional: true },
46616
46610
  onClickAnchor: { type: Function, optional: true },
46617
46611
  };
46618
46612
  static components = { Menu };
46619
46613
  static defaultProps = {
46620
- onFigureDeleted: () => { },
46621
46614
  onMouseDown: () => { },
46622
46615
  onClickAnchor: () => { },
46623
46616
  };
@@ -46691,9 +46684,6 @@ class FigureComponent extends owl.Component {
46691
46684
  el?.focus({ preventScroll: true });
46692
46685
  }
46693
46686
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
46694
- owl.onWillUnmount(() => {
46695
- this.props.onFigureDeleted();
46696
- });
46697
46687
  }
46698
46688
  clickAnchor(dirX, dirY, ev) {
46699
46689
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -46711,7 +46701,6 @@ class FigureComponent extends owl.Component {
46711
46701
  sheetId: this.env.model.getters.getActiveSheetId(),
46712
46702
  id: figure.id,
46713
46703
  });
46714
- this.props.onFigureDeleted();
46715
46704
  ev.preventDefault();
46716
46705
  ev.stopPropagation();
46717
46706
  break;
@@ -46775,7 +46764,7 @@ class FigureComponent extends owl.Component {
46775
46764
  this.menuState.position = position;
46776
46765
  this.menuState.menuItems = figureRegistry
46777
46766
  .get(this.props.figure.tag)
46778
- .menuBuilder(this.props.figure.id, this.props.onFigureDeleted, this.env);
46767
+ .menuBuilder(this.props.figure.id, this.env);
46779
46768
  }
46780
46769
  }
46781
46770
 
@@ -47975,9 +47964,7 @@ css /*SCSS*/ `
47975
47964
  */
47976
47965
  class FiguresContainer extends owl.Component {
47977
47966
  static template = "o-spreadsheet-FiguresContainer";
47978
- static props = {
47979
- onFigureDeleted: Function,
47980
- };
47967
+ static props = {};
47981
47968
  static components = { FigureComponent };
47982
47969
  dnd = owl.useState({
47983
47970
  draggedFigure: undefined,
@@ -48334,16 +48321,16 @@ css /* scss */ `
48334
48321
  `;
48335
48322
  class GridAddRowsFooter extends owl.Component {
48336
48323
  static template = "o-spreadsheet-GridAddRowsFooter";
48337
- static props = {
48338
- focusGrid: Function,
48339
- };
48324
+ static props = {};
48340
48325
  static components = { ValidationMessages };
48326
+ DOMFocusableElementStore;
48341
48327
  inputRef = owl.useRef("inputRef");
48342
48328
  state = owl.useState({
48343
48329
  inputValue: "100",
48344
48330
  errorFlag: false,
48345
48331
  });
48346
48332
  setup() {
48333
+ this.DOMFocusableElementStore = useStore(DOMFocusableElementStore);
48347
48334
  owl.useExternalListener(window, "click", this.onExternalClick, { capture: true });
48348
48335
  }
48349
48336
  get addRowsPosition() {
@@ -48361,7 +48348,7 @@ class GridAddRowsFooter extends owl.Component {
48361
48348
  }
48362
48349
  onKeydown(ev) {
48363
48350
  if (ev.key.toUpperCase() === "ESCAPE") {
48364
- this.props.focusGrid();
48351
+ this.focusDefaultElement();
48365
48352
  }
48366
48353
  else if (ev.key.toUpperCase() === "ENTER") {
48367
48354
  this.onConfirm();
@@ -48387,7 +48374,7 @@ class GridAddRowsFooter extends owl.Component {
48387
48374
  quantity,
48388
48375
  dimension: "ROW",
48389
48376
  });
48390
- this.props.focusGrid();
48377
+ this.focusDefaultElement();
48391
48378
  // After adding new rows, scroll down to the new last row
48392
48379
  const { scrollX } = this.env.model.getters.getActiveSheetDOMScrollInfo();
48393
48380
  const { end } = this.env.model.getters.getRowDimensions(activeSheetId, rowNumber + quantity - 1);
@@ -48400,7 +48387,12 @@ class GridAddRowsFooter extends owl.Component {
48400
48387
  if (this.inputRef.el !== document.activeElement || ev.target === this.inputRef.el) {
48401
48388
  return;
48402
48389
  }
48403
- this.props.focusGrid();
48390
+ this.focusDefaultElement();
48391
+ }
48392
+ focusDefaultElement() {
48393
+ if (document.activeElement === this.inputRef.el) {
48394
+ this.DOMFocusableElementStore.focus();
48395
+ }
48404
48396
  }
48405
48397
  }
48406
48398
 
@@ -48589,7 +48581,6 @@ class GridOverlay extends owl.Component {
48589
48581
  onCellClicked: { type: Function, optional: true },
48590
48582
  onCellRightClicked: { type: Function, optional: true },
48591
48583
  onGridResized: { type: Function, optional: true },
48592
- onFigureDeleted: { type: Function, optional: true },
48593
48584
  onGridMoved: Function,
48594
48585
  gridOverlayDimensions: String,
48595
48586
  };
@@ -48605,7 +48596,6 @@ class GridOverlay extends owl.Component {
48605
48596
  onCellClicked: () => { },
48606
48597
  onCellRightClicked: () => { },
48607
48598
  onGridResized: () => { },
48608
- onFigureDeleted: () => { },
48609
48599
  };
48610
48600
  gridOverlay = owl.useRef("gridOverlay");
48611
48601
  gridOverlayRect = useAbsoluteBoundingRect(this.gridOverlay);
@@ -57397,10 +57387,17 @@ class PivotCorePlugin extends CorePlugin {
57397
57387
  if (!pivot) {
57398
57388
  continue;
57399
57389
  }
57400
- for (const measure of pivot.definition.measures) {
57390
+ const def = deepCopy(pivot.definition);
57391
+ for (const measure of def.measures) {
57401
57392
  if (measure.computedBy?.formula === formulaString) {
57402
- const measureIndex = pivot.definition.measures.indexOf(measure);
57403
- this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
57393
+ const measureIndex = def.measures.indexOf(measure);
57394
+ if (measureIndex !== -1) {
57395
+ def.measures[measureIndex].computedBy = {
57396
+ formula: newFormulaString,
57397
+ sheetId,
57398
+ };
57399
+ }
57400
+ this.dispatch("UPDATE_PIVOT", { pivotId, pivot: def });
57404
57401
  }
57405
57402
  }
57406
57403
  }
@@ -57533,6 +57530,9 @@ class SpreadsheetPivotCorePlugin extends CorePlugin {
57533
57530
  const { sheetId, zone } = definition.dataSet;
57534
57531
  const range = this.getters.getRangeFromZone(sheetId, zone);
57535
57532
  const adaptedRange = adaptPivotRange(range, applyChange);
57533
+ if (adaptedRange === range) {
57534
+ return;
57535
+ }
57536
57536
  const dataSet = adaptedRange && {
57537
57537
  sheetId: adaptedRange.sheetId,
57538
57538
  zone: adaptedRange.zone,
@@ -61288,9 +61288,7 @@ class PivotUIPlugin extends UIPlugin {
61288
61288
  handle(cmd) {
61289
61289
  if (invalidateEvaluationCommands.has(cmd.type)) {
61290
61290
  for (const pivotId of this.getters.getPivotIds()) {
61291
- if (!pivotRegistry.get(this.getters.getPivotCoreDefinition(pivotId).type).externalData) {
61292
- this.setupPivot(pivotId, { recreate: true });
61293
- }
61291
+ this.setupPivot(pivotId, { recreate: true });
61294
61292
  }
61295
61293
  }
61296
61294
  switch (cmd.type) {
@@ -61495,7 +61493,7 @@ class PivotUIPlugin extends UIPlugin {
61495
61493
  pivot.init({ reload: true });
61496
61494
  }
61497
61495
  setupPivot(pivotId, { recreate } = { recreate: false }) {
61498
- const definition = this.getters.getPivotCoreDefinition(pivotId);
61496
+ const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
61499
61497
  if (!(pivotId in this.pivots)) {
61500
61498
  const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
61501
61499
  this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
@@ -70289,7 +70287,7 @@ class Spreadsheet extends owl.Component {
70289
70287
  document.activeElement?.contains(this.spreadsheetRef.el)) {
70290
70288
  this.focusGrid();
70291
70289
  }
70292
- }, () => [this.env.model.getters.getActiveSheetId()]);
70290
+ });
70293
70291
  owl.useExternalListener(window, "resize", () => this.render(true));
70294
70292
  // For some reason, the wheel event is not properly registered inside templates
70295
70293
  // in Chromium-based browsers based on chromium 125
@@ -74772,6 +74770,6 @@ exports.tokenColors = tokenColors;
74772
74770
  exports.tokenize = tokenize;
74773
74771
 
74774
74772
 
74775
- __info__.version = "18.0.49";
74776
- __info__.date = "2025-11-24T07:40:04.646Z";
74777
- __info__.hash = "b4ef5b7";
74773
+ __info__.version = "18.0.50";
74774
+ __info__.date = "2025-12-02T05:32:00.480Z";
74775
+ __info__.hash = "7ed20c4";
@@ -6189,7 +6189,6 @@ type PivotDefinitionConstructor = new (definition: PivotCoreDefinition, fields:
6189
6189
  interface PivotRegistryItem {
6190
6190
  ui: PivotUIConstructor;
6191
6191
  definition: PivotDefinitionConstructor;
6192
- externalData: boolean;
6193
6192
  dateGranularities: string[];
6194
6193
  datetimeGranularities: string[];
6195
6194
  isMeasureCandidate: (field: PivotField) => boolean;
@@ -7705,7 +7704,7 @@ interface ChartSidePanel {
7705
7704
  */
7706
7705
  interface FigureContent {
7707
7706
  Component: any;
7708
- menuBuilder: (figureId: UID, onFigureDeleted: () => void, env: SpreadsheetChildEnv) => Action[];
7707
+ menuBuilder: (figureId: UID, env: SpreadsheetChildEnv) => Action[];
7709
7708
  SidePanelComponent?: string;
7710
7709
  keepRatio?: boolean;
7711
7710
  minFigSize?: number;
@@ -8432,7 +8431,6 @@ type ResizeAnchor = "top left" | "top" | "top right" | "right" | "bottom right"
8432
8431
  interface Props$K {
8433
8432
  figure: Figure;
8434
8433
  style: string;
8435
- onFigureDeleted: () => void;
8436
8434
  onMouseDown: (ev: MouseEvent) => void;
8437
8435
  onClickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
8438
8436
  }
@@ -8444,10 +8442,6 @@ declare class FigureComponent extends Component<Props$K, SpreadsheetChildEnv> {
8444
8442
  type: StringConstructor;
8445
8443
  optional: boolean;
8446
8444
  };
8447
- onFigureDeleted: {
8448
- type: FunctionConstructor;
8449
- optional: boolean;
8450
- };
8451
8445
  onMouseDown: {
8452
8446
  type: FunctionConstructor;
8453
8447
  optional: boolean;
@@ -8461,7 +8455,6 @@ declare class FigureComponent extends Component<Props$K, SpreadsheetChildEnv> {
8461
8455
  Menu: typeof Menu;
8462
8456
  };
8463
8457
  static defaultProps: {
8464
- onFigureDeleted: () => void;
8465
8458
  onMouseDown: () => void;
8466
8459
  onClickAnchor: () => void;
8467
8460
  };
@@ -8487,13 +8480,11 @@ declare class FigureComponent extends Component<Props$K, SpreadsheetChildEnv> {
8487
8480
 
8488
8481
  interface Props$J {
8489
8482
  figure: Figure;
8490
- onFigureDeleted: () => void;
8491
8483
  }
8492
8484
  declare class ChartFigure extends Component<Props$J, SpreadsheetChildEnv> {
8493
8485
  static template: string;
8494
8486
  static props: {
8495
8487
  figure: ObjectConstructor;
8496
- onFigureDeleted: FunctionConstructor;
8497
8488
  };
8498
8489
  static components: {};
8499
8490
  onDoubleClick(): void;
@@ -8664,7 +8655,6 @@ interface SnapLine<T extends HFigureAxisType | VFigureAxisType> {
8664
8655
 
8665
8656
  type ContainerType = "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "dnd";
8666
8657
  interface Props$E {
8667
- onFigureDeleted: () => void;
8668
8658
  }
8669
8659
  interface Container {
8670
8660
  type: ContainerType;
@@ -8745,9 +8735,7 @@ interface DndState {
8745
8735
  */
8746
8736
  declare class FiguresContainer extends Component<Props$E, SpreadsheetChildEnv> {
8747
8737
  static template: string;
8748
- static props: {
8749
- onFigureDeleted: FunctionConstructor;
8750
- };
8738
+ static props: {};
8751
8739
  static components: {
8752
8740
  FigureComponent: typeof FigureComponent;
8753
8741
  };
@@ -8824,16 +8812,14 @@ declare class FilterIconsOverlay extends Component<{}, SpreadsheetChildEnv> {
8824
8812
  }
8825
8813
 
8826
8814
  interface Props$C {
8827
- focusGrid: () => void;
8828
8815
  }
8829
8816
  declare class GridAddRowsFooter extends Component<Props$C, SpreadsheetChildEnv> {
8830
8817
  static template: string;
8831
- static props: {
8832
- focusGrid: FunctionConstructor;
8833
- };
8818
+ static props: {};
8834
8819
  static components: {
8835
8820
  ValidationMessages: typeof ValidationMessages;
8836
8821
  };
8822
+ private DOMFocusableElementStore;
8837
8823
  inputRef: {
8838
8824
  el: HTMLInputElement | null;
8839
8825
  };
@@ -8848,6 +8834,7 @@ declare class GridAddRowsFooter extends Component<Props$C, SpreadsheetChildEnv>
8848
8834
  onInput(ev: InputEvent): void;
8849
8835
  onConfirm(): void;
8850
8836
  private onExternalClick;
8837
+ private focusDefaultElement;
8851
8838
  }
8852
8839
 
8853
8840
  interface Props$B {
@@ -8858,7 +8845,6 @@ interface Props$B {
8858
8845
  onGridResized: (dimension: Rect) => void;
8859
8846
  onGridMoved: (deltaX: Pixel, deltaY: Pixel) => void;
8860
8847
  gridOverlayDimensions: string;
8861
- onFigureDeleted: () => void;
8862
8848
  }
8863
8849
  declare class GridOverlay extends Component<Props$B, SpreadsheetChildEnv> {
8864
8850
  static template: string;
@@ -8883,10 +8869,6 @@ declare class GridOverlay extends Component<Props$B, SpreadsheetChildEnv> {
8883
8869
  type: FunctionConstructor;
8884
8870
  optional: boolean;
8885
8871
  };
8886
- onFigureDeleted: {
8887
- type: FunctionConstructor;
8888
- optional: boolean;
8889
- };
8890
8872
  onGridMoved: FunctionConstructor;
8891
8873
  gridOverlayDimensions: StringConstructor;
8892
8874
  };
@@ -8902,7 +8884,6 @@ declare class GridOverlay extends Component<Props$B, SpreadsheetChildEnv> {
8902
8884
  onCellClicked: () => void;
8903
8885
  onCellRightClicked: () => void;
8904
8886
  onGridResized: () => void;
8905
- onFigureDeleted: () => void;
8906
8887
  };
8907
8888
  private gridOverlay;
8908
8889
  private gridOverlayRect;