@odoo/o-spreadsheet 17.4.15 → 17.4.16

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.15
6
- * @date 2024-12-05T10:40:45.905Z
7
- * @hash 9b13f22
5
+ * @version 17.4.16
6
+ * @date 2024-12-19T07:50:04.021Z
7
+ * @hash 6b827fc
8
8
  */
9
9
 
10
10
  'use strict';
@@ -768,6 +768,7 @@ function removeFalsyAttributes(obj) {
768
768
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
769
769
  */
770
770
  const whiteSpaceSpecialCharacters = [
771
+ " ",
771
772
  "\t",
772
773
  "\f",
773
774
  "\v",
@@ -782,17 +783,15 @@ const whiteSpaceSpecialCharacters = [
782
783
  String.fromCharCode(parseInt("3000", 16)),
783
784
  String.fromCharCode(parseInt("feff", 16)),
784
785
  ];
785
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|") + "|(\r\n|\r|\n)", "g");
786
+ const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
787
+ const newLineRegexp = /(\r\n|\r)/g;
786
788
  /**
787
- * Replace all the special spaces in a string (non-breaking, tabs, ...) by normal spaces, and all the
788
- * different newlines types by \n.
789
+ * Replace all different newlines characters by \n
789
790
  */
790
- function replaceSpecialSpaces(text) {
791
+ function replaceNewLines(text) {
791
792
  if (!text)
792
793
  return "";
793
- if (!whiteSpaceRegexp.test(text))
794
- return text;
795
- return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
794
+ return text.replace(newLineRegexp, NEWLINE);
796
795
  }
797
796
  /**
798
797
  * Determine if the numbers are consecutive.
@@ -5684,7 +5683,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
5684
5683
  const POSTFIX_UNARY_OPERATORS = ["%"];
5685
5684
  const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
5686
5685
  function tokenize(str, locale = DEFAULT_LOCALE) {
5687
- str = replaceSpecialSpaces(str);
5686
+ str = replaceNewLines(str);
5688
5687
  const chars = new TokenizingChars(str);
5689
5688
  const result = [];
5690
5689
  while (!chars.isOver()) {
@@ -5831,12 +5830,12 @@ function tokenizeSpace(chars) {
5831
5830
  if (length) {
5832
5831
  return { type: "SPACE", value: NEWLINE.repeat(length) };
5833
5832
  }
5834
- while (chars.current === " ") {
5835
- length++;
5836
- chars.shift();
5833
+ let spaces = "";
5834
+ while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5835
+ spaces += chars.shift();
5837
5836
  }
5838
- if (length) {
5839
- return { type: "SPACE", value: " ".repeat(length) };
5837
+ if (spaces) {
5838
+ return { type: "SPACE", value: spaces };
5840
5839
  }
5841
5840
  return null;
5842
5841
  }
@@ -38566,6 +38565,7 @@ css /* scss */ `
38566
38565
  }
38567
38566
  }
38568
38567
  `;
38568
+ const DEFAULT_TABLE_STYLE_COLOR = "#3C78D8";
38569
38569
  class TableStyleEditorPanel extends owl.Component {
38570
38570
  static template = "o-spreadsheet-TableStyleEditorPanel";
38571
38571
  static components = { Section, RoundColorPicker, TableStylePreview };
@@ -38584,7 +38584,7 @@ class TableStyleEditorPanel extends owl.Component {
38584
38584
  : null;
38585
38585
  return {
38586
38586
  pickerOpened: false,
38587
- primaryColor: editedStyle?.primaryColor || "#3C78D8",
38587
+ primaryColor: editedStyle?.primaryColor || DEFAULT_TABLE_STYLE_COLOR,
38588
38588
  selectedTemplateName: editedStyle?.templateName || "lightColoredText",
38589
38589
  styleName: editedStyle?.displayName || this.env.model.getters.getNewCustomTableStyleName(),
38590
38590
  };
@@ -38593,7 +38593,7 @@ class TableStyleEditorPanel extends owl.Component {
38593
38593
  this.state.pickerOpened = !this.state.pickerOpened;
38594
38594
  }
38595
38595
  onColorPicked(color) {
38596
- this.state.primaryColor = color;
38596
+ this.state.primaryColor = isColorValid(color) ? color : DEFAULT_TABLE_STYLE_COLOR;
38597
38597
  this.state.pickerOpened = false;
38598
38598
  }
38599
38599
  onTemplatePicked(templateName) {
@@ -39940,6 +39940,7 @@ class FiguresContainer extends owl.Component {
39940
39940
  draggedFigure: undefined,
39941
39941
  horizontalSnap: undefined,
39942
39942
  verticalSnap: undefined,
39943
+ cancelDnd: undefined,
39943
39944
  });
39944
39945
  setup() {
39945
39946
  owl.onMounted(() => {
@@ -39952,12 +39953,28 @@ class FiguresContainer extends owl.Component {
39952
39953
  // new rendering
39953
39954
  this.render();
39954
39955
  });
39956
+ owl.onWillUpdateProps(() => {
39957
+ const sheetId = this.env.model.getters.getActiveSheetId();
39958
+ const draggedFigureId = this.dnd.draggedFigure?.id;
39959
+ if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
39960
+ if (this.dnd.cancelDnd) {
39961
+ this.dnd.cancelDnd();
39962
+ }
39963
+ this.dnd.draggedFigure = undefined;
39964
+ this.dnd.horizontalSnap = undefined;
39965
+ this.dnd.verticalSnap = undefined;
39966
+ this.dnd.cancelDnd = undefined;
39967
+ }
39968
+ });
39955
39969
  }
39956
39970
  getVisibleFigures() {
39957
39971
  const visibleFigures = this.env.model.getters.getVisibleFigures();
39958
39972
  if (this.dnd.draggedFigure &&
39959
39973
  !visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
39960
- visibleFigures.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id));
39974
+ const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
39975
+ if (draggedFigure) {
39976
+ visibleFigures.push(draggedFigure);
39977
+ }
39961
39978
  }
39962
39979
  return visibleFigures;
39963
39980
  }
@@ -40076,7 +40093,7 @@ class FiguresContainer extends owl.Component {
40076
40093
  this.dnd.verticalSnap = undefined;
40077
40094
  this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
40078
40095
  };
40079
- startDnd(onMouseMove, onMouseUp);
40096
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
40080
40097
  }
40081
40098
  /**
40082
40099
  * Initialize the resize of a figure with mouse movements
@@ -40124,7 +40141,7 @@ class FiguresContainer extends owl.Component {
40124
40141
  this.dnd.horizontalSnap = undefined;
40125
40142
  this.dnd.verticalSnap = undefined;
40126
40143
  };
40127
- startDnd(onMouseMove, onMouseUp);
40144
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
40128
40145
  }
40129
40146
  getOtherFigures(figId) {
40130
40147
  return this.getVisibleFigures().filter((f) => f.id !== figId);
@@ -48236,7 +48253,7 @@ class CellPlugin extends CorePlugin {
48236
48253
  const before = this.getters.getCell({ sheetId, col, row });
48237
48254
  const hasContent = "content" in after || "formula" in after;
48238
48255
  // Compute the new cell properties
48239
- const afterContent = hasContent ? replaceSpecialSpaces(after?.content) : before?.content || "";
48256
+ const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
48240
48257
  let style;
48241
48258
  if (after.style !== undefined) {
48242
48259
  style = after.style || undefined;
@@ -51097,6 +51114,9 @@ class SheetPlugin extends CorePlugin {
51097
51114
  };
51098
51115
  }
51099
51116
  getUnboundedZone(sheetId, zone) {
51117
+ if (zone.bottom === undefined || zone.right === undefined) {
51118
+ return zone;
51119
+ }
51100
51120
  const isFullRow = zone.left === 0 && zone.right === this.getNumberCols(sheetId) - 1;
51101
51121
  const isFullCol = zone.top === 0 && zone.bottom === this.getNumberRows(sheetId) - 1;
51102
51122
  return {
@@ -61306,6 +61326,7 @@ class SheetViewPlugin extends UIPlugin {
61306
61326
  break;
61307
61327
  case "DELETE_SHEET":
61308
61328
  this.cleanViewports();
61329
+ this.sheetsWithDirtyViewports.delete(cmd.sheetId);
61309
61330
  break;
61310
61331
  case "ACTIVATE_SHEET":
61311
61332
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
@@ -63729,7 +63750,6 @@ css /* scss */ `
63729
63750
  height: fit-content;
63730
63751
  margin-top: -1px;
63731
63752
  border: 1px solid;
63732
- z-index: ${ComponentsImportance.TopBarComposer};
63733
63753
 
63734
63754
  .o-composer:empty:not(:focus):not(.active)::before {
63735
63755
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
@@ -63771,6 +63791,7 @@ class TopBarComposer extends owl.Component {
63771
63791
  }
63772
63792
  return cssPropertiesToCss({
63773
63793
  "border-color": SELECTION_BORDER_COLOR,
63794
+ "z-index": String(ComponentsImportance.TopBarComposer),
63774
63795
  });
63775
63796
  }
63776
63797
  get delimitation() {
@@ -68726,6 +68747,6 @@ exports.tokenColors = tokenColors;
68726
68747
  exports.tokenize = tokenize;
68727
68748
 
68728
68749
 
68729
- __info__.version = "17.4.15";
68730
- __info__.date = "2024-12-05T10:40:45.905Z";
68731
- __info__.hash = "9b13f22";
68750
+ __info__.version = "17.4.16";
68751
+ __info__.date = "2024-12-19T07:50:04.021Z";
68752
+ __info__.hash = "6b827fc";
@@ -8285,6 +8285,7 @@ interface DndState {
8285
8285
  draggedFigure?: Figure;
8286
8286
  horizontalSnap?: Snap<HFigureAxisType>;
8287
8287
  verticalSnap?: Snap<VFigureAxisType>;
8288
+ cancelDnd: (() => void) | undefined;
8288
8289
  }
8289
8290
  /**
8290
8291
  * Each figure ⭐ is positioned inside a container `div` placed and sized
@@ -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.15
6
- * @date 2024-12-05T10:40:45.905Z
7
- * @hash 9b13f22
5
+ * @version 17.4.16
6
+ * @date 2024-12-19T07:50:04.021Z
7
+ * @hash 6b827fc
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -766,6 +766,7 @@ function removeFalsyAttributes(obj) {
766
766
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
767
767
  */
768
768
  const whiteSpaceSpecialCharacters = [
769
+ " ",
769
770
  "\t",
770
771
  "\f",
771
772
  "\v",
@@ -780,17 +781,15 @@ const whiteSpaceSpecialCharacters = [
780
781
  String.fromCharCode(parseInt("3000", 16)),
781
782
  String.fromCharCode(parseInt("feff", 16)),
782
783
  ];
783
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|") + "|(\r\n|\r|\n)", "g");
784
+ const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
785
+ const newLineRegexp = /(\r\n|\r)/g;
784
786
  /**
785
- * Replace all the special spaces in a string (non-breaking, tabs, ...) by normal spaces, and all the
786
- * different newlines types by \n.
787
+ * Replace all different newlines characters by \n
787
788
  */
788
- function replaceSpecialSpaces(text) {
789
+ function replaceNewLines(text) {
789
790
  if (!text)
790
791
  return "";
791
- if (!whiteSpaceRegexp.test(text))
792
- return text;
793
- return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
792
+ return text.replace(newLineRegexp, NEWLINE);
794
793
  }
795
794
  /**
796
795
  * Determine if the numbers are consecutive.
@@ -5682,7 +5681,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
5682
5681
  const POSTFIX_UNARY_OPERATORS = ["%"];
5683
5682
  const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
5684
5683
  function tokenize(str, locale = DEFAULT_LOCALE) {
5685
- str = replaceSpecialSpaces(str);
5684
+ str = replaceNewLines(str);
5686
5685
  const chars = new TokenizingChars(str);
5687
5686
  const result = [];
5688
5687
  while (!chars.isOver()) {
@@ -5829,12 +5828,12 @@ function tokenizeSpace(chars) {
5829
5828
  if (length) {
5830
5829
  return { type: "SPACE", value: NEWLINE.repeat(length) };
5831
5830
  }
5832
- while (chars.current === " ") {
5833
- length++;
5834
- chars.shift();
5831
+ let spaces = "";
5832
+ while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5833
+ spaces += chars.shift();
5835
5834
  }
5836
- if (length) {
5837
- return { type: "SPACE", value: " ".repeat(length) };
5835
+ if (spaces) {
5836
+ return { type: "SPACE", value: spaces };
5838
5837
  }
5839
5838
  return null;
5840
5839
  }
@@ -38564,6 +38563,7 @@ css /* scss */ `
38564
38563
  }
38565
38564
  }
