@odoo/o-spreadsheet 15.0.1 → 15.0.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.
@@ -2974,6 +2974,9 @@ function isZoneValid(zone) {
2974
2974
  if (isNaN(zone.bottom) || isNaN(zone.top) || isNaN(zone.left) || isNaN(zone.right)) {
2975
2975
  return false;
2976
2976
  }
2977
+ if (zone.top < 0 || zone.left < 0 || zone.right < 0 || zone.bottom < 0) {
2978
+ return false;
2979
+ }
2977
2980
  return zone.bottom >= zone.top && zone.right >= zone.left;
2978
2981
  }
2979
2982
  /**
@@ -18405,6 +18408,7 @@ class EditionPlugin extends UIPlugin {
18405
18408
  this.setContent(this.initialContent || "");
18406
18409
  }
18407
18410
  setContent(text, selection, raise) {
18411
+ text = text.replace(/[\r\n]/g, "");
18408
18412
  const isNewCurrentContent = this.currentContent !== text;
18409
18413
  this.currentContent = text;
18410
18414
  if (selection) {
@@ -23598,6 +23602,7 @@ class RangeAdapter {
23598
23602
  }
23599
23603
  else if (range.zone[start] >= min && range.zone[end] <= max) {
23600
23604
  changeType = "REMOVE";
23605
+ newRange = this.buildInvalidRange(INCORRECT_RANGE_STRING);
23601
23606
  }
23602
23607
  else if (range.zone[start] <= max && range.zone[end] >= max) {
23603
23608
  const toRemove = max - range.zone[start] + 1;
@@ -23663,10 +23668,8 @@ class RangeAdapter {
23663
23668
  return { changeType: "NONE" };
23664
23669
  }
23665
23670
  range = {
23666
- ...range,
23667
- zone: { ...range.zone },
23671
+ ...this.buildInvalidRange(INCORRECT_RANGE_STRING),
23668
23672
  invalidSheetName: this.getters.getSheetName(cmd.sheetId),
23669
- sheetId: "",
23670
23673
  };
23671
23674
  return { changeType: "REMOVE", range };
23672
23675
  }, cmd.sheetId);
@@ -26135,7 +26138,7 @@ const { Portal } = owl.misc;
26135
26138
  const { xml: xml$l } = owl.tags;
26136
26139
  const TEMPLATE$j = xml$l /* xml */ `
26137
26140
  <Portal target="'.o-spreadsheet'">
26138
- <div t-att-style="style">
26141
+ <div class="o-popover" t-att-style="style">
26139
26142
  <t t-slot="default"/>
26140
26143
  </div>
26141
26144
  </Portal>
@@ -26991,6 +26994,8 @@ class ContentEditableHelper {
26991
26994
  start = 0;
26992
26995
  if (end > this.el.textContent.length)
26993
26996
  end = this.el.textContent.length;
26997
+ if (start > this.el.textContent.length)
26998
+ start = this.el.textContent.length;
26994
26999
  }
26995
27000
  let startNode = this.findChildAtCharacterIndex(start);
26996
27001
  let endNode = this.findChildAtCharacterIndex(end);
@@ -27317,7 +27322,7 @@ const CSS$b = css$d /* scss */ `
27317
27322
  padding: 0;
27318
27323
  margin: 0;
27319
27324
  border: 0;
27320
- z-index: 5;
27325
+ z-index: 6;
27321
27326
  flex-grow: 1;
27322
27327
  max-height: inherit;
27323
27328
  .o-composer {
@@ -27888,6 +27893,10 @@ const CSS$9 = css$b /* scss */ `
27888
27893
  border-left: 3px solid red;
27889
27894
  padding: 10px;
27890
27895
  }
27896
+
27897
+ .o-popover:has(.o-error-tooltip) {
27898
+ z-index: 4 !important;
27899
+ }
27891
27900
  `;
27892
27901
  class ErrorToolTip extends owl.Component {
27893
27902
  }
@@ -30214,6 +30223,10 @@ class Grid extends owl.Component {
30214
30223
  }
30215
30224
  }
