@odoo/o-spreadsheet 16.4.1 → 16.4.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.
@@ -24067,13 +24067,18 @@ class Composer extends owl.Component {
24067
24067
  });
24068
24068
  this.processTokenAtCursor();
24069
24069
  }
24070
- onKeyup() {
24070
+ onKeyup(ev) {
24071
24071
  if (this.contentHelper.el === document.activeElement) {
24072
+ const isSelectingForComposer = this.env.model.getters.isSelectingForComposer();
24073
+ if (isSelectingForComposer && ev.key?.startsWith("Arrow")) {
24074
+ return;
24075
+ }
24072
24076
  const { start: oldStart, end: oldEnd } = this.env.model.getters.getComposerSelection();
24073
24077
  const { start, end } = this.contentHelper.getCurrentSelection();
24074
24078
  if (start !== oldStart || end !== oldEnd) {
24075
24079
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
24076
24080
  }
24081
+ this.processTokenAtCursor();
24077
24082
  }
24078
24083
  }
24079
24084
  showAutocomplete(searchTerm) {
@@ -24689,6 +24694,15 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
24689
24694
  y = initialFigure.y - deltaY;
24690
24695
  }
24691
24696
  }
24697
+ // Restrict resizing if x or y reaches header boundaries
24698
+ if (x < 0) {
24699
+ width += x;
24700
+ x = 0;
24701
+ }
24702
+ if (y < 0) {
24703
+ height += y;
24704
+ y = 0;
24705
+ }
24692
24706
  return { ...initialFigure, x, y, width, height };
24693
24707
  }
24694
24708
 
