@odoo/o-spreadsheet 16.3.27 → 16.3.29

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.
@@ -4794,8 +4794,8 @@ function getGroup(cell, cells, filter) {
4794
4794
  if (x === cell) {
4795
4795
  found = true;
4796
4796
  }
4797
- const cellValue = evaluateLiteral(x?.content);
4798
- if (filter(cellValue)) {
4797
+ const cellValue = x?.isFormula ? undefined : evaluateLiteral(x?.content);
4798
+ if (cellValue && filter(cellValue)) {
4799
4799
  group.push(cellValue);
4800
4800
  }
4801
4801
  else {
@@ -21662,7 +21662,11 @@ class GridComposer extends owl.Component {
21662
21662
  }
21663
21663
  }
21664
21664
  updateCellReferenceVisibility() {
21665
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
21665
+ if (this.env.model.getters.getEditionMode() === "inactive") {
21666
+ this.isCellReferenceVisible = false;
21667
+ return;
21668
+ }
21669
+ if (this.isCellReferenceVisible) {
21666
21670
  return;
21667
21671
  }
21668
21672
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -21823,7 +21827,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
21823
21827
  function clamp(value, min, max) {
21824
21828
  return Math.min(Math.max(value, min), max);
21825
21829
  }
21826
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
21830
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
21827
21831
  let { x, y, width, height } = initialFigure;
21828
21832
  if (keepRatio && dirX != 0 && dirY != 0) {
21829
21833
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -21850,14 +21854,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
21850
21854
  y = initialFigure.y - deltaY;
21851
21855
  }
21852
21856
  }
21853
- // Restrict resizing if x or y reaches header boundaries
21854
- if (x < 0) {
21855
- width += x;
21856
- x = 0;
21857
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
21858
+ if (x + scrollX <= 0) {
21859
+ width = width + x + scrollX;
21860
+ x = -scrollX;
21857
21861
  }
21858
- if (y < 0) {
21859
- height += y;
21860
- y = 0;
21862
+ if (y + scrollY <= 0) {
21863
+ height = height + y + scrollY;
21864
+ y = -scrollY;
21861
21865
  }
21862
21866
  return { ...initialFigure, x, y, width, height };
21863
21867
  }
@@ -22274,7 +22278,7 @@ class FiguresContainer extends owl.Component {
22274
22278
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
22275
22279
  const onMouseMove = (ev) => {
22276
22280
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
22277
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
22281
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
22278
22282
  const otherFigures = this.getOtherFigures(figure.id);
22279
22283
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
22280
22284
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -30704,6 +30708,15 @@ class FigurePlugin extends CorePlugin {
30704
30708
  return 0 /* CommandResult.Success */;
30705
30709
  }
30706
30710
  }
30711
+ beforeHandle(cmd) {
30712
+ switch (cmd.type) {
30713
+ case "DELETE_SHEET":
30714
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
30715
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
30716
+ });
30717
+ break;
30718
+ }
30719
+ }
30707
30720
  handle(cmd) {
30708
30721
  switch (cmd.type) {
30709
30722
  case "CREATE_SHEET":
@@ -42450,6 +42463,9 @@ class BottomBarSheet extends owl.Component {
42450
42463
  this.scrollToSheet();
42451
42464
  }
42452
42465
  onDblClick() {
42466
+ if (this.env.model.getters.isReadonly()) {
42467
+ return;
42468
+ }
42453
42469
  this.startEdition();
42454
42470
  }
42455
42471
  onKeyDown(ev) {
@@ -48033,6 +48049,6 @@ exports.setTranslationMethod = setTranslationMethod;
48033
48049
  exports.tokenize = tokenize;
48034
48050
 
48035
48051
 
48036
- __info__.version = '16.3.27';
48037
- __info__.date = '2024-02-28T12:24:18.882Z';
48038
- __info__.hash = '7dc9484';
48052
+ __info__.version = '16.3.29';
48053
+ __info__.date = '2024-03-15T10:57:27.142Z';
48054
+ __info__.hash = 'd86234a';
@@ -3349,6 +3349,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
3349
3349
  [sheet: string]: Record<UID, Figure | undefined> | undefined;
3350
3350
  };
3351
3351
  allowDispatch(cmd: CoreCommand): CommandResult;
3352
+ beforeHandle(cmd: CoreCommand): void;
3352
3353
  handle(cmd: CoreCommand): void;
3353
3354
  private onRowColDelete;
3354
3355
  private onRowDeletion;
@@ -4790,8 +4790,8 @@ function getGroup(cell, cells, filter) {
4790
4790
  if (x === cell) {
4791
4791
  found = true;
4792
4792
  }
4793
- const cellValue = evaluateLiteral(x?.content);
4794
- if (filter(cellValue)) {
4793
+ const cellValue = x?.isFormula ? undefined : evaluateLiteral(x?.content);
4794
+ if (cellValue && filter(cellValue)) {
4795
4795
  group.push(cellValue);
4796
4796
  }
4797
4797
  else {
@@ -21658,7 +21658,11 @@ class GridComposer extends Component {
21658
21658
  }
21659
21659
  }
21660
21660
  updateCellReferenceVisibility() {
21661
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
21661
+ if (this.env.model.getters.getEditionMode() === "inactive") {
21662
+ this.isCellReferenceVisible = false;
21663
+ return;
21664
+ }
21665
+ if (this.isCellReferenceVisible) {
21662
21666
  return;
21663
21667
  }
21664
21668
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -21819,7 +21823,7 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
21819
21823
  function clamp(value, min, max) {
21820
21824
  return Math.min(Math.max(value, min), max);
21821
21825
  }
21822
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
21826
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
21823
21827
  let { x, y, width, height } = initialFigure;
21824
21828
  if (keepRatio && dirX != 0 && dirY != 0) {
21825
21829
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -21846,14 +21850,14 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
21846
21850
  y = initialFigure.y - deltaY;
21847
21851
  }
21848
21852
  }
21849
- // Restrict resizing if x or y reaches header boundaries
21850
- if (x < 0) {
21851
- width += x;
21852
- x = 0;
21853
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
21854
+ if (x + scrollX <= 0) {
21855
+ width = width + x + scrollX;
21856
+ x = -scrollX;
21853
21857
  }
21854
- if (y < 0) {
21855
- height += y;
21856
- y = 0;
21858
+ if (y + scrollY <= 0) {
21859
+ height = height + y + scrollY;
21860
+ y = -scrollY;
21857
21861
  }
21858
21862
  return { ...initialFigure, x, y, width, height };
21859
21863
  }
@@ -22270,7 +22274,7 @@ class FiguresContainer extends Component {
22270
22274
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
22271
22275
  const onMouseMove = (ev) => {
22272
22276
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
22273
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
22277
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
22274
22278
  const otherFigures = this.getOtherFigures(figure.id);
22275
22279
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
22276
22280
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -30700,6 +30704,15 @@ class FigurePlugin extends CorePlugin {
30700
30704
  return 0 /* CommandResult.Success */;
30701
30705
  }
30702
30706
  }
30707
+ beforeHandle(cmd) {
30708
+ switch (cmd.type) {
30709
+ case "DELETE_SHEET":
30710
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
30711
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
30712
+ });
30713
+ break;
30714
+ }
30715
+ }
30703
30716
  handle(cmd) {
30704
30717
  switch (cmd.type) {
30705
30718
  case "CREATE_SHEET":
@@ -42446,6 +42459,9 @@ class BottomBarSheet extends Component {
42446
42459
  this.scrollToSheet();
42447
42460
  }
42448
42461
  onDblClick() {
42462
+ if (this.env.model.getters.isReadonly()) {
42463
+ return;
42464
+ }
42449
42465
  this.startEdition();
42450
42466
  }
42451
42467
  onKeyDown(ev) {
@@ -48001,6 +48017,6 @@ function addFunction(functionName, functionDescription) {
48001
48017
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
48002
48018
 
48003
48019
 
48004
- __info__.version = '16.3.27';
48005
- __info__.date = '2024-02-28T12:24:18.882Z';
48006
- __info__.hash = '7dc9484';
48020
+ __info__.version = '16.3.29';
48021
+ __info__.date = '2024-03-15T10:57:27.142Z';
48022
+ __info__.hash = 'd86234a';
@@ -4791,8 +4791,8 @@
4791
4791
  if (x === cell) {
4792
4792
  found = true;
4793
4793
  }
4794
- const cellValue = evaluateLiteral(x?.content);
4795
- if (filter(cellValue)) {
4794
+ const cellValue = x?.isFormula ? undefined : evaluateLiteral(x?.content);
4795
+ if (cellValue && filter(cellValue)) {
4796
4796
  group.push(cellValue);
4797
4797
  }
4798
4798
  else {
@@ -21659,7 +21659,11 @@
21659
21659
  }
21660
21660
  }
21661
21661
  updateCellReferenceVisibility() {
21662
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
21662
+ if (this.env.model.getters.getEditionMode() === "inactive") {
21663
+ this.isCellReferenceVisible = false;
21664
+ return;
21665
+ }
21666
+ if (this.isCellReferenceVisible) {
21663
21667
  return;
21664
21668
  }
21665
21669
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -21820,7 +21824,7 @@
21820
21824
  function clamp(value, min, max) {
21821
21825
  return Math.min(Math.max(value, min), max);
21822
21826
  }
21823
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
21827
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
21824
21828
  let { x, y, width, height } = initialFigure;
21825
21829
  if (keepRatio && dirX != 0 && dirY != 0) {
21826
21830
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -21847,14 +21851,14 @@
21847
21851
  y = initialFigure.y - deltaY;
21848
21852
  }
21849
21853
  }
21850
- // Restrict resizing if x or y reaches header boundaries
21851
- if (x < 0) {
21852
- width += x;
21853
- x = 0;
21854
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
21855
+ if (x + scrollX <= 0) {
21856
+ width = width + x + scrollX;
21857
+ x = -scrollX;
21854
21858
  }
21855
- if (y < 0) {
21856
- height += y;
21857
- y = 0;
21859
+ if (y + scrollY <= 0) {
21860
+ height = height + y + scrollY;
21861
+ y = -scrollY;
21858
21862
  }
21859
21863
  return { ...initialFigure, x, y, width, height };
21860
21864
  }
@@ -22271,7 +22275,7 @@
22271
22275
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
22272
22276
  const onMouseMove = (ev) => {
22273
22277
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
22274
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
22278
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
22275
22279
  const otherFigures = this.getOtherFigures(figure.id);
22276
22280
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
22277
22281
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -30701,6 +30705,15 @@
30701
30705
  return 0 /* CommandResult.Success */;
30702
30706
  }
30703
30707
  }
30708
+ beforeHandle(cmd) {
30709
+ switch (cmd.type) {
30710
+ case "DELETE_SHEET":
30711
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
30712
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
30713
+ });
30714
+ break;
30715
+ }
30716
+ }
30704
30717
  handle(cmd) {
30705
30718
  switch (cmd.type) {
30706
30719
  case "CREATE_SHEET":
@@ -42447,6 +42460,9 @@
42447
42460
  this.scrollToSheet();
42448
42461
  }
42449
42462
  onDblClick() {
42463
+ if (this.env.model.getters.isReadonly()) {
42464
+ return;
42465
+ }
42450
42466
  this.startEdition();
42451
42467
  }
42452
42468
  onKeyDown(ev) {
@@ -48032,9 +48048,9 @@
48032
48048
  Object.defineProperty(exports, '__esModule', { value: true });
48033
48049
 
48034
48050
 
48035
- __info__.version = '16.3.27';
48036
- __info__.date = '2024-02-28T12:24:18.882Z';
48037
- __info__.hash = '7dc9484';
48051
+ __info__.version = '16.3.29';
48052
+ __info__.date = '2024-03-15T10:57:27.142Z';
48053
+ __info__.hash = 'd86234a';
48038
48054
 
48039
48055
 
48040
48056
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);