@odoo/o-spreadsheet 17.1.19 → 17.1.20

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.19
6
- * @date 2024-06-14T10:03:04.850Z
7
- * @hash 8a74f95
5
+ * @version 17.1.20
6
+ * @date 2024-07-02T09:03:04.534Z
7
+ * @hash d15aaf3
8
8
  */
9
9
 
10
10
  'use strict';
@@ -1770,9 +1770,10 @@ function percentile(values, percent, isInclusive) {
1770
1770
  sortedValues[indexLow] * (indexSup - percentIndex));
1771
1771
  }
1772
1772
 
1773
- // define a mock translation function, when o-spreadsheet runs in standalone it doesn't translate any string
1774
- let _translate = (s) => s;
1775
- let _loaded = () => false;
1773
+ const defaultTranslate = (s) => s;
1774
+ const defaultLoaded = () => false;
1775
+ let _translate = defaultTranslate;
1776
+ let _loaded = defaultLoaded;
1776
1777
  function sprintf(s, ...values) {
1777
1778
  if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
1778
1779
  const valuesDict = values[0];
@@ -1784,7 +1785,8 @@ function sprintf(s, ...values) {
1784
1785
  return s;
1785
1786
  }
1786
1787
  /***
1787
- * Allow to inject a translation function from outside o-spreadsheet.
1788
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
1789
+ * a model.
1788
1790
  * @param tfn the function that will do the translation
1789
1791
  * @param loaded a function that returns true when the translation is loaded
1790
1792
  */
@@ -1792,6 +1794,18 @@ function setTranslationMethod(tfn, loaded = () => true) {
1792
1794
  _translate = tfn;
1793
1795
  _loaded = loaded;
1794
1796
  }
1797
+ /**
1798
+ * If no translation function has been set, this will mark the translation are loaded.
1799
+ *
1800
+ * By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
1801
+ * translated. But if by the time the model is instantiated no custom translation function has been set, we can set
1802
+ * the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
1803
+ */
1804
+ function setDefaultTranslationMethod() {
1805
+ if (_translate === defaultTranslate && _loaded === defaultLoaded) {
1806
+ _loaded = () => true;
1807
+ }
1808
+ }
1795
1809
  const _t = function (s, ...values) {
1796
1810
  if (!_loaded()) {
1797
1811
  return new LazyTranslatedString(s, values);
@@ -52064,7 +52078,7 @@ class BottomBarSheet extends owl.Component {
52064
52078
  this.env.focusableElement.focus();
52065
52079
  }
52066
52080
  }
52067
- onClickSheetName(ev) {
52081
+ onMouseEventSheetName(ev) {
52068
52082
  if (this.state.isEditing)
52069
52083
  ev.stopPropagation();
52070
52084
  }
@@ -57204,6 +57218,7 @@ class Model extends EventBus {
57204
57218
  coreHandlers = [];
57205
57219
  constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
57206
57220
  super();
57221
+ setDefaultTranslationMethod();
57207
57222
  stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
57208
57223
  const workbookData = load(data, verboseImport);
57209
57224
  this.state = new StateObserver();
@@ -57791,6 +57806,6 @@ exports.setTranslationMethod = setTranslationMethod;
57791
57806
  exports.tokenize = tokenize;
57792
57807
 
57793
57808
 
57794
- __info__.version = "17.1.19";
57795
- __info__.date = "2024-06-14T10:03:04.850Z";
57796
- __info__.hash = "8a74f95";
57809
+ __info__.version = "17.1.20";
57810
+ __info__.date = "2024-07-02T09:03:04.534Z";
57811
+ __info__.hash = "d15aaf3";
@@ -6625,7 +6625,7 @@ declare class BottomBarSheet extends Component<Props$v, SpreadsheetChildEnv> {
6625
6625
  private activateSheet;
6626
6626
  onDblClick(): void;
6627
6627
  onKeyDown(ev: KeyboardEvent): void;
6628
- onClickSheetName(ev: MouseEvent): void;
6628
+ onMouseEventSheetName(ev: MouseEvent): void;
6629
6629
  private startEdition;
6630
6630
  private stopEdition;
6631
6631
  private cancelEdition;
@@ -8567,7 +8567,8 @@ type SprintfValues = (string | String | number)[] | [{
8567
8567
  }];
8568
8568
  type TranslationFunction = (string: string, ...values: SprintfValues) => string;
8569
8569
  /***
8570
- * Allow to inject a translation function from outside o-spreadsheet.
8570
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
8571
+ * a model.
8571
8572
  * @param tfn the function that will do the translation
8572
8573
  * @param loaded a function that returns true when the translation is loaded
8573
8574
  */
@@ -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.19
6
- * @date 2024-06-14T10:03:04.850Z
7
- * @hash 8a74f95
5
+ * @version 17.1.20
6
+ * @date 2024-07-02T09:03:04.534Z
7
+ * @hash d15aaf3
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';
@@ -1768,9 +1768,10 @@ function percentile(values, percent, isInclusive) {
1768
1768
  sortedValues[indexLow] * (indexSup - percentIndex));
1769
1769
  }
1770
1770
 
1771
- // define a mock translation function, when o-spreadsheet runs in standalone it doesn't translate any string
1772
- let _translate = (s) => s;
1773
- let _loaded = () => false;
1771
+ const defaultTranslate = (s) => s;
1772
+ const defaultLoaded = () => false;
1773
+ let _translate = defaultTranslate;
1774
+ let _loaded = defaultLoaded;
1774
1775
  function sprintf(s, ...values) {
1775
1776
  if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
1776
1777
  const valuesDict = values[0];
@@ -1782,7 +1783,8 @@ function sprintf(s, ...values) {
1782
1783
  return s;
1783
1784
  }
1784
1785
  /***
1785
- * Allow to inject a translation function from outside o-spreadsheet.
1786
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
1787
+ * a model.
1786
1788
  * @param tfn the function that will do the translation
1787
1789
  * @param loaded a function that returns true when the translation is loaded
1788
1790
  */
@@ -1790,6 +1792,18 @@ function setTranslationMethod(tfn, loaded = () => true) {
1790
1792
  _translate = tfn;
1791
1793
  _loaded = loaded;
1792
1794
  }
1795
+ /**
1796
+ * If no translation function has been set, this will mark the translation are loaded.
1797
+ *
1798
+ * By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
1799
+ * translated. But if by the time the model is instantiated no custom translation function has been set, we can set
1800
+ * the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
1801
+ */
1802
+ function setDefaultTranslationMethod() {
1803
+ if (_translate === defaultTranslate && _loaded === defaultLoaded) {
1804
+ _loaded = () => true;
1805
+ }
1806
+ }
1793
1807
  const _t = function (s, ...values) {
1794
1808
  if (!_loaded()) {
1795
1809
  return new LazyTranslatedString(s, values);
@@ -52062,7 +52076,7 @@ class BottomBarSheet extends Component {
52062
52076
  this.env.focusableElement.focus();
52063
52077
  }
52064
52078
  }
52065
- onClickSheetName(ev) {
52079
+ onMouseEventSheetName(ev) {
52066
52080
  if (this.state.isEditing)
52067
52081
  ev.stopPropagation();
52068
52082
  }
@@ -57202,6 +57216,7 @@ class Model extends EventBus {
57202
57216
  coreHandlers = [];
57203
57217
  constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
57204
57218
  super();
57219
+ setDefaultTranslationMethod();
57205
57220
  stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
57206
57221
  const workbookData = load(data, verboseImport);
57207
57222
  this.state = new StateObserver();
@@ -57753,6 +57768,6 @@ const constants = {
57753
57768
  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 };
57754
57769
 
57755
57770
 
57756
- __info__.version = "17.1.19";
57757
- __info__.date = "2024-06-14T10:03:04.850Z";
57758
- __info__.hash = "8a74f95";
57771
+ __info__.version = "17.1.20";
57772
+ __info__.date = "2024-07-02T09:03:04.534Z";
57773
+ __info__.hash = "d15aaf3";
@@ -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.19
6
- * @date 2024-06-14T10:03:04.850Z
7
- * @hash 8a74f95
5
+ * @version 17.1.20
6
+ * @date 2024-07-02T09:03:04.534Z
7
+ * @hash d15aaf3
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -1769,9 +1769,10 @@
1769
1769
  sortedValues[indexLow] * (indexSup - percentIndex));
1770
1770
  }
1771
1771
 
1772
- // define a mock translation function, when o-spreadsheet runs in standalone it doesn't translate any string
1773
- let _translate = (s) => s;
1774
- let _loaded = () => false;
1772
+ const defaultTranslate = (s) => s;
1773
+ const defaultLoaded = () => false;
1774
+ let _translate = defaultTranslate;
1775
+ let _loaded = defaultLoaded;
1775
1776
  function sprintf(s, ...values) {
1776
1777
  if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
1777
1778
  const valuesDict = values[0];
@@ -1783,7 +1784,8 @@
1783
1784
  return s;
1784
1785
  }
1785
1786
  /***
1786
- * Allow to inject a translation function from outside o-spreadsheet.
1787
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
1788
+ * a model.
1787
1789
  * @param tfn the function that will do the translation
1788
1790
  * @param loaded a function that returns true when the translation is loaded
1789
1791
  */
@@ -1791,6 +1793,18 @@
1791
1793
  _translate = tfn;
1792
1794
  _loaded = loaded;
1793
1795
  }
1796
+ /**
1797
+ * If no translation function has been set, this will mark the translation are loaded.
1798
+ *
1799
+ * By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
1800
+ * translated. But if by the time the model is instantiated no custom translation function has been set, we can set
1801
+ * the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
1802
+ */
1803
+ function setDefaultTranslationMethod() {
1804
+ if (_translate === defaultTranslate && _loaded === defaultLoaded) {
1805
+ _loaded = () => true;
1806
+ }
1807
+ }
1794
1808
  const _t = function (s, ...values) {
1795
1809
  if (!_loaded()) {
1796
1810
  return new LazyTranslatedString(s, values);
@@ -52063,7 +52077,7 @@
52063
52077
  this.env.focusableElement.focus();
52064
52078
  }
52065
52079
  }
52066
- onClickSheetName(ev) {
52080
+ onMouseEventSheetName(ev) {
52067
52081
  if (this.state.isEditing)
52068
52082
  ev.stopPropagation();
52069
52083
  }
@@ -57203,6 +57217,7 @@
57203
57217
  coreHandlers = [];
57204
57218
  constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
57205
57219
  super();
57220
+ setDefaultTranslationMethod();
57206
57221
  stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
57207
57222
  const workbookData = load(data, verboseImport);
57208
57223
  this.state = new StateObserver();
@@ -57790,9 +57805,9 @@
57790
57805
  exports.tokenize = tokenize;
57791
57806
 
57792
57807
 
57793
- __info__.version = "17.1.19";
57794
- __info__.date = "2024-06-14T10:03:04.850Z";
57795
- __info__.hash = "8a74f95";
57808
+ __info__.version = "17.1.20";
57809
+ __info__.date = "2024-07-02T09:03:04.534Z";
57810
+ __info__.hash = "d15aaf3";
57796
57811
 
57797
57812
 
57798
57813
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);