@odoo/o-spreadsheet 17.2.29 → 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.29
7
- * @date 2024-12-05T10:39:14.167Z
8
- * @hash 7b4b898
6
+ * @version 17.2.30
7
+ * @date 2024-12-19T07:48:16.226Z
8
+ * @hash 9a9ae31
9
9
  */
10
10
 
11
11
  'use strict';
@@ -626,6 +626,7 @@ function removeFalsyAttributes(obj) {
626
626
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
627
627
  */
628
628
  const whiteSpaceSpecialCharacters = [
629
+ " ",
629
630
  "\t",
630
631
  "\f",
631
632
  "\v",
@@ -640,17 +641,15 @@ const whiteSpaceSpecialCharacters = [
640
641
  String.fromCharCode(parseInt("3000", 16)),
641
642
  String.fromCharCode(parseInt("feff", 16)),
642
643
  ];
643
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|") + "|(\r\n|\r|\n)", "g");
644
+ const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
645
+ const newLineRegexp = /(\r\n|\r)/g;
644
646
  /**
645
- * Replace all the special spaces in a string (non-breaking, tabs, ...) by normal spaces, and all the
646
- * different newlines types by \n.
647
+ * Replace all different newlines characters by \n
647
648
  */
648
- function replaceSpecialSpaces(text) {
649
+ function replaceNewLines(text) {
649
650
  if (!text)
650
651
  return "";
651
- if (!whiteSpaceRegexp.test(text))
652
- return text;
653
- return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
652
+ return text.replace(newLineRegexp, NEWLINE);
654
653
  }
655
654
  /**
656
655
  * Determine if the numbers are consecutive.
@@ -5163,7 +5162,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
5163
5162
  const POSTFIX_UNARY_OPERATORS = ["%"];
5164
5163
  const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
5165
5164
  function tokenize(str, locale = DEFAULT_LOCALE) {
5166
- str = replaceSpecialSpaces(str);
5165
+ str = replaceNewLines(str);
5167
5166
  const chars = new TokenizingChars(str);
5168
5167
  const result = [];
5169
5168
  while (!chars.isOver()) {
@@ -5310,12 +5309,12 @@ function tokenizeSpace(chars) {
5310
5309
  if (length) {
5311
5310
  return { type: "SPACE", value: NEWLINE.repeat(length) };
5312
5311
  }
5313
- while (chars.current === " ") {
5314
- length++;
5315
- chars.shift();
5312
+ let spaces = "";
5313
+ while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5314
+ spaces += chars.shift();
5316
5315
  }
5317
- if (length) {
5318
- return { type: "SPACE", value: " ".repeat(length) };
5316
+ if (spaces) {
5317
+ return { type: "SPACE", value: spaces };
5319
5318
  }
5320
5319
  return null;
5321
5320
  }
@@ -33528,6 +33527,7 @@ class FiguresContainer extends owl.Component {
33528
33527
  draggedFigure: undefined,
33529
33528
  horizontalSnap: undefined,
33530
33529
  verticalSnap: undefined,
33530
+ cancelDnd: undefined,
33531
33531
  });
33532
33532
  setup() {
33533
33533
  owl.onMounted(() => {
@@ -33540,12 +33540,28 @@ class FiguresContainer extends owl.Component {
33540
33540
  // new rendering
33541
33541
  this.render();
33542
33542
  });
33543
+ owl.onWillUpdateProps(() => {
33544
+ const sheetId = this.env.model.getters.getActiveSheetId();
33545
+ const draggedFigureId = this.dnd.draggedFigure?.id;
33546
+ if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
33547
+ if (this.dnd.cancelDnd) {
33548
+ this.dnd.cancelDnd();
33549
+ }
33550
+ this.dnd.draggedFigure = undefined;
33551
+ this.dnd.horizontalSnap = undefined;
33552
+ this.dnd.verticalSnap = undefined;
33553
+ this.dnd.cancelDnd = undefined;
33554
+ }
33555
+ });
33543
33556
  }
33544
33557
  getVisibleFigures() {
33545
33558
  const visibleFigures = this.env.model.getters.getVisibleFigures();
33546
33559
  if (this.dnd.draggedFigure &&
33547
33560
  !visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
33548
- visibleFigures.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id));
33561
+ const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
33562
+ if (draggedFigure) {
33563
+ visibleFigures.push(draggedFigure);
33564
+ }
33549
33565
  }
33550
33566
  return visibleFigures;
33551
33567
  }
@@ -33664,7 +33680,7 @@ class FiguresContainer extends owl.Component {
33664
33680
  this.dnd.verticalSnap = undefined;
33665
33681
  this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
33666
33682
  };
33667
- startDnd(onMouseMove, onMouseUp);
33683
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33668
33684
  }
33669
33685
  /**
33670
33686
  * Initialize the resize of a figure with mouse movements
@@ -33712,7 +33728,7 @@ class FiguresContainer extends owl.Component {
33712
33728
  this.dnd.horizontalSnap = undefined;
33713
33729
  this.dnd.verticalSnap = undefined;
33714
33730
  };
33715
- startDnd(onMouseMove, onMouseUp);
33731
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33716
33732
  }
33717
33733
  getOtherFigures(figId) {
33718
33734
  return this.getVisibleFigures().filter((f) => f.id !== figId);
@@ -37672,7 +37688,7 @@ function extractStyle(cell, data) {
37672
37688
  vertical: style.verticalAlign
37673
37689
  ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
37674
37690
  : undefined,
37675
- wrapText: style.wrapping === "wrap",
37691
+ wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
37676
37692
  },
37677
37693
  };
37678
37694
  styles.font["strike"] = !!style?.strikethrough || undefined;
@@ -38124,9 +38140,8 @@ function convertRows(sheet, numberOfRows, headerGroups) {
38124
38140
  }
38125
38141
  return rows;
38126
38142
  }
38127
- /** Remove newlines (\n) in shared strings, We do not support them */
38128
38143
  function convertSharedStrings(xlsxSharedStrings) {
38129
- return xlsxSharedStrings.map((str) => str.replace(/\n/g, ""));
38144
+ return xlsxSharedStrings.map(replaceNewLines);
38130
38145
  }
38131
38146
  function convertCells(sheet, data, sheetDims, warningManager) {
38132
38147
  const cells = {};
@@ -38968,15 +38983,10 @@ class XlsxMiscExtractor extends XlsxBaseExtractor {
38968
38983
  getSharedStrings() {
38969
38984
  return this.mapOnElements({ parent: this.rootFile.file.xml, query: "si" }, (ssElement) => {
38970
38985
  // Shared string can either be a simple text, or a rich text (text with formatting, possibly in multiple parts)
38971
- if (ssElement.children[0].tagName === "t") {
38972
- return this.extractTextContent(ssElement) || "";
38973
- }
38974
38986
  // We don't support rich text formatting, we'll only extract the text
38975
- else {
38976
- return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38977
- return this.extractTextContent(textElement) || "";
38978
- }).join("");
38979
- }
38987
+ return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38988
+ return this.extractTextContent(textElement) || "";
38989
+ }).join("");
38980
38990
  });
38981
38991
  }
38982
38992
  }