@@ -38552,9 +38566,17 @@ class FindAndReplacePlugin extends UIPlugin {
38552
38566
  case "REPLACE_ALL_SEARCH":
38553
38567
  this.replaceAll(cmd.replaceWith);
38554
38568
  break;
38569
+ case "EVALUATE_CELLS":
38570
+ case "UPDATE_CELL":
38571
+ case "REMOVE_FILTER_TABLE":
38572
+ case "UPDATE_FILTER":
38573
+ this.isSearchDirty = true;
38574
+ break;
38555
38575
  case "UNDO":
38556
38576
  case "REDO":
38557
38577
  case "REMOVE_COLUMNS_ROWS":
38578
+ case "HIDE_COLUMNS_ROWS":
38579
+ case "UNHIDE_COLUMNS_ROWS":
38558
38580
  case "ADD_COLUMNS_ROWS":
38559
38581
  case "EVALUATE_CELLS":
38560
38582
  case "UPDATE_CELL":
@@ -38690,37 +38712,32 @@ class FindAndReplacePlugin extends UIPlugin {
38690
38712
  // ---------------------------------------------------------------------------
38691
38713
  // Replace
38692
38714
  // ---------------------------------------------------------------------------
38693
- /**
38694
- * Replace the value of the currently selected match
38695
- */
38696
- replace(replaceWith) {
38697
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
38715
+ replaceMatch(selectedMatch, replaceWith) {
38716
+ if (!this.currentSearchRegex) {
38698
38717
  return;
38699
38718
  }
38700
- const matches = this.searchMatches;
38701
- const selectedMatch = matches[this.selectedMatchIndex];
38702
38719
  const sheetId = this.getters.getActiveSheetId();
38703
38720
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
38721
+ const { col, row } = selectedMatch;
38704
38722
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
38705
- this.selectNextCell(Direction.next);
38723
+ return;
38706
38724
  }
38707
- else {
38708
- const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
38709
- const toReplace = this.getSearchableString({
38710
- sheetId,
38711
- col: selectedMatch.col,
38712
- row: selectedMatch.row,
38713
- });
38714
- const newContent = toReplace.replace(replaceRegex, replaceWith);
38715
- this.dispatch("UPDATE_CELL", {
38716
- sheetId: this.getters.getActiveSheetId(),
38717
- col: selectedMatch.col,
38718
- row: selectedMatch.row,
38719
- content: canonicalizeContent(newContent, this.getters.getLocale()),
38720
- });
38721
- this.searchMatches.splice(this.selectedMatchIndex, 1);
38722
- this.selectNextCell(Direction.current);
38725
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
38726
+ const toReplace = this.getSearchableString({ sheetId, col, row });
38727
+ const content = toReplace.replace(replaceRegex, replaceWith);
38728
+ const canonicalContent = canonicalizeContent(content, this.getters.getLocale());
38729
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content: canonicalContent });
38730
+ }
38731
+ /**
38732
+ * Replace the value of the currently selected match
38733
+ */
38734
+ replace(replaceWith) {
38735
+ if (this.selectedMatchIndex === null) {
38736
+ return;
38723
38737
  }
38738
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
38739
+ this.replaceMatch(selectedMatch, replaceWith);
38740
+ this.selectNextCell(Direction.next);
38724
38741
  }
38725
38742
  /**
38726
38743
  * Apply the replace function to all the matches one time.
@@ -38728,7 +38745,7 @@ class FindAndReplacePlugin extends UIPlugin {
38728
38745
  replaceAll(replaceWith) {
38729
38746
  const matchCount = this.searchMatches.length;
38730
38747
  for (let i = 0; i < matchCount; i++) {
38731
- this.replace(replaceWith);
38748
+ this.replaceMatch(this.searchMatches[i], replaceWith);
38732
38749
  }
38733
38750
  }
38734
38751
  getSearchableString(position) {
@@ -42810,6 +42827,7 @@ class FilterEvaluationPlugin extends UIPlugin {
42810
42827
  this.filterValues[cmd.sheetId] = {};
42811
42828
  break;
42812
42829
  case "HIDE_COLUMNS_ROWS":
42830
+ case "UNHIDE_COLUMNS_ROWS":
42813
42831
  this.updateHiddenRows();
42814
42832
  break;
42815
42833
  case "UPDATE_FILTER":
@@ -50528,6 +50546,6 @@ exports.setTranslationMethod = setTranslationMethod;
50528
50546
  exports.tokenize = tokenize;
50529
50547
 
50530
50548
 
50531
- __info__.version = '16.4.1';
50532
- __info__.date = '2023-07-26T12:13:04.992Z';
50533
- __info__.hash = 'e687fa9';
50549
+ __info__.version = '16.4.3';
50550
+ __info__.date = '2023-08-09T09:08:41.454Z';
50551
+ __info__.hash = '1dbd302';
@@ -1453,6 +1453,7 @@ declare class FindAndReplacePlugin extends UIPlugin {
1453
1453
  */
1454
1454
  private selectNextCell;
1455
1455
  private clearSearch;
1456
+ private replaceMatch;
1456
1457
  /**
1457
1458
  * Replace the value of the currently selected match
1458
1459
  */
@@ -6705,7 +6706,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6705
6706
  onCompositionEnd(): void;
6706
6707
  onKeydown(ev: KeyboardEvent): void;
6707
6708
  onInput(ev: InputEvent): void;
6708
- onKeyup(): void;
6709
+ onKeyup(ev: KeyboardEvent): void;
6709
6710
  showAutocomplete(searchTerm: string): void;
6710
6711
  /**
6711
6712
  * This is required to ensure the content helper selection is
@@ -24063,13 +24063,18 @@ class Composer extends Component {
24063
24063
  });
24064
24064
  this.processTokenAtCursor();
24065
24065
  }
24066
- onKeyup() {
24066
+ onKeyup(ev) {
24067
24067
  if (this.contentHelper.el === document.activeElement) {
24068
+ const isSelectingForComposer = this.env.model.getters.isSelectingForComposer();
24069
+ if (isSelectingForComposer && ev.key?.startsWith("Arrow")) {
24070
+ return;
24071
+ }
24068
24072
  const { start: oldStart, end: oldEnd } = this.env.model.getters.getComposerSelection();
24069
24073
  const { start, end } = this.contentHelper.getCurrentSelection();
24070
24074
  if (start !== oldStart || end !== oldEnd) {
24071
24075
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
24072
24076
  }
24077
+ this.processTokenAtCursor();
24073
24078
  }
24074
24079
  }
24075
24080
  showAutocomplete(searchTerm) {
@@ -24685,6 +24690,15 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
24685
24690
  y = initialFigure.y - deltaY;
24686
24691
  }
24687
24692
  }
24693
+ // Restrict resizing if x or y reaches header boundaries
24694
+ if (x < 0) {
24695
+ width += x;
24696
+ x = 0;
24697
+ }
24698
+ if (y < 0) {
24699
+ height += y;
24700
+ y = 0;
24701
+ }
24688
24702
  return { ...initialFigure, x, y, width, height };
24689
24703
  }
24690
24704
 
@@ -38548,9 +38562,17 @@ class FindAndReplacePlugin extends UIPlugin {
38548
38562
  case "REPLACE_ALL_SEARCH":
38549
38563
  this.replaceAll(cmd.replaceWith);
38550
38564
  break;
38565
+ case "EVALUATE_CELLS":
38566
+ case "UPDATE_CELL":
38567
+ case "REMOVE_FILTER_TABLE":
38568
+ case "UPDATE_FILTER":
38569
+ this.isSearchDirty = true;
38570
+ break;
38551
38571
  case "UNDO":
38552
38572
  case "REDO":
38553
38573
  case "REMOVE_COLUMNS_ROWS":
38574
+ case "HIDE_COLUMNS_ROWS":
38575
+ case "UNHIDE_COLUMNS_ROWS":
38554
38576
  case "ADD_COLUMNS_ROWS":
38555
38577
  case "EVALUATE_CELLS":
38556
38578
  case "UPDATE_CELL":
@@ -38686,37 +38708,32 @@ class FindAndReplacePlugin extends UIPlugin {
38686
38708
  // ---------------------------------------------------------------------------
38687
38709
  // Replace
38688
38710
  // ---------------------------------------------------------------------------
38689
- /**
38690
- * Replace the value of the currently selected match
38691
- */
38692
- replace(replaceWith) {
38693
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
38711
+ replaceMatch(selectedMatch, replaceWith) {
38712
+ if (!this.currentSearchRegex) {
38694
38713
  return;
38695
38714
  }
38696
- const matches = this.searchMatches;
38697
- const selectedMatch = matches[this.selectedMatchIndex];
38698
38715
  const sheetId = this.getters.getActiveSheetId();
38699
38716
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
38717
+ const { col, row } = selectedMatch;
38700
38718
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
38701
- this.selectNextCell(Direction.next);
38719
+ return;
38702
38720
  }
38703
- else {
38704
- const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
38705
- const toReplace = this.getSearchableString({
38706
- sheetId,
38707
- col: selectedMatch.col,
38708
- row: selectedMatch.row,
38709
- });
38710
- const newContent = toReplace.replace(replaceRegex, replaceWith);
38711
- this.dispatch("UPDATE_CELL", {
38712
- sheetId: this.getters.getActiveSheetId(),
38713
- col: selectedMatch.col,
38714
- row: selectedMatch.row,
38715
- content: canonicalizeContent(newContent, this.getters.getLocale()),
38716
- });
38717
- this.searchMatches.splice(this.selectedMatchIndex, 1);
38718
- this.selectNextCell(Direction.current);
38721
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
38722
+ const toReplace = this.getSearchableString({ sheetId, col, row });
38723
+ const content = toReplace.replace(replaceRegex, replaceWith);
38724
+ const canonicalContent = canonicalizeContent(content, this.getters.getLocale());
38725
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content: canonicalContent });
38726
+ }
38727
+ /**
38728
+ * Replace the value of the currently selected match
38729
+ */
38730
+ replace(replaceWith) {
38731
+ if (this.selectedMatchIndex === null) {
38732
+ return;
38719
38733
  }
38734
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
38735
+ this.replaceMatch(selectedMatch, replaceWith);
38736
+ this.selectNextCell(Direction.next);
38720
38737
  }
