@odoo/o-spreadsheet 16.3.5 → 16.3.7

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
  }
@@ -34075,6 +34085,7 @@ class FilterEvaluationPlugin extends UIPlugin {
34075
34085
  this.filterValues[cmd.sheetId] = {};
34076
34086
  break;
34077
34087
  case "HIDE_COLUMNS_ROWS":
34088
+ case "UNHIDE_COLUMNS_ROWS":
34078
34089
  this.updateHiddenRows();
34079
34090
  break;
34080
34091
  case "UPDATE_FILTER":
@@ -36910,9 +36921,17 @@ class FindAndReplacePlugin extends UIPlugin {
36910
36921
  case "REPLACE_ALL_SEARCH":
36911
36922
  this.replaceAll(cmd.replaceWith);
36912
36923
  break;
36924
+ case "EVALUATE_CELLS":
36925
+ case "UPDATE_CELL":
36926
+ case "REMOVE_FILTER_TABLE":
36927
+ case "UPDATE_FILTER":
36928
+ this.isSearchDirty = true;
36929
+ break;
36913
36930
  case "UNDO":
36914
36931
  case "REDO":
36915
36932
  case "REMOVE_COLUMNS_ROWS":
36933
+ case "HIDE_COLUMNS_ROWS":
36934
+ case "UNHIDE_COLUMNS_ROWS":
36916
36935
  case "ADD_COLUMNS_ROWS":
36917
36936
  case "EVALUATE_CELLS":
36918
36937
  case "UPDATE_CELL":
@@ -37048,37 +37067,31 @@ class FindAndReplacePlugin extends UIPlugin {
37048
37067
  // ---------------------------------------------------------------------------
37049
37068
  // Replace
37050
37069
  // ---------------------------------------------------------------------------
37051
- /**
37052
- * Replace the value of the currently selected match
37053
- */
37054
- replace(replaceWith) {
37055
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
37070
+ replaceMatch(selectedMatch, replaceWith) {
37071
+ if (!this.currentSearchRegex) {
37056
37072
  return;
37057
37073
  }
37058
- const matches = this.searchMatches;
37059
- const selectedMatch = matches[this.selectedMatchIndex];
37060
37074
  const sheetId = this.getters.getActiveSheetId();
37061
37075
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
37076
+ const { col, row } = selectedMatch;
37062
37077
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
37063
- this.selectNextCell(Direction.next);
37078
+ return;
37064
37079
  }
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);
37080
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37081
+ const toReplace = this.getSearchableString({ sheetId, col, row });
37082
+ const content = toReplace.replace(replaceRegex, replaceWith);
37083
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content });
37084
+ }
37085
+ /**
37086
+ * Replace the value of the currently selected match
37087
+ */
37088
+ replace(replaceWith) {
37089
+ if (this.selectedMatchIndex === null) {
37090
+ return;
37081
37091
  }
37092
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
37093
+ this.replaceMatch(selectedMatch, replaceWith);
37094
+ this.selectNextCell(Direction.next);
37082
37095
  }
37083
37096
  /**
37084
37097
  * Apply the replace function to all the matches one time.
@@ -37086,7 +37099,7 @@ class FindAndReplacePlugin extends UIPlugin {
37086
37099
  replaceAll(replaceWith) {
37087
37100
  const matchCount = this.searchMatches.length;
37088
37101
  for (let i = 0; i < matchCount; i++) {
37089
- this.replace(replaceWith);
37102
+ this.replaceMatch(this.searchMatches[i], replaceWith);
37090
37103
  }
37091
37104
  }
37092
37105
  getSearchableString(position) {
@@ -47643,6 +47656,6 @@ exports.setTranslationMethod = setTranslationMethod;
47643
47656
  exports.tokenize = tokenize;
47644
47657
 
47645
47658
 
47646
- __info__.version = '16.3.5';
47647
- __info__.date = '2023-07-26T12:10:02.115Z';
47648
- __info__.hash = '328bce4';
47659
+ __info__.version = '16.3.7';
47660
+ __info__.date = '2023-08-09T09:06:48.167Z';
47661
+ __info__.hash = 'd2dbcc3';
@@ -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
  }
@@ -34071,6 +34081,7 @@ class FilterEvaluationPlugin extends UIPlugin {
34071
34081
  this.filterValues[cmd.sheetId] = {};
34072
34082
  break;
34073
34083
  case "HIDE_COLUMNS_ROWS":
34084
+ case "UNHIDE_COLUMNS_ROWS":
34074
34085
  this.updateHiddenRows();
34075
34086
  break;
34076
34087
  case "UPDATE_FILTER":
@@ -36906,9 +36917,17 @@ class FindAndReplacePlugin extends UIPlugin {
36906
36917
  case "REPLACE_ALL_SEARCH":
36907
36918
  this.replaceAll(cmd.replaceWith);
36908
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;
36909
36926
  case "UNDO":
36910
36927
  case "REDO":
36911
36928
  case "REMOVE_COLUMNS_ROWS":
36929
+ case "HIDE_COLUMNS_ROWS":
36930
+ case "UNHIDE_COLUMNS_ROWS":
36912
36931
  case "ADD_COLUMNS_ROWS":
36913
36932
  case "EVALUATE_CELLS":
36914
36933
  case "UPDATE_CELL":
@@ -37044,37 +37063,31 @@ class FindAndReplacePlugin extends UIPlugin {
37044
37063
  // ---------------------------------------------------------------------------
37045
37064
  // Replace
37046
37065
  // ---------------------------------------------------------------------------
37047
- /**
37048
- * Replace the value of the currently selected match
37049
- */
37050
- replace(replaceWith) {
37051
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
37066
+ replaceMatch(selectedMatch, replaceWith) {
37067
+ if (!this.currentSearchRegex) {
37052
37068
  return;
37053
37069
  }
37054
- const matches = this.searchMatches;
37055
- const selectedMatch = matches[this.selectedMatchIndex];
37056
37070
  const sheetId = this.getters.getActiveSheetId();
37057
37071
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
37072
+ const { col, row } = selectedMatch;
37058
37073
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
37059
- this.selectNextCell(Direction.next);
37074
+ return;
37060
37075
  }
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);
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;
37077
37087
  }
