@odoo/o-spreadsheet 17.1.18 → 17.1.19

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.18
6
- * @date 2024-06-10T09:34:55.045Z
7
- * @hash 0e756ce
5
+ * @version 17.1.19
6
+ * @date 2024-06-14T10:03:04.850Z
7
+ * @hash 8a74f95
8
8
  */
9
9
 
10
10
  'use strict';
@@ -6995,7 +6995,7 @@ class Popover extends owl.Component {
6995
6995
  if (!anchor)
6996
6996
  return;
6997
6997
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
6998
- const elDims = {
6998
+ let elDims = {
6999
6999
  width: el.getBoundingClientRect().width,
7000
7000
  height: el.getBoundingClientRect().height,
7001
7001
  };
@@ -7003,7 +7003,14 @@ class Popover extends owl.Component {
7003
7003
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
7004
7004
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
7005
7005
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
7006
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
7006
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
7007
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
7008
+ // Re-compute the dimensions after setting the max-width and max-height
7009
+ elDims = {
7010
+ width: el.getBoundingClientRect().width,
7011
+ height: el.getBoundingClientRect().height,
7012
+ };
7013
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
7007
7014
  for (const property of Object.keys(style)) {
7008
7015
  el.style[property] = style[property];
7009
7016
  }
@@ -7066,8 +7073,6 @@ class PopoverPositionContext {
7066
7073
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
7067
7074
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
7068
7075
  const cssProperties = {
7069
- "max-height": maxHeight + "px",
7070
- "max-width": maxWidth + "px",
7071
7076
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
7072
7077
  this.spreadsheetOffset.y -
7073
7078
  verticalOffset +
@@ -25473,13 +25478,17 @@ class SelectMenu extends owl.Component {
25473
25478
  class: { type: String, optional: true },
25474
25479
  };
25475
25480
  static components = { Menu };
25481
+ menuId = new UuidGenerator().uuidv4();
25476
25482
  selectRef = owl.useRef("select");
25477
25483
  selectRect = useAbsoluteBoundingRect(this.selectRef);
25478
25484
  state = owl.useState({
25479
25485
  isMenuOpen: false,
25480
25486
  });
25481
- onClick() {
25482
- this.state.isMenuOpen = true;
25487
+ onClick(ev) {
25488
+ if (ev.closedMenuId === this.menuId) {
25489
+ return;
25490
+ }
25491
+ this.state.isMenuOpen = !this.state.isMenuOpen;
25483
25492
  }
25484
25493
  onMenuClosed() {
25485
25494
  this.state.isMenuOpen = false;
@@ -25487,7 +25496,7 @@ class SelectMenu extends owl.Component {
25487
25496
  get menuPosition() {
25488
25497
  return {
25489
25498
  x: this.selectRect.x,
25490
- y: this.selectRect.y,
25499
+ y: this.selectRect.y + this.selectRect.height,
25491
25500
  };
25492
25501
  }
25493
25502
  }
@@ -28525,7 +28534,7 @@ class FiguresContainer extends owl.Component {
28525
28534
  });
28526
28535
  }
28527
28536
  getContainerRect(container) {
28528
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
28537
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
28529
28538
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
28530
28539
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
28531
28540
  const width = viewWidth - x;
@@ -44798,7 +44807,10 @@ class Session extends EventBus {
44798
44807
  /**
44799
44808
  * Notify the server that the user client left the collaborative session
44800
44809
  */
44801
- leave() {
44810
+ leave(data) {
44811
+ if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44812
+ this.snapshot(data);
44813
+ }
44802
44814
  delete this.clients[this.clientId];
44803
44815
  this.transportService.leave(this.clientId);
44804
44816
  this.transportService.sendMessage({
@@ -44811,6 +44823,9 @@ class Session extends EventBus {
44811
44823
  * Send a snapshot of the spreadsheet to the collaboration server
44812
44824
  */
44813
44825
  snapshot(data) {
44826
+ if (this.pendingMessages.length !== 0) {
44827
+ return;
44828
+ }
44814
44829
  const snapshotId = this.uuidGenerator.uuidv4();
44815
44830
  this.transportService.sendMessage({
44816
44831
  type: "SNAPSHOT",
@@ -49510,10 +49525,8 @@ class EditionPlugin extends UIPlugin {
49510
49525
  const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
49511
49526
  return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
49512
49527
  });
49513
- // this function assumes that the previous range is always found because
49514
- // it's called when changing a highlight, which exists by definition
49515
49528
  if (!previousRefToken) {
49516
- throw new Error("Previous range not found");
49529
+ return;
49517
49530
  }
49518
49531
  const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
49519
49532
  this.selectionStart = previousRefToken.start;
@@ -57266,7 +57279,7 @@ class Model extends EventBus {
57266
57279
  this.session.join(this.config.client);
57267
57280
  }
57268
57281
  leaveSession() {
57269
- this.session.leave();
57282
+ this.session.leave(this.exportData());
57270
57283
  }
57271
57284
  setupUiPlugin(Plugin) {
57272
57285
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57690,6 +57703,7 @@ const helpers = {
57690
57703
  createAction,
57691
57704
  createActions,
57692
57705
  transformRangeData,
57706
+ deepEquals,
57693
57707
  };
57694
57708
  const links = {
57695
57709
  isMarkdownLink,
@@ -57777,6 +57791,6 @@ exports.setTranslationMethod = setTranslationMethod;
57777
57791
  exports.tokenize = tokenize;
57778
57792
 
57779
57793
 
57780
- __info__.version = "17.1.18";
57781
- __info__.date = "2024-06-10T09:34:55.045Z";
57782
- __info__.hash = "0e756ce";
57794
+ __info__.version = "17.1.19";
57795
+ __info__.date = "2024-06-14T10:03:04.850Z";
57796
+ __info__.hash = "8a74f95";
@@ -841,7 +841,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
841
841
  /**
842
842
  * Notify the server that the user client left the collaborative session
843
843
  */
844
- leave(): void;
844
+ leave(data: WorkbookData): void;
845
845
  /**
846
846
  * Send a snapshot of the spreadsheet to the collaboration server
847
847
  */
@@ -982,6 +982,10 @@ declare function isDefined<T>(argument: T | undefined): argument is T;
982
982
  * Lazy value computed by the provided function.
983
983
  */
984
984
  declare function lazy<T>(fn: (() => T) | T): Lazy<T>;
985
+ /**
986
+ * Compares two objects.
987
+ */
988
+ declare function deepEquals(o1: any, o2: any, ignoreFunctions?: "ignoreFunctions"): boolean;
985
989
 
986
990
  interface ConstructorArgs {
987
991
  readonly zone: Readonly<Zone | UnboundedZone>;
@@ -8691,6 +8695,7 @@ declare const helpers: {
8691
8695
  createAction: typeof createAction;
8692
8696
  createActions: typeof createActions;
8693
8697
  transformRangeData: typeof transformRangeData;
8698
+ deepEquals: typeof deepEquals;
8694
8699
  };
8695
8700
  declare const links: {
8696
8701
  isMarkdownLink: typeof isMarkdownLink;
@@ -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.18
6
- * @date 2024-06-10T09:34:55.045Z
7
- * @hash 0e756ce
5
+ * @version 17.1.19
6
+ * @date 2024-06-14T10:03:04.850Z
7
+ * @hash 8a74f95
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, onWillUnmount, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -6993,7 +6993,7 @@ class Popover extends Component {
6993
6993
  if (!anchor)
6994
6994
  return;
6995
6995
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
6996
- const elDims = {
6996
+ let elDims = {
6997
6997
  width: el.getBoundingClientRect().width,
6998
6998
  height: el.getBoundingClientRect().height,
6999
6999
  };
@@ -7001,7 +7001,14 @@ class Popover extends Component {
7001
7001
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
7002
7002
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
7003
7003
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
7004
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
7004
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
7005
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
7006
+ // Re-compute the dimensions after setting the max-width and max-height
7007
+ elDims = {
7008
+ width: el.getBoundingClientRect().width,
7009
+ height: el.getBoundingClientRect().height,
7010
+ };
7011
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
7005
7012
  for (const property of Object.keys(style)) {
7006
7013
  el.style[property] = style[property];
7007
7014
  }
@@ -7064,8 +7071,6 @@ class PopoverPositionContext {
7064
7071
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
7065
7072
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
7066
7073
  const cssProperties = {
7067
- "max-height": maxHeight + "px",
7068
- "max-width": maxWidth + "px",
7069
7074
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
7070
7075
  this.spreadsheetOffset.y -
7071
7076
  verticalOffset +
@@ -25471,13 +25476,17 @@ class SelectMenu extends Component {
25471
25476
  class: { type: String, optional: true },
25472
25477
  };
25473
25478
  static components = { Menu };
25479
+ menuId = new UuidGenerator().uuidv4();
25474
25480
  selectRef = useRef("select");
25475
25481
  selectRect = useAbsoluteBoundingRect(this.selectRef);
25476
25482
  state = useState({
25477
25483
  isMenuOpen: false,
25478
25484
  });
25479
- onClick() {
25480
- this.state.isMenuOpen = true;
25485
+ onClick(ev) {
25486
+ if (ev.closedMenuId === this.menuId) {
25487
+ return;
25488
+ }
25489
+ this.state.isMenuOpen = !this.state.isMenuOpen;
25481
25490
  }
25482
25491
  onMenuClosed() {
25483
25492
  this.state.isMenuOpen = false;
@@ -25485,7 +25494,7 @@ class SelectMenu extends Component {
25485
25494
  get menuPosition() {
25486
25495
  return {
25487
25496
  x: this.selectRect.x,
25488
- y: this.selectRect.y,
25497
+ y: this.selectRect.y + this.selectRect.height,
25489
25498
  };
25490
25499
  }
25491
25500
  }
@@ -28523,7 +28532,7 @@ class FiguresContainer extends Component {
28523
28532
  });
28524
28533
  }
28525
28534
  getContainerRect(container) {
28526
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
28535
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
28527
28536
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
28528
28537
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
28529
28538
  const width = viewWidth - x;
@@ -44796,7 +44805,10 @@ class Session extends EventBus {
44796
44805
  /**
44797
44806
  * Notify the server that the user client left the collaborative session
44798
44807
  */
44799
- leave() {
44808
+ leave(data) {
44809
+ if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44810
+ this.snapshot(data);
44811
+ }
44800
44812
  delete this.clients[this.clientId];
44801
44813
  this.transportService.leave(this.clientId);
44802
44814
  this.transportService.sendMessage({
@@ -44809,6 +44821,9 @@ class Session extends EventBus {
44809
44821
  * Send a snapshot of the spreadsheet to the collaboration server
44810
44822
  */
44811
44823
  snapshot(data) {
44824
+ if (this.pendingMessages.length !== 0) {
44825
+ return;
44826
+ }
44812
44827
  const snapshotId = this.uuidGenerator.uuidv4();
44813
44828
  this.transportService.sendMessage({
44814
44829
  type: "SNAPSHOT",
@@ -49508,10 +49523,8 @@ class EditionPlugin extends UIPlugin {
49508
49523
  const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
49509
49524
  return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
49510
49525
  });
49511
- // this function assumes that the previous range is always found because
49512
- // it's called when changing a highlight, which exists by definition
49513
49526
  if (!previousRefToken) {
49514
- throw new Error("Previous range not found");
49527
+ return;
49515
49528
  }
49516
49529
  const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
49517
49530
  this.selectionStart = previousRefToken.start;
@@ -57264,7 +57277,7 @@ class Model extends EventBus {
57264
57277
  this.session.join(this.config.client);
57265
57278
  }
57266
57279
  leaveSession() {
57267
- this.session.leave();
57280
+ this.session.leave(this.exportData());
57268
57281
  }
57269
57282
  setupUiPlugin(Plugin) {
57270
57283
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57688,6 +57701,7 @@ const helpers = {
57688
57701
  createAction,
57689
57702
  createActions,
57690
57703
  transformRangeData,
57704
+ deepEquals,
57691
57705
  };
57692
57706
  const links = {
57693
57707
  isMarkdownLink,
@@ -57739,6 +57753,6 @@ const constants = {
57739
57753
  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 };
57740
57754
 
57741
57755
 
57742
- __info__.version = "17.1.18";
57743
- __info__.date = "2024-06-10T09:34:55.045Z";
57744
- __info__.hash = "0e756ce";
57756
+ __info__.version = "17.1.19";
57757
+ __info__.date = "2024-06-14T10:03:04.850Z";
57758
+ __info__.hash = "8a74f95";
@@ -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.18
6
- * @date 2024-06-10T09:34:55.045Z
7
- * @hash 0e756ce
5
+ * @version 17.1.19
6
+ * @date 2024-06-14T10:03:04.850Z
7
+ * @hash 8a74f95
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6994,7 +6994,7 @@
6994
6994
  if (!anchor)
6995
6995
  return;
6996
6996
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
6997
- const elDims = {
6997
+ let elDims = {
6998
6998
  width: el.getBoundingClientRect().width,
6999
6999
  height: el.getBoundingClientRect().height,
7000
7000
  };
@@ -7002,7 +7002,14 @@
7002
7002
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
7003
7003
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
7004
7004
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
7005
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
7005
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
7006
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
7007
+ // Re-compute the dimensions after setting the max-width and max-height
7008
+ elDims = {
7009
+ width: el.getBoundingClientRect().width,
7010
+ height: el.getBoundingClientRect().height,
7011
+ };
7012
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
7006
7013
  for (const property of Object.keys(style)) {
7007
7014
  el.style[property] = style[property];
7008
7015
  }
@@ -7065,8 +7072,6 @@
7065
7072
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
7066
7073
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
7067
7074
  const cssProperties = {
7068
- "max-height": maxHeight + "px",
7069
- "max-width": maxWidth + "px",
7070
7075
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
7071
7076
  this.spreadsheetOffset.y -
7072
7077
  verticalOffset +
@@ -25472,13 +25477,17 @@
25472
25477
  class: { type: String, optional: true },
25473
25478
  };
25474
25479
  static components = { Menu };
25480
+ menuId = new UuidGenerator().uuidv4();
25475
25481
  selectRef = owl.useRef("select");
25476
25482
  selectRect = useAbsoluteBoundingRect(this.selectRef);
25477
25483
  state = owl.useState({
25478
25484
  isMenuOpen: false,
25479
25485
  });
25480
- onClick() {
25481
- this.state.isMenuOpen = true;
25486
+ onClick(ev) {
25487
+ if (ev.closedMenuId === this.menuId) {
25488
+ return;
25489
+ }
25490
+ this.state.isMenuOpen = !this.state.isMenuOpen;
25482
25491
  }
25483
25492
  onMenuClosed() {
25484
25493
  this.state.isMenuOpen = false;
@@ -25486,7 +25495,7 @@
25486
25495
  get menuPosition() {
25487
25496
  return {
25488
25497
  x: this.selectRect.x,
25489
- y: this.selectRect.y,
25498
+ y: this.selectRect.y + this.selectRect.height,
25490
25499
  };
25491
25500
  }
25492
25501
  }
@@ -28524,7 +28533,7 @@
28524
28533
  });
28525
28534
  }
28526
28535
  getContainerRect(container) {
28527
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
28536
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
28528
28537
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
28529
28538
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
28530
28539
  const width = viewWidth - x;
@@ -44797,7 +44806,10 @@
44797
44806
  /**
44798
44807
  * Notify the server that the user client left the collaborative session
44799
44808
  */
44800
- leave() {
44809
+ leave(data) {
44810
+ if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44811
+ this.snapshot(data);
44812
+ }
44801
44813
  delete this.clients[this.clientId];
44802
44814
  this.transportService.leave(this.clientId);
44803
44815
  this.transportService.sendMessage({
@@ -44810,6 +44822,9 @@
44810
44822
  * Send a snapshot of the spreadsheet to the collaboration server
44811
44823
  */
44812
44824
  snapshot(data) {
44825
+ if (this.pendingMessages.length !== 0) {
44826
+ return;
44827
+ }
44813
44828
  const snapshotId = this.uuidGenerator.uuidv4();
44814
44829
  this.transportService.sendMessage({
44815
44830
  type: "SNAPSHOT",
@@ -49509,10 +49524,8 @@
49509
49524
  const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
49510
49525
  return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
49511
49526
  });
49512
- // this function assumes that the previous range is always found because
49513
- // it's called when changing a highlight, which exists by definition
49514
49527
  if (!previousRefToken) {
49515
- throw new Error("Previous range not found");
49528
+ return;
49516
49529
  }
49517
49530
  const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
49518
49531
  this.selectionStart = previousRefToken.start;
@@ -57265,7 +57278,7 @@
57265
57278
  this.session.join(this.config.client);
57266
57279
  }
57267
57280
  leaveSession() {
57268
- this.session.leave();
57281
+ this.session.leave(this.exportData());
57269
57282
  }
57270
57283
  setupUiPlugin(Plugin) {
57271
57284
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57689,6 +57702,7 @@
57689
57702
  createAction,
57690
57703
  createActions,
57691
57704
  transformRangeData,
57705
+ deepEquals,
57692
57706
  };
57693
57707
  const links = {
57694
57708
  isMarkdownLink,
@@ -57776,9 +57790,9 @@
57776
57790
  exports.tokenize = tokenize;
57777
57791
 
57778
57792
 
57779
- __info__.version = "17.1.18";
57780
- __info__.date = "2024-06-10T09:34:55.045Z";
57781
- __info__.hash = "0e756ce";
57793
+ __info__.version = "17.1.19";
57794
+ __info__.date = "2024-06-14T10:03:04.850Z";
57795
+ __info__.hash = "8a74f95";
57782
57796
 
57783
57797
 
57784
57798
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);