@odoo/o-spreadsheet 16.1.15 → 16.1.17

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.
@@ -106,7 +106,7 @@
106
106
  const HEADER_BORDER_COLOR = "#C0C0C0";
107
107
  const CELL_BORDER_COLOR = "#E2E3E3";
108
108
  const BACKGROUND_CHART_COLOR = "#FFFFFF";
109
- const MENU_ITEM_DISABLED_COLOR = "#CACACA";
109
+ const DISABLED_TEXT_COLOR = "#CACACA";
110
110
  const DEFAULT_COLOR_SCALE_MIDPOINT_COLOR = 0xb6d7a8;
111
111
  const LINK_COLOR = "#01666b";
112
112
  const FILTERS_COLOR = "#188038";
@@ -3456,7 +3456,6 @@
3456
3456
  "SET_VIEWPORT_OFFSET",
3457
3457
  "SELECT_SEARCH_NEXT_MATCH",
3458
3458
  "SELECT_SEARCH_PREVIOUS_MATCH",
3459
- "REFRESH_SEARCH",
3460
3459
  "UPDATE_SEARCH",
3461
3460
  "CLEAR_SEARCH",
3462
3461
  "EVALUATE_CELLS",
@@ -5964,7 +5963,7 @@
5964
5963
  }
5965
5964
  }
5966
5965
  &.disabled {
5967
- color: ${MENU_ITEM_DISABLED_COLOR};
5966
+ color: ${DISABLED_TEXT_COLOR};
5968
5967
  cursor: not-allowed;
5969
5968
  }
5970
5969
  }
@@ -21716,11 +21715,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21716
21715
  }
21717
21716
  setup() {
21718
21717
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
21718
+ this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
21719
21719
  owl.onMounted(() => this.focusInput());
21720
21720
  owl.onWillUnmount(() => {
21721
21721
  this.env.model.dispatch("CLEAR_SEARCH");
21722
21722
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
21723
21723
  });
21724
+ owl.useEffect(() => {
21725
+ this.state.searchOptions.searchFormulas = this.env.model.getters.shouldShowFormulas();
21726
+ this.searchFormulas();
21727
+ }, () => [this.env.model.getters.shouldShowFormulas()]);
21724
21728
  }
21725
21729
  onInput(ev) {
21726
21730
  this.state.toSearch = ev.target.value;
@@ -21740,10 +21744,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21740
21744
  this.replace();
21741
21745
  }
21742
21746
  }
21743
- onFocusSidePanel() {
21744
- this.state.searchOptions.searchFormulas = this.env.model.getters.shouldShowFormulas();
21745
- this.env.model.dispatch("REFRESH_SEARCH");
21746
- }
21747
21747
  searchFormulas() {
21748
21748
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", {
21749
21749
  show: this.state.searchOptions.searchFormulas,
@@ -21762,13 +21762,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21762
21762
  searchOptions: this.state.searchOptions,
21763
21763
  });
21764
21764
  }
21765
- debouncedUpdateSearch() {
21766
- clearTimeout(this.debounceTimeoutId);
21767
- this.debounceTimeoutId = setTimeout(() => {
21768
- this.updateSearch();
21769
- this.debounceTimeoutId = undefined;
21770
- }, 400);
21771
- }
21772
21765
  replace() {
21773
21766
  this.env.model.dispatch("REPLACE_SEARCH", {
21774
21767
  replaceWith: this.state.replaceWith,
@@ -22272,6 +22265,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22272
22265
  if (dirY < 0) {
22273
22266
  this.dnd.y = dndInitialY + figure.height * fraction;
22274
22267
  }
22268
+ if (this.dnd.x < 0) {
22269
+ this.dnd.width += this.dnd.x;
22270
+ this.dnd.x = 0;
22271
+ }
22272
+ if (this.dnd.y < 0) {
22273
+ this.dnd.height += this.dnd.y;
22274
+ this.dnd.y = 0;
22275
+ }
22275
22276
  };
22276
22277
  }
22277
22278
  else {
@@ -22287,6 +22288,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22287
22288
  if (dirY < 0) {
22288
22289
  this.dnd.y = dndInitialY - deltaY;
22289
22290
  }
22291
+ if (this.dnd.x < 0) {
22292
+ this.dnd.width += this.dnd.x;
22293
+ this.dnd.x = 0;
22294
+ }
22295
+ if (this.dnd.y < 0) {
22296
+ this.dnd.height += this.dnd.y;
22297
+ this.dnd.y = 0;
22298
+ }
22290
22299
  };
22291
22300
  }
