@odoo/o-spreadsheet 16.2.8 → 16.2.9

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.
@@ -1726,27 +1726,36 @@ function removeTrailingZeroes(numberString) {
1726
1726
  }
1727
1727
  return numberString.slice(0, i + 1) || undefined;
1728
1728
  }
1729
+ const leadingZeroesRegexp = /^0+/;
1729
1730
  /**
1730
1731
  * Limit the size of the decimal part of a number to the given number of digits.
1731
1732
  */
1732
1733
  function limitDecimalDigits(decimalDigits, maxDecimals) {
1734
+ var _a;
1733
1735
  let integerDigits = "0";
1734
1736
  let resultDecimalDigits = decimalDigits;
1735
1737
  // Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
1736
1738
  // but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
1737
1739
  let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
1738
1740
  const i = maxDecimals;
1739
- if (Number(Number(decimalDigits[i]) < 5)) {
1741
+ if (Number(decimalDigits[i]) < 5) {
1740
1742
  return { integerDigits, decimalDigits: slicedDecimalDigits };
1741
1743
  }
1742
1744
  // round up
1745
+ const leadingZeroes = ((_a = slicedDecimalDigits.match(leadingZeroesRegexp)) === null || _a === void 0 ? void 0 : _a[0]) || "";
1743
1746
  const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
1744
- if (slicedRoundedUp.length > slicedDecimalDigits.length) {
1745
- integerDigits = (Number(integerDigits) + 1).toString();
1747
+ const withoutLeadingZeroes = slicedDecimalDigits.slice(leadingZeroes.length);
1748
+ // e.g. carry over from 99 to 100
1749
+ const carryOver = slicedRoundedUp.length > withoutLeadingZeroes.length;
1750
+ if (carryOver && !leadingZeroes) {
1751
+ integerDigits = "1";
1746
1752
  resultDecimalDigits = undefined;
1747
1753
  }
1754
+ else if (carryOver) {
1755
+ resultDecimalDigits = leadingZeroes.slice(0, -1) + slicedRoundedUp;
1756
+ }
1748
1757
  else {
1749
- resultDecimalDigits = slicedRoundedUp;
1758
+ resultDecimalDigits = leadingZeroes + slicedRoundedUp;
1750
1759
  }
1751
1760
  return { integerDigits, decimalDigits: resultDecimalDigits };
1752
1761
  }
@@ -16953,6 +16962,7 @@ css /* scss */ `
16953
16962
  .o-color-picker-toggler {
16954
16963
  display: flex;
16955
16964
  .o-color-picker-toggler-sign {
16965
+ display: flex;
16956
16966
  margin: auto auto;
16957
16967
  width: 55%;
16958
16968
  height: 55%;
@@ -19847,6 +19857,7 @@ class Composer extends owl.Component {
19847
19857
  (this.autoCompleteState.selectedIndex + 1) % this.autoCompleteState.values.length;
19848
19858
  }
19849
19859
  }
19860
+ this.updateCursorIfNeeded();
19850
19861
  }
19851
19862
  processTabKey(ev) {
19852
19863
  var _a;
@@ -19917,10 +19928,12 @@ class Composer extends owl.Component {
19917
19928
  }
19918
19929
  else {
19919
19930
  ev.stopPropagation();
19931
+ this.updateCursorIfNeeded();
19920
19932
  }
19921
- const { start, end } = this.contentHelper.getCurrentSelection();
19922
- if (!this.env.model.getters.isSelectingForComposer() &&
19923
- !(ev.key === "Enter" && (ev.altKey || ev.ctrlKey))) {
19933
+ }
19934
+ updateCursorIfNeeded() {
19935
+ if (!this.env.model.getters.isSelectingForComposer()) {
19936
+ const { start, end } = this.contentHelper.getCurrentSelection();
19924
19937
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
19925
19938
  this.isKeyStillDown = true;
19926
19939
  }
@@ -19978,7 +19991,12 @@ class Composer extends owl.Component {
19978
19991
  };
19979
19992
  });
19980
19993
  if (searchTerm) {
19981
- values = fuzzyLookup(searchTerm, values, (t) => t.text);
19994
+ if (searchTerm.toLowerCase() === "true" || searchTerm.toLowerCase() === "false") {
19995
+ values = [];
19996
+ }
19997
+ else {
19998
+ values = fuzzyLookup(searchTerm, values, (t) => t.text);
19999
+ }
19982
20000
  }
19983
20001
  else {
19984
20002
  // alphabetical order
@@ -45350,6 +45368,6 @@ exports.setTranslationMethod = setTranslationMethod;
45350
45368
  exports.tokenize = tokenize;
45351
45369
 
45352
45370
 
45353
- __info__.version = '16.2.8';
45354
- __info__.date = '2023-06-02T10:12:43.068Z';
45355
- __info__.hash = 'b474e62';
45371
+ __info__.version = '16.2.9';
45372
+ __info__.date = '2023-06-12T13:49:57.216Z';
45373
+ __info__.hash = '37e2719';
@@ -6099,6 +6099,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6099
6099
  onCompositionStart(): void;
6100
6100
  onCompositionEnd(): void;
6101
6101
  onKeydown(ev: KeyboardEvent): void;
6102
+ private updateCursorIfNeeded;
6102
6103
  onInput(): void;
6103
6104
  onKeyup(ev: KeyboardEvent): void;
6104
6105
  showAutocomplete(searchTerm: string): void;
@@ -1722,27 +1722,36 @@ function removeTrailingZeroes(numberString) {
1722
1722
  }
1723
1723
  return numberString.slice(0, i + 1) || undefined;
1724
1724
  }
1725
+ const leadingZeroesRegexp = /^0+/;
1725
1726
  /**
1726
1727
  * Limit the size of the decimal part of a number to the given number of digits.
1727
1728
  */
1728
1729
  function limitDecimalDigits(decimalDigits, maxDecimals) {
1730
+ var _a;
1729
1731
  let integerDigits = "0";
1730
1732
  let resultDecimalDigits = decimalDigits;
1731
1733
  // Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
1732
1734
  // but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
1733
1735
  let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
1734
1736
  const i = maxDecimals;
1735
- if (Number(Number(decimalDigits[i]) < 5)) {
1737
+ if (Number(decimalDigits[i]) < 5) {
1736
1738
  return { integerDigits, decimalDigits: slicedDecimalDigits };
1737
1739
  }
1738
1740
  // round up
1741
+ const leadingZeroes = ((_a = slicedDecimalDigits.match(leadingZeroesRegexp)) === null || _a === void 0 ? void 0 : _a[0]) || "";
1739
1742
  const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
1740
- if (slicedRoundedUp.length > slicedDecimalDigits.length) {
1741
- integerDigits = (Number(integerDigits) + 1).toString();
1743
+ const withoutLeadingZeroes = slicedDecimalDigits.slice(leadingZeroes.length);
1744
+ // e.g. carry over from 99 to 100
1745
+ const carryOver = slicedRoundedUp.length > withoutLeadingZeroes.length;
1746
+ if (carryOver && !leadingZeroes) {
1747
+ integerDigits = "1";
1742
1748
  resultDecimalDigits = undefined;
1743
1749
  }
1750
+ else if (carryOver) {
1751
+ resultDecimalDigits = leadingZeroes.slice(0, -1) + slicedRoundedUp;
1752
+ }
1744
1753
  else {
1745
- resultDecimalDigits = slicedRoundedUp;
1754
+ resultDecimalDigits = leadingZeroes + slicedRoundedUp;
1746
1755
  }
1747
1756
  return { integerDigits, decimalDigits: resultDecimalDigits };
1748
1757
  }
@@ -16949,6 +16958,7 @@ css /* scss */ `
16949
16958
  .o-color-picker-toggler {
16950
16959
  display: flex;
16951
16960
  .o-color-picker-toggler-sign {
16961
+ display: flex;
16952
16962
  margin: auto auto;
16953
16963
  width: 55%;
16954
16964
  height: 55%;
@@ -19843,6 +19853,7 @@ class Composer extends Component {
19843
19853
  (this.autoCompleteState.selectedIndex + 1) % this.autoCompleteState.values.length;
19844
19854
  }
19845
19855
  }
19856
+ this.updateCursorIfNeeded();
19846
19857
  }
19847
19858
  processTabKey(ev) {
19848
19859
  var _a;
@@ -19913,10 +19924,12 @@ class Composer extends Component {
19913
19924
  }
19914
19925
  else {
19915
19926
  ev.stopPropagation();
19927
+ this.updateCursorIfNeeded();
19916
19928
  }
19917
- const { start, end } = this.contentHelper.getCurrentSelection();
19918
- if (!this.env.model.getters.isSelectingForComposer() &&
19919
- !(ev.key === "Enter" && (ev.altKey || ev.ctrlKey))) {
19929
+ }
19930
+ updateCursorIfNeeded() {
19931
+ if (!this.env.model.getters.isSelectingForComposer()) {
19932
+ const { start, end } = this.contentHelper.getCurrentSelection();
19920
19933
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
19921
19934
  this.isKeyStillDown = true;
19922
19935
  }
@@ -19974,7 +19987,12 @@ class Composer extends Component {
19974
19987
  };
19975
19988
  });
19976
19989
  if (searchTerm) {
19977
- values = fuzzyLookup(searchTerm, values, (t) => t.text);
19990
+ if (searchTerm.toLowerCase() === "true" || searchTerm.toLowerCase() === "false") {
19991
+ values = [];
19992
+ }
19993
+ else {
19994
+ values = fuzzyLookup(searchTerm, values, (t) => t.text);
19995
+ }
19978
19996
  }
19979
19997
  else {
19980
19998
  // alphabetical order
@@ -45318,6 +45336,6 @@ function addFunction(functionName, functionDescription) {
45318
45336
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, 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, setTranslationMethod, tokenize };
45319
45337
 
45320
45338
 
45321
- __info__.version = '16.2.8';
45322
- __info__.date = '2023-06-02T10:12:43.068Z';
45323
- __info__.hash = 'b474e62';
45339
+ __info__.version = '16.2.9';
45340
+ __info__.date = '2023-06-12T13:49:57.216Z';
45341
+ __info__.hash = '37e2719';
@@ -1723,27 +1723,36 @@
1723
1723
  }
1724
1724
  return numberString.slice(0, i + 1) || undefined;
1725
1725
  }
1726
+ const leadingZeroesRegexp = /^0+/;
1726
1727
  /**
1727
1728
  * Limit the size of the decimal part of a number to the given number of digits.
1728
1729
  */
1729
1730
  function limitDecimalDigits(decimalDigits, maxDecimals) {
1731
+ var _a;
1730
1732
  let integerDigits = "0";
1731
1733
  let resultDecimalDigits = decimalDigits;
1732
1734
  // Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
1733
1735
  // but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
1734
1736
  let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
1735
1737
  const i = maxDecimals;
1736
- if (Number(Number(decimalDigits[i]) < 5)) {
1738
+ if (Number(decimalDigits[i]) < 5) {
1737
1739
  return { integerDigits, decimalDigits: slicedDecimalDigits };
1738
1740
  }
1739
1741
  // round up
1742
+ const leadingZeroes = ((_a = slicedDecimalDigits.match(leadingZeroesRegexp)) === null || _a === void 0 ? void 0 : _a[0]) || "";
1740
1743
  const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
1741
- if (slicedRoundedUp.length > slicedDecimalDigits.length) {
1742
- integerDigits = (Number(integerDigits) + 1).toString();
1744
+ const withoutLeadingZeroes = slicedDecimalDigits.slice(leadingZeroes.length);
1745
+ // e.g. carry over from 99 to 100
1746
+ const carryOver = slicedRoundedUp.length > withoutLeadingZeroes.length;
1747
+ if (carryOver && !leadingZeroes) {
1748
+ integerDigits = "1";
1743
1749
  resultDecimalDigits = undefined;
1744
1750
  }
1751
+ else if (carryOver) {
1752
+ resultDecimalDigits = leadingZeroes.slice(0, -1) + slicedRoundedUp;
1753
+ }
1745
1754
  else {
1746
- resultDecimalDigits = slicedRoundedUp;
1755
+ resultDecimalDigits = leadingZeroes + slicedRoundedUp;
1747
1756
  }
1748
1757
  return { integerDigits, decimalDigits: resultDecimalDigits };
1749
1758
  }
@@ -16950,6 +16959,7 @@
16950
16959
  .o-color-picker-toggler {
16951
16960
  display: flex;
16952
16961
  .o-color-picker-toggler-sign {
16962
+ display: flex;
16953
16963
  margin: auto auto;
16954
16964
  width: 55%;
16955
16965
  height: 55%;
@@ -19844,6 +19854,7 @@
19844
19854
  (this.autoCompleteState.selectedIndex + 1) % this.autoCompleteState.values.length;
19845
19855
  }
19846
19856
  }
19857
+ this.updateCursorIfNeeded();
19847
19858
  }
19848
19859
  processTabKey(ev) {
19849
19860
  var _a;
@@ -19914,10 +19925,12 @@
19914
19925
  }
19915
19926
  else {
19916
19927
  ev.stopPropagation();
19928
+ this.updateCursorIfNeeded();
19917
19929
  }
19918
- const { start, end } = this.contentHelper.getCurrentSelection();
19919
- if (!this.env.model.getters.isSelectingForComposer() &&
19920
- !(ev.key === "Enter" && (ev.altKey || ev.ctrlKey))) {
19930
+ }
19931
+ updateCursorIfNeeded() {
19932
+ if (!this.env.model.getters.isSelectingForComposer()) {
19933
+ const { start, end } = this.contentHelper.getCurrentSelection();
19921
19934
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
19922
19935
  this.isKeyStillDown = true;
19923
19936
  }
@@ -19975,7 +19988,12 @@
19975
19988
  };
19976
19989
  });
19977
19990
  if (searchTerm) {
19978
- values = fuzzyLookup(searchTerm, values, (t) => t.text);
19991
+ if (searchTerm.toLowerCase() === "true" || searchTerm.toLowerCase() === "false") {
19992
+ values = [];
19993
+ }
19994
+ else {
19995
+ values = fuzzyLookup(searchTerm, values, (t) => t.text);
19996
+ }
19979
19997
  }
19980
19998
  else {
19981
19999
  // alphabetical order
@@ -45349,9 +45367,9 @@
45349
45367
  Object.defineProperty(exports, '__esModule', { value: true });
45350
45368
 
45351
45369
 
45352
- __info__.version = '16.2.8';
45353
- __info__.date = '2023-06-02T10:12:43.068Z';
45354
- __info__.hash = 'b474e62';
45370
+ __info__.version = '16.2.9';
45371
+ __info__.date = '2023-06-12T13:49:57.216Z';
45372
+ __info__.hash = '37e2719';
45355
45373
 
45356
45374
 
45357
45375
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);