@odoo/o-spreadsheet 16.0.3 → 16.0.5

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.
@@ -896,6 +896,9 @@ function parseSheetLink(sheetLink) {
896
896
  function isDefined$1(argument) {
897
897
  return argument !== undefined;
898
898
  }
899
+ function isNonEmptyString(str) {
900
+ return str !== undefined && str !== "";
901
+ }
899
902
  /**
900
903
  * Check if all the values of an object, and all the values of the objects inside of it, are undefined.
901
904
  */
@@ -9960,6 +9963,7 @@ const CHART_PADDING_RATIO = 0.02;
9960
9963
  const LINE_HEIGHT = 1.2;
9961
9964
  css /* scss */ `
9962
9965
  div.o-scorecard {
9966
+ font-family: ${DEFAULT_FONT};
9963
9967
  user-select: none;
9964
9968
  background-color: white;
9965
9969
  display: flex;
@@ -19369,6 +19373,7 @@ class EditionPlugin extends UIPlugin {
19369
19373
  this.setContent(this.initialContent || "");
19370
19374
  }
19371
19375
  setContent(text, selection, raise) {
19376
+ text = text.replace(/[\r\n]/g, "");
19372
19377
  const isNewCurrentContent = this.currentContent !== text;
19373
19378
  this.currentContent = text;
19374
19379
  if (selection) {
@@ -19698,6 +19703,8 @@ class ContentEditableHelper {
19698
19703
  start = 0;
19699
19704
  if (end > this.el.textContent.length)
19700
19705
  end = this.el.textContent.length;
19706
+ if (start > this.el.textContent.length)
19707
+ start = this.el.textContent.length;
19701
19708
  }
19702
19709
  let startNode = this.findChildAtCharacterIndex(start);
19703
19710
  let endNode = this.findChildAtCharacterIndex(end);
@@ -19923,6 +19930,7 @@ css /* scss */ `
19923
19930
  flex-grow: 1;
19924
19931
  max-height: inherit;
19925
19932
  .o-composer {
19933
+ font-family: ${DEFAULT_FONT};
19926
19934
  caret-color: black;
19927
19935
  padding-left: 3px;
19928
19936
  padding-right: 3px;
@@ -22509,6 +22517,10 @@ class Grid extends owl.Component {
22509
22517
  }
22510
22518
  }
22511
22519
  onInput(ev) {
22520
+ // the user meant to paste in the sheet, not open the composer with the pasted content
22521
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
22522
+ return;
22523
+ }
22512
22524
  if (ev.data) {
22513
22525
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
22514
22526
  // character
@@ -32918,7 +32930,7 @@ class FilterEvaluationPlugin extends UIPlugin {
32918
32930
  const valuesInFilterZone = filter.filteredZone
32919
32931
  ? positions(filter.filteredZone)
32920
32932
  .map((pos) => { var _a; return (_a = this.getters.getCell(sheetData.id, pos.col, pos.row)) === null || _a === void 0 ? void 0 : _a.formattedValue; })
32921
- .filter(isDefined$1)
32933
+ .filter(isNonEmptyString)
32922
32934
  : [];
32923
32935
  // In xlsx, filtered values = values that are displayed, not values that are hidden
32924
32936
  const xlsxFilteredValues = valuesInFilterZone.filter((val) => !filteredValues.includes(val));
@@ -38190,6 +38202,7 @@ class TopBar extends owl.Component {
38190
38202
  this.state.menuState.parentMenu = menu;
38191
38203
  this.isSelectingMenu = true;
38192
38204
  this.openedEl = ev.target;
38205
+ this.env.model.dispatch("STOP_EDITION");
38193
38206
  }
38194
38207
  closeMenus() {
38195
38208
  this.state.activeTool = "";
@@ -38355,9 +38368,6 @@ css /* scss */ `
38355
38368
  color: #333;
38356
38369
  }
38357
38370
 
38358
- * {
38359
- font-family: "Roboto", "RobotoDraft", Helvetica, Arial, sans-serif;
38360
- }
38361
38371
  &,
38362
38372
  *,
38363
38373
  *:before,
@@ -39533,6 +39543,7 @@ class RangeAdapter {
39533
39543
  }
39534
39544
  else if (range.zone[start] >= min && range.zone[end] <= max) {
39535
39545
  changeType = "REMOVE";
39546
+ newRange = range.clone({ ...this.getInvalidRange() });
39536
39547
  }
39537
39548
  else if (range.zone[start] <= max && range.zone[end] >= max) {
39538
39549
  const toRemove = max - range.zone[start] + 1;
@@ -39598,8 +39609,10 @@ class RangeAdapter {
39598
39609
  return { changeType: "NONE" };
39599
39610
  }
39600
39611
  const invalidSheetName = this.getters.getSheetName(cmd.sheetId);
39601
- const sheetId = "";
39602
- range = range.clone({ sheetId, invalidSheetName });
39612
+ range = range.clone({
39613
+ ...this.getInvalidRange(),
39614
+ invalidSheetName,
39615
+ });
39603
39616
  return { changeType: "REMOVE", range };
39604
39617
  }, cmd.sheetId);
39605
39618
  break;
@@ -39863,6 +39876,15 @@ class RangeAdapter {
39863
39876
  }
39864
39877
  return str;
39865
39878
  }
39879
+ getInvalidRange() {
39880
+ return {
39881
+ parts: [],
39882
+ prefixSheet: false,
39883
+ zone: { left: -1, top: -1, right: -1, bottom: -1 },
39884
+ sheetId: "",
39885
+ invalidXc: INCORRECT_RANGE_STRING,
39886
+ };
39887
+ }
39866
39888
  }
39867
39889
  RangeAdapter.getters = [
39868
39890
  "getRangeString",
@@ -42467,6 +42489,6 @@ exports.setTranslationMethod = setTranslationMethod;
42467
42489
  exports.tokenize = tokenize;
42468
42490
 
42469
42491
 
42470
- __info__.version = '16.0.3';
42471
- __info__.date = '2023-03-14T09:22:56.932Z';
42472
- __info__.hash = '4deeca9';
42492
+ __info__.version = '16.0.5';
42493
+ __info__.date = '2023-03-23T11:35:22.974Z';
42494
+ __info__.hash = '53150ef';
@@ -2894,6 +2894,7 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2894
2894
  * Get a Xc string that represent a part of a range
2895
2895
  */
2896
2896
  private getRangePartString;
2897
+ private getInvalidRange;
2897
2898
  }
2898
2899
 
2899
2900
  interface CorePluginConstructor {
@@ -892,6 +892,9 @@ function parseSheetLink(sheetLink) {
892
892
  function isDefined$1(argument) {
893
893
  return argument !== undefined;
894
894
  }
895
+ function isNonEmptyString(str) {
896
+ return str !== undefined && str !== "";
897
+ }
895
898
  /**
896
899
  * Check if all the values of an object, and all the values of the objects inside of it, are undefined.
897
900
  */
@@ -9956,6 +9959,7 @@ const CHART_PADDING_RATIO = 0.02;
9956
9959
  const LINE_HEIGHT = 1.2;
9957
9960
  css /* scss */ `
9958
9961
  div.o-scorecard {
9962
+ font-family: ${DEFAULT_FONT};
9959
9963
  user-select: none;
9960
9964
  background-color: white;
9961
9965
  display: flex;
@@ -19365,6 +19369,7 @@ class EditionPlugin extends UIPlugin {
19365
19369
  this.setContent(this.initialContent || "");
19366
19370
  }
19367
19371
  setContent(text, selection, raise) {
19372
+ text = text.replace(/[\r\n]/g, "");
19368
19373
  const isNewCurrentContent = this.currentContent !== text;
19369
19374
  this.currentContent = text;
19370
19375
  if (selection) {
@@ -19694,6 +19699,8 @@ class ContentEditableHelper {
19694
19699
  start = 0;
19695
19700
  if (end > this.el.textContent.length)
19696
19701
  end = this.el.textContent.length;
19702
+ if (start > this.el.textContent.length)
19703
+ start = this.el.textContent.length;
19697
19704
  }
19698
19705
  let startNode = this.findChildAtCharacterIndex(start);
19699
19706
  let endNode = this.findChildAtCharacterIndex(end);
@@ -19919,6 +19926,7 @@ css /* scss */ `
19919
19926
  flex-grow: 1;
19920
19927
  max-height: inherit;
19921
19928
  .o-composer {
19929
+ font-family: ${DEFAULT_FONT};
19922
19930
  caret-color: black;
19923
19931
  padding-left: 3px;
19924
19932
  padding-right: 3px;
@@ -22505,6 +22513,10 @@ class Grid extends Component {
22505
22513
  }
22506
22514
  }
22507
22515
  onInput(ev) {
22516
+ // the user meant to paste in the sheet, not open the composer with the pasted content
22517
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
22518
+ return;
22519
+ }
22508
22520
  if (ev.data) {
22509
22521
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
22510
22522
  // character
@@ -32914,7 +32926,7 @@ class FilterEvaluationPlugin extends UIPlugin {
32914
32926
  const valuesInFilterZone = filter.filteredZone
32915
32927
  ? positions(filter.filteredZone)
32916
32928
  .map((pos) => { var _a; return (_a = this.getters.getCell(sheetData.id, pos.col, pos.row)) === null || _a === void 0 ? void 0 : _a.formattedValue; })
32917
- .filter(isDefined$1)
32929
+ .filter(isNonEmptyString)
32918
32930
  : [];
32919
32931
  // In xlsx, filtered values = values that are displayed, not values that are hidden
32920
32932
  const xlsxFilteredValues = valuesInFilterZone.filter((val) => !filteredValues.includes(val));
@@ -38186,6 +38198,7 @@ class TopBar extends Component {
38186
38198
  this.state.menuState.parentMenu = menu;
38187
38199
  this.isSelectingMenu = true;
38188
38200
  this.openedEl = ev.target;
38201
+ this.env.model.dispatch("STOP_EDITION");
38189
38202
  }
38190
38203
  closeMenus() {
38191
38204
  this.state.activeTool = "";
@@ -38351,9 +38364,6 @@ css /* scss */ `
38351
38364
  color: #333;
38352
38365
  }
38353
38366
 
38354
- * {
38355
- font-family: "Roboto", "RobotoDraft", Helvetica, Arial, sans-serif;
38356
- }
38357
38367
  &,
38358
38368
  *,
38359
38369
  *:before,
@@ -39529,6 +39539,7 @@ class RangeAdapter {
39529
39539
  }
39530
39540
  else if (range.zone[start] >= min && range.zone[end] <= max) {
39531
39541
  changeType = "REMOVE";
39542
+ newRange = range.clone({ ...this.getInvalidRange() });
39532
39543
  }
39533
39544
  else if (range.zone[start] <= max && range.zone[end] >= max) {
39534
39545
  const toRemove = max - range.zone[start] + 1;
@@ -39594,8 +39605,10 @@ class RangeAdapter {
39594
39605
  return { changeType: "NONE" };
39595
39606
  }
39596
39607
  const invalidSheetName = this.getters.getSheetName(cmd.sheetId);
39597
- const sheetId = "";
39598
- range = range.clone({ sheetId, invalidSheetName });
39608
+ range = range.clone({
39609
+ ...this.getInvalidRange(),
39610
+ invalidSheetName,
39611
+ });
39599
39612
  return { changeType: "REMOVE", range };
39600
39613
  }, cmd.sheetId);
39601
39614
  break;
@@ -39859,6 +39872,15 @@ class RangeAdapter {
39859
39872
  }
39860
39873
  return str;
39861
39874
  }
39875
+ getInvalidRange() {
39876
+ return {
39877
+ parts: [],
39878
+ prefixSheet: false,
39879
+ zone: { left: -1, top: -1, right: -1, bottom: -1 },
39880
+ sheetId: "",
39881
+ invalidXc: INCORRECT_RANGE_STRING,
39882
+ };
39883
+ }
39862
39884
  }
39863
39885
  RangeAdapter.getters = [
39864
39886
  "getRangeString",
@@ -42435,6 +42457,6 @@ function addFunction(functionName, functionDescription) {
42435
42457
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
42436
42458
 
42437
42459
 
42438
- __info__.version = '16.0.3';
42439
- __info__.date = '2023-03-14T09:22:56.932Z';
42440
- __info__.hash = '4deeca9';
42460
+ __info__.version = '16.0.5';
42461
+ __info__.date = '2023-03-23T11:35:22.974Z';
42462
+ __info__.hash = '53150ef';
@@ -893,6 +893,9 @@
893
893
  function isDefined$1(argument) {
894
894
  return argument !== undefined;
895
895
  }
896
+ function isNonEmptyString(str) {
897
+ return str !== undefined && str !== "";
898
+ }
896
899
  /**
897
900
  * Check if all the values of an object, and all the values of the objects inside of it, are undefined.
898
901
  */
@@ -9957,6 +9960,7 @@
9957
9960
  const LINE_HEIGHT = 1.2;
9958
9961
  css /* scss */ `
9959
9962
  div.o-scorecard {
9963
+ font-family: ${DEFAULT_FONT};
9960
9964
  user-select: none;
9961
9965
  background-color: white;
9962
9966
  display: flex;
@@ -19366,6 +19370,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19366
19370
  this.setContent(this.initialContent || "");
19367
19371
  }
19368
19372
  setContent(text, selection, raise) {
19373
+ text = text.replace(/[\r\n]/g, "");
19369
19374
  const isNewCurrentContent = this.currentContent !== text;
19370
19375
  this.currentContent = text;
19371
19376
  if (selection) {
@@ -19695,6 +19700,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19695
19700
  start = 0;
19696
19701
  if (end > this.el.textContent.length)
19697
19702
  end = this.el.textContent.length;
19703
+ if (start > this.el.textContent.length)
19704
+ start = this.el.textContent.length;
19698
19705
  }
19699
19706
  let startNode = this.findChildAtCharacterIndex(start);
19700
19707
  let endNode = this.findChildAtCharacterIndex(end);
@@ -19920,6 +19927,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19920
19927
  flex-grow: 1;
19921
19928
  max-height: inherit;
19922
19929
  .o-composer {
19930
+ font-family: ${DEFAULT_FONT};
19923
19931
  caret-color: black;
19924
19932
  padding-left: 3px;
19925
19933
  padding-right: 3px;
@@ -22506,6 +22514,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22506
22514
  }
22507
22515
  }
22508
22516
  onInput(ev) {
22517
+ // the user meant to paste in the sheet, not open the composer with the pasted content
22518
+ if (!ev.isComposing && ev.inputType === "insertFromPaste") {
22519
+ return;
22520
+ }
22509
22521
  if (ev.data) {
22510
22522
  // if the user types a character on the grid, it means he wants to start composing the selected cell with that
22511
22523
  // character
@@ -32915,7 +32927,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32915
32927
  const valuesInFilterZone = filter.filteredZone
32916
32928
  ? positions(filter.filteredZone)
32917
32929
  .map((pos) => { var _a; return (_a = this.getters.getCell(sheetData.id, pos.col, pos.row)) === null || _a === void 0 ? void 0 : _a.formattedValue; })
32918
- .filter(isDefined$1)
32930
+ .filter(isNonEmptyString)
32919
32931
  : [];
32920
32932
  // In xlsx, filtered values = values that are displayed, not values that are hidden
32921
32933
  const xlsxFilteredValues = valuesInFilterZone.filter((val) => !filteredValues.includes(val));
@@ -38187,6 +38199,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
38187
38199
  this.state.menuState.parentMenu = menu;
38188
38200
  this.isSelectingMenu = true;
38189
38201
  this.openedEl = ev.target;
38202
+ this.env.model.dispatch("STOP_EDITION");
38190
38203
  }
38191
38204
  closeMenus() {
38192
38205
  this.state.activeTool = "";
@@ -38352,9 +38365,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
38352
38365
  color: #333;
38353
38366
  }
38354
38367
 
38355
- * {
38356
- font-family: "Roboto", "RobotoDraft", Helvetica, Arial, sans-serif;
38357
- }
38358
38368
  &,
38359
38369
  *,
38360
38370
  *:before,
@@ -39530,6 +39540,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39530
39540
  }
39531
39541
  else if (range.zone[start] >= min && range.zone[end] <= max) {
39532
39542
  changeType = "REMOVE";
39543
+ newRange = range.clone({ ...this.getInvalidRange() });
39533
39544
  }
39534
39545
  else if (range.zone[start] <= max && range.zone[end] >= max) {
39535
39546
  const toRemove = max - range.zone[start] + 1;
@@ -39595,8 +39606,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39595
39606
  return { changeType: "NONE" };
39596
39607
  }
39597
39608
  const invalidSheetName = this.getters.getSheetName(cmd.sheetId);
39598
- const sheetId = "";
39599
- range = range.clone({ sheetId, invalidSheetName });
39609
+ range = range.clone({
39610
+ ...this.getInvalidRange(),
39611
+ invalidSheetName,
39612
+ });
39600
39613
  return { changeType: "REMOVE", range };
39601
39614
  }, cmd.sheetId);
39602
39615
  break;
@@ -39860,6 +39873,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39860
39873
  }
39861
39874
  return str;
39862
39875
  }
39876
+ getInvalidRange() {
39877
+ return {
39878
+ parts: [],
39879
+ prefixSheet: false,
39880
+ zone: { left: -1, top: -1, right: -1, bottom: -1 },
39881
+ sheetId: "",
39882
+ invalidXc: INCORRECT_RANGE_STRING,
39883
+ };
39884
+ }
39863
39885
  }
39864
39886
  RangeAdapter.getters = [
39865
39887
  "getRangeString",
@@ -42466,9 +42488,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42466
42488
  Object.defineProperty(exports, '__esModule', { value: true });
42467
42489
 
42468
42490
 
42469
- __info__.version = '16.0.3';
42470
- __info__.date = '2023-03-14T09:22:56.932Z';
42471
- __info__.hash = '4deeca9';
42491
+ __info__.version = '16.0.5';
42492
+ __info__.date = '2023-03-23T11:35:22.974Z';
42493
+ __info__.hash = '53150ef';
42472
42494
 
42473
42495
 
42474
42496
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);