22292
22301
  const onMouseUp = (ev) => {
@@ -29777,7 +29786,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29777
29786
  this.sizes = {};
29778
29787
  }
29779
29788
  handle(cmd) {
29780
- var _a, _b, _c;
29789
+ var _a, _b;
29781
29790
  switch (cmd.type) {
29782
29791
  case "CREATE_SHEET": {
29783
29792
  const computedSizes = this.computeSheetSizes(cmd.sheetId);
@@ -29865,7 +29874,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29865
29874
  }
29866
29875
  break;
29867
29876
  case "UPDATE_CELL":
29868
- if (!((_c = (_b = (_a = this.sizes[cmd.sheetId]) === null || _a === void 0 ? void 0 : _a["ROW"]) === null || _b === void 0 ? void 0 : _b[cmd.row]) === null || _c === void 0 ? void 0 : _c.manualSize)) {
29877
+ const row = (_b = (_a = this.sizes[cmd.sheetId]) === null || _a === void 0 ? void 0 : _a["ROW"]) === null || _b === void 0 ? void 0 : _b[cmd.row];
29878
+ if (row && !row.manualSize) {
29869
29879
  const { sheetId, row } = cmd;
29870
29880
  this.history.update("sizes", sheetId, "ROW", row, "computedSize", lazy(() => this.getRowTallestCellSize(sheetId, row)));
29871
29881
  }
@@ -34881,6 +34891,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34881
34891
  searchFormulas: false,
34882
34892
  };
34883
34893
  this.toSearch = "";
34894
+ this.isSearchDirty = false;
34884
34895
  }
34885
34896
  // ---------------------------------------------------------------------------
34886
34897
  // Command Handling
@@ -34905,18 +34916,33 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34905
34916
  case "REPLACE_ALL_SEARCH":
34906
34917
  this.replaceAll(cmd.replaceWith);
34907
34918
  break;
34919
+ case "EVALUATE_CELLS":
34920
+ case "UPDATE_CELL":
34921
+ case "REMOVE_FILTER_TABLE":
34922
+ case "UPDATE_FILTER":
34923
+ this.isSearchDirty = true;
34924
+ break;
34908
34925
  case "UNDO":
34909
34926
  case "REDO":
34910
34927
  case "REMOVE_COLUMNS_ROWS":
34928
+ case "HIDE_COLUMNS_ROWS":
34929
+ case "UNHIDE_COLUMNS_ROWS":
34911
34930
  case "ADD_COLUMNS_ROWS":
34912
- this.clearSearch();
34931
+ case "EVALUATE_CELLS":
34932
+ case "UPDATE_CELL":
34933
+ this.isSearchDirty = true;
34913
34934
  break;
34914
34935
  case "ACTIVATE_SHEET":
34915
- case "REFRESH_SEARCH":
34916
34936
  this.refreshSearch();
34917
34937
  break;
34918
34938
  }
34919
34939
  }
34940
+ finalize() {
34941
+ if (this.isSearchDirty) {
34942
+ this.refreshSearch();
34943
+ this.isSearchDirty = false;
34944
+ }
34945
+ }
34920
34946
  // ---------------------------------------------------------------------------
34921
34947
  // Getters
34922
34948
  // ---------------------------------------------------------------------------