@@ -41870,7 +41880,7 @@ class CellPlugin extends CorePlugin {
41870
41880
  const before = this.getters.getCell({ sheetId, col, row });
41871
41881
  const hasContent = "content" in after || "formula" in after;
41872
41882
  // Compute the new cell properties
41873
- const afterContent = hasContent ? replaceSpecialSpaces(after?.content) : before?.content || "";
41883
+ const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
41874
41884
  let style;
41875
41885
  if (after.style !== undefined) {
41876
41886
  style = after.style || undefined;
@@ -54192,6 +54202,7 @@ class SheetViewPlugin extends UIPlugin {
54192
54202
  break;
54193
54203
  case "DELETE_SHEET":
54194
54204
  this.cleanViewports();
54205
+ this.sheetsWithDirtyViewports.delete(cmd.sheetId);
54195
54206
  break;
54196
54207
  case "ACTIVATE_SHEET":
54197
54208
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
@@ -56429,7 +56440,6 @@ css /* scss */ `
56429
56440
  height: fit-content;
56430
56441
  margin-top: -1px;
56431
56442
  border: 1px solid;
56432
- z-index: ${ComponentsImportance.TopBarComposer};
56433
56443
 
56434
56444
  .o-composer:empty:not(:focus):not(.active)::before {
56435
56445
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
@@ -56471,6 +56481,7 @@ class TopBarComposer extends owl.Component {
56471
56481
  }
56472
56482
  return cssPropertiesToCss({
56473
56483
  "border-color": SELECTION_BORDER_COLOR,
56484
+ "z-index": String(ComponentsImportance.TopBarComposer),
56474
56485
  });
56475
56486
  }
56476
56487
  get delimitation() {
@@ -60254,7 +60265,12 @@ function createSharedStrings(strings) {
60254
60265
  ["count", strings.length],
60255
60266
  ["uniqueCount", strings.length],
60256
60267
  ];
60257
- const stringNodes = strings.map((string) => escapeXml /*xml*/ `<si><t>${string}</t></si>`);
60268
+ const stringNodes = strings.map((string) => {
60269
+ if (string.trim() !== string) {
60270
+ return escapeXml /*xml*/ `<si><t xml:space="preserve">${string}</t></si>`;
60271
+ }
60272
+ return escapeXml /*xml*/ `<si><t>${string}</t></si>`;
60273
+ });
60258
60274
  const xml = escapeXml /*xml*/ `
60259
60275
  <sst ${formatAttributes(namespaces)}>
60260
60276
  ${joinXmlNodes(stringNodes)}
@@ -61019,6 +61035,6 @@ exports.tokenColors = tokenColors;
61019
61035
  exports.tokenize = tokenize;
61020
61036
 
61021
61037
 
61022
- __info__.version = "17.2.29";
61023
- __info__.date = "2024-12-05T10:39:14.167Z";
61024
- __info__.hash = "7b4b898";
61038
+ __info__.version = "17.2.30";
61039
+ __info__.date = "2024-12-19T07:48:16.226Z";
61040
+ __info__.hash = "9a9ae31";
@@ -7311,6 +7311,7 @@ interface DndState {
7311
7311
  draggedFigure?: Figure;
7312
7312
  horizontalSnap?: Snap<HFigureAxisType>;
7313
7313
  verticalSnap?: Snap<VFigureAxisType>;
7314
+ cancelDnd: (() => void) | undefined;
7314
7315
  }
7315
7316
  /**
7316
7317
  * Each figure ⭐ is positioned inside a container `div` placed and sized
@@ -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.29
7
- * @date 2024-12-05T10:39:14.167Z
8
- * @hash 7b4b898
6
+ * @version 17.2.30
7
+ * @date 2024-12-19T07:48:16.226Z
8
+ * @hash 9a9ae31
9
9
  */
10
10
 
11
11
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw } from '@odoo/owl';
@@ -624,6 +624,7 @@ function removeFalsyAttributes(obj) {
624
624
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
625
625
  */
626
626
  const whiteSpaceSpecialCharacters = [
627
+ " ",
627
628
  "\t",
628
629
  "\f",
629
630
  "\v",
@@ -638,17 +639,15 @@ const whiteSpaceSpecialCharacters = [
638
639
  String.fromCharCode(parseInt("3000", 16)),
639
640
  String.fromCharCode(parseInt("feff", 16)),
640
641
  ];
641
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|") + "|(\r\n|\r|\n)", "g");
642
+ const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
643
+ const newLineRegexp = /(\r\n|\r)/g;
642
644
  /**
643
- * Replace all the special spaces in a string (non-breaking, tabs, ...) by normal spaces, and all the
644
- * different newlines types by \n.
645
+ * Replace all different newlines characters by \n
645
646
  */
646
- function replaceSpecialSpaces(text) {
647
+ function replaceNewLines(text) {
647
648
  if (!text)
648
649
  return "";
649
- if (!whiteSpaceRegexp.test(text))
650
- return text;
651
- return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
650
+ return text.replace(newLineRegexp, NEWLINE);
652
651
  }
653
652
  /**
654
653
  * Determine if the numbers are consecutive.
@@ -5161,7 +5160,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
5161
5160
  const POSTFIX_UNARY_OPERATORS = ["%"];
5162
5161
  const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
5163
5162
  function tokenize(str, locale = DEFAULT_LOCALE) {
5164
- str = replaceSpecialSpaces(str);
5163
+ str = replaceNewLines(str);
5165
5164
  const chars = new TokenizingChars(str);
5166
5165
  const result = [];
5167
5166
  while (!chars.isOver()) {
@@ -5308,12 +5307,12 @@ function tokenizeSpace(chars) {
5308
5307
  if (length) {
5309
5308
  return { type: "SPACE", value: NEWLINE.repeat(length) };
5310
5309
  }
5311
- while (chars.current === " ") {
5312
- length++;
5313
- chars.shift();
5310
+ let spaces = "";
5311
+ while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5312
+ spaces += chars.shift();
5314
5313
  }
5315
- if (length) {
5316
- return { type: "SPACE", value: " ".repeat(length) };
5314
+ if (spaces) {
5315
+ return { type: "SPACE", value: spaces };
5317
5316
  }
5318
5317
  return null;
5319
5318
  }
@@ -33526,6 +33525,7 @@ class FiguresContainer extends Component {
33526
33525
  draggedFigure: undefined,
33527
33526
  horizontalSnap: undefined,
33528
33527
  verticalSnap: undefined,
33528
+ cancelDnd: undefined,
33529
33529
  });
33530
33530
  setup() {
33531
33531
  onMounted(() => {
@@ -33538,12 +33538,28 @@ class FiguresContainer extends Component {
33538
33538
  // new rendering
33539
33539
  this.render();
33540
33540
  });
33541
+ onWillUpdateProps(() => {
33542
+ const sheetId = this.env.model.getters.getActiveSheetId();
33543
+ const draggedFigureId = this.dnd.draggedFigure?.id;
33544
+ if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
33545
+ if (this.dnd.cancelDnd) {
33546
+ this.dnd.cancelDnd();
33547
+ }
33548
+ this.dnd.draggedFigure = undefined;
33549
+ this.dnd.horizontalSnap = undefined;
33550
+ this.dnd.verticalSnap = undefined;
33551
+ this.dnd.cancelDnd = undefined;
33552
+ }
33553
+ });
33541
33554
  }
33542
33555
  getVisibleFigures() {
33543
33556
  const visibleFigures = this.env.model.getters.getVisibleFigures();
33544
33557
  if (this.dnd.draggedFigure &&
33545
33558
  !visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
33546
- visibleFigures.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id));
33559
+ const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
33560
+ if (draggedFigure) {
33561
+ visibleFigures.push(draggedFigure);
33562
+ }
33547
33563
  }
33548
33564
  return visibleFigures;
33549
33565
  }
@@ -33662,7 +33678,7 @@ class FiguresContainer extends Component {
33662
33678
  this.dnd.verticalSnap = undefined;
33663
33679
  this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
33664
33680
  };
33665
- startDnd(onMouseMove, onMouseUp);
33681
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33666
33682
  }
33667
33683
  /**
33668
33684
  * Initialize the resize of a figure with mouse movements
@@ -33710,7 +33726,7 @@ class FiguresContainer extends Component {
33710
33726
  this.dnd.horizontalSnap = undefined;
33711
33727
  this.dnd.verticalSnap = undefined;
33712
33728
  };
33713
- startDnd(onMouseMove, onMouseUp);
33729
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33714
33730
  }
33715
33731
  getOtherFigures(figId) {
33716
33732
  return this.getVisibleFigures().filter((f) => f.id !== figId);
@@ -37670,7 +37686,7 @@ function extractStyle(cell, data) {
37670
37686
  vertical: style.verticalAlign
37671
37687
  ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
37672
37688
  : undefined,
37673
- wrapText: style.wrapping === "wrap",
37689
+ wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
37674
37690
  },
37675
37691
  };
37676
37692
  styles.font["strike"] = !!style?.strikethrough || undefined;
@@ -38122,9 +38138,8 @@ function convertRows(sheet, numberOfRows, headerGroups) {
38122
38138
  }
38123
38139
  return rows;
38124
38140
  }
38125
- /** Remove newlines (\n) in shared strings, We do not support them */
38126
38141
  function convertSharedStrings(xlsxSharedStrings) {
38127
- return xlsxSharedStrings.map((str) => str.replace(/\n/g, ""));
38142
+ return xlsxSharedStrings.map(replaceNewLines);
38128
38143
  }
38129
38144
  function convertCells(sheet, data, sheetDims, warningManager) {
38130
38145
  const cells = {};
@@ -38966,15 +38981,10 @@ class XlsxMiscExtractor extends XlsxBaseExtractor {
38966
38981
  getSharedStrings() {
38967
38982
  return this.mapOnElements({ parent: this.rootFile.file.xml, query: "si" }, (ssElement) => {
38968
38983
  // Shared string can either be a simple text, or a rich text (text with formatting, possibly in multiple parts)
38969
- if (ssElement.children[0].tagName === "t") {
38970
- return this.extractTextContent(ssElement) || "";
38971
- }
38972
38984
  // We don't support rich text formatting, we'll only extract the text
38973
- else {
38974
- return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38975
- return this.extractTextContent(textElement) || "";
38976
- }).join("");
38977
- }
38985
+ return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38986
+ return this.extractTextContent(textElement) || "";
38987
+ }).join("");
38978
38988
  });
38979
38989
  }
38980
38990
  }
@@ -41868,7 +41878,7 @@ class CellPlugin extends CorePlugin {
41868
41878
  const before = this.getters.getCell({ sheetId, col, row });
41869
41879
  const hasContent = "content" in after || "formula" in after;
41870
41880
  // Compute the new cell properties
41871
- const afterContent = hasContent ? replaceSpecialSpaces(after?.content) : before?.content || "";
41881
+ const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
41872
41882
  let style;
41873
41883
  if (after.style !== undefined) {
41874
41884
  style = after.style || undefined;
@@ -54190,6 +54200,7 @@ class SheetViewPlugin extends UIPlugin {
54190
54200
  break;
54191
54201
  case "DELETE_SHEET":
54192
54202
  this.cleanViewports();
54203
+ this.sheetsWithDirtyViewports.delete(cmd.sheetId);
54193
54204
  break;
54194
54205
  case "ACTIVATE_SHEET":
54195
54206
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
@@ -56427,7 +56438,6 @@ css /* scss */ `
56427
56438
  height: fit-content;
56428
56439
  margin-top: -1px;
56429
56440
  border: 1px solid;
56430
- z-index: ${ComponentsImportance.TopBarComposer};
56431
56441
 
56432
56442
  .o-composer:empty:not(:focus):not(.active)::before {
56433
56443
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
@@ -56469,6 +56479,7 @@ class TopBarComposer extends Component {
56469
56479
  }
56470
56480
  return cssPropertiesToCss({
56471
56481
  "border-color": SELECTION_BORDER_COLOR,
56482
+ "z-index": String(ComponentsImportance.TopBarComposer),
56472
56483
  });
56473
56484
  }
56474
56485
  get delimitation() {
@@ -60252,7 +60263,12 @@ function createSharedStrings(strings) {
60252
60263
  ["count", strings.length],
60253
60264
  ["uniqueCount", strings.length],
60254
60265
  ];
60255
- const stringNodes = strings.map((string) => escapeXml /*xml*/ `<si><t>${string}</t></si>`);
60266
+ const stringNodes = strings.map((string) => {
60267
+ if (string.trim() !== string) {
60268
+ return escapeXml /*xml*/ `<si><t xml:space="preserve">${string}</t></si>`;
60269
+ }
60270
+ return escapeXml /*xml*/ `<si><t>${string}</t></si>`;
60271
+ });
60256
60272
  const xml = escapeXml /*xml*/ `
60257
60273
  <sst ${formatAttributes(namespaces)}>
60258
60274
  ${joinXmlNodes(stringNodes)}
@@ -60976,6 +60992,6 @@ const constants = {
60976
60992
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
60977
60993
 
60978
60994
 
60979
- __info__.version = "17.2.29";
60980
- __info__.date = "2024-12-05T10:39:14.167Z";
60981
- __info__.hash = "7b4b898";
60995
+ __info__.version = "17.2.30";
60996
+ __info__.date = "2024-12-19T07:48:16.226Z";
60997
+ __info__.hash = "9a9ae31";
@@ -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.29
7
- * @date 2024-12-05T10:39:14.167Z
8
- * @hash 7b4b898
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
  }
@@ -33527,6 +33526,7 @@ stores.inject(MyMetaStore, storeInstance);
33527
33526
  draggedFigure: undefined,
33528
33527
  horizontalSnap: undefined,
33529
33528
  verticalSnap: undefined,
33529
+ cancelDnd: undefined,
33530
33530
  });
33531
33531
  setup() {
33532
33532
  owl.onMounted(() => {
@@ -33539,12 +33539,28 @@ stores.inject(MyMetaStore, storeInstance);
33539
33539
  // new rendering
33540
33540
  this.render();
33541
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
+ });
33542
33555
  }
33543
33556
  getVisibleFigures() {
33544
33557
  const visibleFigures = this.env.model.getters.getVisibleFigures();
33545
33558
  if (this.dnd.draggedFigure &&
33546
33559
  !visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
33547
- 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
+ }
33548
33564
  }
33549
33565
  return visibleFigures;
33550
33566
  }
@@ -33663,7 +33679,7 @@ stores.inject(MyMetaStore, storeInstance);
33663
33679
  this.dnd.verticalSnap = undefined;
33664
33680
  this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
33665
33681
  };
33666
- startDnd(onMouseMove, onMouseUp);
33682
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33667
33683
  }