38721
38738
  /**
38722
38739
  * Apply the replace function to all the matches one time.
@@ -38724,7 +38741,7 @@ class FindAndReplacePlugin extends UIPlugin {
38724
38741
  replaceAll(replaceWith) {
38725
38742
  const matchCount = this.searchMatches.length;
38726
38743
  for (let i = 0; i < matchCount; i++) {
38727
- this.replace(replaceWith);
38744
+ this.replaceMatch(this.searchMatches[i], replaceWith);
38728
38745
  }
38729
38746
  }
38730
38747
  getSearchableString(position) {
@@ -42806,6 +42823,7 @@ class FilterEvaluationPlugin extends UIPlugin {
42806
42823
  this.filterValues[cmd.sheetId] = {};
42807
42824
  break;
42808
42825
  case "HIDE_COLUMNS_ROWS":
42826
+ case "UNHIDE_COLUMNS_ROWS":
42809
42827
  this.updateHiddenRows();
42810
42828
  break;
42811
42829
  case "UPDATE_FILTER":
@@ -50492,6 +50510,6 @@ const constants = {
50492
50510
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
50493
50511
 
50494
50512
 
50495
- __info__.version = '16.4.1';
50496
- __info__.date = '2023-07-26T12:13:04.992Z';
50497
- __info__.hash = 'e687fa9';
50513
+ __info__.version = '16.4.3';
50514
+ __info__.date = '2023-08-09T09:08:41.454Z';
50515
+ __info__.hash = '1dbd302';
@@ -24064,13 +24064,18 @@
24064
24064
  });
24065
24065
  this.processTokenAtCursor();
24066
24066
  }
24067
- onKeyup() {
24067
+ onKeyup(ev) {
24068
24068
  if (this.contentHelper.el === document.activeElement) {
24069
+ const isSelectingForComposer = this.env.model.getters.isSelectingForComposer();
24070
+ if (isSelectingForComposer && ev.key?.startsWith("Arrow")) {
24071
+ return;
24072
+ }
24069
24073
  const { start: oldStart, end: oldEnd } = this.env.model.getters.getComposerSelection();
24070
24074
  const { start, end } = this.contentHelper.getCurrentSelection();
24071
24075
  if (start !== oldStart || end !== oldEnd) {
24072
24076
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
24073
24077
  }
24078
+ this.processTokenAtCursor();
24074
24079
  }
24075
24080
  }
24076
24081
  showAutocomplete(searchTerm) {
@@ -24686,6 +24691,15 @@
24686
24691
  y = initialFigure.y - deltaY;
24687
24692
  }
24688
24693
  }
24694
+ // Restrict resizing if x or y reaches header boundaries
24695
+ if (x < 0) {
24696
+ width += x;
24697
+ x = 0;
24698
+ }
24699
+ if (y < 0) {
24700
+ height += y;
24701
+ y = 0;
24702
+ }
24689
24703
  return { ...initialFigure, x, y, width, height };
24690
24704
  }
24691
24705
 
@@ -38549,9 +38563,17 @@
38549
38563
  case "REPLACE_ALL_SEARCH":
38550
38564
  this.replaceAll(cmd.replaceWith);
38551
38565
  break;
38566
+ case "EVALUATE_CELLS":
38567
+ case "UPDATE_CELL":
38568
+ case "REMOVE_FILTER_TABLE":
38569
+ case "UPDATE_FILTER":
38570
+ this.isSearchDirty = true;
38571
+ break;
38552
38572
  case "UNDO":
38553
38573
  case "REDO":
38554
38574
  case "REMOVE_COLUMNS_ROWS":
38575
+ case "HIDE_COLUMNS_ROWS":
38576
+ case "UNHIDE_COLUMNS_ROWS":
38555
38577
  case "ADD_COLUMNS_ROWS":
38556
38578
  case "EVALUATE_CELLS":
38557
38579
  case "UPDATE_CELL":
@@ -38687,37 +38709,32 @@
38687
38709
  // ---------------------------------------------------------------------------
38688
38710
  // Replace
38689
38711
  // ---------------------------------------------------------------------------
38690
- /**
38691
- * Replace the value of the currently selected match
38692
- */
38693
- replace(replaceWith) {
38694
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
38712
+ replaceMatch(selectedMatch, replaceWith) {
38713
+ if (!this.currentSearchRegex) {
38695
38714
  return;
38696
38715
  }
38697
- const matches = this.searchMatches;
38698
- const selectedMatch = matches[this.selectedMatchIndex];
38699
38716
  const sheetId = this.getters.getActiveSheetId();
38700
38717
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
38718
+ const { col, row } = selectedMatch;
38701
38719
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
38702
- this.selectNextCell(Direction.next);
38720
+ return;
38703
38721
  }
38704
- else {
38705
- const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
38706
- const toReplace = this.getSearchableString({
38707
- sheetId,
38708
- col: selectedMatch.col,
38709
- row: selectedMatch.row,
38710
- });
38711
- const newContent = toReplace.replace(replaceRegex, replaceWith);
38712
- this.dispatch("UPDATE_CELL", {
38713
- sheetId: this.getters.getActiveSheetId(),
38714
- col: selectedMatch.col,
38715
- row: selectedMatch.row,
38716
- content: canonicalizeContent(newContent, this.getters.getLocale()),
38717
- });
38718
- this.searchMatches.splice(this.selectedMatchIndex, 1);
38719
- this.selectNextCell(Direction.current);
38722
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
38723
+ const toReplace = this.getSearchableString({ sheetId, col, row });
38724
+ const content = toReplace.replace(replaceRegex, replaceWith);
38725
+ const canonicalContent = canonicalizeContent(content, this.getters.getLocale());
38726
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content: canonicalContent });
38727
+ }
38728
+ /**
38729
+ * Replace the value of the currently selected match
38730
+ */
38731
+ replace(replaceWith) {
38732
+ if (this.selectedMatchIndex === null) {
38733
+ return;
38720
38734
  }
38735
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
38736
+ this.replaceMatch(selectedMatch, replaceWith);
38737
+ this.selectNextCell(Direction.next);
38721
38738
  }
