@odoo/o-spreadsheet 16.0.34 → 16.0.35

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.
@@ -21149,6 +21149,9 @@ class FigureComponent extends owl.Component {
21149
21149
  el === null || el === void 0 ? void 0 : el.focus({ preventScroll: true });
21150
21150
  }
21151
21151
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
21152
+ owl.onWillUnmount(() => {
21153
+ this.props.onFigureDeleted();
21154
+ });
21152
21155
  }
21153
21156
  clickAnchor(dirX, dirY, ev) {
21154
21157
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -21166,6 +21169,7 @@ class FigureComponent extends owl.Component {
21166
21169
  });
21167
21170
  this.props.onFigureDeleted();
21168
21171
  ev.preventDefault();
21172
+ ev.stopPropagation();
21169
21173
  break;
21170
21174
  case "ArrowDown":
21171
21175
  case "ArrowLeft":
@@ -21185,6 +21189,7 @@ class FigureComponent extends owl.Component {
21185
21189
  y: figure.y + delta[1],
21186
21190
  });
21187
21191
  ev.preventDefault();
21192
+ ev.stopPropagation();
21188
21193
  break;
21189
21194
  }
21190
21195
  }
@@ -21409,6 +21414,7 @@ class FiguresContainer extends owl.Component {
21409
21414
  ev.stopPropagation();
21410
21415
  const initialX = ev.clientX;
21411
21416
  const initialY = ev.clientY;
21417
+ const { scrollX, scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
21412
21418
  const { x: dndInitialX, y: dndInitialY } = this.internalToScreenCoordinates(figure);
21413
21419
  this.dnd.x = dndInitialX;
21414
21420
  this.dnd.y = dndInitialY;
@@ -21427,13 +21433,14 @@ class FiguresContainer extends owl.Component {
21427
21433
  if (dirY < 0) {
21428
21434
  this.dnd.y = dndInitialY - deltaY;
21429
21435
  }
21430
- if (this.dnd.x < 0) {
21431
- this.dnd.width += this.dnd.x;
21432
- this.dnd.x = 0;
21436
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
21437
+ if (this.dnd.x + scrollX <= 0) {
21438
+ this.dnd.width = this.dnd.width + this.dnd.x + scrollX;
21439
+ this.dnd.x = -scrollX;
21433
21440
  }
21434
- if (this.dnd.y < 0) {
21435
- this.dnd.height += this.dnd.y;
21436
- this.dnd.y = 0;
21441
+ if (this.dnd.y + scrollY <= 0) {
21442
+ this.dnd.height = this.dnd.height + this.dnd.y + scrollY;
21443
+ this.dnd.y = -scrollY;
21437
21444
  }
21438
21445
  };
21439
21446
  const onMouseUp = (ev) => {
@@ -28803,6 +28810,15 @@ class FigurePlugin extends CorePlugin {
28803
28810
  return 0 /* CommandResult.Success */;
28804
28811
  }
28805
28812
  }
28813
+ beforeHandle(cmd) {
28814
+ switch (cmd.type) {
28815
+ case "DELETE_SHEET":
28816
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
28817
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
28818
+ });
28819
+ break;
28820
+ }
28821
+ }
28806
28822
  handle(cmd) {
28807
28823
  switch (cmd.type) {
28808
28824
  case "CREATE_SHEET":
@@ -34951,6 +34967,7 @@ class GridSelectionPlugin extends UIPlugin {
34951
34967
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
34952
34968
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
34953
34969
  this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones);
34970
+ this.selectedFigureId = null;
34954
34971
  break;
34955
34972
  }
34956
34973
  /** Any change to the selection has to be reflected in the selection processor. */
@@ -43274,6 +43291,6 @@ exports.setTranslationMethod = setTranslationMethod;
43274
43291
  exports.tokenize = tokenize;
43275
43292
 
43276
43293
 
43277
- __info__.version = '16.0.34';
43278
- __info__.date = '2024-03-12T07:54:05.304Z';
43279
- __info__.hash = 'e923ddd';
43294
+ __info__.version = '16.0.35';
43295
+ __info__.date = '2024-03-15T10:57:14.362Z';
43296
+ __info__.hash = '5cba28b';
@@ -3328,6 +3328,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
3328
3328
  [sheet: string]: Record<UID, Figure | undefined> | undefined;
3329
3329
  };
3330
3330
  allowDispatch(cmd: CoreCommand): CommandResult;
3331
+ beforeHandle(cmd: CoreCommand): void;
3331
3332
  handle(cmd: CoreCommand): void;
3332
3333
  private updateFigure;
3333
3334
  private addFigure;
@@ -21145,6 +21145,9 @@ class FigureComponent extends Component {
21145
21145
  el === null || el === void 0 ? void 0 : el.focus({ preventScroll: true });
21146
21146
  }
21147
21147
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
21148
+ onWillUnmount(() => {
21149
+ this.props.onFigureDeleted();
21150
+ });
21148
21151
  }
21149
21152
  clickAnchor(dirX, dirY, ev) {
21150
21153
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -21162,6 +21165,7 @@ class FigureComponent extends Component {
21162
21165
  });
21163
21166
  this.props.onFigureDeleted();
21164
21167
  ev.preventDefault();
21168
+ ev.stopPropagation();
21165
21169
  break;
21166
21170
  case "ArrowDown":
21167
21171
  case "ArrowLeft":
@@ -21181,6 +21185,7 @@ class FigureComponent extends Component {
21181
21185
  y: figure.y + delta[1],
21182
21186
  });