33668
33684
  /**
33669
33685
  * Initialize the resize of a figure with mouse movements
@@ -33711,7 +33727,7 @@ stores.inject(MyMetaStore, storeInstance);
33711
33727
  this.dnd.horizontalSnap = undefined;
33712
33728
  this.dnd.verticalSnap = undefined;
33713
33729
  };
33714
- startDnd(onMouseMove, onMouseUp);
33730
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
33715
33731
  }
33716
33732
  getOtherFigures(figId) {
33717
33733
  return this.getVisibleFigures().filter((f) => f.id !== figId);
@@ -37671,7 +37687,7 @@ stores.inject(MyMetaStore, storeInstance);
37671
37687
  vertical: style.verticalAlign
37672
37688
  ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
37673
37689
  : undefined,
37674
- wrapText: style.wrapping === "wrap",
37690
+ wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
37675
37691
  },
37676
37692
  };
37677
37693
  styles.font["strike"] = !!style?.strikethrough || undefined;
@@ -38123,9 +38139,8 @@ stores.inject(MyMetaStore, storeInstance);
38123
38139
  }
38124
38140
  return rows;
38125
38141
  }
38126
- /** Remove newlines (\n) in shared strings, We do not support them */
38127
38142
  function convertSharedStrings(xlsxSharedStrings) {
38128
- return xlsxSharedStrings.map((str) => str.replace(/\n/g, ""));
38143
+ return xlsxSharedStrings.map(replaceNewLines);
38129
38144
  }
