@odoo/o-spreadsheet 17.2.12 → 17.2.14

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.12
7
- * @date 2024-06-21T19:58:15.248Z
8
- * @hash 1aaacc4
6
+ * @version 17.2.14
7
+ * @date 2024-07-02T10:35:53.850Z
8
+ * @hash fb0d979
9
9
  */
10
10
 
11
11
  'use strict';
@@ -1818,9 +1818,10 @@ function percentile(values, percent, isInclusive) {
1818
1818
  sortedValues[indexLow] * (indexSup - percentIndex));
1819
1819
  }
1820
1820
 
1821
- // define a mock translation function, when o-spreadsheet runs in standalone it doesn't translate any string
1822
- let _translate = (s) => s;
1823
- let _loaded = () => false;
1821
+ const defaultTranslate = (s) => s;
1822
+ const defaultLoaded = () => false;
1823
+ let _translate = defaultTranslate;
1824
+ let _loaded = defaultLoaded;
1824
1825
  function sprintf(s, ...values) {
1825
1826
  if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
1826
1827
  const valuesDict = values[0];
@@ -1832,7 +1833,8 @@ function sprintf(s, ...values) {
1832
1833
  return s;
1833
1834
  }
1834
1835
  /***
1835
- * Allow to inject a translation function from outside o-spreadsheet.
1836
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
1837
+ * a model.
1836
1838
  * @param tfn the function that will do the translation
1837
1839
  * @param loaded a function that returns true when the translation is loaded
1838
1840
  */
@@ -1840,6 +1842,18 @@ function setTranslationMethod(tfn, loaded = () => true) {
1840
1842
  _translate = tfn;
1841
1843
  _loaded = loaded;
1842
1844
  }
1845
+ /**
1846
+ * If no translation function has been set, this will mark the translation are loaded.
1847
+ *
1848
+ * By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
1849
+ * translated. But if by the time the model is instantiated no custom translation function has been set, we can set
1850
+ * the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
1851
+ */
1852
+ function setDefaultTranslationMethod() {
1853
+ if (_translate === defaultTranslate && _loaded === defaultLoaded) {
1854
+ _loaded = () => true;
1855
+ }
1856
+ }
1843
1857
  const _t = function (s, ...values) {
1844
1858
  if (!_loaded()) {
1845
1859
  return new LazyTranslatedString(s, values);
@@ -29853,6 +29867,7 @@ class FindAndReplaceStore extends SpreadsheetStore {
29853
29867
  currentSearchRegex = null;
29854
29868
  isSearchDirty = false;
29855
29869
  initialShowFormulaState;
29870
+ preserveSelectedMatchIndex = false;
29856
29871
  // fixme: why do we make selectedMatchIndex on top of a selected
29857
29872
  // property in the matches?
29858
29873
  selectedMatchIndex = null;
@@ -29962,7 +29977,9 @@ class FindAndReplaceStore extends SpreadsheetStore {
29962
29977
  * refresh the matches according to the current search options
29963
29978
  */
29964
29979
  refreshSearch(jumpToMatchSheet = true) {
29965
- this.selectedMatchIndex = null;
29980
+ if (!this.preserveSelectedMatchIndex) {
29981
+ this.selectedMatchIndex = null;
29982
+ }
29966
29983
  this.findMatches();
29967
29984
  this.selectNextCell(Direction.current, jumpToMatchSheet);
29968
29985
  }
@@ -30061,10 +30078,16 @@ class FindAndReplaceStore extends SpreadsheetStore {
30061
30078
  const selectedMatch = matches[nextIndex];
30062
30079
  // Switch to the sheet where the match is located
30063
30080
  if (jumpToMatchSheet && this.getters.getActiveSheetId() !== selectedMatch.sheetId) {
30081
+ // We set `preserveSelectedMatchIndex` to true to avoid resetting the selected search
30082
+ // index in the `refreshSearch` function when a new sheet is activated. The reason being
30083
+ // that, when we automatically go back to previous sheet while performing a search, the
30084
+ // search index is reset to the first occurrence each time.
30085
+ this.preserveSelectedMatchIndex = true;
30064
30086
  this.model.dispatch("ACTIVATE_SHEET", {
30065
30087
  sheetIdFrom: this.getters.getActiveSheetId(),
30066
30088
  sheetIdTo: selectedMatch.sheetId,
30067
30089
  });
30090
+ this.preserveSelectedMatchIndex = false;
30068
30091
  // We do not want to reset the selection at finalize in this case
30069
30092
  this.isSearchDirty = false;
30070
30093
  }
@@ -36470,6 +36493,8 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36470
36493
  "BITOR",
36471
36494
  "BITRSHIFT",
36472
36495
  "BITXOR",
36496
+ "BYCOL",
36497
+ "BYROW",
36473
36498
  "CEILING.MATH",
36474
36499
  "CEILING.PRECISE",
36475
36500
  "CHISQ.DIST",
@@ -36477,6 +36502,8 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36477
36502
  "CHISQ.INV",
36478
36503
  "CHISQ.INV.RT",
36479
36504
  "CHISQ.TEST",
36505
+ "CHOOSECOLS",
36506
+ "CHOOSEROWS",
36480
36507
  "COMBINA",
36481
36508
  "CONCAT",
36482
36509
  "CONFIDENCE.NORM",
@@ -36489,14 +36516,17 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36489
36516
  "CSCH",
36490
36517
  "DAYS",
36491
36518
  "DECIMAL",
36519
+ "DROP",
36492
36520
  "ERF.PRECISE",
36493
36521
  "ERFC.PRECISE",
36522
+ "EXPAND",
36494
36523
  "EXPON.DIST",
36495
36524
  "F.DIST",
36496
36525
  "F.DIST.RT",
36497
36526
  "F.INV",
36498
36527
  "F.INV.RT",
36499
36528
  "F.TEST",
36529
+ "FIELDVALUE",
36500
36530
  "FILTERXML",
36501
36531
  "FLOOR.MATH",
36502
36532
  "FLOOR.PRECISE",
@@ -36511,6 +36541,7 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36511
36541
  "GAMMA.INV",
36512
36542
  "GAMMALN.PRECISE",
36513
36543
  "GAUSS",
36544
+ "HSTACK",
36514
36545
  "HYPGEOM.DIST",
36515
36546
  "IFNA",
36516
36547
  "IFS",
@@ -36523,9 +36554,14 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36523
36554
  "IMSINH",
36524
36555
  "IMTAN",
36525
36556
  "ISFORMULA",
36557
+ "ISOMITTED",
36526
36558
  "ISOWEEKNUM",
36559
+ "LAMBDA",
36560
+ "LET",
36527
36561
  "LOGNORM.DIST",
36528
36562
  "LOGNORM.INV",
36563
+ "MAKEARRAY",
36564
+ "MAP",
36529
36565
  "MAXIFS",
36530
36566
  "MINIFS",
36531
36567
  "MODE.MULT",
@@ -36545,17 +36581,26 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36545
36581
  "PERMUTATIONA",
36546
36582
  "PHI",
36547
36583
  "POISSON.DIST",
36584
+ "PQSOURCE",
36585
+ "PYTHON_STR",
36586
+ "PYTHON_TYPE",
36587
+ "PYTHON_TYPENAME",
36548
36588
  "QUARTILE.EXC",
36549
36589
  "QUARTILE.INC",
36550
36590
  "QUERYSTRING",
36591
+ "RANDARRAY",
36551
36592
  "RANK.AVG",
36552
36593
  "RANK.EQ",
36594
+ "REDUCE",
36553
36595
  "RRI",
36596
+ "SCAN",
36554
36597
  "SEC",
36555
36598
  "SECH",
36599
+ "SEQUENCE",
36556
36600
  "SHEET",
36557
36601
  "SHEETS",
36558
36602
  "SKEW.P",
36603
+ "SORTBY",
36559
36604
  "STDEV.P",
36560
36605
  "STDEV.S",
36561
36606
  "SWITCH",
@@ -36565,13 +36610,24 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36565
36610
  "T.INV",
36566
36611
  "T.INV.2T",
36567
36612
  "T.TEST",
36613
+ "TAKE",
36614
+ "TEXTAFTER",
36615
+ "TEXTBEFORE",
36568
36616
  "TEXTJOIN",
36617
+ "TEXTSPLIT",
36618
+ "TOCOL",
36619
+ "TOROW",
36569
36620
  "UNICHAR",
36570
36621
  "UNICODE",
36622
+ "UNIQUE",
36571
36623
  "VAR.P",
36572
36624
  "VAR.S",
36625
+ "VSTACK",
36573
36626
  "WEBSERVICE",
36574
36627
  "WEIBULL.DIST",
36628
+ "WRAPCOLS",
36629
+ "WRAPROWS",
36630
+ "XLOOKUP",
36575
36631
  "XOR",
36576
36632
  "Z.TEST",
36577
36633
  ];
@@ -54980,7 +55036,7 @@ class BottomBarSheet extends owl.Component {
54980
55036
  this.DOMFocusableElementStore.focus();
54981
55037
  }
54982
55038
  }
54983
- onClickSheetName(ev) {
55039
+ onMouseEventSheetName(ev) {
54984
55040
  if (this.state.isEditing)
54985
55041
  ev.stopPropagation();
54986
55042
  }
@@ -60152,6 +60208,7 @@ class Model extends EventBus {
60152
60208
  coreHandlers = [];
60153
60209
  constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
60154
60210
  super();
60211
+ setDefaultTranslationMethod();
60155
60212
  stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
60156
60213
  const workbookData = load(data, verboseImport);
60157
60214
  this.state = new StateObserver();
@@ -60784,6 +60841,6 @@ exports.tokenColors = tokenColors;
60784
60841
  exports.tokenize = tokenize;
60785
60842
 
60786
60843
 
60787
- __info__.version = "17.2.12";
60788
- __info__.date = "2024-06-21T19:58:15.248Z";
60789
- __info__.hash = "1aaacc4";
60844
+ __info__.version = "17.2.14";
60845
+ __info__.date = "2024-07-02T10:35:53.850Z";
60846
+ __info__.hash = "fb0d979";
@@ -7951,6 +7951,7 @@ declare class FindAndReplaceStore extends SpreadsheetStore implements HighlightP
7951
7951
  private currentSearchRegex;
7952
7952
  private isSearchDirty;
7953
7953
  private initialShowFormulaState;
7954
+ private preserveSelectedMatchIndex;
7954
7955
  selectedMatchIndex: number | null;
7955
7956
  toSearch: string;
7956
7957
  toReplace: string;
@@ -8235,7 +8236,7 @@ declare class BottomBarSheet extends Component<Props$b, SpreadsheetChildEnv> {
8235
8236
  private activateSheet;
8236
8237
  onDblClick(): void;
8237
8238
  onKeyDown(ev: KeyboardEvent): void;
8238
- onClickSheetName(ev: MouseEvent): void;
8239
+ onMouseEventSheetName(ev: MouseEvent): void;
8239
8240
  private startEdition;
8240
8241
  private stopEdition;
8241
8242
  private cancelEdition;
@@ -9072,7 +9073,8 @@ type SprintfValues = (string | String | number)[] | [{
9072
9073
  }];
9073
9074
  type TranslationFunction = (string: string, ...values: SprintfValues) => string;
9074
9075
  /***
9075
- * Allow to inject a translation function from outside o-spreadsheet.
9076
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
9077
+ * a model.
9076
9078
  * @param tfn the function that will do the translation
9077
9079
  * @param loaded a function that returns true when the translation is loaded
9078
9080
  */
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.12
7
- * @date 2024-06-21T19:58:15.248Z
8
- * @hash 1aaacc4
6
+ * @version 17.2.14
7
+ * @date 2024-07-02T10:35:53.850Z
8
+ * @hash fb0d979
9
9
  */
10
10
 
11
11
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw } from '@odoo/owl';
@@ -1816,9 +1816,10 @@ function percentile(values, percent, isInclusive) {
1816
1816
  sortedValues[indexLow] * (indexSup - percentIndex));
1817
1817
  }
1818
1818
 
1819
- // define a mock translation function, when o-spreadsheet runs in standalone it doesn't translate any string
1820
- let _translate = (s) => s;
1821
- let _loaded = () => false;
1819
+ const defaultTranslate = (s) => s;
1820
+ const defaultLoaded = () => false;
1821
+ let _translate = defaultTranslate;
1822
+ let _loaded = defaultLoaded;
1822
1823
  function sprintf(s, ...values) {
1823
1824
  if (values.length === 1 && typeof values[0] === "object" && !(values[0] instanceof String)) {
1824
1825
  const valuesDict = values[0];
@@ -1830,7 +1831,8 @@ function sprintf(s, ...values) {
1830
1831
  return s;
1831
1832
  }
1832
1833
  /***
1833
- * Allow to inject a translation function from outside o-spreadsheet.
1834
+ * Allow to inject a translation function from outside o-spreadsheet. This should be called before instantiating
1835
+ * a model.
1834
1836
  * @param tfn the function that will do the translation
1835
1837
  * @param loaded a function that returns true when the translation is loaded
1836
1838
  */
@@ -1838,6 +1840,18 @@ function setTranslationMethod(tfn, loaded = () => true) {
1838
1840
  _translate = tfn;
1839
1841
  _loaded = loaded;
1840
1842
  }
1843
+ /**
1844
+ * If no translation function has been set, this will mark the translation are loaded.
1845
+ *
1846
+ * By default, the translations should not be set as loaded, otherwise top-level translated constants will never be
1847
+ * translated. But if by the time the model is instantiated no custom translation function has been set, we can set
1848
+ * the default translation function as loaded so o-spreadsheet can be run in standalone with no translations.
1849
+ */
1850
+ function setDefaultTranslationMethod() {
1851
+ if (_translate === defaultTranslate && _loaded === defaultLoaded) {
1852
+ _loaded = () => true;
1853
+ }
1854
+ }
1841
1855
  const _t = function (s, ...values) {
1842
1856
  if (!_loaded()) {
1843
1857
  return new LazyTranslatedString(s, values);
@@ -29851,6 +29865,7 @@ class FindAndReplaceStore extends SpreadsheetStore {
29851
29865
  currentSearchRegex = null;
29852
29866
  isSearchDirty = false;
29853
29867
  initialShowFormulaState;
29868
+ preserveSelectedMatchIndex = false;
29854
29869
  // fixme: why do we make selectedMatchIndex on top of a selected
29855
29870
  // property in the matches?
29856
29871
  selectedMatchIndex = null;
@@ -29960,7 +29975,9 @@ class FindAndReplaceStore extends SpreadsheetStore {
29960
29975
  * refresh the matches according to the current search options
29961
29976
  */
29962
29977
  refreshSearch(jumpToMatchSheet = true) {
29963
- this.selectedMatchIndex = null;
29978
+ if (!this.preserveSelectedMatchIndex) {
29979
+ this.selectedMatchIndex = null;
29980
+ }
29964
29981
  this.findMatches();
29965
29982
  this.selectNextCell(Direction.current, jumpToMatchSheet);
29966
29983
  }
@@ -30059,10 +30076,16 @@ class FindAndReplaceStore extends SpreadsheetStore {
30059
30076
  const selectedMatch = matches[nextIndex];
30060
30077
  // Switch to the sheet where the match is located
30061
30078
  if (jumpToMatchSheet && this.getters.getActiveSheetId() !== selectedMatch.sheetId) {
30079
+ // We set `preserveSelectedMatchIndex` to true to avoid resetting the selected search
30080
+ // index in the `refreshSearch` function when a new sheet is activated. The reason being
30081
+ // that, when we automatically go back to previous sheet while performing a search, the
30082
+ // search index is reset to the first occurrence each time.
30083
+ this.preserveSelectedMatchIndex = true;
30062
30084
  this.model.dispatch("ACTIVATE_SHEET", {
30063
30085
  sheetIdFrom: this.getters.getActiveSheetId(),
30064
30086
  sheetIdTo: selectedMatch.sheetId,
30065
30087
  });
30088
+ this.preserveSelectedMatchIndex = false;
30066
30089
  // We do not want to reset the selection at finalize in this case
30067
30090
  this.isSearchDirty = false;
30068
30091
  }
@@ -36468,6 +36491,8 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36468
36491
  "BITOR",
36469
36492
  "BITRSHIFT",
36470
36493
  "BITXOR",
36494
+ "BYCOL",
36495
+ "BYROW",
36471
36496
  "CEILING.MATH",
36472
36497
  "CEILING.PRECISE",
36473
36498
  "CHISQ.DIST",
@@ -36475,6 +36500,8 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36475
36500
  "CHISQ.INV",
36476
36501
  "CHISQ.INV.RT",
36477
36502
  "CHISQ.TEST",
36503
+ "CHOOSECOLS",
36504
+ "CHOOSEROWS",
36478
36505
  "COMBINA",
36479
36506
  "CONCAT",
36480
36507
  "CONFIDENCE.NORM",
@@ -36487,14 +36514,17 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36487
36514
  "CSCH",
36488
36515
  "DAYS",
36489
36516
  "DECIMAL",
36517
+ "DROP",
36490
36518
  "ERF.PRECISE",
36491
36519
  "ERFC.PRECISE",
36520
+ "EXPAND",
36492
36521
  "EXPON.DIST",
36493
36522
  "F.DIST",
36494
36523
  "F.DIST.RT",
36495
36524
  "F.INV",
36496
36525
  "F.INV.RT",
36497
36526
  "F.TEST",
36527
+ "FIELDVALUE",
36498
36528
  "FILTERXML",
36499
36529
  "FLOOR.MATH",
36500
36530
  "FLOOR.PRECISE",
@@ -36509,6 +36539,7 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36509
36539
  "GAMMA.INV",
36510
36540
  "GAMMALN.PRECISE",
36511
36541
  "GAUSS",
36542
+ "HSTACK",
36512
36543
  "HYPGEOM.DIST",
36513
36544
  "IFNA",
36514
36545
  "IFS",
@@ -36521,9 +36552,14 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36521
36552
  "IMSINH",
36522
36553
  "IMTAN",
36523
36554
  "ISFORMULA",
36555
+ "ISOMITTED",
36524
36556
  "ISOWEEKNUM",
36557
+ "LAMBDA",
36558
+ "LET",
36525
36559
  "LOGNORM.DIST",
36526
36560
  "LOGNORM.INV",
36561
+ "MAKEARRAY",
36562
+ "MAP",
36527
36563
  "MAXIFS",
36528
36564
  "MINIFS",
36529
36565
  "MODE.MULT",
@@ -36543,17 +36579,26 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36543
36579
  "PERMUTATIONA",
36544
36580
  "PHI",
36545
36581
  "POISSON.DIST",
36582
+ "PQSOURCE",
36583
+ "PYTHON_STR",
36584
+ "PYTHON_TYPE",
36585
+ "PYTHON_TYPENAME",
36546
36586
  "QUARTILE.EXC",
36547
36587
  "QUARTILE.INC",
36548
36588
  "QUERYSTRING",
36589
+ "RANDARRAY",
36549
36590
  "RANK.AVG",
36550
36591
  "RANK.EQ",
36592
+ "REDUCE",
36551
36593
  "RRI",
36594
+ "SCAN",
36552
36595
  "SEC",
36553
36596
  "SECH",
36597
+ "SEQUENCE",
36554
36598
  "SHEET",
36555
36599
  "SHEETS",
36556
36600
  "SKEW.P",
36601
+ "SORTBY",
36557
36602
  "STDEV.P",
36558
36603
  "STDEV.S",
36559
36604
  "SWITCH",
@@ -36563,13 +36608,24 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
36563
36608
  "T.INV",
36564
36609
  "T.INV.2T",
36565
36610
  "T.TEST",
36611
+ "TAKE",
36612
+ "TEXTAFTER",
36613
+ "TEXTBEFORE",
36566
36614
  "TEXTJOIN",
36615
+ "TEXTSPLIT",
36616
+ "TOCOL",
36617
+ "TOROW",
36567
36618
  "UNICHAR",
36568
36619
  "UNICODE",
36620
+ "UNIQUE",
36569
36621
  "VAR.P",
36570
36622
  "VAR.S",
36623
+ "VSTACK",
36571
36624
  "WEBSERVICE",
36572
36625
  "WEIBULL.DIST",
36626
+ "WRAPCOLS",
36627
+ "WRAPROWS",
36628
+ "XLOOKUP",
36573
36629
  "XOR",
36574
36630
  "Z.TEST",
36575
36631
  ];
@@ -54978,7 +55034,7 @@ class BottomBarSheet extends Component {
54978
55034
  this.DOMFocusableElementStore.focus();
54979
55035
  }
54980
55036
  }
54981
- onClickSheetName(ev) {
55037
+ onMouseEventSheetName(ev) {
54982
55038
  if (this.state.isEditing)
54983
55039
  ev.stopPropagation();
54984
55040
  }
@@ -60150,6 +60206,7 @@ class Model extends EventBus {
60150
60206
  coreHandlers = [];
60151
60207
  constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
60152
60208
  super();
60209
+ setDefaultTranslationMethod();
60153
60210
  stateUpdateMessages = repairInitialMessages(data, stateUpdateMessages);
60154
60211
  const workbookData = load(data, verboseImport);
60155
60212
  this.state = new StateObserver();
@@ -60741,6 +60798,6 @@ const constants = {
60741
60798
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
60742
60799
 
60743
60800
 
60744
- __info__.version = "17.2.12";
60745
- __info__.date = "2024-06-21T19:58:15.248Z";
60746
- __info__.hash = "1aaacc4";
60801
+ __info__.version = "17.2.14";
60802
+ __info__.date = "2024-07-02T10:35:53.850Z";
60803
+ __info__.hash = "fb0d979";