38566
38565
  `;
38566
+ const DEFAULT_TABLE_STYLE_COLOR = "#3C78D8";
38567
38567
  class TableStyleEditorPanel extends Component {
38568
38568
  static template = "o-spreadsheet-TableStyleEditorPanel";
38569
38569
  static components = { Section, RoundColorPicker, TableStylePreview };
@@ -38582,7 +38582,7 @@ class TableStyleEditorPanel extends Component {
38582
38582
  : null;
38583
38583
  return {
38584
38584
  pickerOpened: false,
38585
- primaryColor: editedStyle?.primaryColor || "#3C78D8",
38585
+ primaryColor: editedStyle?.primaryColor || DEFAULT_TABLE_STYLE_COLOR,
38586
38586
  selectedTemplateName: editedStyle?.templateName || "lightColoredText",
38587
38587
  styleName: editedStyle?.displayName || this.env.model.getters.getNewCustomTableStyleName(),
38588
38588
  };
@@ -38591,7 +38591,7 @@ class TableStyleEditorPanel extends Component {
38591
38591
  this.state.pickerOpened = !this.state.pickerOpened;
38592
38592
  }
38593
38593
  onColorPicked(color) {
38594
- this.state.primaryColor = color;
38594
+ this.state.primaryColor = isColorValid(color) ? color : DEFAULT_TABLE_STYLE_COLOR;
38595
38595
  this.state.pickerOpened = false;
38596
38596
  }
38597
38597
  onTemplatePicked(templateName) {
@@ -39938,6 +39938,7 @@ class FiguresContainer extends Component {
39938
39938
  draggedFigure: undefined,
39939
39939
  horizontalSnap: undefined,
39940
39940
  verticalSnap: undefined,
39941
+ cancelDnd: undefined,
39941
39942
  });
39942
39943
  setup() {
39943
39944
  onMounted(() => {
@@ -39950,12 +39951,28 @@ class FiguresContainer extends Component {
39950
39951
  // new rendering
39951
39952
  this.render();
39952
39953
  });
39954
+ onWillUpdateProps(() => {
39955
+ const sheetId = this.env.model.getters.getActiveSheetId();
39956
+ const draggedFigureId = this.dnd.draggedFigure?.id;
39957
+ if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
39958
+ if (this.dnd.cancelDnd) {
39959
+ this.dnd.cancelDnd();
39960
+ }
39961
+ this.dnd.draggedFigure = undefined;
39962
+ this.dnd.horizontalSnap = undefined;
39963
+ this.dnd.verticalSnap = undefined;
39964
+ this.dnd.cancelDnd = undefined;
39965
+ }
39966
+ });
39953
39967
  }
39954
39968
  getVisibleFigures() {
39955
39969
  const visibleFigures = this.env.model.getters.getVisibleFigures();
39956
39970
  if (this.dnd.draggedFigure &&
39957
39971
  !visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
39958
- visibleFigures.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id));
39972
+ const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
39973
+ if (draggedFigure) {
39974
+ visibleFigures.push(draggedFigure);
39975
+ }
39959
39976
  }
39960
39977
  return visibleFigures;
39961
39978
  }
@@ -40074,7 +40091,7 @@ class FiguresContainer extends Component {
40074
40091
  this.dnd.verticalSnap = undefined;
40075
40092
  this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
40076
40093
  };
40077
- startDnd(onMouseMove, onMouseUp);
40094
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
40078
40095
  }
40079
40096
  /**
40080
40097
  * Initialize the resize of a figure with mouse movements
@@ -40122,7 +40139,7 @@ class FiguresContainer extends Component {
40122
40139
  this.dnd.horizontalSnap = undefined;
40123
40140
  this.dnd.verticalSnap = undefined;
40124
40141
  };
40125
- startDnd(onMouseMove, onMouseUp);
40142
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
40126
40143
  }
40127
40144
  getOtherFigures(figId) {
40128
40145
  return this.getVisibleFigures().filter((f) => f.id !== figId);
@@ -48234,7 +48251,7 @@ class CellPlugin extends CorePlugin {
48234
48251
  const before = this.getters.getCell({ sheetId, col, row });
48235
48252
  const hasContent = "content" in after || "formula" in after;
48236
48253
  // Compute the new cell properties
48237
- const afterContent = hasContent ? replaceSpecialSpaces(after?.content) : before?.content || "";
48254
+ const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
48238
48255
  let style;
48239
48256
  if (after.style !== undefined) {
48240
48257
  style = after.style || undefined;
@@ -51095,6 +51112,9 @@ class SheetPlugin extends CorePlugin {
51095
51112
  };
51096
51113
  }
51097
51114
  getUnboundedZone(sheetId, zone) {
51115
+ if (zone.bottom === undefined || zone.right === undefined) {
51116
+ return zone;
51117
+ }
51098
51118
  const isFullRow = zone.left === 0 && zone.right === this.getNumberCols(sheetId) - 1;
51099
51119
  const isFullCol = zone.top === 0 && zone.bottom === this.getNumberRows(sheetId) - 1;
51100
51120
  return {
@@ -61304,6 +61324,7 @@ class SheetViewPlugin extends UIPlugin {
61304
61324
  break;
61305
61325
  case "DELETE_SHEET":
61306
61326
  this.cleanViewports();
61327
+ this.sheetsWithDirtyViewports.delete(cmd.sheetId);
61307
61328
  break;
61308
61329
  case "ACTIVATE_SHEET":
61309
61330
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
@@ -63727,7 +63748,6 @@ css /* scss */ `
63727
63748
  height: fit-content;
