@odoo/o-spreadsheet 17.1.20 → 17.1.22

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.20
6
- * @date 2024-07-02T09:03:04.534Z
7
- * @hash d15aaf3
5
+ * @version 17.1.22
6
+ * @date 2024-07-08T05:41:57.737Z
7
+ * @hash da27a94
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -1703,7 +1703,7 @@
1703
1703
  });
1704
1704
  const getNumberRegex = memoize(function getNumberRegex(locale) {
1705
1705
  const decimalSeparator = escapeRegExp(locale.decimalSeparator);
1706
- const thousandsSeparator = escapeRegExp(locale.thousandsSeparator);
1706
+ const thousandsSeparator = escapeRegExp(locale.thousandsSeparator || "");
1707
1707
  const pIntegerAndDecimals = `(\\d+(${thousandsSeparator}\\d{3,})*(${decimalSeparator}\\d*)?)`; // pattern that match integer number with or without decimal digits
1708
1708
  const pOnlyDecimals = `(${decimalSeparator}\\d+)`; // pattern that match only expression with decimal digits
1709
1709
  const pScientificFormat = "(e(\\+|-)?\\d+)?"; // pattern that match scientific format between zero and one time (should be placed before pPercentFormat)
@@ -1730,7 +1730,7 @@
1730
1730
  return getNumberRegex(locale).test(value.trim());
1731
1731
  }
1732
1732
  const getInvaluableSymbolsRegexp = memoize(function getInvaluableSymbolsRegexp(locale) {
1733
- return new RegExp(`[\$€${escapeRegExp(locale.thousandsSeparator)}]`, "g");
1733
+ return new RegExp(`[\$€${escapeRegExp(locale.thousandsSeparator || "")}]`, "g");
1734
1734
  });
1735
1735
  /**
1736
1736
  * Convert a string into a number. It assumes that the string actually represents
@@ -7717,19 +7717,22 @@
7717
7717
  }
7718
7718
 
7719
7719
  function isValidLocale(locale) {
7720
- if (!(locale &&
7721
- typeof locale === "object" &&
7722
- typeof locale.name === "string" &&
7723
- typeof locale.code === "string" &&
7724
- typeof locale.thousandsSeparator === "string" &&
7725
- typeof locale.decimalSeparator === "string" &&
7726
- typeof locale.dateFormat === "string" &&
7727
- typeof locale.timeFormat === "string" &&
7728
- typeof locale.formulaArgSeparator === "string")) {
7720
+ if (!locale ||
7721
+ typeof locale !== "object" ||
7722
+ !(!locale.thousandsSeparator || typeof locale.thousandsSeparator === "string")) {
7729
7723
  return false;
7730
7724
  }
7731
- if (!Object.values(locale).every((v) => v)) {
7732
- return false;
7725
+ for (const property of [
7726
+ "code",
7727
+ "name",
7728
+ "decimalSeparator",
7729
+ "dateFormat",
7730
+ "timeFormat",
7731
+ "formulaArgSeparator",
7732
+ ]) {
7733
+ if (!locale[property] || typeof locale[property] !== "string") {
7734
+ return false;
7735
+ }
7733
7736
  }
7734
7737
  if (locale.formulaArgSeparator === locale.decimalSeparator) {
7735
7738
  return false;
@@ -7827,7 +7830,10 @@
7827
7830
  if (locale.decimalSeparator === "." || !isNumber(content, locale)) {
7828
7831
  return content;
7829
7832
  }
7830
- return content.replace(locale.thousandsSeparator, "").replace(locale.decimalSeparator, ".");
7833
+ if (locale.thousandsSeparator) {
7834
+ content = content.replaceAll(locale.thousandsSeparator, "");
7835
+ }
7836
+ return content.replace(locale.decimalSeparator, ".");
7831
7837
  }
7832
7838
  /**
7833
7839
  * Change a content string from the given locale to its canonical form (en_US locale). Also convert date string.
@@ -9506,15 +9512,6 @@
9506
9512
  }
9507
9513
  const colors = new ChartColors();
9508
9514
  for (let [index, { label, data }] of dataSetsValues.entries()) {
9509
- if (["linear", "time"].includes(axisType)) {
9510
- // Replace empty string labels by undefined to make sure chartJS doesn't decide that "" is the same as 0
9511
- data = data.map((y, index) => ({ x: labels[index] || undefined, y }));
9512
- }
9513
- const color = colors.next();
9514
- let backgroundRGBA = colorToRGBA(color);
9515
- if (chart.stacked) {
9516
- backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
9517
- }
9518
9515
  if (chart.cumulative) {
9519
9516
  let accumulator = 0;
9520
9517
  data = data.map((value) => {
@@ -9525,6 +9522,15 @@
9525
9522
  return value;
9526
9523
  });
9527
9524
  }
9525
+ if (["linear", "time"].includes(axisType)) {
9526
+ // Replace empty string labels by undefined to make sure chartJS doesn't decide that "" is the same as 0
9527
+ data = data.map((y, index) => ({ x: labels[index] || undefined, y }));
9528
+ }
9529
+ const color = colors.next();
9530
+ let backgroundRGBA = colorToRGBA(color);
9531
+ if (chart.stacked) {
9532
+ backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
9533
+ }
9528
9534
  const backgroundColor = rgbaToHex(backgroundRGBA);
9529
9535
  const dataset = {
9530
9536
  label,
@@ -24780,7 +24786,13 @@
24780
24786
  }
24781
24787
  async loadLocales() {
24782
24788
  this.loadedLocales = (await this.env.loadLocales())
24783
- .filter(isValidLocale)
24789
+ .filter((locale) => {
24790
+ const isValid = isValidLocale(locale);
24791
+ if (!isValid) {
24792
+ console.warn(`Invalid locale: ${locale["code"]} ${locale}`);
24793
+ }
24794
+ return isValid;
24795
+ })
24784
24796
  .sort((a, b) => a.name.localeCompare(b.name));
24785
24797
  }
24786
24798
  get numberFormatPreview() {
@@ -30536,6 +30548,7 @@
30536
30548
  return;
30537
30549
  }
30538
30550
  if (clipboardData.types.indexOf(ClipboardMIMEType.PlainText) > -1) {
30551
+ ev.preventDefault();
30539
30552
  const content = clipboardData.getData(ClipboardMIMEType.PlainText);
30540
30553
  const target = this.env.model.getters.getSelectedZones();
30541
30554
  const clipboardString = this.env.model.getters.getClipboardTextContent();
@@ -30791,6 +30804,8 @@
30791
30804
  "BITOR",
30792
30805
  "BITRSHIFT",
30793
30806
  "BITXOR",
30807
+ "BYCOL",
30808
+ "BYROW",
30794
30809
  "CEILING.MATH",
30795
30810
  "CEILING.PRECISE",
30796
30811
  "CHISQ.DIST",
@@ -30798,6 +30813,8 @@
30798
30813
  "CHISQ.INV",
30799
30814
  "CHISQ.INV.RT",
30800
30815
  "CHISQ.TEST",
30816
+ "CHOOSECOLS",
30817
+ "CHOOSEROWS",
30801
30818
  "COMBINA",
30802
30819
  "CONCAT",
30803
30820
  "CONFIDENCE.NORM",
@@ -30810,14 +30827,17 @@
30810
30827
  "CSCH",
30811
30828
  "DAYS",
30812
30829
  "DECIMAL",
30830
+ "DROP",
30813
30831
  "ERF.PRECISE",
30814
30832
  "ERFC.PRECISE",
30833
+ "EXPAND",
30815
30834
  "EXPON.DIST",
30816
30835
  "F.DIST",
30817
30836
  "F.DIST.RT",
30818
30837
  "F.INV",
30819
30838
  "F.INV.RT",
30820
30839
  "F.TEST",
30840
+ "FIELDVALUE",
30821
30841
  "FILTERXML",
30822
30842
  "FLOOR.MATH",
30823
30843
  "FLOOR.PRECISE",
@@ -30832,6 +30852,7 @@
30832
30852
  "GAMMA.INV",
30833
30853
  "GAMMALN.PRECISE",
30834
30854
  "GAUSS",
30855
+ "HSTACK",
30835
30856
  "HYPGEOM.DIST",
30836
30857
  "IFNA",
30837
30858
  "IFS",
@@ -30844,9 +30865,14 @@
30844
30865
  "IMSINH",
30845
30866
  "IMTAN",
30846
30867
  "ISFORMULA",
30868
+ "ISOMITTED",
30847
30869
  "ISOWEEKNUM",
30870
+ "LAMBDA",
30871
+ "LET",
30848
30872
  "LOGNORM.DIST",
30849
30873
  "LOGNORM.INV",
30874
+ "MAKEARRAY",
30875
+ "MAP",
30850
30876
  "MAXIFS",
30851
30877
  "MINIFS",
30852
30878
  "MODE.MULT",
@@ -30866,17 +30892,26 @@
30866
30892
  "PERMUTATIONA",
30867
30893
  "PHI",
30868
30894
  "POISSON.DIST",
30895
+ "PQSOURCE",
30896
+ "PYTHON_STR",
30897
+ "PYTHON_TYPE",
30898
+ "PYTHON_TYPENAME",
30869
30899
  "QUARTILE.EXC",
30870
30900
  "QUARTILE.INC",
30871
30901
  "QUERYSTRING",
30902
+ "RANDARRAY",
30872
30903
  "RANK.AVG",
30873
30904
  "RANK.EQ",
30905
+ "REDUCE",
30874
30906
  "RRI",
30907
+ "SCAN",
30875
30908
  "SEC",
30876
30909
  "SECH",
30910
+ "SEQUENCE",
30877
30911
  "SHEET",
30878
30912
  "SHEETS",
30879
30913
  "SKEW.P",
30914
+ "SORTBY",
30880
30915
  "STDEV.P",
30881
30916
  "STDEV.S",
30882
30917
  "SWITCH",
@@ -30886,13 +30921,24 @@
30886
30921
  "T.INV",
30887
30922
  "T.INV.2T",
30888
30923
  "T.TEST",
30924
+ "TAKE",
30925
+ "TEXTAFTER",
30926
+ "TEXTBEFORE",
30889
30927
  "TEXTJOIN",
30928
+ "TEXTSPLIT",
30929
+ "TOCOL",
30930
+ "TOROW",
30890
30931
  "UNICHAR",
30891
30932
  "UNICODE",
30933
+ "UNIQUE",
30892
30934
  "VAR.P",
30893
30935
  "VAR.S",
30936
+ "VSTACK",
30894
30937
  "WEBSERVICE",
30895
30938
  "WEIBULL.DIST",
30939
+ "WRAPCOLS",
30940
+ "WRAPROWS",
30941
+ "XLOOKUP",
30896
30942
  "XOR",
30897
30943
  "Z.TEST",
30898
30944
  ];
@@ -35100,6 +35146,21 @@
35100
35146
  return [];
35101
35147
  return Object.keys(sheetBorders).map((index) => parseInt(index, 10));
35102
35148
  }
35149
+ /**
35150
+ * Get all the rows which contains at least a border
35151
+ */
35152
+ getRowsWithBorders(sheetId) {
35153
+ const sheetBorders = this.borders[sheetId]?.filter(isDefined$1);
35154
+ if (!sheetBorders)
35155
+ return [];
35156
+ const rowsWithBorders = new Set();
35157
+ for (const rowBorders of sheetBorders) {
35158
+ for (const rowBorder in rowBorders) {
35159
+ rowsWithBorders.add(parseInt(rowBorder, 10));
35160
+ }
35161
+ }
35162
+ return Array.from(rowsWithBorders);
35163
+ }
35103
35164
  /**
35104
35165
  * Get the range of all the rows in the sheet
35105
35166
  */
@@ -35149,7 +35210,7 @@
35149
35210
  destructive: false,
35150
35211
  });