21183
21187
  ev.preventDefault();
21188
+ ev.stopPropagation();
21184
21189
  break;
21185
21190
  }
21186
21191
  }
@@ -21405,6 +21410,7 @@ class FiguresContainer extends Component {
21405
21410
  ev.stopPropagation();
21406
21411
  const initialX = ev.clientX;
21407
21412
  const initialY = ev.clientY;
21413
+ const { scrollX, scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
21408
21414
  const { x: dndInitialX, y: dndInitialY } = this.internalToScreenCoordinates(figure);
21409
21415
  this.dnd.x = dndInitialX;
21410
21416
  this.dnd.y = dndInitialY;
@@ -21423,13 +21429,14 @@ class FiguresContainer extends Component {
21423
21429
  if (dirY < 0) {
21424
21430
  this.dnd.y = dndInitialY - deltaY;
21425
21431
  }
21426
- if (this.dnd.x < 0) {
21427
- this.dnd.width += this.dnd.x;
21428
- this.dnd.x = 0;
21432
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
21433
+ if (this.dnd.x + scrollX <= 0) {
21434
+ this.dnd.width = this.dnd.width + this.dnd.x + scrollX;
21435
+ this.dnd.x = -scrollX;
21429
21436
  }
21430
- if (this.dnd.y < 0) {
21431
- this.dnd.height += this.dnd.y;
21432
- this.dnd.y = 0;
21437
+ if (this.dnd.y + scrollY <= 0) {
21438
+ this.dnd.height = this.dnd.height + this.dnd.y + scrollY;
21439
+ this.dnd.y = -scrollY;
21433
21440
  }
21434
21441
  };
21435
21442
  const onMouseUp = (ev) => {
@@ -28799,6 +28806,15 @@ class FigurePlugin extends CorePlugin {
28799
28806
  return 0 /* CommandResult.Success */;
28800
28807
  }
28801
28808
  }
28809
+ beforeHandle(cmd) {
28810
+ switch (cmd.type) {
28811
+ case "DELETE_SHEET":
28812
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
28813
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
28814
+ });
28815
+ break;
28816
+ }
28817
+ }
28802
28818
  handle(cmd) {
28803
28819
  switch (cmd.type) {
28804
28820
  case "CREATE_SHEET":
@@ -34947,6 +34963,7 @@ class GridSelectionPlugin extends UIPlugin {
34947
34963
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
34948
34964
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
34949
34965
  this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones);
34966
+ this.selectedFigureId = null;
34950
34967
  break;
34951
34968
  }
34952
34969
  /** Any change to the selection has to be reflected in the selection processor. */
@@ -43242,6 +43259,6 @@ function addFunction(functionName, functionDescription) {
43242
43259
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43243
43260
 
43244
43261
 
43245
- __info__.version = '16.0.34';
43246
- __info__.date = '2024-03-12T07:54:05.304Z';
43247
- __info__.hash = 'e923ddd';
43262
+ __info__.version = '16.0.35';
43263
+ __info__.date = '2024-03-15T10:57:14.362Z';
43264
+ __info__.hash = '5cba28b';
@@ -21146,6 +21146,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21146
21146
  el === null || el === void 0 ? void 0 : el.focus({ preventScroll: true });
21147
21147
  }
21148
21148
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
21149
+ owl.onWillUnmount(() => {
21150
+ this.props.onFigureDeleted();
21151
+ });
21149
21152
  }
21150
21153
  clickAnchor(dirX, dirY, ev) {
21151
21154
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -21163,6 +21166,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21163
21166
  });
21164
21167
  this.props.onFigureDeleted();
21165
21168
  ev.preventDefault();
21169
+ ev.stopPropagation();
21166
21170
  break;
21167
21171
  case "ArrowDown":
21168
21172
  case "ArrowLeft":
@@ -21182,6 +21186,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21182
21186
  y: figure.y + delta[1],
21183
21187
  });