38130
38145
  function convertCells(sheet, data, sheetDims, warningManager) {
38131
38146
  const cells = {};
@@ -38967,15 +38982,10 @@ stores.inject(MyMetaStore, storeInstance);
38967
38982
  getSharedStrings() {
38968
38983
  return this.mapOnElements({ parent: this.rootFile.file.xml, query: "si" }, (ssElement) => {
38969
38984
  // Shared string can either be a simple text, or a rich text (text with formatting, possibly in multiple parts)
38970
- if (ssElement.children[0].tagName === "t") {
38971
- return this.extractTextContent(ssElement) || "";
38972
- }
38973
38985
  // We don't support rich text formatting, we'll only extract the text
38974
- else {
38975
- return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38976
- return this.extractTextContent(textElement) || "";
38977
- }).join("");
38978
- }
38986
+ return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
38987
+ return this.extractTextContent(textElement) || "";
38988
+ }).join("");
38979
38989
  });
38980
38990
  }
38981
38991
  }
@@ -41869,7 +41879,7 @@ stores.inject(MyMetaStore, storeInstance);
41869
41879
  const before = this.getters.getCell({ sheetId, col, row });
41870
41880
  const hasContent = "content" in after || "formula" in after;
41871
41881
  // Compute the new cell properties
41872
- const afterContent = hasContent ? replaceSpecialSpaces(after?.content) : before?.content || "";
41882
+ const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
41873
41883
  let style;
