@odoo/o-spreadsheet 16.3.5 → 16.3.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.
@@ -21635,6 +21635,15 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
21635
21635
  y = initialFigure.y - deltaY;
21636
21636
  }
21637
21637
  }
21638
+ // Restrict resizing if x or y reaches header boundaries
21639
+ if (x < 0) {
21640
+ width += x;
21641
+ x = 0;
21642
+ }
21643
+ if (y < 0) {
21644
+ height += y;
21645
+ y = 0;
21646
+ }
21638
21647
  return { ...initialFigure, x, y, width, height };
21639
21648
  }
21640
21649
 
@@ -30938,7 +30947,8 @@ class HeaderSizePlugin extends CorePlugin {
30938
30947
  }
30939
30948
  break;
30940
30949
  case "UPDATE_CELL":
30941
- if (!this.sizes[cmd.sheetId]?.["ROW"]?.[cmd.row]?.manualSize) {
30950
+ const row = this.sizes[cmd.sheetId]?.["ROW"]?.[cmd.row];
30951
+ if (row && !row.manualSize) {
30942
30952
  const { sheetId, row } = cmd;
30943
30953
  this.history.update("sizes", sheetId, "ROW", row, "computedSize", lazy(() => this.getRowTallestCellSize(sheetId, row)));
30944
30954
  }
@@ -36910,9 +36920,17 @@ class FindAndReplacePlugin extends UIPlugin {
36910
36920
  case "REPLACE_ALL_SEARCH":
36911
36921
  this.replaceAll(cmd.replaceWith);
36912
36922
  break;
36923
+ case "EVALUATE_CELLS":
36924
+ case "UPDATE_CELL":
36925
+ case "REMOVE_FILTER_TABLE":
36926
+ case "UPDATE_FILTER":
36927
+ this.isSearchDirty = true;
36928
+ break;
36913
36929
  case "UNDO":
36914
36930
  case "REDO":
36915
36931
  case "REMOVE_COLUMNS_ROWS":
36932
+ case "HIDE_COLUMNS_ROWS":
36933
+ case "UNHIDE_COLUMNS_ROWS":
36916
36934
  case "ADD_COLUMNS_ROWS":
36917
36935
  case "EVALUATE_CELLS":
36918
36936
  case "UPDATE_CELL":
@@ -37048,37 +37066,31 @@ class FindAndReplacePlugin extends UIPlugin {
37048
37066
  // ---------------------------------------------------------------------------
37049
37067
  // Replace
37050
37068
  // ---------------------------------------------------------------------------
37051
- /**
37052
- * Replace the value of the currently selected match
37053
- */
37054
- replace(replaceWith) {
37055
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
37069
+ replaceMatch(selectedMatch, replaceWith) {
37070
+ if (!this.currentSearchRegex) {
37056
37071
  return;
37057
37072
  }
37058
- const matches = this.searchMatches;
37059
- const selectedMatch = matches[this.selectedMatchIndex];
37060
37073
  const sheetId = this.getters.getActiveSheetId();
37061
37074
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
37075
+ const { col, row } = selectedMatch;
37062
37076
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
37063
- this.selectNextCell(Direction.next);
37077
+ return;
37064
37078
  }
37065
- else {
37066
- const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37067
- const toReplace = this.getSearchableString({
37068
- sheetId,
37069
- col: selectedMatch.col,
37070
- row: selectedMatch.row,
37071
- });
37072
- const newContent = toReplace.replace(replaceRegex, replaceWith);
37073
- this.dispatch("UPDATE_CELL", {
37074
- sheetId: this.getters.getActiveSheetId(),
37075
- col: selectedMatch.col,
37076
- row: selectedMatch.row,
37077
- content: newContent,
37078
- });
37079
- this.searchMatches.splice(this.selectedMatchIndex, 1);
37080
- this.selectNextCell(Direction.current);
37079
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37080
+ const toReplace = this.getSearchableString({ sheetId, col, row });
37081
+ const content = toReplace.replace(replaceRegex, replaceWith);
37082
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content });
37083
+ }
37084
+ /**
37085
+ * Replace the value of the currently selected match
37086
+ */
37087
+ replace(replaceWith) {
37088
+ if (this.selectedMatchIndex === null) {
37089
+ return;
37081
37090
  }
37091
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
37092
+ this.replaceMatch(selectedMatch, replaceWith);
37093
+ this.selectNextCell(Direction.next);
37082
37094
  }
37083
37095
  /**
37084
37096
  * Apply the replace function to all the matches one time.
@@ -37086,7 +37098,7 @@ class FindAndReplacePlugin extends UIPlugin {
37086
37098
  replaceAll(replaceWith) {
37087
37099
  const matchCount = this.searchMatches.length;
37088
37100
  for (let i = 0; i < matchCount; i++) {
37089
- this.replace(replaceWith);
37101
+ this.replaceMatch(this.searchMatches[i], replaceWith);
37090
37102
  }
37091
37103
  }
37092
37104
  getSearchableString(position) {
@@ -47643,6 +47655,6 @@ exports.setTranslationMethod = setTranslationMethod;
47643
47655
  exports.tokenize = tokenize;
47644
47656
 
47645
47657
 
47646
- __info__.version = '16.3.5';
47647
- __info__.date = '2023-07-26T12:10:02.115Z';
47648
- __info__.hash = '328bce4';
47658
+ __info__.version = '16.3.6';
47659
+ __info__.date = '2023-08-07T09:00:44.937Z';
47660
+ __info__.hash = '36bb0b8';
@@ -1449,6 +1449,7 @@ declare class FindAndReplacePlugin extends UIPlugin {
1449
1449
  */
1450
1450
  private selectNextCell;
1451
1451
  private clearSearch;
1452
+ private replaceMatch;
1452
1453
  /**
1453
1454
  * Replace the value of the currently selected match
1454
1455
  */
@@ -21631,6 +21631,15 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
21631
21631
  y = initialFigure.y - deltaY;
21632
21632
  }
21633
21633
  }