30216
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
+ }
30217
30230
  if (ev.data) {
30218
30231
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30219
30232
  // character
@@ -31356,6 +31369,6 @@ exports.registries = registries;
31356
31369
  exports.setTranslationMethod = setTranslationMethod;
31357
31370
 
31358
31371
 
31359
- __info__.version = '15.0.1';
31360
- __info__.date = '2023-03-06T07:16:47.732Z';
31361
- __info__.hash = 'de03e1c';
31372
+ __info__.version = '15.0.3';
31373
+ __info__.date = '2023-03-23T11:34:07.983Z';
31374
+ __info__.hash = 'f51b30b';
@@ -2951,6 +2951,9 @@ function isZoneValid(zone) {
2951
2951
  if (isNaN(zone.bottom) || isNaN(zone.top) || isNaN(zone.left) || isNaN(zone.right)) {
2952
2952
  return false;
2953
2953
  }
2954
+ if (zone.top < 0 || zone.left < 0 || zone.right < 0 || zone.bottom < 0) {
2955
+ return false;
2956
+ }
2954
2957
  return zone.bottom >= zone.top && zone.right >= zone.left;
2955
2958
  }
2956
2959
  /**
@@ -18382,6 +18385,7 @@ class EditionPlugin extends UIPlugin {
18382
18385
  this.setContent(this.initialContent || "");
18383
18386
  }
18384
18387
  setContent(text, selection, raise) {
18388
+ text = text.replace(/[\r\n]/g, "");
18385
18389
  const isNewCurrentContent = this.currentContent !== text;
18386
18390
  this.currentContent = text;
18387
18391
  if (selection) {
@@ -23575,6 +23579,7 @@ class RangeAdapter {
23575
23579
  }
23576
23580
  else if (range.zone[start] >= min && range.zone[end] <= max) {
23577
23581
  changeType = "REMOVE";
23582
+ newRange = this.buildInvalidRange(INCORRECT_RANGE_STRING);
23578
23583
  }
23579
23584
  else if (range.zone[start] <= max && range.zone[end] >= max) {
23580
23585
  const toRemove = max - range.zone[start] + 1;
@@ -23640,10 +23645,8 @@ class RangeAdapter {
23640
23645
  return { changeType: "NONE" };
23641
23646
  }
23642
23647
  range = {
23643
- ...range,
23644
- zone: { ...range.zone },
23648
+ ...this.buildInvalidRange(INCORRECT_RANGE_STRING),
23645
23649
  invalidSheetName: this.getters.getSheetName(cmd.sheetId),
23646
- sheetId: "",
23647
23650
  };
23648
23651
  return { changeType: "REMOVE", range };
23649
23652
  }, cmd.sheetId);
@@ -26112,7 +26115,7 @@ const { Portal } = misc$1;
26112
26115
  const { xml: xml$l } = tags;
26113
26116
  const TEMPLATE$j = xml$l /* xml */ `
26114
26117
  <Portal target="'.o-spreadsheet'">
26115
- <div t-att-style="style">
26118
+ <div class="o-popover" t-att-style="style">
26116
26119
  <t t-slot="default"/>
26117
26120
  </div>
26118
26121
  </Portal>
@@ -26968,6 +26971,8 @@ class ContentEditableHelper {
26968
26971
  start = 0;
26969
26972
  if (end > this.el.textContent.length)
26970
26973
  end = this.el.textContent.length;
26974
+ if (start > this.el.textContent.length)
26975
+ start = this.el.textContent.length;
26971
26976
  }
26972
26977
  let startNode = this.findChildAtCharacterIndex(start);
26973
26978
  let endNode = this.findChildAtCharacterIndex(end);
@@ -27294,7 +27299,7 @@ const CSS$b = css$d /* scss */ `
27294
27299
  padding: 0;
27295
27300
  margin: 0;
27296
27301
  border: 0;
27297
- z-index: 5;
27302
+ z-index: 6;
27298
27303
  flex-grow: 1;
27299
27304
  max-height: inherit;
27300
27305
  .o-composer {
@@ -27865,6 +27870,10 @@ const CSS$9 = css$b /* scss */ `
27865
27870
  border-left: 3px solid red;
27866
27871
  padding: 10px;
27867
27872
  }
27873
+
27874
+ .o-popover:has(.o-error-tooltip) {
27875
+ z-index: 4 !important;
27876
+ }
27868
27877
  `;
27869
27878
  class ErrorToolTip extends Component {
27870
27879
  }
@@ -30191,6 +30200,10 @@ class Grid extends Component {
30191
30200
  }
30192
30201
  }
30193
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
+ }
30194
30207
  if (ev.data) {
30195
30208
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30196
30209
  // character
@@ -31311,6 +31324,6 @@ const helpers = {
31311
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 };
31312
31325
 
31313
31326
 
31314
- __info__.version = '15.0.1';
31315
- __info__.date = '2023-03-06T07:16:47.732Z';
31316
- __info__.hash = 'de03e1c';
31327
+ __info__.version = '15.0.3';
31328
+ __info__.date = '2023-03-23T11:34:07.983Z';
31329
+ __info__.hash = 'f51b30b';
@@ -2971,6 +2971,9 @@
2971
2971
  if (isNaN(zone.bottom) || isNaN(zone.top) || isNaN(zone.left) || isNaN(zone.right)) {
2972
2972
  return false;
2973
2973
  }
2974
+ if (zone.top < 0 || zone.left < 0 || zone.right < 0 || zone.bottom < 0) {
2975
+ return false;
2976
+ }
2974
2977
  return zone.bottom >= zone.top && zone.right >= zone.left;
2975
2978
  }