21184
21188
  ev.preventDefault();
21189
+ ev.stopPropagation();
21185
21190
  break;
21186
21191
  }
21187
21192
  }
@@ -21406,6 +21411,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21406
21411
  ev.stopPropagation();
21407
21412
  const initialX = ev.clientX;
21408
21413
  const initialY = ev.clientY;
21414
+ const { scrollX, scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
21409
21415
  const { x: dndInitialX, y: dndInitialY } = this.internalToScreenCoordinates(figure);
21410
21416
  this.dnd.x = dndInitialX;
21411
21417
  this.dnd.y = dndInitialY;
@@ -21424,13 +21430,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21424
21430
  if (dirY < 0) {
21425
21431
  this.dnd.y = dndInitialY - deltaY;
21426
21432
  }
21427
- if (this.dnd.x < 0) {
21428
- this.dnd.width += this.dnd.x;
21429
- this.dnd.x = 0;
21433
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
21434
+ if (this.dnd.x + scrollX <= 0) {
21435
+ this.dnd.width = this.dnd.width + this.dnd.x + scrollX;
21436
+ this.dnd.x = -scrollX;
21430
21437
  }
21431
- if (this.dnd.y < 0) {
21432
- this.dnd.height += this.dnd.y;
21433
- this.dnd.y = 0;
21438
+ if (this.dnd.y + scrollY <= 0) {
21439
+ this.dnd.height = this.dnd.height + this.dnd.y + scrollY;
21440
+ this.dnd.y = -scrollY;
21434
21441
  }
21435
21442
  };
21436
21443
  const onMouseUp = (ev) => {
@@ -28800,6 +28807,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28800
28807
  return 0 /* CommandResult.Success */;
28801
28808
  }
28802
28809
  }
28810
+ beforeHandle(cmd) {
28811
+ switch (cmd.type) {
28812
+ case "DELETE_SHEET":
28813
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
28814
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
28815
+ });
28816
+ break;
28817
+ }
28818
+ }
28803
28819
  handle(cmd) {
28804
28820
  switch (cmd.type) {
28805
28821
  case "CREATE_SHEET":
@@ -34948,6 +34964,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34948
34964
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
34949
34965
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
34950
34966
  this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones);
34967
+ this.selectedFigureId = null;
34951
34968
  break;
34952
34969
  }
34953
34970
  /** Any change to the selection has to be reflected in the selection processor. */
@@ -43273,9 +43290,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43273
43290
  Object.defineProperty(exports, '__esModule', { value: true });
43274
43291
 
43275
43292
 
43276
- __info__.version = '16.0.34';
43277
- __info__.date = '2024-03-12T07:54:05.304Z';
43278
- __info__.hash = 'e923ddd';
43293
+ __info__.version = '16.0.35';
43294
+ __info__.date = '2024-03-15T10:57:14.362Z';
43295
+ __info__.hash = '5cba28b';
43279
43296
 
43280
43297
 
43281
43298
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);