@odoo/o-spreadsheet 17.2.28 → 17.2.30

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.28
7
- * @date 2024-11-28T09:04:19.153Z
8
- * @hash fb1cbd8
6
+ * @version 17.2.30
7
+ * @date 2024-12-19T07:48:16.226Z
8
+ * @hash 9a9ae31
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -625,6 +625,7 @@
625
625
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
626
626
  */
627
627
  const whiteSpaceSpecialCharacters = [
628
+ " ",
628
629
  "\t",
629
630
  "\f",
630
631
  "\v",
@@ -639,17 +640,15 @@
639
640
  String.fromCharCode(parseInt("3000", 16)),
640
641
  String.fromCharCode(parseInt("feff", 16)),
641
642
  ];
642
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|") + "|(\r\n|\r|\n)", "g");
643
+ const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
644
+ const newLineRegexp = /(\r\n|\r)/g;
643
645
  /**
644
- * Replace all the special spaces in a string (non-breaking, tabs, ...) by normal spaces, and all the
645
- * different newlines types by \n.
646
+ * Replace all different newlines characters by \n
646
647
  */
647
- function replaceSpecialSpaces(text) {
648
+ function replaceNewLines(text) {
648
649
  if (!text)
649
650
  return "";
650
- if (!whiteSpaceRegexp.test(text))
651
- return text;
652
- return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
651
+ return text.replace(newLineRegexp, NEWLINE);
653
652
  }
654
653
  /**
655
654
  * Determine if the numbers are consecutive.
@@ -5162,7 +5161,7 @@
5162
5161
  const POSTFIX_UNARY_OPERATORS = ["%"];
5163
5162
  const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
5164
5163
  function tokenize(str, locale = DEFAULT_LOCALE) {
5165
- str = replaceSpecialSpaces(str);
5164
+ str = replaceNewLines(str);
5166
5165
  const chars = new TokenizingChars(str);
5167
5166
  const result = [];
5168
5167
  while (!chars.isOver()) {
@@ -5309,12 +5308,12 @@
5309
5308
  if (length) {
5310
5309
  return { type: "SPACE", value: NEWLINE.repeat(length) };
5311
5310
  }
5312
- while (chars.current === " ") {
5313
- length++;
5314
- chars.shift();
5311
+ let spaces = "";
5312
+ while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5313
+ spaces += chars.shift();
5315
5314
  }
5316
- if (length) {
5317
- return { type: "SPACE", value: " ".repeat(length) };
5315
+ if (spaces) {
5316
+ return { type: "SPACE", value: spaces };
5318
5317
  }
5319
5318
  return null;
5320
5319
  }
@@ -18750,6 +18749,18 @@ stores.inject(MyMetaStore, storeInstance);
18750
18749
  },
18751
18750
  isExported: true,
18752
18751
  };
18752
+ // -----------------------------------------------------------------------------
18753
+ // VALUE
18754
+ // -----------------------------------------------------------------------------
18755
+ const VALUE = {
18756
+ description: _t("Converts a string to a numeric value."),
18757
+ args: [arg("value (number)", _t("the string to be converted"))],
18758
+ returns: ["NUMBER"],
18759
+ compute: function (value) {
18760
+ return toNumber(value, this.locale);
18761
+ },
18762
+ isExported: true,
18763
+ };
18753
18764
 
18754
18765
  var text = /*#__PURE__*/Object.freeze({
18755
18766
  __proto__: null,
@@ -18772,7 +18783,8 @@ stores.inject(MyMetaStore, storeInstance);
18772
18783
  TEXT: TEXT,
18773
18784
  TEXTJOIN: TEXTJOIN,
18774
18785
  TRIM: TRIM,
18775
- UPPER: UPPER
18786
+ UPPER: UPPER,
18787
+ VALUE: VALUE
18776
18788
  });
18777
18789
 
18778
18790
  // -----------------------------------------------------------------------------
@@ -33514,6 +33526,7 @@ stores.inject(MyMetaStore, storeInstance);
33514
33526
  draggedFigure: undefined,
33515
33527
  horizontalSnap: undefined,
33516
33528
  verticalSnap: undefined,
33529
+ cancelDnd: undefined,
33517
33530
  });
