@odoo/o-spreadsheet 15.0.2 → 15.0.4

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.
@@ -370,7 +370,7 @@ function formatJSTime(jsDate, format) {
370
370
  * - it does not accept "," as thousand separator, because when we tokenize a
371
371
  * formula, commas are used to separate arguments
372
372
  */
373
- const formulaNumberRegexp = /^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?/;
373
+ const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
374
374
  const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
375
375
  /**
376
376
  * Return true if the argument is a "number string".
@@ -18408,6 +18408,7 @@ class EditionPlugin extends UIPlugin {
18408
18408
  this.setContent(this.initialContent || "");
18409
18409
  }
18410
18410
  setContent(text, selection, raise) {
18411
+ text = text.replace(/[\r\n]/g, "");
18411
18412
  const isNewCurrentContent = this.currentContent !== text;
18412
18413
  this.currentContent = text;
18413
18414
  if (selection) {
@@ -26993,6 +26994,8 @@ class ContentEditableHelper {
26993
26994
  start = 0;
26994
26995
  if (end > this.el.textContent.length)
26995
26996
  end = this.el.textContent.length;
26997
+ if (start > this.el.textContent.length)
26998
+ start = this.el.textContent.length;
26996
26999
  }
26997
27000
  let startNode = this.findChildAtCharacterIndex(start);
26998
27001
  let endNode = this.findChildAtCharacterIndex(end);
@@ -30220,6 +30223,10 @@ class Grid extends owl.Component {
30220
30223
  }
30221
30224
  }
30222
30225
  onInput(ev) {
30226
+ // the user meant to paste in the sheet, not open the composer with the pasted content
30227
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
30228
+ return;
30229
+ }
30223
30230
  if (ev.data) {
30224
30231
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30225
30232
  // character
@@ -31362,6 +31369,6 @@ exports.registries = registries;
31362
31369
  exports.setTranslationMethod = setTranslationMethod;
31363
31370
 
31364
31371
 
31365
- __info__.version = '15.0.2';
31366
- __info__.date = '2023-03-14T09:19:34.555Z';
31367
- __info__.hash = 'c0a25a0';
31372
+ __info__.version = '15.0.4';
31373
+ __info__.date = '2023-04-13T08:14:04.472Z';
31374
+ __info__.hash = 'f66eddd';
@@ -347,7 +347,7 @@ function formatJSTime(jsDate, format) {
347
347
  * - it does not accept "," as thousand separator, because when we tokenize a
348
348
  * formula, commas are used to separate arguments
349
349
  */
350
- const formulaNumberRegexp = /^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?/;
350
+ const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
351
351
  const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
352
352
  /**
353
353
  * Return true if the argument is a "number string".
@@ -18385,6 +18385,7 @@ class EditionPlugin extends UIPlugin {
18385
18385
  this.setContent(this.initialContent || "");
18386
18386
  }
18387
18387
  setContent(text, selection, raise) {
18388
+ text = text.replace(/[\r\n]/g, "");
18388
18389
  const isNewCurrentContent = this.currentContent !== text;
18389
18390
  this.currentContent = text;
18390
18391
  if (selection) {
@@ -26970,6 +26971,8 @@ class ContentEditableHelper {
26970
26971
  start = 0;
26971
26972
  if (end > this.el.textContent.length)
26972
26973
  end = this.el.textContent.length;
26974
+ if (start > this.el.textContent.length)
26975
+ start = this.el.textContent.length;
26973
26976
  }
26974
26977
  let startNode = this.findChildAtCharacterIndex(start);
26975
26978
  let endNode = this.findChildAtCharacterIndex(end);
@@ -30197,6 +30200,10 @@ class Grid extends Component {
30197
30200
  }
30198
30201
  }
30199
30202
  onInput(ev) {
30203
+ // the user meant to paste in the sheet, not open the composer with the pasted content
30204
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
30205
+ return;
30206
+ }
30200
30207
  if (ev.data) {
30201
30208
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30202
30209
  // character
@@ -31317,6 +31324,6 @@ const helpers = {
31317
31324
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, normalize, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31318
31325
 
31319
31326
 
31320
- __info__.version = '15.0.2';
31321
- __info__.date = '2023-03-14T09:19:34.555Z';
31322
- __info__.hash = 'c0a25a0';
31327
+ __info__.version = '15.0.4';
31328
+ __info__.date = '2023-04-13T08:14:04.472Z';
31329
+ __info__.hash = 'f66eddd';
@@ -367,7 +367,7 @@
367
367
  * - it does not accept "," as thousand separator, because when we tokenize a
368
368
  * formula, commas are used to separate arguments
369
369
  */
370
- const formulaNumberRegexp = /^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?/;
370
+ const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
371
371
  const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
372
372
  /**
373
373
  * Return true if the argument is a "number string".
@@ -18405,6 +18405,7 @@
18405
18405
  this.setContent(this.initialContent || "");
18406
18406
  }
18407
18407
  setContent(text, selection, raise) {
18408
+ text = text.replace(/[\r\n]/g, "");
18408
18409
  const isNewCurrentContent = this.currentContent !== text;
18409
18410
  this.currentContent = text;
18410
18411
  if (selection) {
@@ -26990,6 +26991,8 @@
26990
26991
  start = 0;
26991
26992
  if (end > this.el.textContent.length)
26992
26993
  end = this.el.textContent.length;
26994
+ if (start > this.el.textContent.length)
26995
+ start = this.el.textContent.length;
26993
26996
  }
26994
26997
  let startNode = this.findChildAtCharacterIndex(start);
26995
26998
  let endNode = this.findChildAtCharacterIndex(end);
@@ -30217,6 +30220,10 @@
30217
30220
  }
30218
30221
  }
30219
30222
  onInput(ev) {
30223
+ // the user meant to paste in the sheet, not open the composer with the pasted content
30224
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
30225
+ return;
30226
+ }
30220
30227
  if (ev.data) {
30221
30228
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30222
30229
  // character
@@ -31361,9 +31368,9 @@
31361
31368
  Object.defineProperty(exports, '__esModule', { value: true });
31362
31369
 
31363
31370
 
31364
- __info__.version = '15.0.2';
31365
- __info__.date = '2023-03-14T09:19:34.555Z';
31366
- __info__.hash = 'c0a25a0';
31371
+ __info__.version = '15.0.4';
31372
+ __info__.date = '2023-04-13T08:14:04.472Z';
31373
+ __info__.hash = 'f66eddd';
31367
31374
 
31368
31375
 
31369
31376
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);