35151
35212
  }
35152
- this.getRowsRange(sheetId)
35213
+ this.getRowsWithBorders(sheetId)
35153
35214
  .filter((row) => row >= start)
35154
35215
  .sort((a, b) => (delta < 0 ? a - b : b - a)) // start by the end when moving up
35155
35216
  .forEach((row) => {
@@ -35604,7 +35665,7 @@
35604
35665
  * Parse an expression (as a string) into an AST.
35605
35666
  */
35606
35667
  function parse(str) {
35607
- return parseTokens(tokenize(str));
35668
+ return parseTokens(rangeTokenize(str));
35608
35669
  }
35609
35670
  function parseTokens(tokens) {
35610
35671
  tokens = tokens.filter((x) => x.type !== "SPACE");
@@ -57805,9 +57866,9 @@
57805
57866
  exports.tokenize = tokenize;
57806
57867
 
57807
57868
 
57808
- __info__.version = "17.1.20";
57809
- __info__.date = "2024-07-02T09:03:04.534Z";
57810
- __info__.hash = "d15aaf3";
57869
+ __info__.version = "17.1.22";
57870
+ __info__.date = "2024-07-08T05:41:57.737Z";
57871
+ __info__.hash = "da27a94";
57811
57872
 
57812
57873
 
57813
57874
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);