33518
33531
  setup() {
33519
33532
  owl.onMounted(() => {
@@ -33526,12 +33539,28 @@ stores.inject(MyMetaStore, storeInstance);
33526
33539
  // new rendering
33527
33540
  this.render();
33528
33541
  });
33542
+ owl.onWillUpdateProps(() => {
33543
+ const sheetId = this.env.model.getters.getActiveSheetId();
33544
+ const draggedFigureId = this.dnd.draggedFigure?.id;
33545
+ if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
33546
+ if (this.dnd.cancelDnd) {
33547
+ this.dnd.cancelDnd();
33548
+ }
33549
+ this.dnd.draggedFigure = undefined;
33550
+ this.dnd.horizontalSnap = undefined;
33551
+ this.dnd.verticalSnap = undefined;
33552
+ this.dnd.cancelDnd = undefined;
33553
+ }
33554
+ });
33529
33555
  }
33530
33556
  getVisibleFigures() {
33531
33557
  const visibleFigures = this.env.model.getters.getVisibleFigures();
33532
33558
  if (this.dnd.draggedFigure &&
33533
33559
  !visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
33534
- visibleFigures.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id));
33560
+ const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
33561
+ if (draggedFigure) {
33562
+ visibleFigures.push(draggedFigure);
33563
+ }
33535
33564
  }
33536
33565
  return visibleFigures;
33537
33566
  }
@@ -33650,7 +33679,7 @@ stores.inject(MyMetaStore, storeInstance);
33650
33679
  this.dnd.verticalSnap = undefined;
33651
33680
  this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
33652
33681
  };
33653
- startDnd(onMouseMove, onMouseUp);
33682
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33654
33683
  }
33655
33684
  /**
33656
33685
  * Initialize the resize of a figure with mouse movements
@@ -33698,7 +33727,7 @@ stores.inject(MyMetaStore, storeInstance);
33698
33727
  this.dnd.horizontalSnap = undefined;
33699
33728
  this.dnd.verticalSnap = undefined;
33700
33729
  };
33701
- startDnd(onMouseMove, onMouseUp);
33730
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33702
33731
  }
33703
33732
  getOtherFigures(figId) {
33704
33733
  return this.getVisibleFigures().filter((f) => f.id !== figId);
@@ -37658,7 +37687,7 @@ stores.inject(MyMetaStore, storeInstance);
37658
37687
  vertical: style.verticalAlign
37659
37688
  ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
37660
37689
  : undefined,
37661
- wrapText: style.wrapping === "wrap",
37690
+ wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
37662
37691
  },
37663
37692
  };
37664
37693
  styles.font["strike"] = !!style?.strikethrough || undefined;
@@ -38110,9 +38139,8 @@ stores.inject(MyMetaStore, storeInstance);
38110
38139
  }
38111
38140
  return rows;
38112
38141
  }
38113
- /** Remove newlines (\n) in shared strings, We do not support them */
38114
38142
  function convertSharedStrings(xlsxSharedStrings) {
38115
- return xlsxSharedStrings.map((str) => str.replace(/\n/g, ""));
38143
+ return xlsxSharedStrings.map(replaceNewLines);
38116
38144
  }
38117
38145
  function convertCells(sheet, data, sheetDims, warningManager) {
38118
38146
  const cells = {};
@@ -38954,15 +38982,10 @@ stores.inject(MyMetaStore, storeInstance);
38954
38982
  getSharedStrings() {
38955
38983
  return this.mapOnElements({ parent: this.rootFile.file.xml, query: "si" }, (ssElement) => {
38956
38984
  // Shared string can either be a simple text, or a rich text (text with formatting, possibly in multiple parts)
38957
- if (ssElement.children[0].tagName === "t") {
38958
- return this.extractTextContent(ssElement) || "";
38959
- }
38960
38985
  // We don't support rich text formatting, we'll only extract the text
38961
- else {
38962
- return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38963
- return this.extractTextContent(textElement) || "";
38964
- }).join("");
38965
- }
38986
+ return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38987
+ return this.extractTextContent(textElement) || "";
38988
+ }).join("");
38966
38989
  });