@@ -34972,6 +34998,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34972
34998
  if (this.toSearch) {
34973
34999
  for (const cell of Object.values(cells)) {
34974
35000
  const { col, row } = this.getters.getCellPosition(cell.id);
35001
+ const isColHidden = this.getters.isColHidden(sheetId, col);
35002
+ const isRowHidden = this.getters.isRowHidden(sheetId, row);
35003
+ if (isColHidden || isRowHidden) {
35004
+ continue;
35005
+ }
34975
35006
  if (cell &&
34976
35007
  this.currentSearchRegex &&
34977
35008
  this.currentSearchRegex.test(this.getSearchableString({ sheetId, col, row }))) {
@@ -35031,37 +35062,31 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35031
35062
  // ---------------------------------------------------------------------------
35032
35063
  // Replace
35033
35064
  // ---------------------------------------------------------------------------
35034
- /**
35035
- * Replace the value of the currently selected match
35036
- */
35037
- replace(replaceWith) {
35038
- if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
35065
+ replaceMatch(selectedMatch, replaceWith) {
35066
+ if (!this.currentSearchRegex) {
35039
35067
  return;
35040
35068
  }
35041
- const matches = this.searchMatches;
35042
- const selectedMatch = matches[this.selectedMatchIndex];
35043
35069
  const sheetId = this.getters.getActiveSheetId();
35044
35070
  const cell = this.getters.getCell({ sheetId, ...selectedMatch });
35071
+ const { col, row } = selectedMatch;
35045
35072
  if ((cell === null || cell === void 0 ? void 0 : cell.isFormula) && !this.searchOptions.searchFormulas) {
35046
- this.selectNextCell(Direction.next);
35073
+ return;
35047
35074
  }
35048
- else {
35049
- const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
35050
- const toReplace = this.getSearchableString({
35051
- sheetId,
35052
- col: selectedMatch.col,
35053
- row: selectedMatch.row,
35054
- });
35055
- const newContent = toReplace.replace(replaceRegex, replaceWith);
35056
- this.dispatch("UPDATE_CELL", {
35057
- sheetId: this.getters.getActiveSheetId(),
35058
- col: selectedMatch.col,
35059
- row: selectedMatch.row,
35060
- content: newContent,
35061
- });
35062
- this.searchMatches.splice(this.selectedMatchIndex, 1);
35063
- this.selectNextCell(Direction.current);
35075
+ const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
35076
+ const toReplace = this.getSearchableString({ sheetId, col, row });
35077
+ const content = toReplace.replace(replaceRegex, replaceWith);
35078
+ this.dispatch("UPDATE_CELL", { sheetId, col, row, content });
35079
+ }
35080
+ /**
35081
+ * Replace the value of the currently selected match
35082
+ */
35083
+ replace(replaceWith) {
35084
+ if (this.selectedMatchIndex === null) {
35085
+ return;
35064
35086
  }
35087
+ const selectedMatch = this.searchMatches[this.selectedMatchIndex];
35088
+ this.replaceMatch(selectedMatch, replaceWith);
35089
+ this.selectNextCell(Direction.next);
35065
35090
  }
35066
35091
  /**
35067
35092
  * Apply the replace function to all the matches one time.
@@ -35069,7 +35094,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35069
35094
  replaceAll(replaceWith) {
35070
35095
  const matchCount = this.searchMatches.length;
35071
35096
  for (let i = 0; i < matchCount; i++) {
35072
- this.replace(replaceWith);
35097
+ this.replaceMatch(this.searchMatches[i], replaceWith);
35073
35098
  }
35074
35099
  }
35075
35100
  getSearchableString(position) {
@@ -37414,10 +37439,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37414
37439
  }
37415
37440
  updateCellCommands.push(newCellValues);
37416
37441
  }
37417
- for (const cmd of updateCellCommands) {
37418
- this.dispatch("UPDATE_CELL", cmd);
37419
- }
37420
37442
  }
37443
+ updateCellCommands.forEach((cmdPayload) => this.dispatch("UPDATE_CELL", cmdPayload));
37421
37444
  }
37422
37445
  /**
37423
37446
  * Return the distances between main merge cells in the zone.
@@ -39744,6 +39767,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39744
39767
  .o-sidePanelButton:enabled {
39745
39768
  cursor: pointer;
39746
39769
  }
39770
+
39771
+ .o-sidePanelButton:disabled {
39772
+ color: ${DISABLED_TEXT_COLOR};
39773
+ }
39774
+
39747
39775
  .o-sidePanelButton:last-child {
39748
39776
  margin-right: 0px;
39749
39777
  }
@@ -44283,9 +44311,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44283
44311
  Object.defineProperty(exports, '__esModule', { value: true });
44284
44312
 
44285
44313
 
44286
- __info__.version = '16.1.15';
44287
- __info__.date = '2023-06-26T14:33:07.859Z';
44288
- __info__.hash = '2b264ad';
44314
+ __info__.version = '16.1.17';
44315
+ __info__.date = '2023-08-07T09:00:57.212Z';
44316
+ __info__.hash = '2a79aa8';
44289
44317
 
44290
44318
 
44291
44319
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);