@odoo/o-spreadsheet 15.2.1 → 15.2.3

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.
@@ -3183,6 +3183,9 @@ function isZoneValid(zone) {
3183
3183
  if (isNaN(zone.bottom) || isNaN(zone.top) || isNaN(zone.left) || isNaN(zone.right)) {
3184
3184
  return false;
3185
3185
  }
3186
+ if (zone.top < 0 || zone.left < 0 || zone.right < 0 || zone.bottom < 0) {
3187
+ return false;
3188
+ }
3186
3189
  return zone.bottom >= zone.top && zone.right >= zone.left;
3187
3190
  }
3188
3191
  /**
@@ -18458,6 +18461,7 @@ class EditionPlugin extends UIPlugin {
18458
18461
  this.setContent(this.initialContent || "");
18459
18462
  }
18460
18463
  setContent(text, selection, raise) {
18464
+ text = text.replace(/[\r\n]/g, "");
18461
18465
  const isNewCurrentContent = this.currentContent !== text;
18462
18466
  this.currentContent = text;
18463
18467
  if (selection) {
@@ -23509,6 +23513,7 @@ class RangeAdapter {
23509
23513
  }
23510
23514
  else if (range.zone[start] >= min && range.zone[end] <= max) {
23511
23515
  changeType = "REMOVE";
23516
+ newRange = this.buildInvalidRange(INCORRECT_RANGE_STRING);
23512
23517
  }
23513
23518
  else if (range.zone[start] <= max && range.zone[end] >= max) {
23514
23519
  const toRemove = max - range.zone[start] + 1;
@@ -23574,10 +23579,8 @@ class RangeAdapter {
23574
23579
  return { changeType: "NONE" };
23575
23580
  }
23576
23581
  range = {
23577
- ...range,
23578
- zone: { ...range.zone },
23582
+ ...this.buildInvalidRange(INCORRECT_RANGE_STRING),
23579
23583
  invalidSheetName: this.getters.getSheetName(cmd.sheetId),
23580
- sheetId: "",
23581
23584
  };
23582
23585
  return { changeType: "REMOVE", range };
23583
23586
  }, cmd.sheetId);
@@ -26933,6 +26936,8 @@ class ContentEditableHelper {
26933
26936
  start = 0;
26934
26937
  if (end > this.el.textContent.length)
26935
26938
  end = this.el.textContent.length;
26939
+ if (start > this.el.textContent.length)
26940
+ start = this.el.textContent.length;
26936
26941
  }
26937
26942
  let startNode = this.findChildAtCharacterIndex(start);
26938
26943
  let endNode = this.findChildAtCharacterIndex(end);
@@ -30177,6 +30182,10 @@ class Grid extends owl.Component {
30177
30182
  }
30178
30183
  }
30179
30184
  onInput(ev) {
30185
+ // the user meant to paste in the sheet, not open the composer with the pasted content
30186
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
30187
+ return;
30188
+ }
30180
30189
  if (ev.data) {
30181
30190
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30182
30191
  // character
@@ -31289,6 +31298,6 @@ exports.registries = registries;
31289
31298
  exports.setTranslationMethod = setTranslationMethod;
31290
31299
 
31291
31300
 
31292
- __info__.version = '15.2.1';
31293
- __info__.date = '2023-03-06T07:16:45.196Z';
31294
- __info__.hash = 'baeea23';
31301
+ __info__.version = '15.2.3';
31302
+ __info__.date = '2023-03-23T11:32:58.083Z';
31303
+ __info__.hash = '0541ed5';
@@ -3160,6 +3160,9 @@ function isZoneValid(zone) {
3160
3160
  if (isNaN(zone.bottom) || isNaN(zone.top) || isNaN(zone.left) || isNaN(zone.right)) {
3161
3161
  return false;
3162
3162
  }
3163
+ if (zone.top < 0 || zone.left < 0 || zone.right < 0 || zone.bottom < 0) {
3164
+ return false;
3165
+ }
3163
3166
  return zone.bottom >= zone.top && zone.right >= zone.left;
3164
3167
  }
3165
3168
  /**
@@ -18435,6 +18438,7 @@ class EditionPlugin extends UIPlugin {
18435
18438
  this.setContent(this.initialContent || "");
18436
18439
  }
18437
18440
  setContent(text, selection, raise) {
18441
+ text = text.replace(/[\r\n]/g, "");
18438
18442
  const isNewCurrentContent = this.currentContent !== text;
18439
18443
  this.currentContent = text;
18440
18444
  if (selection) {
@@ -23486,6 +23490,7 @@ class RangeAdapter {
23486
23490
  }
23487
23491
  else if (range.zone[start] >= min && range.zone[end] <= max) {
23488
23492
  changeType = "REMOVE";
23493
+ newRange = this.buildInvalidRange(INCORRECT_RANGE_STRING);
23489
23494
  }
23490
23495
  else if (range.zone[start] <= max && range.zone[end] >= max) {
23491
23496
  const toRemove = max - range.zone[start] + 1;
@@ -23551,10 +23556,8 @@ class RangeAdapter {
23551
23556
  return { changeType: "NONE" };
23552
23557
  }
23553
23558
  range = {
23554
- ...range,
23555
- zone: { ...range.zone },
23559
+ ...this.buildInvalidRange(INCORRECT_RANGE_STRING),
23556
23560
  invalidSheetName: this.getters.getSheetName(cmd.sheetId),
23557
- sheetId: "",
23558
23561
  };
23559
23562
  return { changeType: "REMOVE", range };
23560
23563
  }, cmd.sheetId);
@@ -26910,6 +26913,8 @@ class ContentEditableHelper {
26910
26913
  start = 0;
26911
26914
  if (end > this.el.textContent.length)
26912
26915
  end = this.el.textContent.length;
26916
+ if (start > this.el.textContent.length)
26917
+ start = this.el.textContent.length;
26913
26918
  }
26914
26919
  let startNode = this.findChildAtCharacterIndex(start);
26915
26920
  let endNode = this.findChildAtCharacterIndex(end);
@@ -30154,6 +30159,10 @@ class Grid extends Component {
30154
30159
  }
30155
30160
  }
30156
30161
  onInput(ev) {
30162
+ // the user meant to paste in the sheet, not open the composer with the pasted content
30163
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
30164
+ return;
30165
+ }
30157
30166
  if (ev.data) {
30158
30167
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30159
30168
  // character
@@ -31243,6 +31252,6 @@ const helpers = {
31243
31252
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, compile, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31244
31253
 
31245
31254
 
31246
- __info__.version = '15.2.1';
31247
- __info__.date = '2023-03-06T07:16:45.196Z';
31248
- __info__.hash = 'baeea23';
31255
+ __info__.version = '15.2.3';
31256
+ __info__.date = '2023-03-23T11:32:58.083Z';
31257
+ __info__.hash = '0541ed5';
@@ -3180,6 +3180,9 @@
3180
3180
  if (isNaN(zone.bottom) || isNaN(zone.top) || isNaN(zone.left) || isNaN(zone.right)) {
3181
3181
  return false;
3182
3182
  }
3183
+ if (zone.top < 0 || zone.left < 0 || zone.right < 0 || zone.bottom < 0) {
3184
+ return false;
3185
+ }
3183
3186
  return zone.bottom >= zone.top && zone.right >= zone.left;
3184
3187
  }
3185
3188
  /**
@@ -18455,6 +18458,7 @@
18455
18458
  this.setContent(this.initialContent || "");
18456
18459
  }
18457
18460
  setContent(text, selection, raise) {
18461
+ text = text.replace(/[\r\n]/g, "");
18458
18462
  const isNewCurrentContent = this.currentContent !== text;
18459
18463
  this.currentContent = text;
18460
18464
  if (selection) {
@@ -23506,6 +23510,7 @@
23506
23510
  }
23507
23511
  else if (range.zone[start] >= min && range.zone[end] <= max) {
23508
23512
  changeType = "REMOVE";
23513
+ newRange = this.buildInvalidRange(INCORRECT_RANGE_STRING);
23509
23514
  }
23510
23515
  else if (range.zone[start] <= max && range.zone[end] >= max) {
23511
23516
  const toRemove = max - range.zone[start] + 1;
@@ -23571,10 +23576,8 @@
23571
23576
  return { changeType: "NONE" };
23572
23577
  }
23573
23578
  range = {
23574
- ...range,
23575
- zone: { ...range.zone },
23579
+ ...this.buildInvalidRange(INCORRECT_RANGE_STRING),
23576
23580
  invalidSheetName: this.getters.getSheetName(cmd.sheetId),
23577
- sheetId: "",
23578
23581
  };
23579
23582
  return { changeType: "REMOVE", range };
23580
23583
  }, cmd.sheetId);
@@ -26930,6 +26933,8 @@
26930
26933
  start = 0;
26931
26934
  if (end > this.el.textContent.length)
26932
26935
  end = this.el.textContent.length;
26936
+ if (start > this.el.textContent.length)
26937
+ start = this.el.textContent.length;
26933
26938
  }
26934
26939
  let startNode = this.findChildAtCharacterIndex(start);
26935
26940
  let endNode = this.findChildAtCharacterIndex(end);
@@ -30174,6 +30179,10 @@
30174
30179
  }
30175
30180
  }
30176
30181
  onInput(ev) {
30182
+ // the user meant to paste in the sheet, not open the composer with the pasted content
30183
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
30184
+ return;
30185
+ }
30177
30186
  if (ev.data) {
30178
30187
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30179
30188
  // character
@@ -31288,9 +31297,9 @@
31288
31297
  Object.defineProperty(exports, '__esModule', { value: true });
31289
31298
 
31290
31299
 
31291
- __info__.version = '15.2.1';
31292
- __info__.date = '2023-03-06T07:16:45.196Z';
31293
- __info__.hash = 'baeea23';
31300
+ __info__.version = '15.2.3';
31301
+ __info__.date = '2023-03-23T11:32:58.083Z';
31302
+ __info__.hash = '0541ed5';
31294
31303
 
31295
31304
 
31296
31305
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);