@odoo/o-spreadsheet 17.1.7 → 17.1.8

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.1.7
6
- * @date 2024-03-12T07:56:10.783Z
7
- * @hash 3a9f334
5
+ * @version 17.1.8
6
+ * @date 2024-03-15T10:59:39.362Z
7
+ * @hash bd0c9e0
8
8
  */
9
9
 
10
10
  'use strict';
@@ -28038,7 +28038,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
28038
28038
  function clamp(value, min, max) {
28039
28039
  return Math.min(Math.max(value, min), max);
28040
28040
  }
28041
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
28041
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
28042
28042
  let { x, y, width, height } = initialFigure;
28043
28043
  if (keepRatio && dirX != 0 && dirY != 0) {
28044
28044
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -28065,14 +28065,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
28065
28065
  y = initialFigure.y - deltaY;
28066
28066
  }
28067
28067
  }
28068
- // Restrict resizing if x or y reaches header boundaries
28069
- if (x < 0) {
28070
- width += x;
28071
- x = 0;
28068
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
28069
+ if (x + scrollX <= 0) {
28070
+ width = width + x + scrollX;
28071
+ x = -scrollX;
28072
28072
  }
28073
- if (y < 0) {
28074
- height += y;
28075
- y = 0;
28073
+ if (y + scrollY <= 0) {
28074
+ height = height + y + scrollY;
28075
+ y = -scrollY;
28076
28076
  }
28077
28077
  return { ...initialFigure, x, y, width, height };
28078
28078
  }
@@ -28492,7 +28492,7 @@ class FiguresContainer extends owl.Component {
28492
28492
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
28493
28493
  const onMouseMove = (ev) => {
28494
28494
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
28495
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
28495
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
28496
28496
  const otherFigures = this.getOtherFigures(figure.id);
28497
28497
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
28498
28498
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -37308,6 +37308,15 @@ class FigurePlugin extends CorePlugin {
37308
37308
  return "Success" /* CommandResult.Success */;
37309
37309
  }
37310
37310
  }
37311
+ beforeHandle(cmd) {
37312
+ switch (cmd.type) {
37313
+ case "DELETE_SHEET":
37314
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
37315
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
37316
+ });
37317
+ break;
37318
+ }
37319
+ }
37311
37320
  handle(cmd) {
37312
37321
  switch (cmd.type) {
37313
37322
  case "CREATE_SHEET":
@@ -51546,6 +51555,9 @@ class BottomBarSheet extends owl.Component {
51546
51555
  this.scrollToSheet();
51547
51556
  }
51548
51557
  onDblClick() {
51558
+ if (this.env.model.getters.isReadonly()) {
51559
+ return;
51560
+ }
51549
51561
  this.startEdition();
51550
51562
  }
51551
51563
  onKeyDown(ev) {
@@ -57276,6 +57288,6 @@ exports.setTranslationMethod = setTranslationMethod;
57276
57288
  exports.tokenize = tokenize;
57277
57289
 
57278
57290
 
57279
- __info__.version = "17.1.7";
57280
- __info__.date = "2024-03-12T07:56:10.783Z";
57281
- __info__.hash = "3a9f334";
57291
+ __info__.version = "17.1.8";
57292
+ __info__.date = "2024-03-15T10:59:39.362Z";
57293
+ __info__.hash = "bd0c9e0";
@@ -3533,6 +3533,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
3533
3533
  [sheet: string]: Record<UID, Figure | undefined> | undefined;
3534
3534
  };
3535
3535
  allowDispatch(cmd: CoreCommand): CommandResult;
3536
+ beforeHandle(cmd: CoreCommand): void;
3536
3537
  handle(cmd: CoreCommand): void;
3537
3538
  private onRowColDelete;
3538
3539
  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.1.7
6
- * @date 2024-03-12T07:56:10.783Z
7
- * @hash 3a9f334
5
+ * @version 17.1.8
6
+ * @date 2024-03-15T10:59:39.362Z
7
+ * @hash bd0c9e0
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';
@@ -28036,7 +28036,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
28036
28036
  function clamp(value, min, max) {
28037
28037
  return Math.min(Math.max(value, min), max);
28038
28038
  }
28039
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
28039
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
28040
28040
  let { x, y, width, height } = initialFigure;
28041
28041
  if (keepRatio && dirX != 0 && dirY != 0) {
28042
28042
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -28063,14 +28063,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
28063
28063
  y = initialFigure.y - deltaY;
28064
28064
  }
28065
28065
  }
28066
- // Restrict resizing if x or y reaches header boundaries
28067
- if (x < 0) {
28068
- width += x;
28069
- x = 0;
28066
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
28067
+ if (x + scrollX <= 0) {
28068
+ width = width + x + scrollX;
28069
+ x = -scrollX;
28070
28070
  }
28071
- if (y < 0) {
28072
- height += y;
28073
- y = 0;
28071
+ if (y + scrollY <= 0) {
28072
+ height = height + y + scrollY;
28073
+ y = -scrollY;
28074
28074
  }
28075
28075
  return { ...initialFigure, x, y, width, height };
28076
28076
  }
@@ -28490,7 +28490,7 @@ class FiguresContainer extends Component {
28490
28490
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
28491
28491
  const onMouseMove = (ev) => {
28492
28492
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
28493
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
28493
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
28494
28494
  const otherFigures = this.getOtherFigures(figure.id);
28495
28495
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
28496
28496
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -37306,6 +37306,15 @@ class FigurePlugin extends CorePlugin {
37306
37306
  return "Success" /* CommandResult.Success */;
37307
37307
  }
37308
37308
  }
37309
+ beforeHandle(cmd) {
37310
+ switch (cmd.type) {
37311
+ case "DELETE_SHEET":
37312
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
37313
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
37314
+ });
37315
+ break;
37316
+ }
37317
+ }
37309
37318
  handle(cmd) {
37310
37319
  switch (cmd.type) {
37311
37320
  case "CREATE_SHEET":
@@ -51544,6 +51553,9 @@ class BottomBarSheet extends Component {
51544
51553
  this.scrollToSheet();
51545
51554
  }
51546
51555
  onDblClick() {
51556
+ if (this.env.model.getters.isReadonly()) {
51557
+ return;
51558
+ }
51547
51559
  this.startEdition();
51548
51560
  }
51549
51561
  onKeyDown(ev) {
@@ -57238,6 +57250,6 @@ const constants = {
57238
57250
  export { AbstractChart, CellErrorType, 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 };
57239
57251
 
57240
57252
 
57241
- __info__.version = "17.1.7";
57242
- __info__.date = "2024-03-12T07:56:10.783Z";
57243
- __info__.hash = "3a9f334";
57253
+ __info__.version = "17.1.8";
57254
+ __info__.date = "2024-03-15T10:59:39.362Z";
57255
+ __info__.hash = "bd0c9e0";
@@ -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.1.7
6
- * @date 2024-03-12T07:56:10.783Z
7
- * @hash 3a9f334
5
+ * @version 17.1.8
6
+ * @date 2024-03-15T10:59:39.362Z
7
+ * @hash bd0c9e0
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -28037,7 +28037,7 @@
28037
28037
  function clamp(value, min, max) {
28038
28038
  return Math.min(Math.max(value, min), max);
28039
28039
  }
28040
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
28040
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
28041
28041
  let { x, y, width, height } = initialFigure;
28042
28042
  if (keepRatio && dirX != 0 && dirY != 0) {
28043
28043
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -28064,14 +28064,14 @@
28064
28064
  y = initialFigure.y - deltaY;
28065
28065
  }
28066
28066
  }
28067
- // Restrict resizing if x or y reaches header boundaries
28068
- if (x < 0) {
28069
- width += x;
28070
- x = 0;
28067
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
28068
+ if (x + scrollX <= 0) {
28069
+ width = width + x + scrollX;
28070
+ x = -scrollX;
28071
28071
  }
28072
- if (y < 0) {
28073
- height += y;
28074
- y = 0;
28072
+ if (y + scrollY <= 0) {
28073
+ height = height + y + scrollY;
28074
+ y = -scrollY;
28075
28075
  }
28076
28076
  return { ...initialFigure, x, y, width, height };
28077
28077
  }
@@ -28491,7 +28491,7 @@
28491
28491
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
28492
28492
  const onMouseMove = (ev) => {
28493
28493
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
28494
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
28494
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
28495
28495
  const otherFigures = this.getOtherFigures(figure.id);
28496
28496
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
28497
28497
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -37307,6 +37307,15 @@
37307
37307
  return "Success" /* CommandResult.Success */;
37308
37308
  }
37309
37309
  }
37310
+ beforeHandle(cmd) {
37311
+ switch (cmd.type) {
37312
+ case "DELETE_SHEET":
37313
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
37314
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
37315
+ });
37316
+ break;
37317
+ }
37318
+ }
37310
37319
  handle(cmd) {
37311
37320
  switch (cmd.type) {
37312
37321
  case "CREATE_SHEET":
@@ -51545,6 +51554,9 @@
51545
51554
  this.scrollToSheet();
51546
51555
  }
51547
51556
  onDblClick() {
51557
+ if (this.env.model.getters.isReadonly()) {
51558
+ return;
51559
+ }
51548
51560
  this.startEdition();
51549
51561
  }
51550
51562
  onKeyDown(ev) {
@@ -57275,9 +57287,9 @@
57275
57287
  exports.tokenize = tokenize;
57276
57288
 
57277
57289
 
57278
- __info__.version = "17.1.7";
57279
- __info__.date = "2024-03-12T07:56:10.783Z";
57280
- __info__.hash = "3a9f334";
57290
+ __info__.version = "17.1.8";
57291
+ __info__.date = "2024-03-15T10:59:39.362Z";
57292
+ __info__.hash = "bd0c9e0";
57281
57293
 
57282
57294
 
57283
57295
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);