2976
2979
  /**
@@ -18402,6 +18405,7 @@
18402
18405
  this.setContent(this.initialContent || "");
18403
18406
  }
18404
18407
  setContent(text, selection, raise) {
18408
+ text = text.replace(/[\r\n]/g, "");
18405
18409
  const isNewCurrentContent = this.currentContent !== text;
18406
18410
  this.currentContent = text;
18407
18411
  if (selection) {
@@ -23595,6 +23599,7 @@
23595
23599
  }
23596
23600
  else if (range.zone[start] >= min && range.zone[end] <= max) {
23597
23601
  changeType = "REMOVE";
23602
+ newRange = this.buildInvalidRange(INCORRECT_RANGE_STRING);
23598
23603
  }
23599
23604
  else if (range.zone[start] <= max && range.zone[end] >= max) {
23600
23605
  const toRemove = max - range.zone[start] + 1;
@@ -23660,10 +23665,8 @@
23660
23665
  return { changeType: "NONE" };
23661
23666
  }
23662
23667
  range = {
23663
- ...range,
23664
- zone: { ...range.zone },
23668
+ ...this.buildInvalidRange(INCORRECT_RANGE_STRING),
23665
23669
  invalidSheetName: this.getters.getSheetName(cmd.sheetId),
23666
- sheetId: "",
23667
23670
  };
23668
23671
  return { changeType: "REMOVE", range };
23669
23672
  }, cmd.sheetId);
@@ -26132,7 +26135,7 @@
26132
26135
  const { xml: xml$l } = owl.tags;
26133
26136
  const TEMPLATE$j = xml$l /* xml */ `
26134
26137
  <Portal target="'.o-spreadsheet'">
26135
- <div t-att-style="style">
26138
+ <div class="o-popover" t-att-style="style">
26136
26139
  <t t-slot="default"/>
26137
26140
  </div>
26138
26141
  </Portal>
@@ -26988,6 +26991,8 @@
26988
26991
  start = 0;
26989
26992
  if (end > this.el.textContent.length)
26990
26993
  end = this.el.textContent.length;
26994
+ if (start > this.el.textContent.length)
26995
+ start = this.el.textContent.length;
26991
26996
  }
26992
26997
  let startNode = this.findChildAtCharacterIndex(start);
26993
26998
  let endNode = this.findChildAtCharacterIndex(end);
@@ -27314,7 +27319,7 @@
27314
27319
  padding: 0;
27315
27320
  margin: 0;
27316
27321
  border: 0;
27317
- z-index: 5;
27322
+ z-index: 6;
27318
27323
  flex-grow: 1;
27319
27324
  max-height: inherit;
27320
27325
  .o-composer {
@@ -27885,6 +27890,10 @@
27885
27890
  border-left: 3px solid red;
27886
27891
  padding: 10px;
27887
27892
  }
27893
+
27894
+ .o-popover:has(.o-error-tooltip) {
27895
+ z-index: 4 !important;
27896
+ }
27888
27897
  `;
27889
27898
  class ErrorToolTip extends owl.Component {
27890
27899
  }
@@ -30211,6 +30220,10 @@
30211
30220
  }
30212
30221
  }
30213
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
+ }
30214
30227
  if (ev.data) {
30215
30228
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
30216
30229
  // character
@@ -31355,9 +31368,9 @@
31355
31368
  Object.defineProperty(exports, '__esModule', { value: true });
31356
31369
 
31357
31370
 
31358
- __info__.version = '15.0.1';
31359
- __info__.date = '2023-03-06T07:16:47.732Z';
31360
- __info__.hash = 'de03e1c';
31371
+ __info__.version = '15.0.3';
31372
+ __info__.date = '2023-03-23T11:34:07.983Z';
31373
+ __info__.hash = 'f51b30b';
31361
31374
 
31362
31375
 
31363
31376
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);