@odoo/o-spreadsheet 17.0.25 → 17.0.28

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,17 +2,18 @@
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.0.25
6
- * @date 2024-06-10T09:33:40.022Z
7
- * @hash 1f01394
5
+ * @version 17.0.28
6
+ * @date 2024-07-02T10:35:57.899Z
7
+ * @hash 7f86a16
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
11
11
  'use strict';
12
12
 
13
- // define a mock translation function, when o-spreadsheet runs in standalone it doesn't translate any string
14
- let _translate = (s) => s;
15
- let _loaded = () => false;
13
+ const defaultTranslate = (s) => s;
14
+ const defaultLoaded = () => false;
15
+ let _translate = defaultTranslate;
16
+ let _loaded = defaultLoaded;
16
17
  function sprintf(s, ...values) {
17
18
  if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
18
19
  const valuesDict = values[0];
@@ -24,7 +25,8 @@
24
25
  return s;
25
26
  }
26
27
  /***
27
- * Allow to inject a translation function from outside o-spreadsheet.
28
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
29
+ * a model.
28
30
  * @param tfn the function that will do the translation
29
31
  * @param loaded a function that returns true when the translation is loaded
30
32
  */
@@ -32,6 +34,18 @@
32
34
  _translate = tfn;
33
35
  _loaded = loaded;
34
36
  }