37088
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
37089
+ this.replaceMatch(selectedMatch, replaceWith);
37090
+ this.selectNextCell(Direction.next);
37078
37091
  }
37079
37092
  /**
37080
37093
  * Apply the replace function to all the matches one time.
@@ -37082,7 +37095,7 @@ class FindAndReplacePlugin extends UIPlugin {
37082
37095
  replaceAll(replaceWith) {
37083
37096
  const matchCount = this.searchMatches.length;
37084
37097
  for (let i = 0; i < matchCount; i++) {
37085
- this.replace(replaceWith);
37098
+ this.replaceMatch(this.searchMatches[i], replaceWith);
37086
37099
  }
37087
37100
  }
37088
37101
  getSearchableString(position) {
@@ -47611,6 +47624,6 @@ function addFunction(functionName, functionDescription) {
47611
47624
  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
47625
 
47613
47626
 
47614
- __info__.version = '16.3.5';
47615
- __info__.date = '2023-07-26T12:10:02.115Z';
47616
- __info__.hash = '328bce4';
47627
+ __info__.version = '16.3.7';
47628
+ __info__.date = '2023-08-09T09:06:48.167Z';
47629
+ __info__.hash = 'd2dbcc3';
@@ -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
  }
@@ -34072,6 +34082,7 @@
34072
34082
  this.filterValues[cmd.sheetId] = {};
34073
34083
  break;
34074
34084
  case "HIDE_COLUMNS_ROWS":
34085
+ case "UNHIDE_COLUMNS_ROWS":
34075
34086
  this.updateHiddenRows();
34076
34087
  break;
34077
34088
  case "UPDATE_FILTER":
@@ -36907,9 +36918,17 @@
36907
36918
  case "REPLACE_ALL_SEARCH":
36908
36919
  this.replaceAll(cmd.replaceWith);
36909
36920
  break;
36921
+ case "EVALUATE_CELLS":
36922
+ case "UPDATE_CELL":
36923
+ case "REMOVE_FILTER_TABLE":
36924
+ case "UPDATE_FILTER":
36925
+ this.isSearchDirty = true;
36926
+ break;
36910
36927
  case "UNDO":
36911
36928
  case "REDO":
36912
36929
  case "REMOVE_COLUMNS_ROWS":
36930
+ case "HIDE_COLUMNS_ROWS":
36931
+ case "UNHIDE_COLUMNS_ROWS":
36913
36932
  case "ADD_COLUMNS_ROWS":
36914
36933
  case "EVALUATE_CELLS":
36915
36934
  case "UPDATE_CELL":
@@ -37045,37 +37064,31 @@
37045
37064
  // ---------------------------------------------------------------------------
37046
37065
  // Replace
37047
37066
  // ---------------------------------------------------------------------------
37048
- /**
37049
- * Replace the value of the currently selected match
37050
- */
37051
- replace(replaceWith) {
37052
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
37067
+ replaceMatch(selectedMatch, replaceWith) {
37068
+ if (!this.currentSearchRegex) {
37053
37069
  return;
37054
37070
  }
37055
- const matches = this.searchMatches;
37056
- const selectedMatch = matches[this.selectedMatchIndex];
37057
37071
  const sheetId = this.getters.getActiveSheetId();
37058
37072
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
37073
+ const { col, row } = selectedMatch;
37059
37074
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
37060
- this.selectNextCell(Direction.next);
37075
+ return;
37061
37076
  }
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);
37077
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
37078
+ const toReplace = this.getSearchableString({ sheetId, col, row });
37079
+ const content = toReplace.replace(replaceRegex, replaceWith);
37080
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content });
37081
+ }
37082
+ /**
37083
+ * Replace the value of the currently selected match
37084
+ */
37085
+ replace(replaceWith) {
37086
+ if (this.selectedMatchIndex === null) {
37087
+ return;
37078
37088
  }
37089
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
37090
+ this.replaceMatch(selectedMatch, replaceWith);
37091
+ this.selectNextCell(Direction.next);
37079
37092
  }
37080
37093
  /**
37081
37094
  * Apply the replace function to all the matches one time.
@@ -37083,7 +37096,7 @@
37083
37096
  replaceAll(replaceWith) {
37084
37097
  const matchCount = this.searchMatches.length;
37085
37098
  for (let i = 0; i < matchCount; i++) {
37086
- this.replace(replaceWith);
37099
+ this.replaceMatch(this.searchMatches[i], replaceWith);
37087
37100
  }
37088
37101
  }
37089
37102
  getSearchableString(position) {
@@ -47642,9 +47655,9 @@
47642
47655
  Object.defineProperty(exports, '__esModule', { value: true });
47643
47656
 
47644
47657
 
47645
- __info__.version = '16.3.5';
47646
- __info__.date = '2023-07-26T12:10:02.115Z';
47647
- __info__.hash = '328bce4';
47658
+ __info__.version = '16.3.7';
47659
+ __info__.date = '2023-08-09T09:06:48.167Z';
47660
+ __info__.hash = 'd2dbcc3';
47648
47661
 
47649
47662
 
47650
47663
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);