@odoo/o-spreadsheet 16.0.28 → 16.0.29

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.
@@ -1565,6 +1565,31 @@ const MAX_DECIMAL_PLACES = 20;
1565
1565
  //from https://stackoverflow.com/questions/721304/insert-commas-into-number-string @Thomas/Alan Moore
1566
1566
  const thousandsGroupsRegexp = /(\d+?)(?=(\d{3})+(?!\d)|$)/g;
1567
1567
  const zeroRegexp = /0/g;
1568
+ // TODO in the future : remove these constants MONTHS/DAYS, and use a library such as luxon to handle it
1569
+ // + possibly handle automatic translation of day/month
1570
+ const MONTHS = {
1571
+ 0: _lt("January"),
1572
+ 1: _lt("February"),
1573
+ 2: _lt("March"),
1574
+ 3: _lt("April"),
1575
+ 4: _lt("May"),
1576
+ 5: _lt("June"),
1577
+ 6: _lt("July"),
1578
+ 7: _lt("August"),
1579
+ 8: _lt("September"),
1580
+ 9: _lt("October"),
1581
+ 10: _lt("November"),
1582
+ 11: _lt("December"),
1583
+ };
1584
+ const DAYS$1 = {
1585
+ 0: _lt("Sunday"),
1586
+ 1: _lt("Monday"),
1587
+ 2: _lt("Tuesday"),
1588
+ 3: _lt("Wednesday"),
1589
+ 4: _lt("Thursday"),
1590
+ 5: _lt("Friday"),
1591
+ 6: _lt("Saturday"),
1592
+ };
1568
1593
  // -----------------------------------------------------------------------------
1569
1594
  // FORMAT REPRESENTATION CACHE
1570
1595
  // -----------------------------------------------------------------------------
@@ -1797,8 +1822,9 @@ function applyDateTimeFormat(value, format) {
1797
1822
  return strDate + (strDate && strTime ? " " : "") + strTime;
1798
1823
  }