41874
41884
  if (after.style !== undefined) {
41875
41885
  style = after.style || undefined;
@@ -54191,6 +54201,7 @@ stores.inject(MyMetaStore, storeInstance);
54191
54201
  break;
54192
54202
  case "DELETE_SHEET":
54193
54203
  this.cleanViewports();
54204
+ this.sheetsWithDirtyViewports.delete(cmd.sheetId);
54194
54205
  break;
54195
54206
  case "ACTIVATE_SHEET":
54196
54207
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
@@ -56428,7 +56439,6 @@ stores.inject(MyMetaStore, storeInstance);
56428
56439
  height: fit-content;
56429
56440
  margin-top: -1px;
56430
56441
  border: 1px solid;
56431
- z-index: ${ComponentsImportance.TopBarComposer};
56432
56442
 
56433
56443
  .o-composer:empty:not(:focus):not(.active)::before {
56434
56444
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
@@ -56470,6 +56480,7 @@ stores.inject(MyMetaStore, storeInstance);
56470
56480
  }
56471
56481
  return cssPropertiesToCss({
56472
56482
  "border-color": SELECTION_BORDER_COLOR,
56483
+ "z-index": String(ComponentsImportance.TopBarComposer),
56473
56484
  });
56474
56485
  }
56475
56486
  get delimitation() {
@@ -60253,7 +60264,12 @@ stores.inject(MyMetaStore, storeInstance);
60253
60264
  ["count", strings.length],
60254
60265
  ["uniqueCount", strings.length],
60255
60266
  ];
60256
- 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
+ });
60257
60273
  const xml = escapeXml /*xml*/ `
60258
60274
  <sst ${formatAttributes(namespaces)}>
60259
60275
  ${joinXmlNodes(stringNodes)}
@@ -61018,9 +61034,9 @@ stores.inject(MyMetaStore, storeInstance);
61018
61034
  exports.tokenize = tokenize;
61019
61035
 
61020
61036
 
61021
- __info__.version = "17.2.29";
61022
- __info__.date = "2024-12-05T10:39:14.167Z";
61023
- __info__.hash = "7b4b898";
61037
+ __info__.version = "17.2.30";
61038
+ __info__.date = "2024-12-19T07:48:16.226Z";
61039
+ __info__.hash = "9a9ae31";
61024
61040
 
61025
61041
 
61026
61042
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);