@odoo/o-spreadsheet 17.4.27 → 17.4.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.
@@ -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.4.27
6
- * @date 2025-03-19T08:27:27.414Z
7
- * @hash a87c1da
5
+ * @version 17.4.29
6
+ * @date 2025-04-04T08:40:34.590Z
7
+ * @hash 2937d99
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -773,8 +773,7 @@
773
773
  *
774
774
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
775
775
  */
776
- const whiteSpaceSpecialCharacters = [
777
- " ",
776
+ const specialWhiteSpaceSpecialCharacters = [
778
777
  "\t",
779
778
  "\f",
780
779
  "\v",
@@ -789,7 +788,7 @@
789
788
  String.fromCharCode(parseInt("3000", 16)),
790
789
  String.fromCharCode(parseInt("feff", 16)),
791
790
  ];
792
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
791
+ const specialWhiteSpaceRegexp = new RegExp(specialWhiteSpaceSpecialCharacters.join("|"), "g");
793
792
  const newLineRegexp = /(\r\n|\r)/g;
794
793
  /**
795
794
  * Replace all different newlines characters by \n
@@ -1008,7 +1007,10 @@
1008
1007
  }
1009
1008
  else if (stringVals.length === 4) {
1010
1009
  const alpha = parseFloat(stringVals.pop() || "1");
1011
- alphaHex = Math.round((alpha || 1) * 255);
1010
+ if (isNaN(alpha)) {
1011
+ throw new Error("invalid alpha value");
1012
+ }
1013
+ alphaHex = Math.round(alpha * 255);
1012
1014
  }
1013
1015
  const vals = stringVals.map((val) => parseInt(val, 10));
1014
1016
  if (alphaHex !== 255) {
@@ -5723,8 +5725,12 @@
5723
5725
  str = replaceNewLines(str);
5724
5726
  const chars = new TokenizingChars(str);
5725
5727
  const result = [];
5728
+ const tokenizeSpace = specialWhiteSpaceRegexp.test(str)
5729
+ ? tokenizeSpecialCharacterSpace
5730
+ : tokenizeSimpleSpace;
5726
5731
  while (!chars.isOver()) {
5727
- let token = tokenizeSpace(chars) ||
5732
+ let token = tokenizeNewLine(chars) ||
5733
+ tokenizeSpace(chars) ||
5728
5734
  tokenizeArgsSeparator(chars, locale) ||
5729
5735
  tokenizeParenthesis(chars) ||
5730
5736
  tokenizeOperator(chars) ||
@@ -5858,17 +5864,19 @@
5858
5864
  }
5859
5865
  return null;
5860
5866
  }
5861
- function tokenizeSpace(chars) {
5862
- let length = 0;
5863
- while (chars.current === NEWLINE) {
5864
- length++;
5865
- chars.shift();
5867
+ function tokenizeSpecialCharacterSpace(chars) {
5868
+ let spaces = "";
5869
+ while (chars.current === " " || (chars.current && chars.current.match(specialWhiteSpaceRegexp))) {
5870
+ spaces += chars.shift();
5866
5871
  }
5867
- if (length) {
5868
- return { type: "SPACE", value: NEWLINE.repeat(length) };
5872
+ if (spaces) {
5873
+ return { type: "SPACE", value: spaces };
5869
5874
  }
5875
+ return null;
5876
+ }
5877
+ function tokenizeSimpleSpace(chars) {
5870
5878
  let spaces = "";
5871
- while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5879
+ while (chars.current === " ") {
5872
5880
  spaces += chars.shift();
5873
5881
  }
5874
5882
  if (spaces) {
@@ -5876,6 +5884,17 @@
5876
5884
  }
5877
5885
  return null;
5878
5886
  }
5887
+ function tokenizeNewLine(chars) {
5888
+ let length = 0;
5889
+ while (chars.current === NEWLINE) {
5890
+ length++;
5891
+ chars.shift();
5892
+ }
5893
+ if (length) {
5894
+ return { type: "SPACE", value: NEWLINE.repeat(length) };
5895
+ }
5896
+ return null;
5897
+ }
5879
5898
  function tokenizeInvalidRange(chars) {
5880
5899
  if (chars.currentStartsWith(CellErrorType.InvalidReference)) {
5881
5900
  chars.advanceBy(CellErrorType.InvalidReference.length);
@@ -5964,7 +5983,7 @@
5964
5983
  */
5965
5984
  function canonicalizeNumberContent(content, locale) {
5966
5985
  return content.startsWith("=")
5967
- ? canonicalizeFormula$1(content, locale)
5986
+ ? canonicalizeFormula(content, locale)
5968
5987
  : canonicalizeNumberLiteral(content, locale);
5969
5988
  }
5970
5989
  /**
@@ -5979,7 +5998,7 @@
5979
5998
  */
5980
5999
  function canonicalizeContent(content, locale) {
5981
6000
  return content.startsWith("=")
5982
- ? canonicalizeFormula$1(content, locale)
6001
+ ? canonicalizeFormula(content, locale)
5983
6002
  : canonicalizeLiteral(content, locale);
5984
6003
  }
5985
6004
  /**
@@ -5995,15 +6014,21 @@
5995
6014
  ? localizeFormula(content, locale)
5996
6015
  : localizeLiteral(content, locale);
5997
6016
  }
6017
+ /** Change a number string to its canonical form (en_US locale) */
6018
+ function canonicalizeNumberValue(content, locale) {
6019
+ return content.startsWith("=")
6020
+ ? canonicalizeFormula(content, locale)
6021
+ : canonicalizeNumberLiteral(content, locale);
6022
+ }
5998
6023
  /** Change a formula to its canonical form (en_US locale) */
5999
- function canonicalizeFormula$1(formula, locale) {
6000
- return _localizeFormula$1(formula, locale, DEFAULT_LOCALE);
6024
+ function canonicalizeFormula(formula, locale) {
6025
+ return _localizeFormula(formula, locale, DEFAULT_LOCALE);
6001
6026
  }
6002
6027
  /** Change a formula from the canonical form to the given locale */
6003
6028
  function localizeFormula(formula, locale) {
6004
- return _localizeFormula$1(formula, DEFAULT_LOCALE, locale);
6029
+ return _localizeFormula(formula, DEFAULT_LOCALE, locale);
6005
6030
  }
6006
- function _localizeFormula$1(formula, fromLocale, toLocale) {
6031
+ function _localizeFormula(formula, fromLocale, toLocale) {
6007
6032
  if (fromLocale.formulaArgSeparator === toLocale.formulaArgSeparator &&
6008
6033
  fromLocale.decimalSeparator === toLocale.decimalSeparator) {
6009
6034
  return formula;
@@ -6158,37 +6183,6 @@
6158
6183
  return locale.dateFormat + " " + locale.timeFormat;
6159
6184
  }
6160
6185
 
6161
- /** Change a number string to its canonical form (en_US locale) */
6162
- function canonicalizeNumberValue(content, locale) {
6163
- return content.startsWith("=")
6164
- ? canonicalizeFormula(content, locale)
6165
- : canonicalizeNumberLiteral(content, locale);
6166
- }
6167
- /** Change a formula to its canonical form (en_US locale) */
6168
- function canonicalizeFormula(formula, locale) {
6169
- return _localizeFormula(formula, locale, DEFAULT_LOCALE);
6170
- }
6171
- function _localizeFormula(formula, fromLocale, toLocale) {
6172
- if (fromLocale.formulaArgSeparator === toLocale.formulaArgSeparator &&
6173
- fromLocale.decimalSeparator === toLocale.decimalSeparator) {
6174
- return formula;
6175
- }
6176
- const tokens = tokenize(formula, fromLocale);
6177
- let localizedFormula = "";
6178
- for (const token of tokens) {
6179
- if (token.type === "NUMBER") {
6180
- localizedFormula += token.value.replace(fromLocale.decimalSeparator, toLocale.decimalSeparator);
6181
- }
6182
- else if (token.type === "ARG_SEPARATOR") {
6183
- localizedFormula += toLocale.formulaArgSeparator;
6184
- }
6185
- else {
6186
- localizedFormula += token.value;
6187
- }
6188
- }
6189
- return localizedFormula;
6190
- }
6191
-
6192
6186
  function boolAnd(args) {
6193
6187
  let foundBoolean = false;
6194
6188
  let acc = true;
@@ -12025,7 +12019,8 @@ stores.inject(MyMetaStore, storeInstance);
12025
12019
  }
12026
12020
  }
12027
12021
  else if (dataSets.length === 1) {
12028
- for (let i = 0; i < getData(getters, dataSets[0]).length; i++) {
12022
+ const dataLength = getData(getters, dataSets[0]).length;
12023
+ for (let i = 0; i < dataLength; i++) {
12029
12024
  labels.formattedValues.push("");
12030
12025
  labels.values.push("");
12031
12026
  }
@@ -43180,9 +43175,9 @@ stores.inject(MyMetaStore, storeInstance);
43180
43175
  /** In XLSX color format (no #) */
43181
43176
  const AUTO_COLOR = "000000";
43182
43177
  const XLSX_ICONSET_MAP = {
43183
- arrow: "3Arrows",
43178
+ arrows: "3Arrows",
43184
43179
  smiley: "3Symbols",
43185
- dot: "3TrafficLights1",
43180
+ dots: "3TrafficLights1",
43186
43181
  };
43187
43182
  const NAMESPACE = {
43188
43183
  styleSheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
@@ -43598,6 +43593,7 @@ stores.inject(MyMetaStore, storeInstance);
43598
43593
  };
43599
43594
  /** Map between legend position in XLSX file and human readable position */
43600
43595
  const DRAWING_LEGEND_POSITION_CONVERSION_MAP = {
43596
+ none: "none",
43601
43597
  b: "bottom",
43602
43598
  t: "top",
43603
43599
  l: "left",
@@ -45847,7 +45843,7 @@ stores.inject(MyMetaStore, storeInstance);
45847
45843
  default: "ffffff",
45848
45844
  }).asString(),
45849
45845
  legendPosition: DRAWING_LEGEND_POSITION_CONVERSION_MAP[this.extractChildAttr(rootChartElement, "c:legendPos", "val", {
45850
- default: "b",
45846
+ default: "none",
45851
45847
  }).asString()],
45852
45848
  stacked: barChartGrouping === "stacked",
45853
45849
  fontColor: "000000",
@@ -45881,7 +45877,7 @@ stores.inject(MyMetaStore, storeInstance);
45881
45877
  default: "ffffff",
45882
45878
  }).asString(),
45883
45879
  legendPosition: DRAWING_LEGEND_POSITION_CONVERSION_MAP[this.extractChildAttr(chartElement, "c:legendPos", "val", {
45884
- default: "b",
45880
+ default: "none",
45885
45881
  }).asString()],
45886
45882
  stacked: barChartGrouping === "stacked",
45887
45883
  fontColor: "000000",
@@ -64179,7 +64175,9 @@ stores.inject(MyMetaStore, storeInstance);
64179
64175
  margin-top: -1px;
64180
64176
  border: 1px solid;
64181
64177
 
64182
- .o-composer:empty:not(:focus):not(.active)::before {
64178
+ /* In readonly we always show the fx icon if the composer is empty, not matter the focus */
64179
+ .o-composer:empty:not(:focus):not(.active)::before,
64180
+ &.o-topbar-composer-readonly .o-composer:empty::before {
64183
64181
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
64184
64182
  position: relative;
64185
64183
  top: 20%;
@@ -67423,10 +67421,14 @@ stores.inject(MyMetaStore, storeInstance);
67423
67421
  continue;
67424
67422
  }
67425
67423
  const cfValueObjectNodes = cfValueObject.map((attrs) => escapeXml /*xml*/ `<cfvo ${formatAttributes(attrs)} />`);
67424
+ const iconSetAttrs = [["iconSet", getIconSet(rule.icons)]];
67425
+ if (isIconSetReversed(rule.icons)) {
67426
+ iconSetAttrs.push(["reverse", "1"]);
67427
+ }
67426
67428
  conditionalFormats.push(escapeXml /*xml*/ `
67427
67429
  <conditionalFormatting sqref="${range}">
67428
67430
  <cfRule ${formatAttributes(ruleAttributes)}>
67429
- <iconSet iconSet="${getIconSet(rule.icons)}">
67431
+ <iconSet ${formatAttributes(iconSetAttrs)}>
67430
67432
  ${joinXmlNodes(cfValueObjectNodes)}
67431
67433
  </iconSet>
67432
67434
  </cfRule>
@@ -67444,9 +67446,21 @@ stores.inject(MyMetaStore, storeInstance);
67444
67446
  ["stopIfTrue", cf.stopIfTrue ? 1 : 0],
67445
67447
  ];
67446
67448
  }
67449
+ function isIconSetReversed(iconSet) {
67450
+ const defaultIconSet = ICON_SETS[detectIconsType(iconSet)];
67451
+ return iconSet.upper === defaultIconSet.bad && iconSet.lower === defaultIconSet.good;
67452
+ }
67447
67453
  function getIconSet(iconSet) {
67448
- return XLSX_ICONSET_MAP[Object.keys(XLSX_ICONSET_MAP).find((key) => iconSet.upper.toLowerCase().startsWith(key)) ||
67449
- "dots"];
67454
+ return XLSX_ICONSET_MAP[detectIconsType(iconSet)];
67455
+ }
67456
+ /**
67457
+ * Partial detection based on "upper" point only.
67458
+ * We support any arbitrary icon in the set, while excel doesn't allow
67459
+ * mixing icons from different types.
67460
+ */
67461
+ function detectIconsType(iconSet) {
67462
+ const type = Object.keys(ICON_SETS).find((type) => Object.values(ICON_SETS[type]).includes(iconSet.upper)) || "dots";
67463
+ return type;
67450
67464
  }
67451
67465
  function thresholdAttributes(threshold, position) {
67452
67466
  const type = getExcelThresholdType(threshold.type, position);
@@ -69228,9 +69242,9 @@ stores.inject(MyMetaStore, storeInstance);
69228
69242
  exports.tokenize = tokenize;
69229
69243
 
69230
69244
 
69231
- __info__.version = "17.4.27";
69232
- __info__.date = "2025-03-19T08:27:27.414Z";
69233
- __info__.hash = "a87c1da";
69245
+ __info__.version = "17.4.29";
69246
+ __info__.date = "2025-04-04T08:40:34.590Z";
69247
+ __info__.hash = "2937d99";
69234
69248
 
69235
69249
 
69236
69250
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);