21634
+ // Restrict resizing if x or y reaches header boundaries
21635
+ if (x < 0) {
21636
+ width += x;
21637
+ x = 0;
21638
+ }
21639
+ if (y < 0) {
21640
+ height += y;
21641
+ y = 0;
21642
+ }
21634
21643
  return { ...initialFigure, x, y, width, height };
21635
21644
  }
21636
21645
 
@@ -30934,7 +30943,8 @@ class HeaderSizePlugin extends CorePlugin {
30934
30943
  }
30935
30944
  break;
30936
30945
  case "UPDATE_CELL":
30937
- if (!this.sizes[cmd.sheetId]?.["ROW"]?.[cmd.row]?.manualSize) {
30946
+ const row = this.sizes[cmd.sheetId]?.["ROW"]?.[cmd.row];
30947
+ if (row && !row.manualSize) {
30938
30948
  const { sheetId, row } = cmd;
30939
30949
  this.history.update("sizes", sheetId, "ROW", row, "computedSize", lazy(() => this.getRowTallestCellSize(sheetId, row)));
30940
30950
  }
@@ -36906,9 +36916,17 @@ class FindAndReplacePlugin extends UIPlugin {
36906
36916
  case "REPLACE_ALL_SEARCH":
36907
36917
  this.replaceAll(cmd.replaceWith);
36908
36918
  break;
36919
+ case "EVALUATE_CELLS":
36920
+ case "UPDATE_CELL":
36921
+ case "REMOVE_FILTER_TABLE":
36922
+ case "UPDATE_FILTER":
36923
+ this.isSearchDirty = true;
36924
+ break;
36909
36925
  case "UNDO":
36910
36926
  case "REDO":
36911
36927
  case "REMOVE_COLUMNS_ROWS":
36928
+ case "HIDE_COLUMNS_ROWS":
36929
+ case "UNHIDE_COLUMNS_ROWS":
36912
36930
  case "ADD_COLUMNS_ROWS":
36913
36931
  case "EVALUATE_CELLS":
36914
36932
  case "UPDATE_CELL":
@@ -37044,37 +37062,31 @@ class FindAndReplacePlugin extends UIPlugin {
37044
37062
  // ---------------------------------------------------------------------------
37045
37063
  // Replace
37046
37064
  // ---------------------------------------------------------------------------
37047
- /**
37048
- * Replace the value of the currently selected match
37049
- */
37050
- replace(replaceWith) {
37051
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
37065
+ replaceMatch(selectedMatch, replaceWith) {
37066
+ if (!this.currentSearchRegex) {
37052
37067
  return;
37053
37068
  }
37054
- const matches = this.searchMatches;
37055
- const selectedMatch = matches[this.selectedMatchIndex];
37056
37069
  const sheetId = this.getters.getActiveSheetId();
37057
37070
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
37071
+ const { col, row } = selectedMatch;
37058
37072
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
37059
- this.selectNextCell(Direction.next);
37073
+ return;
37060
37074
  }
37061
- else {
37062
- const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37063
- const toReplace = this.getSearchableString({
37064
- sheetId,
37065
- col: selectedMatch.col,
37066
- row: selectedMatch.row,
37067
- });
37068
- const newContent = toReplace.replace(replaceRegex, replaceWith);
37069
- this.dispatch("UPDATE_CELL", {
37070
- sheetId: this.getters.getActiveSheetId(),
37071
- col: selectedMatch.col,
37072
- row: selectedMatch.row,
37073
- content: newContent,
37074
- });
37075
- this.searchMatches.splice(this.selectedMatchIndex, 1);
37076
- this.selectNextCell(Direction.current);
37075
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37076
+ const toReplace = this.getSearchableString({ sheetId, col, row });
37077
+ const content = toReplace.replace(replaceRegex, replaceWith);
37078
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content });
37079
+ }
37080
+ /**
37081
+ * Replace the value of the currently selected match
37082
+ */
37083
+ replace(replaceWith) {
37084
+ if (this.selectedMatchIndex === null) {
37085
+ return;
37077
37086
  }
37087
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
37088
+ this.replaceMatch(selectedMatch, replaceWith);
37089
+ this.selectNextCell(Direction.next);
37078
37090
  }
37079
37091
  /**
37080
37092
  * Apply the replace function to all the matches one time.
@@ -37082,7 +37094,7 @@ class FindAndReplacePlugin extends UIPlugin {
37082
37094
  replaceAll(replaceWith) {
37083
37095
  const matchCount = this.searchMatches.length;
37084
37096
  for (let i = 0; i < matchCount; i++) {
37085
- this.replace(replaceWith);
37097
+ this.replaceMatch(this.searchMatches[i], replaceWith);
37086
37098
  }
37087
37099
  }
37088
37100
  getSearchableString(position) {
@@ -47611,6 +47623,6 @@ function addFunction(functionName, functionDescription) {
47611
47623
  export { AbstractChart, CommandResult, CorePlugin, 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, setDefaultSheetViewSize, setTranslationMethod, tokenize };
47612
47624
 
47613
47625
 
47614
- __info__.version = '16.3.5';
47615
- __info__.date = '2023-07-26T12:10:02.115Z';
47616
- __info__.hash = '328bce4';
47626
+ __info__.version = '16.3.6';
47627
+ __info__.date = '2023-08-07T09:00:44.937Z';
47628
+ __info__.hash = '36bb0b8';
@@ -21632,6 +21632,15 @@
21632
21632
  y = initialFigure.y - deltaY;
21633
21633
  }
21634
21634
  }
21635
+ // Restrict resizing if x or y reaches header boundaries
21636
+ if (x < 0) {
21637
+ width += x;
21638
+ x = 0;
21639
+ }
21640
+ if (y < 0) {
21641
+ height += y;
21642
+ y = 0;
21643
+ }
21635
21644
  return { ...initialFigure, x, y, width, height };
21636
21645
  }
21637
21646
 
@@ -30935,7 +30944,8 @@
30935
30944
  }
30936
30945
  break;
30937
30946
  case "UPDATE_CELL":
30938
- if (!this.sizes[cmd.sheetId]?.["ROW"]?.[cmd.row]?.manualSize) {
30947
+ const row = this.sizes[cmd.sheetId]?.["ROW"]?.[cmd.row];
30948
+ if (row && !row.manualSize) {
30939
30949
  const { sheetId, row } = cmd;
30940
30950
  this.history.update("sizes", sheetId, "ROW", row, "computedSize", lazy(() => this.getRowTallestCellSize(sheetId, row)));
30941
30951
  }
@@ -36907,9 +36917,17 @@
36907
36917
  case "REPLACE_ALL_SEARCH":
36908
36918
  this.replaceAll(cmd.replaceWith);
36909
36919
  break;
36920
+ case "EVALUATE_CELLS":
36921
+ case "UPDATE_CELL":
36922
+ case "REMOVE_FILTER_TABLE":
36923
+ case "UPDATE_FILTER":
36924
+ this.isSearchDirty = true;
36925
+ break;
36910
36926
  case "UNDO":
36911
36927
  case "REDO":
36912
36928
  case "REMOVE_COLUMNS_ROWS":
36929
+ case "HIDE_COLUMNS_ROWS":
36930
+ case "UNHIDE_COLUMNS_ROWS":
36913
36931
  case "ADD_COLUMNS_ROWS":
36914
36932
  case "EVALUATE_CELLS":
36915
36933
  case "UPDATE_CELL":
@@ -37045,37 +37063,31 @@
37045
37063
  // ---------------------------------------------------------------------------
37046
37064
  // Replace
37047
37065
  // ---------------------------------------------------------------------------
37048
- /**
37049
- * Replace the value of the currently selected match
37050
- */
37051
- replace(replaceWith) {
37052
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
37066
+ replaceMatch(selectedMatch, replaceWith) {
37067
+ if (!this.currentSearchRegex) {
37053
37068
  return;
37054
37069
  }
37055
- const matches = this.searchMatches;
37056
- const selectedMatch = matches[this.selectedMatchIndex];
37057
37070
  const sheetId = this.getters.getActiveSheetId();
37058
37071
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
37072
+ const { col, row } = selectedMatch;
37059
37073
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
37060
- this.selectNextCell(Direction.next);
37074
+ return;
37061
37075
  }
37062
- else {
37063
- const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37064
- const toReplace = this.getSearchableString({
37065
- sheetId,
37066
- col: selectedMatch.col,
37067
- row: selectedMatch.row,
37068
- });
37069
- const newContent = toReplace.replace(replaceRegex, replaceWith);
37070
- this.dispatch("UPDATE_CELL", {
37071
- sheetId: this.getters.getActiveSheetId(),
37072
- col: selectedMatch.col,
37073
- row: selectedMatch.row,
37074
- content: newContent,
37075
- });
37076
- this.searchMatches.splice(this.selectedMatchIndex, 1);
37077
- this.selectNextCell(Direction.current);
37076
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37077
+ const toReplace = this.getSearchableString({ sheetId, col, row });
37078
+ const content = toReplace.replace(replaceRegex, replaceWith);
37079
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content });
37080
+ }
37081
+ /**
37082
+ * Replace the value of the currently selected match
37083
+ */
37084
+ replace(replaceWith) {
37085
+ if (this.selectedMatchIndex === null) {
37086
+ return;
37078
37087
  }
37088
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
37089
+ this.replaceMatch(selectedMatch, replaceWith);
37090
+ this.selectNextCell(Direction.next);
37079
37091
  }
37080
37092
  /**
37081
37093
  * Apply the replace function to all the matches one time.
@@ -37083,7 +37095,7 @@
37083
37095
  replaceAll(replaceWith) {
37084
37096
  const matchCount = this.searchMatches.length;
37085
37097
  for (let i = 0; i < matchCount; i++) {
37086
- this.replace(replaceWith);
37098
+ this.replaceMatch(this.searchMatches[i], replaceWith);
37087
37099
  }
37088
37100
  }
37089
37101
  getSearchableString(position) {
@@ -47642,9 +47654,9 @@
47642
47654
  Object.defineProperty(exports, '__esModule', { value: true });
47643
47655
 
47644
47656
 
47645
- __info__.version = '16.3.5';
47646
- __info__.date = '2023-07-26T12:10:02.115Z';
47647
- __info__.hash = '328bce4';
47657
+ __info__.version = '16.3.6';
47658
+ __info__.date = '2023-08-07T09:00:44.937Z';
47659
+ __info__.hash = '36bb0b8';
47648
47660
 
47649
47661
 
47650
47662
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);