38967
38990
  }
38968
38991
  }
@@ -41856,7 +41879,7 @@ stores.inject(MyMetaStore, storeInstance);
41856
41879
  const before = this.getters.getCell({ sheetId, col, row });
41857
41880
  const hasContent = "content" in after || "formula" in after;
41858
41881
  // Compute the new cell properties
41859
- const afterContent = hasContent ? replaceSpecialSpaces(after?.content) : before?.content || "";
41882
+ const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
41860
41883
  let style;
41861
41884
  if (after.style !== undefined) {
41862
41885
  style = after.style || undefined;
@@ -54178,6 +54201,7 @@ stores.inject(MyMetaStore, storeInstance);
54178
54201
  break;
54179
54202
  case "DELETE_SHEET":
54180
54203
  this.cleanViewports();
54204
+ this.sheetsWithDirtyViewports.delete(cmd.sheetId);
54181
54205
  break;
54182
54206
  case "ACTIVATE_SHEET":
54183
54207
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
@@ -56148,7 +56172,7 @@ stores.inject(MyMetaStore, storeInstance);
56148
56172
  setup() {
56149
56173
  owl.onWillUpdateProps((nextProps) => {
56150
56174
  if (nextProps.action !== this.props.action) {
56151
- this.actionButton = createAction(this.props.action);
56175
+ this.actionButton = createAction(nextProps.action);
56152
56176
  }
56153
56177
  });
56154
56178
  }
@@ -56415,7 +56439,6 @@ stores.inject(MyMetaStore, storeInstance);
56415
56439
  height: fit-content;
56416
56440
  margin-top: -1px;
56417
56441
  border: 1px solid;
56418
- z-index: ${ComponentsImportance.TopBarComposer};
56419
56442
 
56420
56443
  .o-composer:empty:not(:focus):not(.active)::before {
56421
56444
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
@@ -56457,6 +56480,7 @@ stores.inject(MyMetaStore, storeInstance);
56457
56480
  }
56458
56481
  return cssPropertiesToCss({
56459
56482
  "border-color": SELECTION_BORDER_COLOR,
56483
+ "z-index": String(ComponentsImportance.TopBarComposer),
56460
56484
  });
56461
56485
  }
56462
56486
  get delimitation() {
@@ -60240,7 +60264,12 @@ stores.inject(MyMetaStore, storeInstance);
60240
60264
  ["count", strings.length],
60241
60265
  ["uniqueCount", strings.length],
60242
60266
  ];
60243
- const stringNodes = strings.map((string) => escapeXml /*xml*/ `<si><t>${string}</t></si>`);
60267
+ const stringNodes = strings.map((string) => {
60268
+ if (string.trim() !== string) {
60269
+ return escapeXml /*xml*/ `<si><t xml:space="preserve">${string}</t></si>`;
60270
+ }
60271
+ return escapeXml /*xml*/ `<si><t>${string}</t></si>`;
60272
+ });
60244
60273
  const xml = escapeXml /*xml*/ `
60245
60274
  <sst ${formatAttributes(namespaces)}>
60246
60275
  ${joinXmlNodes(stringNodes)}
@@ -61005,9 +61034,9 @@ stores.inject(MyMetaStore, storeInstance);
61005
61034
  exports.tokenize = tokenize;
61006
61035
 
61007
61036
 
61008
- __info__.version = "17.2.28";
61009
- __info__.date = "2024-11-28T09:04:19.153Z";
61010
- __info__.hash = "fb1cbd8";
61037
+ __info__.version = "17.2.30";
61038
+ __info__.date = "2024-12-19T07:48:16.226Z";
61039
+ __info__.hash = "9a9ae31";
61011
61040
 
61012
61041
 
61013
61042
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);