@odoo/o-spreadsheet 16.4.25 → 16.4.26

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.
@@ -24951,7 +24951,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
24951
24951
  function clamp(value, min, max) {
24952
24952
  return Math.min(Math.max(value, min), max);
24953
24953
  }
24954
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
24954
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
24955
24955
  let { x, y, width, height } = initialFigure;
24956
24956
  if (keepRatio && dirX != 0 && dirY != 0) {
24957
24957
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -24978,14 +24978,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
24978
24978
  y = initialFigure.y - deltaY;
24979
24979
  }
24980
24980
  }
24981
- // Restrict resizing if x or y reaches header boundaries
24982
- if (x < 0) {
24983
- width += x;
24984
- x = 0;
24981
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
24982
+ if (x + scrollX <= 0) {
24983
+ width = width + x + scrollX;
24984
+ x = -scrollX;
24985
24985
  }
24986
- if (y < 0) {
24987
- height += y;
24988
- y = 0;
24986
+ if (y + scrollY <= 0) {
24987
+ height = height + y + scrollY;
24988
+ y = -scrollY;
24989
24989
  }
24990
24990
  return { ...initialFigure, x, y, width, height };
24991
24991
  }
@@ -25402,7 +25402,7 @@ class FiguresContainer extends owl.Component {
25402
25402
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
25403
25403
  const onMouseMove = (ev) => {
25404
25404
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
25405
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
25405
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
25406
25406
  const otherFigures = this.getOtherFigures(figure.id);
25407
25407
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
25408
25408
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -32909,6 +32909,15 @@ class FigurePlugin extends CorePlugin {
32909
32909
  return 0 /* CommandResult.Success */;
32910
32910
  }
32911
32911
  }
32912
+ beforeHandle(cmd) {
32913
+ switch (cmd.type) {
32914
+ case "DELETE_SHEET":
32915
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
32916
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
32917
+ });
32918
+ break;
32919
+ }
32920
+ }
32912
32921
  handle(cmd) {
32913
32922
  switch (cmd.type) {
32914
32923
  case "CREATE_SHEET":
@@ -46100,6 +46109,9 @@ class BottomBarSheet extends owl.Component {
46100
46109
  this.scrollToSheet();
46101
46110
  }
46102
46111
  onDblClick() {
46112
+ if (this.env.model.getters.isReadonly()) {
46113
+ return;
46114
+ }
46103
46115
  this.startEdition();
46104
46116
  }
46105
46117
  onKeyDown(ev) {
@@ -51722,6 +51734,6 @@ exports.setTranslationMethod = setTranslationMethod;
51722
51734
  exports.tokenize = tokenize;
51723
51735
 
51724
51736
 
51725
- __info__.version = '16.4.25';
51726
- __info__.date = '2024-03-12T07:54:10.025Z';
51727
- __info__.hash = '182ad16';
51737
+ __info__.version = '16.4.26';
51738
+ __info__.date = '2024-03-15T10:58:33.088Z';
51739
+ __info__.hash = 'b8caa0f';
@@ -3409,6 +3409,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
3409
3409
  [sheet: string]: Record<UID, Figure | undefined> | undefined;
3410
3410
  };
3411
3411
  allowDispatch(cmd: CoreCommand): CommandResult;
3412
+ beforeHandle(cmd: CoreCommand): void;
3412
3413
  handle(cmd: CoreCommand): void;
3413
3414
  private onRowColDelete;
3414
3415
  private onRowDeletion;
@@ -24947,7 +24947,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
24947
24947
  function clamp(value, min, max) {
24948
24948
  return Math.min(Math.max(value, min), max);
24949
24949
  }
24950
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
24950
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
24951
24951
  let { x, y, width, height } = initialFigure;
24952
24952
  if (keepRatio && dirX != 0 && dirY != 0) {
24953
24953
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -24974,14 +24974,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
24974
24974
  y = initialFigure.y - deltaY;
24975
24975
  }
24976
24976
  }
24977
- // Restrict resizing if x or y reaches header boundaries
24978
- if (x < 0) {
24979
- width += x;
24980
- x = 0;
24977
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
24978
+ if (x + scrollX <= 0) {
24979
+ width = width + x + scrollX;
24980
+ x = -scrollX;
24981
24981
  }
24982
- if (y < 0) {
24983
- height += y;
24984
- y = 0;
24982
+ if (y + scrollY <= 0) {
24983
+ height = height + y + scrollY;
24984
+ y = -scrollY;
24985
24985
  }
24986
24986
  return { ...initialFigure, x, y, width, height };
24987
24987
  }
@@ -25398,7 +25398,7 @@ class FiguresContainer extends Component {
25398
25398
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
25399
25399
  const onMouseMove = (ev) => {
25400
25400
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
25401
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
25401
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
25402
25402
  const otherFigures = this.getOtherFigures(figure.id);
25403
25403
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
25404
25404
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -32905,6 +32905,15 @@ class FigurePlugin extends CorePlugin {
32905
32905
  return 0 /* CommandResult.Success */;
32906
32906
  }
32907
32907
  }
32908
+ beforeHandle(cmd) {
32909
+ switch (cmd.type) {
32910
+ case "DELETE_SHEET":
32911
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
32912
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
32913
+ });
32914
+ break;
32915
+ }
32916
+ }
32908
32917
  handle(cmd) {
32909
32918
  switch (cmd.type) {
32910
32919
  case "CREATE_SHEET":
@@ -46096,6 +46105,9 @@ class BottomBarSheet extends Component {
46096
46105
  this.scrollToSheet();
46097
46106
  }
46098
46107
  onDblClick() {
46108
+ if (this.env.model.getters.isReadonly()) {
46109
+ return;
46110
+ }
46099
46111
  this.startEdition();
46100
46112
  }
46101
46113
  onKeyDown(ev) {
@@ -51686,6 +51698,6 @@ const constants = {
51686
51698
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
51687
51699
 
51688
51700
 
51689
- __info__.version = '16.4.25';
51690
- __info__.date = '2024-03-12T07:54:10.025Z';
51691
- __info__.hash = '182ad16';
51701
+ __info__.version = '16.4.26';
51702
+ __info__.date = '2024-03-15T10:58:33.088Z';
51703
+ __info__.hash = 'b8caa0f';
@@ -24948,7 +24948,7 @@
24948
24948
  function clamp(value, min, max) {
24949
24949
  return Math.min(Math.max(value, min), max);
24950
24950
  }
24951
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
24951
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
24952
24952
  let { x, y, width, height } = initialFigure;
24953
24953
  if (keepRatio && dirX != 0 && dirY != 0) {
24954
24954
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -24975,14 +24975,14 @@
24975
24975
  y = initialFigure.y - deltaY;
24976
24976
  }
24977
24977
  }
24978
- // Restrict resizing if x or y reaches header boundaries
24979
- if (x < 0) {
24980
- width += x;
24981
- x = 0;
24978
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
24979
+ if (x + scrollX <= 0) {
24980
+ width = width + x + scrollX;
24981
+ x = -scrollX;
24982
24982
  }
24983
- if (y < 0) {
24984
- height += y;
24985
- y = 0;
24983
+ if (y + scrollY <= 0) {
24984
+ height = height + y + scrollY;
24985
+ y = -scrollY;
24986
24986
  }
24987
24987
  return { ...initialFigure, x, y, width, height };
24988
24988
  }
@@ -25399,7 +25399,7 @@
25399
25399
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
25400
25400
  const onMouseMove = (ev) => {
25401
25401
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
25402
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
25402
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
25403
25403
  const otherFigures = this.getOtherFigures(figure.id);
25404
25404
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
25405
25405
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -32906,6 +32906,15 @@
32906
32906
  return 0 /* CommandResult.Success */;
32907
32907
  }
32908
32908
  }
32909
+ beforeHandle(cmd) {
32910
+ switch (cmd.type) {
32911
+ case "DELETE_SHEET":
32912
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
32913
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
32914
+ });
32915
+ break;
32916
+ }
32917
+ }
32909
32918
  handle(cmd) {
32910
32919
  switch (cmd.type) {
32911
32920
  case "CREATE_SHEET":
@@ -46097,6 +46106,9 @@
46097
46106
  this.scrollToSheet();
46098
46107
  }
46099
46108
  onDblClick() {
46109
+ if (this.env.model.getters.isReadonly()) {
46110
+ return;
46111
+ }
46100
46112
  this.startEdition();
46101
46113
  }
46102
46114
  onKeyDown(ev) {
@@ -51721,9 +51733,9 @@
51721
51733
  Object.defineProperty(exports, '__esModule', { value: true });
51722
51734
 
51723
51735
 
51724
- __info__.version = '16.4.25';
51725
- __info__.date = '2024-03-12T07:54:10.025Z';
51726
- __info__.hash = '182ad16';
51736
+ __info__.version = '16.4.26';
51737
+ __info__.date = '2024-03-15T10:58:33.088Z';
51738
+ __info__.hash = 'b8caa0f';
51727
51739
 
51728
51740
 
51729
51741
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);