63728
63749
  margin-top: -1px;
63729
63750
  border: 1px solid;
63730
- z-index: ${ComponentsImportance.TopBarComposer};
63731
63751
 
63732
63752
  .o-composer:empty:not(:focus):not(.active)::before {
63733
63753
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
@@ -63769,6 +63789,7 @@ class TopBarComposer extends Component {
63769
63789
  }
63770
63790
  return cssPropertiesToCss({
63771
63791
  "border-color": SELECTION_BORDER_COLOR,
63792
+ "z-index": String(ComponentsImportance.TopBarComposer),
63772
63793
  });
63773
63794
  }
63774
63795
  get delimitation() {
@@ -68681,6 +68702,6 @@ const constants = {
68681
68702
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, 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 };
68682
68703
 
68683
68704
 
68684
- __info__.version = "17.4.15";
68685
- __info__.date = "2024-12-05T10:40:45.905Z";
68686
- __info__.hash = "9b13f22";
68705
+ __info__.version = "17.4.16";
68706
+ __info__.date = "2024-12-19T07:50:04.021Z";
68707
+ __info__.hash = "6b827fc";
@@ -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.15
6
- * @date 2024-12-05T10:40:45.905Z
7
- * @hash 9b13f22
5
+ * @version 17.4.16
6
+ * @date 2024-12-19T07:50:04.021Z
7
+ * @hash 6b827fc
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -767,6 +767,7 @@
767
767
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
768
768
  */
769
769
  const whiteSpaceSpecialCharacters = [
770
+ " ",
770
771
  "\t",
771
772
  "\f",
772
773
  "\v",
@@ -781,17 +782,15 @@
781
782
  String.fromCharCode(parseInt("3000", 16)),
782
783
  String.fromCharCode(parseInt("feff", 16)),
783
784
  ];
784
- const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|") + "|(\r\n|\r|\n)", "g");
785
+ const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
786
+ const newLineRegexp = /(\r\n|\r)/g;
785
787
  /**
786
- * Replace all the special spaces in a string (non-breaking, tabs, ...) by normal spaces, and all the
787
- * different newlines types by \n.
788
+ * Replace all different newlines characters by \n
788
789
  */
789
- function replaceSpecialSpaces(text) {
790
+ function replaceNewLines(text) {
790
791
  if (!text)
791
792
  return "";
792
- if (!whiteSpaceRegexp.test(text))
793
- return text;
794
- return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
793
+ return text.replace(newLineRegexp, NEWLINE);
795
794
  }
796
795
  /**
797
796
  * Determine if the numbers are consecutive.
@@ -5683,7 +5682,7 @@
5683
5682
  const POSTFIX_UNARY_OPERATORS = ["%"];
5684
5683
  const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
5685
5684
  function tokenize(str, locale = DEFAULT_LOCALE) {
5686
- str = replaceSpecialSpaces(str);
5685
+ str = replaceNewLines(str);
5687
5686
  const chars = new TokenizingChars(str);
5688
5687
  const result = [];
5689
5688
  while (!chars.isOver()) {
@@ -5830,12 +5829,12 @@
5830
5829
  if (length) {
5831
5830
  return { type: "SPACE", value: NEWLINE.repeat(length) };
5832
5831
  }
5833
- while (chars.current === " ") {
5834
- length++;
5835
- chars.shift();
5832
+ let spaces = "";
5833
+ while (chars.current && chars.current.match(whiteSpaceRegexp)) {
5834
+ spaces += chars.shift();
5836
5835
  }
5837
- if (length) {
5838
- return { type: "SPACE", value: " ".repeat(length) };
5836
+ if (spaces) {
5837
+ return { type: "SPACE", value: spaces };
5839
5838
  }
5840
5839
  return null;
5841
5840
  }
@@ -38565,6 +38564,7 @@ stores.inject(MyMetaStore, storeInstance);
38565
38564
  }
38566
38565
  }
38567
38566
  `;
38567
+ const DEFAULT_TABLE_STYLE_COLOR = "#3C78D8";
38568
38568
  class TableStyleEditorPanel extends owl.Component {
38569
38569
  static template = "o-spreadsheet-TableStyleEditorPanel";
38570
38570
  static components = { Section, RoundColorPicker, TableStylePreview };
@@ -38583,7 +38583,7 @@ stores.inject(MyMetaStore, storeInstance);
38583
38583
  : null;
38584
38584
  return {
38585
38585
  pickerOpened: false,
38586
- primaryColor: editedStyle?.primaryColor || "#3C78D8",
38586
+ primaryColor: editedStyle?.primaryColor || DEFAULT_TABLE_STYLE_COLOR,
38587
38587
  selectedTemplateName: editedStyle?.templateName || "lightColoredText",
38588
38588
  styleName: editedStyle?.displayName || this.env.model.getters.getNewCustomTableStyleName(),
38589
38589
  };
@@ -38592,7 +38592,7 @@ stores.inject(MyMetaStore, storeInstance);
38592
38592
  this.state.pickerOpened = !this.state.pickerOpened;
38593
38593
  }
38594
38594
  onColorPicked(color) {
38595
- this.state.primaryColor = color;
38595
+ this.state.primaryColor = isColorValid(color) ? color : DEFAULT_TABLE_STYLE_COLOR;
38596
38596
  this.state.pickerOpened = false;
38597
38597
  }
38598
38598
  onTemplatePicked(templateName) {
@@ -39939,6 +39939,7 @@ stores.inject(MyMetaStore, storeInstance);
39939
39939
  draggedFigure: undefined,
39940
39940
  horizontalSnap: undefined,
39941
39941
  verticalSnap: undefined,
39942
+ cancelDnd: undefined,
39942
39943
  });
39943
39944
  setup() {
39944
39945
  owl.onMounted(() => {
@@ -39951,12 +39952,28 @@ stores.inject(MyMetaStore, storeInstance);
39951
39952
  // new rendering
39952
39953
  this.render();
39953
39954
  });
39955
+ owl.onWillUpdateProps(() => {
39956
+ const sheetId = this.env.model.getters.getActiveSheetId();
39957
+ const draggedFigureId = this.dnd.draggedFigure?.id;
39958
+ if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
39959
+ if (this.dnd.cancelDnd) {
39960
+ this.dnd.cancelDnd();
39961
+ }
39962
+ this.dnd.draggedFigure = undefined;
39963
+ this.dnd.horizontalSnap = undefined;
39964
+ this.dnd.verticalSnap = undefined;
39965
+ this.dnd.cancelDnd = undefined;
39966
+ }
39967
+ });
39954
39968
  }
39955
39969
  getVisibleFigures() {
39956
39970
  const visibleFigures = this.env.model.getters.getVisibleFigures();
39957
39971
  if (this.dnd.draggedFigure &&
39958
39972
  !visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
39959
- visibleFigures.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id));
39973
+ const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
39974
+ if (draggedFigure) {
39975
+ visibleFigures.push(draggedFigure);
39976
+ }
39960
39977
  }
39961
39978
  return visibleFigures;
39962
39979
  }
@@ -40075,7 +40092,7 @@ stores.inject(MyMetaStore, storeInstance);
40075
40092
  this.dnd.verticalSnap = undefined;
40076
40093
  this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
40077
40094
  };
40078
- startDnd(onMouseMove, onMouseUp);
40095
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
40079
40096
  }
40080
40097
  /**
40081
40098
  * Initialize the resize of a figure with mouse movements
@@ -40123,7 +40140,7 @@ stores.inject(MyMetaStore, storeInstance);
40123
40140
  this.dnd.horizontalSnap = undefined;
40124
40141
  this.dnd.verticalSnap = undefined;
40125
40142
  };
40126
- startDnd(onMouseMove, onMouseUp);
40143
+ this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
40127
40144
  }
40128
40145
  getOtherFigures(figId) {
40129
40146
  return this.getVisibleFigures().filter((f) => f.id !== figId);
@@ -48235,7 +48252,7 @@ stores.inject(MyMetaStore, storeInstance);
48235
48252
  const before = this.getters.getCell({ sheetId, col, row });
48236
48253
  const hasContent = "content" in after || "formula" in after;
48237
48254
  // Compute the new cell properties
48238
- const afterContent = hasContent ? replaceSpecialSpaces(after?.content) : before?.content || "";
48255
+ const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
48239
48256
  let style;
48240
48257
  if (after.style !== undefined) {
48241
48258
  style = after.style || undefined;
@@ -51096,6 +51113,9 @@ stores.inject(MyMetaStore, storeInstance);
51096
51113
  };
51097
51114
  }
51098
51115
  getUnboundedZone(sheetId, zone) {
51116
+ if (zone.bottom === undefined || zone.right === undefined) {
51117
+ return zone;
51118
+ }
51099
51119
  const isFullRow = zone.left === 0 && zone.right === this.getNumberCols(sheetId) - 1;
51100
51120
  const isFullCol = zone.top === 0 && zone.bottom === this.getNumberRows(sheetId) - 1;
51101
51121
  return {
@@ -61305,6 +61325,7 @@ stores.inject(MyMetaStore, storeInstance);
61305
61325
  break;
61306
61326
  case "DELETE_SHEET":
61307
61327
  this.cleanViewports();
61328
+ this.sheetsWithDirtyViewports.delete(cmd.sheetId);
61308
61329
  break;
61309
61330
  case "ACTIVATE_SHEET":
61310
61331
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
@@ -63728,7 +63749,6 @@ stores.inject(MyMetaStore, storeInstance);
63728
63749
  height: fit-content;
63729
63750
  margin-top: -1px;
63730
63751
  border: 1px solid;
63731
- z-index: ${ComponentsImportance.TopBarComposer};
63732
63752
 
63733
63753
  .o-composer:empty:not(:focus):not(.active)::before {
63734
63754
  content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
@@ -63770,6 +63790,7 @@ stores.inject(MyMetaStore, storeInstance);
63770
63790
  }
63771
63791
  return cssPropertiesToCss({
63772
63792
  "border-color": SELECTION_BORDER_COLOR,
63793
+ "z-index": String(ComponentsImportance.TopBarComposer),
63773
63794
  });
63774
63795
  }
63775
63796
  get delimitation() {
@@ -68725,9 +68746,9 @@ stores.inject(MyMetaStore, storeInstance);
68725
68746
  exports.tokenize = tokenize;
68726
68747
 
68727
68748
 
68728
- __info__.version = "17.4.15";
68729
- __info__.date = "2024-12-05T10:40:45.905Z";
68730
- __info__.hash = "9b13f22";
68749
+ __info__.version = "17.4.16";
68750
+ __info__.date = "2024-12-19T07:50:04.021Z";
68751
+ __info__.hash = "6b827fc";
68731
68752
 
68732
68753
 
68733
68754
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);