37
+ /**
38
+ * If no translation function has been set, this will mark the translation are loaded.
39
+ *
40
+ * By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
41
+ * translated. But if by the time the model is instantiated no custom translation function has been set, we can set
42
+ * the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
43
+ */
44
+ function setDefaultTranslationMethod() {
45
+ if (_translate === defaultTranslate && _loaded === defaultLoaded) {
46
+ _loaded = () => true;
47
+ }
48
+ }
35
49
  const _t = function (s, ...values) {
36
50
  if (!_loaded()) {
37
51
  return new LazyTranslatedString(s, values);
@@ -6932,7 +6946,7 @@
6932
6946
  if (!anchor)
6933
6947
  return;
6934
6948
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
6935
- const elDims = {
6949
+ let elDims = {
6936
6950
  width: el.getBoundingClientRect().width,
6937
6951
  height: el.getBoundingClientRect().height,
6938
6952
  };
@@ -6940,7 +6954,14 @@
6940
6954
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
6941
6955
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
6942
6956
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
6943
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
6957
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
6958
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
6959
+ // Re-compute the dimensions after setting the max-width and max-height
6960
+ elDims = {
6961
+ width: el.getBoundingClientRect().width,
6962
+ height: el.getBoundingClientRect().height,
6963
+ };
6964
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
6944
6965
  for (const property of Object.keys(style)) {
6945
6966
  el.style[property] = style[property];
6946
6967
  }
@@ -7016,8 +7037,6 @@
7016
7037
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
7017
7038
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
7018
7039
  const cssProperties = {
7019
- "max-height": maxHeight + "px",
7020
- "max-width": maxWidth + "px",
7021
7040
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
7022
7041
  this.spreadsheetOffset.y -
7023
7042
  verticalOffset +
@@ -24976,13 +24995,17 @@
24976
24995
  class SelectMenu extends owl.Component {
24977
24996
  static template = "o-spreadsheet-SelectMenu";
24978
24997
  static components = { Menu };
24998
+ menuId = new UuidGenerator().uuidv4();
24979
24999
  selectRef = owl.useRef("select");
24980
25000
  selectRect = useAbsoluteBoundingRect(this.selectRef);
24981
25001
  state = owl.useState({
24982
25002
  isMenuOpen: false,
24983
25003
  });
24984
- onClick() {
24985
- this.state.isMenuOpen = true;
25004
+ onClick(ev) {
25005
+ if (ev.closedMenuId === this.menuId) {
25006
+ return;
25007
+ }
25008
+ this.state.isMenuOpen = !this.state.isMenuOpen;
24986
25009
  }
24987
25010
  onMenuClosed() {
24988
25011
  this.state.isMenuOpen = false;
@@ -24990,7 +25013,7 @@
24990
25013
  get menuPosition() {
24991
25014
  return {
24992
25015
  x: this.selectRect.x,
24993
- y: this.selectRect.y,
25016
+ y: this.selectRect.y + this.selectRect.height,
24994
25017
  };
24995
25018
  }
24996
25019
  }
@@ -28021,7 +28044,7 @@
28021
28044
  });
28022
28045
  }
28023
28046
  getContainerRect(container) {
28024
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
28047
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
28025
28048
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
28026
28049
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
28027
28050
  const width = viewWidth - x;
@@ -30304,6 +30327,8 @@
30304
30327
  "BITOR",
30305
30328
  "BITRSHIFT",
30306
30329
  "BITXOR",
30330
+ "BYCOL",
30331
+ "BYROW",
30307
30332
  "CEILING.MATH",
30308
30333
  "CEILING.PRECISE",
30309
30334
  "CHISQ.DIST",
@@ -30311,6 +30336,8 @@
30311
30336
  "CHISQ.INV",
30312
30337
  "CHISQ.INV.RT",
30313
30338
  "CHISQ.TEST",
30339
+ "CHOOSECOLS",
30340
+ "CHOOSEROWS",
30314
30341
  "COMBINA",
30315
30342
  "CONCAT",
30316
30343
  "CONFIDENCE.NORM",
@@ -30323,14 +30350,17 @@
30323
30350
  "CSCH",
30324
30351
  "DAYS",
30325
30352
  "DECIMAL",
30353
+ "DROP",
30326
30354
  "ERF.PRECISE",
30327
30355
  "ERFC.PRECISE",
30356
+ "EXPAND",
30328
30357
  "EXPON.DIST",
30329
30358
  "F.DIST",
30330
30359
  "F.DIST.RT",
30331
30360
  "F.INV",
30332
30361
  "F.INV.RT",
30333
30362
  "F.TEST",
30363
+ "FIELDVALUE",
30334
30364
  "FILTERXML",
30335
30365
  "FLOOR.MATH",
30336
30366
  "FLOOR.PRECISE",
@@ -30345,6 +30375,7 @@
30345
30375
  "GAMMA.INV",
30346
30376
  "GAMMALN.PRECISE",
30347
30377
  "GAUSS",
30378
+ "HSTACK",
30348
30379
  "HYPGEOM.DIST",
30349
30380
  "IFNA",
30350
30381
  "IFS",
@@ -30357,9 +30388,14 @@
30357
30388
  "IMSINH",
30358
30389
  "IMTAN",
30359
30390
  "ISFORMULA",
30391
+ "ISOMITTED",
30360
30392
  "ISOWEEKNUM",
30393
+ "LAMBDA",
30394
+ "LET",
30361
30395
  "LOGNORM.DIST",
30362
30396
  "LOGNORM.INV",
30397
+ "MAKEARRAY",
30398
+ "MAP",
30363
30399
  "MAXIFS",
30364
30400
  "MINIFS",
30365
30401
  "MODE.MULT",
@@ -30379,17 +30415,26 @@
30379
30415
  "PERMUTATIONA",
30380
30416
  "PHI",
30381
30417
  "POISSON.DIST",
30418
+ "PQSOURCE",
30419
+ "PYTHON_STR",
30420
+ "PYTHON_TYPE",
30421
+ "PYTHON_TYPENAME",
30382
30422
  "QUARTILE.EXC",
30383
30423
  "QUARTILE.INC",
30384
30424
  "QUERYSTRING",
30425
+ "RANDARRAY",
30385
30426
  "RANK.AVG",
30386
30427
  "RANK.EQ",
30428
+ "REDUCE",
30387
30429
  "RRI",
30430
+ "SCAN",
30388
30431
  "SEC",
30389
30432
  "SECH",
30433
+ "SEQUENCE",
30390
30434
  "SHEET",
30391
30435
  "SHEETS",
30392
30436
  "SKEW.P",
30437
+ "SORTBY",
30393
30438
  "STDEV.P",
30394
30439
  "STDEV.S",
30395
30440
  "SWITCH",
@@ -30399,13 +30444,24 @@
30399
30444
  "T.INV",
30400
30445
  "T.INV.2T",
30401
30446
  "T.TEST",
30447
+ "TAKE",
30448
+ "TEXTAFTER",
30449
+ "TEXTBEFORE",
30402
30450
  "TEXTJOIN",
30451
+ "TEXTSPLIT",
30452
+ "TOCOL",
30453
+ "TOROW",
30403
30454
  "UNICHAR",
30404
30455
  "UNICODE",
30456
+ "UNIQUE",
30405
30457
  "VAR.P",
30406
30458
  "VAR.S",
30459
+ "VSTACK",
30407
30460
  "WEBSERVICE",
30408
30461
  "WEIBULL.DIST",
30462
+ "WRAPCOLS",
30463
+ "WRAPROWS",
30464
+ "XLOOKUP",
30409
30465
  "XOR",
30410
30466
  "Z.TEST",
30411
30467
  ];
@@ -44346,7 +44402,10 @@
44346
44402
  /**
44347
44403
  * Notify the server that the user client left the collaborative session
44348
44404
  */
44349
- leave() {
44405
+ leave(data) {
44406
+ if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44407
+ this.snapshot(data);
44408
+ }
44350
44409
  delete this.clients[this.clientId];
44351
44410
  this.transportService.leave(this.clientId);
44352
44411
  this.transportService.sendMessage({
@@ -44359,6 +44418,9 @@
44359
44418
  * Send a snapshot of the spreadsheet to the collaboration server
44360
44419
  */
44361
44420
  snapshot(data) {
44421
+ if (this.pendingMessages.length !== 0) {
44422
+ return;
44423
+ }
44362
44424
  const snapshotId = this.uuidGenerator.uuidv4();
44363
44425
  this.transportService.sendMessage({
44364
44426
  type: "SNAPSHOT",
@@ -49139,10 +49201,8 @@
49139
49201
  const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
49140
49202
  return isEqual(this.getters.expandZone(activeSheetId, refRange.zone), oldZone);
49141
49203
  });
49142
- // this function assumes that the previous range is always found because
49143
- // it's called when changing a highlight, which exists by definition
49144
49204
  if (!previousRefToken) {
49145
- throw new Error("Previous range not found");
49205
+ return;
49146
49206
  }
49147
49207
  const previousRange = this.getters.getRangeFromSheetXC(activeSheetId, previousRefToken.value);
49148
49208
  this.selectionStart = previousRefToken.start;
@@ -51705,7 +51765,7 @@
51705
51765
  this.env.focusableElement.focus();
51706
51766
  }
51707
51767
  }
51708
- onClickSheetName(ev) {
51768
+ onMouseEventSheetName(ev) {
51709
51769
  if (this.state.isEditing)
51710
51770
  ev.stopPropagation();
51711
51771
  }
@@ -56898,6 +56958,7 @@
56898
56958
  coreHandlers = [];
56899
56959
  constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
56900
56960
  super();
56961
+ setDefaultTranslationMethod();
56901
56962
  stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
56902
56963
  const workbookData = load(data, verboseImport);
56903
56964
  this.state = new StateObserver();
@@ -56973,7 +57034,7 @@
56973
57034
  this.session.join(this.config.client);
56974
57035
  }
56975
57036
  leaveSession() {
56976
- this.session.leave();
57037
+ this.session.leave(this.exportData());
56977
57038
  }
56978
57039
  setupUiPlugin(Plugin) {
56979
57040
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57397,6 +57458,7 @@
57397
57458
  createAction,
57398
57459
  createActions,
57399
57460
  transformRangeData,
57461
+ deepEquals,
57400
57462
  };
57401
57463
  const links = {
57402
57464
  isMarkdownLink,
@@ -57475,9 +57537,9 @@
57475
57537
  exports.tokenize = tokenize;
57476
57538
 
57477
57539
 
57478
- __info__.version = "17.0.25";
57479
- __info__.date = "2024-06-10T09:33:40.022Z";
57480
- __info__.hash = "1f01394";
57540
+ __info__.version = "17.0.28";
57541
+ __info__.date = "2024-07-02T10:35:57.899Z";
57542
+ __info__.hash = "7f86a16";
57481
57543
 
57482
57544
 
57483
57545
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);