@odoo/o-spreadsheet 17.0.14 → 17.0.15

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 17.0.14
6
- * @date 2024-03-12T07:56:15.364Z
7
- * @hash 6f6e1b9
5
+ * @version 17.0.15
6
+ * @date 2024-03-15T11:00:59.958Z
7
+ * @hash e02add9
8
8
  */
9
9
 
10
10
  'use strict';
@@ -27544,7 +27544,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
27544
27544
  function clamp(value, min, max) {
27545
27545
  return Math.min(Math.max(value, min), max);
27546
27546
  }
27547
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
27547
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
27548
27548
  let { x, y, width, height } = initialFigure;
27549
27549
  if (keepRatio && dirX != 0 && dirY != 0) {
27550
27550
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -27571,14 +27571,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
27571
27571
  y = initialFigure.y - deltaY;
27572
27572
  }
27573
27573
  }
27574
- // Restrict resizing if x or y reaches header boundaries
27575
- if (x < 0) {
27576
- width += x;
27577
- x = 0;
27574
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
27575
+ if (x + scrollX <= 0) {
27576
+ width = width + x + scrollX;
27577
+ x = -scrollX;
27578
27578
  }
27579
- if (y < 0) {
27580
- height += y;
27581
- y = 0;
27579
+ if (y + scrollY <= 0) {
27580
+ height = height + y + scrollY;
27581
+ y = -scrollY;
27582
27582
  }
27583
27583
  return { ...initialFigure, x, y, width, height };
27584
27584
  }
@@ -27995,7 +27995,7 @@ class FiguresContainer extends owl.Component {
27995
27995
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
27996
27996
  const onMouseMove = (ev) => {
27997
27997
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
27998
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
27998
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
27999
27999
  const otherFigures = this.getOtherFigures(figure.id);
28000
28000
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
28001
28001
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -36825,6 +36825,15 @@ class FigurePlugin extends CorePlugin {
36825
36825
  return "Success" /* CommandResult.Success */;
36826
36826
  }
36827
36827
  }
36828
+ beforeHandle(cmd) {
36829
+ switch (cmd.type) {
36830
+ case "DELETE_SHEET":
36831
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
36832
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
36833
+ });
36834
+ break;
36835
+ }
36836
+ }
36828
36837
  handle(cmd) {
36829
36838
  switch (cmd.type) {
36830
36839
  case "CREATE_SHEET":
@@ -51182,6 +51191,9 @@ class BottomBarSheet extends owl.Component {
51182
51191
  this.scrollToSheet();
51183
51192
  }
51184
51193
  onDblClick() {
51194
+ if (this.env.model.getters.isReadonly()) {
51195
+ return;
51196
+ }
51185
51197
  this.startEdition();
51186
51198
  }
51187
51199
  onKeyDown(ev) {
@@ -56956,6 +56968,6 @@ exports.setTranslationMethod = setTranslationMethod;
56956
56968
  exports.tokenize = tokenize;
56957
56969
 
56958
56970
 
56959
- __info__.version = "17.0.14";
56960
- __info__.date = "2024-03-12T07:56:15.364Z";
56961
- __info__.hash = "6f6e1b9";
56971
+ __info__.version = "17.0.15";
56972
+ __info__.date = "2024-03-15T11:00:59.958Z";
56973
+ __info__.hash = "e02add9";
@@ -3660,6 +3660,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
3660
3660
  [sheet: string]: Record<UID, Figure | undefined> | undefined;
3661
3661
  };
3662
3662
  allowDispatch(cmd: CoreCommand): CommandResult;
3663
+ beforeHandle(cmd: CoreCommand): void;
3663
3664
  handle(cmd: CoreCommand): void;
3664
3665
  private onRowColDelete;
3665
3666
  private onRowDeletion;
@@ -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 17.0.14
6
- * @date 2024-03-12T07:56:15.364Z
7
- * @hash 6f6e1b9
5
+ * @version 17.0.15
6
+ * @date 2024-03-15T11:00:59.958Z
7
+ * @hash e02add9
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -27542,7 +27542,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
27542
27542
  function clamp(value, min, max) {
27543
27543
  return Math.min(Math.max(value, min), max);
27544
27544
  }
27545
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
27545
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
27546
27546
  let { x, y, width, height } = initialFigure;
27547
27547
  if (keepRatio && dirX != 0 && dirY != 0) {
27548
27548
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -27569,14 +27569,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
27569
27569
  y = initialFigure.y - deltaY;
27570
27570
  }
27571
27571
  }
27572
- // Restrict resizing if x or y reaches header boundaries
27573
- if (x < 0) {
27574
- width += x;
27575
- x = 0;
27572
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
27573
+ if (x + scrollX <= 0) {
27574
+ width = width + x + scrollX;
27575
+ x = -scrollX;
27576
27576
  }
27577
- if (y < 0) {
27578
- height += y;
27579
- y = 0;
27577
+ if (y + scrollY <= 0) {
27578
+ height = height + y + scrollY;
27579
+ y = -scrollY;
27580
27580
  }
27581
27581
  return { ...initialFigure, x, y, width, height };
27582
27582
  }
@@ -27993,7 +27993,7 @@ class FiguresContainer extends Component {
27993
27993
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
27994
27994
  const onMouseMove = (ev) => {
27995
27995
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
27996
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
27996
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
27997
27997
  const otherFigures = this.getOtherFigures(figure.id);
27998
27998
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
27999
27999
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -36823,6 +36823,15 @@ class FigurePlugin extends CorePlugin {
36823
36823
  return "Success" /* CommandResult.Success */;
36824
36824
  }
36825
36825
  }
36826
+ beforeHandle(cmd) {
36827
+ switch (cmd.type) {
36828
+ case "DELETE_SHEET":
36829
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
36830
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
36831
+ });
36832
+ break;
36833
+ }
36834
+ }
36826
36835
  handle(cmd) {
36827
36836
  switch (cmd.type) {
36828
36837
  case "CREATE_SHEET":
@@ -51180,6 +51189,9 @@ class BottomBarSheet extends Component {
51180
51189
  this.scrollToSheet();
51181
51190
  }
51182
51191
  onDblClick() {
51192
+ if (this.env.model.getters.isReadonly()) {
51193
+ return;
51194
+ }
51183
51195
  this.startEdition();
51184
51196
  }
51185
51197
  onKeyDown(ev) {
@@ -56919,6 +56931,6 @@ const constants = {
56919
56931
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
56920
56932
 
56921
56933
 
56922
- __info__.version = "17.0.14";
56923
- __info__.date = "2024-03-12T07:56:15.364Z";
56924
- __info__.hash = "6f6e1b9";
56934
+ __info__.version = "17.0.15";
56935
+ __info__.date = "2024-03-15T11:00:59.958Z";
56936
+ __info__.hash = "e02add9";
@@ -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 17.0.14
6
- * @date 2024-03-12T07:56:15.364Z
7
- * @hash 6f6e1b9
5
+ * @version 17.0.15
6
+ * @date 2024-03-15T11:00:59.958Z
7
+ * @hash e02add9
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -27543,7 +27543,7 @@
27543
27543
  function clamp(value, min, max) {
27544
27544
  return Math.min(Math.max(value, min), max);
27545
27545
  }
27546
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
27546
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
27547
27547
  let { x, y, width, height } = initialFigure;
27548
27548
  if (keepRatio && dirX != 0 && dirY != 0) {
27549
27549
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -27570,14 +27570,14 @@
27570
27570
  y = initialFigure.y - deltaY;
27571
27571
  }
27572
27572
  }
27573
- // Restrict resizing if x or y reaches header boundaries
27574
- if (x < 0) {
27575
- width += x;
27576
- x = 0;
27573
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
27574
+ if (x + scrollX <= 0) {
27575
+ width = width + x + scrollX;
27576
+ x = -scrollX;
27577
27577
  }
27578
- if (y < 0) {
27579
- height += y;
27580
- y = 0;
27578
+ if (y + scrollY <= 0) {
27579
+ height = height + y + scrollY;
27580
+ y = -scrollY;
27581
27581
  }
27582
27582
  return { ...initialFigure, x, y, width, height };
27583
27583
  }
@@ -27994,7 +27994,7 @@
27994
27994
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
27995
27995
  const onMouseMove = (ev) => {
27996
27996
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
27997
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
27997
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
27998
27998
  const otherFigures = this.getOtherFigures(figure.id);
27999
27999
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
28000
28000
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -36824,6 +36824,15 @@
36824
36824
  return "Success" /* CommandResult.Success */;
36825
36825
  }
36826
36826
  }
36827
+ beforeHandle(cmd) {
36828
+ switch (cmd.type) {
36829
+ case "DELETE_SHEET":
36830
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
36831
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
36832
+ });
36833
+ break;
36834
+ }
36835
+ }
36827
36836
  handle(cmd) {
36828
36837
  switch (cmd.type) {
36829
36838
  case "CREATE_SHEET":
@@ -51181,6 +51190,9 @@
51181
51190
  this.scrollToSheet();
51182
51191
  }
51183
51192
  onDblClick() {
51193
+ if (this.env.model.getters.isReadonly()) {
51194
+ return;
51195
+ }
51184
51196
  this.startEdition();
51185
51197
  }
51186
51198
  onKeyDown(ev) {
@@ -56955,9 +56967,9 @@
56955
56967
  exports.tokenize = tokenize;
56956
56968
 
56957
56969
 
56958
- __info__.version = "17.0.14";
56959
- __info__.date = "2024-03-12T07:56:15.364Z";
56960
- __info__.hash = "6f6e1b9";
56970
+ __info__.version = "17.0.15";
56971
+ __info__.date = "2024-03-15T11:00:59.958Z";
56972
+ __info__.hash = "e02add9";
56961
56973
 
56962
56974
 
56963
56975
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);