38722
38739
  /**
38723
38740
  * Apply the replace function to all the matches one time.
@@ -38725,7 +38742,7 @@
38725
38742
  replaceAll(replaceWith) {
38726
38743
  const matchCount = this.searchMatches.length;
38727
38744
  for (let i = 0; i < matchCount; i++) {
38728
- this.replace(replaceWith);
38745
+ this.replaceMatch(this.searchMatches[i], replaceWith);
38729
38746
  }
38730
38747
  }
38731
38748
  getSearchableString(position) {
@@ -42807,6 +42824,7 @@
42807
42824
  this.filterValues[cmd.sheetId] = {};
42808
42825
  break;
42809
42826
  case "HIDE_COLUMNS_ROWS":
42827
+ case "UNHIDE_COLUMNS_ROWS":
42810
42828
  this.updateHiddenRows();
42811
42829
  break;
42812
42830
  case "UPDATE_FILTER":
@@ -50527,9 +50545,9 @@
50527
50545
  Object.defineProperty(exports, '__esModule', { value: true });
50528
50546
 
50529
50547
 
50530
- __info__.version = '16.4.1';
50531
- __info__.date = '2023-07-26T12:13:04.992Z';
50532
- __info__.hash = 'e687fa9';
50548
+ __info__.version = '16.4.3';
50549
+ __info__.date = '2023-08-09T09:08:41.454Z';
50550
+ __info__.hash = '1dbd302';
50533
50551
 
50534
50552
 
50535
50553
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);