@odoo/o-spreadsheet 16.1.4 → 16.1.6

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.
@@ -3106,7 +3106,7 @@ class ScorecardChart$1 extends owl.Component {
3106
3106
  return this.runtime.fontColor;
3107
3107
  }
3108
3108
  get secondaryFontColor() {
3109
- return relativeLuminance(this.primaryFontColor) <= 0.3 ? "#757575" : "#bbbbbb";
3109
+ return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
3110
3110
  }
3111
3111
  get figure() {
3112
3112
  return this.props.figure;
@@ -16525,6 +16525,7 @@ class EditionPlugin extends UIPlugin {
16525
16525
  this.setContent(this.initialContent || "");
16526
16526
  }
16527
16527
  setContent(text, selection, raise) {
16528
+ text = text.replace(/[\r\n]/g, "");
16528
16529
  const isNewCurrentContent = this.currentContent !== text;
16529
16530
  this.currentContent = text;
16530
16531
  if (selection) {
@@ -16809,6 +16810,8 @@ class ContentEditableHelper {
16809
16810
  start = 0;
16810
16811
  if (end > this.el.textContent.length)
16811
16812
  end = this.el.textContent.length;
16813
+ if (start > this.el.textContent.length)
16814
+ start = this.el.textContent.length;
16812
16815
  }
16813
16816
  let startNode = this.findChildAtCharacterIndex(start);
16814
16817
  let endNode = this.findChildAtCharacterIndex(end);
@@ -22287,6 +22290,9 @@ class GridOverlay extends owl.Component {
22287
22290
  owl.onMounted(() => {
22288
22291
  resizeObserver.observe(this.gridOverlayEl);
22289
22292
  });
22293
+ owl.onWillUnmount(() => {
22294
+ resizeObserver.disconnect();
22295
+ });
22290
22296
  useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
22291
22297
  const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
22292
22298
  return scrollY > 0;
@@ -23707,6 +23713,10 @@ class Grid extends owl.Component {
23707
23713
  }
23708
23714
  }
23709
23715
  onInput(ev) {
23716
+ // the user meant to paste in the sheet, not open the composer with the pasted content
23717
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
23718
+ return;
23719
+ }
23710
23720
  if (ev.data) {
23711
23721
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
23712
23722
  // character
@@ -30519,6 +30529,7 @@ class RangeAdapter {
30519
30529
  }
30520
30530
  else if (range.zone[start] >= min && range.zone[end] <= max) {
30521
30531
  changeType = "REMOVE";
30532
+ newRange = range.clone({ ...this.getInvalidRange() });
30522
30533
  }
30523
30534
  else if (range.zone[start] <= max && range.zone[end] >= max) {
30524
30535
  const toRemove = max - range.zone[start] + 1;
@@ -30584,8 +30595,10 @@ class RangeAdapter {
30584
30595
  return { changeType: "NONE" };
30585
30596
  }
30586
30597
  const invalidSheetName = this.getters.getSheetName(cmd.sheetId);
30587
- const sheetId = "";
30588
- range = range.clone({ sheetId, invalidSheetName });
30598
+ range = range.clone({
30599
+ ...this.getInvalidRange(),
30600
+ invalidSheetName,
30601
+ });
30589
30602
  return { changeType: "REMOVE", range };
30590
30603
  }, cmd.sheetId);
30591
30604
  break;
@@ -30845,6 +30858,15 @@ class RangeAdapter {
30845
30858
  }
30846
30859
  return str;
30847
30860
  }
30861
+ getInvalidRange() {
30862
+ return {
30863
+ parts: [],
30864
+ prefixSheet: false,
30865
+ zone: { left: -1, top: -1, right: -1, bottom: -1 },
30866
+ sheetId: "",
30867
+ invalidXc: INCORRECT_RANGE_STRING,
30868
+ };
30869
+ }
30848
30870
  }
30849
30871
  RangeAdapter.getters = [
30850
30872
  "getRangeString",
@@ -39894,6 +39916,7 @@ class TopBar extends owl.Component {
39894
39916
  this.state.menuState.parentMenu = menu;
39895
39917
  this.isSelectingMenu = true;
39896
39918
  this.openedEl = ev.target;
39919
+ this.env.model.dispatch("STOP_EDITION");
39897
39920
  }
39898
39921
  closeMenus() {
39899
39922
  this.state.activeTool = "";
@@ -43911,6 +43934,6 @@ exports.setTranslationMethod = setTranslationMethod;
43911
43934
  exports.tokenize = tokenize;
43912
43935
 
43913
43936
 
43914
- __info__.version = '16.1.4';
43915
- __info__.date = '2023-03-14T09:27:28.837Z';
43916
- __info__.hash = 'c8882d9';
43937
+ __info__.version = '16.1.6';
43938
+ __info__.date = '2023-03-23T11:36:48.524Z';
43939
+ __info__.hash = '3bad828';
@@ -2978,6 +2978,7 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2978
2978
  * Get a Xc string that represent a part of a range
2979
2979
  */
2980
2980
  private getRangePartString;
2981
+ private getInvalidRange;
2981
2982
  }
2982
2983
 
2983
2984
  interface CorePluginConfig {
@@ -5310,7 +5311,7 @@ declare class ScorecardChart extends Component<Props$p, SpreadsheetChildEnv> {
5310
5311
  get baselineArrowDirection(): BaselineArrowDirection;
5311
5312
  get backgroundColor(): string;
5312
5313
  get primaryFontColor(): string;
5313
- get secondaryFontColor(): "#757575" | "#bbbbbb";
5314
+ get secondaryFontColor(): "#525252" | "#C8C8C8";
5314
5315
  get figure(): Figure;
5315
5316
  get chartStyle(): string;
5316
5317
  get chartContentStyle(): string;
@@ -3102,7 +3102,7 @@ class ScorecardChart$1 extends Component {
3102
3102
  return this.runtime.fontColor;
3103
3103
  }
3104
3104
  get secondaryFontColor() {
3105
- return relativeLuminance(this.primaryFontColor) <= 0.3 ? "#757575" : "#bbbbbb";
3105
+ return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
3106
3106
  }
3107
3107
  get figure() {
3108
3108
  return this.props.figure;
@@ -16521,6 +16521,7 @@ class EditionPlugin extends UIPlugin {
16521
16521
  this.setContent(this.initialContent || "");
16522
16522
  }
16523
16523
  setContent(text, selection, raise) {
16524
+ text = text.replace(/[\r\n]/g, "");
16524
16525
  const isNewCurrentContent = this.currentContent !== text;
16525
16526
  this.currentContent = text;
16526
16527
  if (selection) {
@@ -16805,6 +16806,8 @@ class ContentEditableHelper {
16805
16806
  start = 0;
16806
16807
  if (end > this.el.textContent.length)
16807
16808
  end = this.el.textContent.length;
16809
+ if (start > this.el.textContent.length)
16810
+ start = this.el.textContent.length;
16808
16811
  }
16809
16812
  let startNode = this.findChildAtCharacterIndex(start);
16810
16813
  let endNode = this.findChildAtCharacterIndex(end);
@@ -22283,6 +22286,9 @@ class GridOverlay extends Component {
22283
22286
  onMounted(() => {
22284
22287
  resizeObserver.observe(this.gridOverlayEl);
22285
22288
  });
22289
+ onWillUnmount(() => {
22290
+ resizeObserver.disconnect();
22291
+ });
22286
22292
  useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
22287
22293
  const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
22288
22294
  return scrollY > 0;
@@ -23703,6 +23709,10 @@ class Grid extends Component {
23703
23709
  }
23704
23710
  }
23705
23711
  onInput(ev) {
23712
+ // the user meant to paste in the sheet, not open the composer with the pasted content
23713
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
23714
+ return;
23715
+ }
23706
23716
  if (ev.data) {
23707
23717
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
23708
23718
  // character
@@ -30515,6 +30525,7 @@ class RangeAdapter {
30515
30525
  }
30516
30526
  else if (range.zone[start] >= min && range.zone[end] <= max) {
30517
30527
  changeType = "REMOVE";
30528
+ newRange = range.clone({ ...this.getInvalidRange() });
30518
30529
  }
30519
30530
  else if (range.zone[start] <= max && range.zone[end] >= max) {
30520
30531
  const toRemove = max - range.zone[start] + 1;
@@ -30580,8 +30591,10 @@ class RangeAdapter {
30580
30591
  return { changeType: "NONE" };
30581
30592
  }
30582
30593
  const invalidSheetName = this.getters.getSheetName(cmd.sheetId);
30583
- const sheetId = "";
30584
- range = range.clone({ sheetId, invalidSheetName });
30594
+ range = range.clone({
30595
+ ...this.getInvalidRange(),
30596
+ invalidSheetName,
30597
+ });
30585
30598
  return { changeType: "REMOVE", range };
30586
30599
  }, cmd.sheetId);
30587
30600
  break;
@@ -30841,6 +30854,15 @@ class RangeAdapter {
30841
30854
  }
30842
30855
  return str;
30843
30856
  }
30857
+ getInvalidRange() {
30858
+ return {
30859
+ parts: [],
30860
+ prefixSheet: false,
30861
+ zone: { left: -1, top: -1, right: -1, bottom: -1 },
30862
+ sheetId: "",
30863
+ invalidXc: INCORRECT_RANGE_STRING,
30864
+ };
30865
+ }
30844
30866
  }
30845
30867
  RangeAdapter.getters = [
30846
30868
  "getRangeString",
@@ -39890,6 +39912,7 @@ class TopBar extends Component {
39890
39912
  this.state.menuState.parentMenu = menu;
39891
39913
  this.isSelectingMenu = true;
39892
39914
  this.openedEl = ev.target;
39915
+ this.env.model.dispatch("STOP_EDITION");
39893
39916
  }
39894
39917
  closeMenus() {
39895
39918
  this.state.activeTool = "";
@@ -43879,6 +43902,6 @@ function addFunction(functionName, functionDescription) {
43879
43902
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43880
43903
 
43881
43904
 
43882
- __info__.version = '16.1.4';
43883
- __info__.date = '2023-03-14T09:27:28.837Z';
43884
- __info__.hash = 'c8882d9';
43905
+ __info__.version = '16.1.6';
43906
+ __info__.date = '2023-03-23T11:36:48.524Z';
43907
+ __info__.hash = '3bad828';
@@ -3103,7 +3103,7 @@
3103
3103
  return this.runtime.fontColor;
3104
3104
  }
3105
3105
  get secondaryFontColor() {
3106
- return relativeLuminance(this.primaryFontColor) <= 0.3 ? "#757575" : "#bbbbbb";
3106
+ return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
3107
3107
  }
3108
3108
  get figure() {
3109
3109
  return this.props.figure;
@@ -16522,6 +16522,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
16522
16522
  this.setContent(this.initialContent || "");
16523
16523
  }
16524
16524
  setContent(text, selection, raise) {
16525
+ text = text.replace(/[\r\n]/g, "");
16525
16526
  const isNewCurrentContent = this.currentContent !== text;
16526
16527
  this.currentContent = text;
16527
16528
  if (selection) {
@@ -16806,6 +16807,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
16806
16807
  start = 0;
16807
16808
  if (end > this.el.textContent.length)
16808
16809
  end = this.el.textContent.length;
16810
+ if (start > this.el.textContent.length)
16811
+ start = this.el.textContent.length;
16809
16812
  }
16810
16813
  let startNode = this.findChildAtCharacterIndex(start);
16811
16814
  let endNode = this.findChildAtCharacterIndex(end);
@@ -22284,6 +22287,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22284
22287
  owl.onMounted(() => {
22285
22288
  resizeObserver.observe(this.gridOverlayEl);
22286
22289
  });
22290
+ owl.onWillUnmount(() => {
22291
+ resizeObserver.disconnect();
22292
+ });
22287
22293
  useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
22288
22294
  const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
22289
22295
  return scrollY > 0;
@@ -23704,6 +23710,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23704
23710
  }
23705
23711
  }
23706
23712
  onInput(ev) {
23713
+ // the user meant to paste in the sheet, not open the composer with the pasted content
23714
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
23715
+ return;
23716
+ }
23707
23717
  if (ev.data) {
23708
23718
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
23709
23719
  // character
@@ -30516,6 +30526,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30516
30526
  }
30517
30527
  else if (range.zone[start] >= min && range.zone[end] <= max) {
30518
30528
  changeType = "REMOVE";
30529
+ newRange = range.clone({ ...this.getInvalidRange() });
30519
30530
  }
30520
30531
  else if (range.zone[start] <= max && range.zone[end] >= max) {
30521
30532
  const toRemove = max - range.zone[start] + 1;
@@ -30581,8 +30592,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30581
30592
  return { changeType: "NONE" };
30582
30593
  }
30583
30594
  const invalidSheetName = this.getters.getSheetName(cmd.sheetId);
30584
- const sheetId = "";
30585
- range = range.clone({ sheetId, invalidSheetName });
30595
+ range = range.clone({
30596
+ ...this.getInvalidRange(),
30597
+ invalidSheetName,
30598
+ });
30586
30599
  return { changeType: "REMOVE", range };
30587
30600
  }, cmd.sheetId);
30588
30601
  break;
@@ -30842,6 +30855,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30842
30855
  }
30843
30856
  return str;
30844
30857
  }
30858
+ getInvalidRange() {
30859
+ return {
30860
+ parts: [],
30861
+ prefixSheet: false,
30862
+ zone: { left: -1, top: -1, right: -1, bottom: -1 },
30863
+ sheetId: "",
30864
+ invalidXc: INCORRECT_RANGE_STRING,
30865
+ };
30866
+ }
30845
30867
  }
30846
30868
  RangeAdapter.getters = [
30847
30869
  "getRangeString",
@@ -39891,6 +39913,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39891
39913
  this.state.menuState.parentMenu = menu;
39892
39914
  this.isSelectingMenu = true;
39893
39915
  this.openedEl = ev.target;
39916
+ this.env.model.dispatch("STOP_EDITION");
39894
39917
  }
39895
39918
  closeMenus() {
39896
39919
  this.state.activeTool = "";
@@ -43910,9 +43933,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43910
43933
  Object.defineProperty(exports, '__esModule', { value: true });
43911
43934
 
43912
43935
 
43913
- __info__.version = '16.1.4';
43914
- __info__.date = '2023-03-14T09:27:28.837Z';
43915
- __info__.hash = 'c8882d9';
43936
+ __info__.version = '16.1.6';
43937
+ __info__.date = '2023-03-23T11:36:48.524Z';
43938
+ __info__.hash = '3bad828';
43916
43939
 
43917
43940
 
43918
43941
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);