1799
1824
  function formatJSDate(jsDate, format) {
1800
- const sep = format.match(/\/|-|\s/)[0];
1801
- const parts = format.split(sep);
1825
+ var _a;
1826
+ const sep = (_a = format.match(/\/|-|\s/)) === null || _a === void 0 ? void 0 : _a[0];
1827
+ const parts = sep ? format.split(sep) : [format];
1802
1828
  return parts
1803
1829
  .map((p) => {
1804
1830
  switch (p) {
@@ -1806,10 +1832,23 @@ function formatJSDate(jsDate, format) {
1806
1832
  return jsDate.getDate();
1807
1833
  case "dd":
1808
1834
  return jsDate.getDate().toString().padStart(2, "0");
1835
+ case "ddd":
1836
+ return DAYS$1[jsDate.getDay()].slice(0, 3);
1837
+ case "dddd":
1838
+ return DAYS$1[jsDate.getDay()];
1809
1839
  case "m":
1810
1840
  return jsDate.getMonth() + 1;
1811
1841
  case "mm":
1812
1842
  return String(jsDate.getMonth() + 1).padStart(2, "0");
1843
+ case "mmm":
1844
+ return MONTHS[jsDate.getMonth()].slice(0, 3);
1845
+ case "mmmm":
1846
+ return MONTHS[jsDate.getMonth()];
1847
+ case "mmmmm":
1848
+ return MONTHS[jsDate.getMonth()].slice(0, 1);
1849
+ case "yy":
1850
+ const fullYear = String(jsDate.getFullYear()).replace("-", "").padStart(2, "0");
1851
+ return fullYear.slice(fullYear.length - 2);
1813
1852
  case "yyyy":
1814
1853
  return jsDate.getFullYear();
1815
1854
  default:
@@ -40488,9 +40527,10 @@ class RangeAdapter {
40488
40527
  * Get a Xc string that represent a part of a range
40489
40528
  */
40490
40529
  getRangePartString(range, part) {
40491
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
40530
+ var _a, _b;
40531
+ const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
40492
40532
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
40493
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
40533
+ const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
40494
40534
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
40495
40535
  let str = "";
40496
40536
  if (range.isFullCol) {
@@ -43131,6 +43171,6 @@ exports.setTranslationMethod = setTranslationMethod;
43131
43171
  exports.tokenize = tokenize;
43132
43172
 
43133
43173
 
43134
- __info__.version = '16.0.28';
43135
- __info__.date = '2024-01-12T13:42:04.756Z';
43136
- __info__.hash = '7251a47';
43174
+ __info__.version = '16.0.29';
43175
+ __info__.date = '2024-01-17T10:24:52.885Z';
43176
+ __info__.hash = '3fda985';
@@ -1561,6 +1561,31 @@ const MAX_DECIMAL_PLACES = 20;
1561
1561
  //from https://stackoverflow.com/questions/721304/insert-commas-into-number-string @Thomas/Alan Moore
1562
1562
  const thousandsGroupsRegexp = /(\d+?)(?=(\d{3})+(?!\d)|$)/g;
1563
1563
  const zeroRegexp = /0/g;
1564
+ // TODO in the future : remove these constants MONTHS/DAYS, and use a library such as luxon to handle it
1565
+ // + possibly handle automatic translation of day/month
1566
+ const MONTHS = {
1567
+ 0: _lt("January"),
1568
+ 1: _lt("February"),
1569
+ 2: _lt("March"),
1570
+ 3: _lt("April"),
1571
+ 4: _lt("May"),
1572
+ 5: _lt("June"),
1573
+ 6: _lt("July"),
1574
+ 7: _lt("August"),
1575
+ 8: _lt("September"),
1576
+ 9: _lt("October"),
1577
+ 10: _lt("November"),
1578
+ 11: _lt("December"),
1579
+ };
1580
+ const DAYS$1 = {
1581
+ 0: _lt("Sunday"),
1582
+ 1: _lt("Monday"),
1583
+ 2: _lt("Tuesday"),
1584
+ 3: _lt("Wednesday"),
1585
+ 4: _lt("Thursday"),
1586
+ 5: _lt("Friday"),
1587
+ 6: _lt("Saturday"),
1588
+ };
1564
1589
  // -----------------------------------------------------------------------------
1565
1590
  // FORMAT REPRESENTATION CACHE
1566
1591
  // -----------------------------------------------------------------------------
@@ -1793,8 +1818,9 @@ function applyDateTimeFormat(value, format) {
1793
1818
  return strDate + (strDate && strTime ? " " : "") + strTime;
1794
1819
  }
1795
1820
  function formatJSDate(jsDate, format) {
1796
- const sep = format.match(/\/|-|\s/)[0];
1797
- const parts = format.split(sep);
1821
+ var _a;
1822
+ const sep = (_a = format.match(/\/|-|\s/)) === null || _a === void 0 ? void 0 : _a[0];
1823
+ const parts = sep ? format.split(sep) : [format];
1798
1824
  return parts
1799
1825
  .map((p) => {
1800
1826
  switch (p) {
@@ -1802,10 +1828,23 @@ function formatJSDate(jsDate, format) {
1802
1828
  return jsDate.getDate();
1803
1829
  case "dd":
1804
1830
  return jsDate.getDate().toString().padStart(2, "0");
1831
+ case "ddd":
1832
+ return DAYS$1[jsDate.getDay()].slice(0, 3);
1833
+ case "dddd":
1834
+ return DAYS$1[jsDate.getDay()];
1805
1835
  case "m":
1806
1836
  return jsDate.getMonth() + 1;
1807
1837
  case "mm":
1808
1838
  return String(jsDate.getMonth() + 1).padStart(2, "0");
1839
+ case "mmm":
1840
+ return MONTHS[jsDate.getMonth()].slice(0, 3);
1841
+ case "mmmm":
1842
+ return MONTHS[jsDate.getMonth()];
1843
+ case "mmmmm":
1844
+ return MONTHS[jsDate.getMonth()].slice(0, 1);
1845
+ case "yy":
1846
+ const fullYear = String(jsDate.getFullYear()).replace("-", "").padStart(2, "0");
1847
+ return fullYear.slice(fullYear.length - 2);
1809
1848
  case "yyyy":
1810
1849
  return jsDate.getFullYear();
1811
1850
  default:
@@ -40484,9 +40523,10 @@ class RangeAdapter {
40484
40523
  * Get a Xc string that represent a part of a range
40485
40524
  */
40486
40525
  getRangePartString(range, part) {
40487
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
40526
+ var _a, _b;
40527
+ const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
40488
40528
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
40489
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
40529
+ const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
40490
40530
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
40491
40531
  let str = "";
40492
40532
  if (range.isFullCol) {
@@ -43099,6 +43139,6 @@ function addFunction(functionName, functionDescription) {
43099
43139
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43100
43140
 
43101
43141
 
43102
- __info__.version = '16.0.28';
43103
- __info__.date = '2024-01-12T13:42:04.756Z';
43104
- __info__.hash = '7251a47';
43142
+ __info__.version = '16.0.29';
43143
+ __info__.date = '2024-01-17T10:24:52.885Z';
43144
+ __info__.hash = '3fda985';
@@ -1562,6 +1562,31 @@
1562
1562
  //from https://stackoverflow.com/questions/721304/insert-commas-into-number-string @Thomas/Alan Moore
1563
1563
  const thousandsGroupsRegexp = /(\d+?)(?=(\d{3})+(?!\d)|$)/g;
1564
1564
  const zeroRegexp = /0/g;
1565
+ // TODO in the future : remove these constants MONTHS/DAYS, and use a library such as luxon to handle it
1566
+ // + possibly handle automatic translation of day/month
1567
+ const MONTHS = {
1568
+ 0: _lt("January"),
1569
+ 1: _lt("February"),
1570
+ 2: _lt("March"),
1571
+ 3: _lt("April"),
1572
+ 4: _lt("May"),
1573
+ 5: _lt("June"),
1574
+ 6: _lt("July"),
1575
+ 7: _lt("August"),
1576
+ 8: _lt("September"),
1577
+ 9: _lt("October"),
1578
+ 10: _lt("November"),
1579
+ 11: _lt("December"),
1580
+ };
1581
+ const DAYS$1 = {
1582
+ 0: _lt("Sunday"),
1583
+ 1: _lt("Monday"),
1584
+ 2: _lt("Tuesday"),
1585
+ 3: _lt("Wednesday"),
1586
+ 4: _lt("Thursday"),
1587
+ 5: _lt("Friday"),
1588
+ 6: _lt("Saturday"),
1589
+ };
1565
1590
  // -----------------------------------------------------------------------------
1566
1591
  // FORMAT REPRESENTATION CACHE
1567
1592
  // -----------------------------------------------------------------------------
@@ -1794,8 +1819,9 @@
1794
1819
  return strDate + (strDate && strTime ? " " : "") + strTime;
1795
1820
  }
1796
1821
  function formatJSDate(jsDate, format) {
1797
- const sep = format.match(/\/|-|\s/)[0];
1798
- const parts = format.split(sep);
1822
+ var _a;
1823
+ const sep = (_a = format.match(/\/|-|\s/)) === null || _a === void 0 ? void 0 : _a[0];
1824
+ const parts = sep ? format.split(sep) : [format];
1799
1825
  return parts
1800
1826
  .map((p) => {
1801
1827
  switch (p) {
@@ -1803,10 +1829,23 @@
1803
1829
  return jsDate.getDate();
1804
1830
  case "dd":
1805
1831
  return jsDate.getDate().toString().padStart(2, "0");
1832
+ case "ddd":
1833
+ return DAYS$1[jsDate.getDay()].slice(0, 3);
1834
+ case "dddd":
1835
+ return DAYS$1[jsDate.getDay()];
1806
1836
  case "m":
1807
1837
  return jsDate.getMonth() + 1;
1808
1838
  case "mm":
1809
1839
  return String(jsDate.getMonth() + 1).padStart(2, "0");
1840
+ case "mmm":
1841
+ return MONTHS[jsDate.getMonth()].slice(0, 3);
1842
+ case "mmmm":
1843
+ return MONTHS[jsDate.getMonth()];
1844
+ case "mmmmm":
1845
+ return MONTHS[jsDate.getMonth()].slice(0, 1);
1846
+ case "yy":
1847
+ const fullYear = String(jsDate.getFullYear()).replace("-", "").padStart(2, "0");
1848
+ return fullYear.slice(fullYear.length - 2);
1810
1849
  case "yyyy":
1811
1850
  return jsDate.getFullYear();
1812
1851
  default:
@@ -40485,9 +40524,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40485
40524
  * Get a Xc string that represent a part of a range
40486
40525
  */
40487
40526
  getRangePartString(range, part) {
40488
- const colFixed = range.parts && range.parts[part].colFixed ? "$" : "";
40527
+ var _a, _b;
40528
+ const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
40489
40529
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
40490
- const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
40530
+ const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
40491
40531
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
40492
40532
  let str = "";
40493
40533
  if (range.isFullCol) {
@@ -43130,9 +43170,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43130
43170
  Object.defineProperty(exports, '__esModule', { value: true });
43131
43171
 
43132
43172
 
43133
- __info__.version = '16.0.28';
43134
- __info__.date = '2024-01-12T13:42:04.756Z';
43135
- __info__.hash = '7251a47';
43173
+ __info__.version = '16.0.29';
43174
+ __info__.date = '2024-01-17T10:24:52.885Z';
43175
+ __info__.hash = '3fda985';
43136
43176
 
43137
43177
 
43138
43178
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);