@odoo/o-spreadsheet 16.0.2 → 16.0.4

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
  */
@@ -8386,7 +8389,7 @@ class ColorPicker extends owl.Component {
8386
8389
  }
8387
8390
  onColorClick(color) {
8388
8391
  if (color) {
8389
- this.props.onColorPicked(color);
8392
+ this.props.onColorPicked(toHex(color));
8390
8393
  }
8391
8394
  }
8392
8395
  getCheckMarkColor() {
@@ -8401,8 +8404,10 @@ class ColorPicker extends owl.Component {
8401
8404
  this.state.isCurrentColorInvalid = true;
8402
8405
  return;
8403
8406
  }
8407
+ const color = toHex(this.state.currentColor);
8404
8408
  this.state.isCurrentColorInvalid = false;
8405
- this.props.onColorPicked(this.state.currentColor);
8409
+ this.props.onColorPicked(color);
8410
+ this.state.currentColor = color;
8406
8411
  }
8407
8412
  toggleColorPicker() {
8408
8413
  this.state.showGradient = !this.state.showGradient;
@@ -10039,7 +10044,7 @@ class ScorecardChart extends owl.Component {
10039
10044
  return this.runtime.fontColor;
10040
10045
  }
10041
10046
  get secondaryFontColor() {
10042
- return relativeLuminance(this.primaryFontColor) <= 0.3 ? "#757575" : "#bbbbbb";
10047
+ return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
10043
10048
  }
10044
10049
  get figure() {
10045
10050
  return this.props.figure;
@@ -32770,6 +32775,9 @@ class FilterEvaluationPlugin extends UIPlugin {
32770
32775
  case "CREATE_SHEET":
32771
32776
  this.filterValues[cmd.sheetId] = {};
32772
32777
  break;
32778
+ case "HIDE_COLUMNS_ROWS":
32779
+ this.updateHiddenRows();
32780
+ break;
32773
32781
  case "UPDATE_FILTER":
32774
32782
  this.updateFilter(cmd);
32775
32783
  this.updateHiddenRows();
@@ -32871,9 +32879,16 @@ class FilterEvaluationPlugin extends UIPlugin {
32871
32879
  updateHiddenRows() {
32872
32880
  var _a, _b;
32873
32881
  const sheetId = this.getters.getActiveSheetId();
32874
- const filters = this.getters.getFilters(sheetId);
32882
+ const filters = this.getters
32883
+ .getFilters(sheetId)
32884
+ .sort((filter1, filter2) => filter1.zoneWithHeaders.top - filter2.zoneWithHeaders.top);
32875
32885
  const hiddenRows = new Set();
32876
32886
  for (let filter of filters) {
32887
+ // Disable filters whose header are hidden
32888
+ if (this.getters.isRowHiddenByUser(sheetId, filter.zoneWithHeaders.top))
32889
+ continue;
32890
+ if (hiddenRows.has(filter.zoneWithHeaders.top))
32891
+ continue;
32877
32892
  const filteredValues = (_b = (_a = this.filterValues[sheetId]) === null || _a === void 0 ? void 0 : _a[filter.id]) === null || _b === void 0 ? void 0 : _b.map(toLowerCase);
32878
32893
  if (!filteredValues || !filter.filteredZone)
32879
32894
  continue;
@@ -32906,7 +32921,7 @@ class FilterEvaluationPlugin extends UIPlugin {
32906
32921
  const valuesInFilterZone = filter.filteredZone
32907
32922
  ? positions(filter.filteredZone)
32908
32923
  .map((pos) => { var _a; return (_a = this.getters.getCell(sheetData.id, pos.col, pos.row)) === null || _a === void 0 ? void 0 : _a.formattedValue; })
32909
- .filter(isDefined$1)
32924
+ .filter(isNonEmptyString)
32910
32925
  : [];
32911
32926
  // In xlsx, filtered values = values that are displayed, not values that are hidden
32912
32927
  const xlsxFilteredValues = valuesInFilterZone.filter((val) => !filteredValues.includes(val));
@@ -38178,6 +38193,7 @@ class TopBar extends owl.Component {
38178
38193
  this.state.menuState.parentMenu = menu;
38179
38194
  this.isSelectingMenu = true;
38180
38195
  this.openedEl = ev.target;
38196
+ this.env.model.dispatch("STOP_EDITION");
38181
38197
  }
38182
38198
  closeMenus() {
38183
38199
  this.state.activeTool = "";
@@ -42455,6 +42471,6 @@ exports.setTranslationMethod = setTranslationMethod;
42455
42471
  exports.tokenize = tokenize;
42456
42472
 
42457
42473
 
42458
- __info__.version = '16.0.2';
42459
- __info__.date = '2023-03-06T07:17:51.313Z';
42460
- __info__.hash = '6b4d816';
42474
+ __info__.version = '16.0.4';
42475
+ __info__.date = '2023-03-16T12:11:01.007Z';
42476
+ __info__.hash = 'ebbb1f0';
@@ -5148,7 +5148,7 @@ declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5148
5148
  get baselineArrowDirection(): BaselineArrowDirection;
5149
5149
  get backgroundColor(): string;
5150
5150
  get primaryFontColor(): string;
5151
- get secondaryFontColor(): "#757575" | "#bbbbbb";
5151
+ get secondaryFontColor(): "#525252" | "#C8C8C8";
5152
5152
  get figure(): Figure;
5153
5153
  get chartStyle(): string;
5154
5154
  get chartContentStyle(): string;
@@ -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
  */
@@ -8382,7 +8385,7 @@ class ColorPicker extends Component {
8382
8385
  }
8383
8386
  onColorClick(color) {
8384
8387
  if (color) {
8385
- this.props.onColorPicked(color);
8388
+ this.props.onColorPicked(toHex(color));
8386
8389
  }
8387
8390
  }
8388
8391
  getCheckMarkColor() {
@@ -8397,8 +8400,10 @@ class ColorPicker extends Component {
8397
8400
  this.state.isCurrentColorInvalid = true;
8398
8401
  return;
8399
8402
  }
8403
+ const color = toHex(this.state.currentColor);
8400
8404
  this.state.isCurrentColorInvalid = false;
8401
- this.props.onColorPicked(this.state.currentColor);
8405
+ this.props.onColorPicked(color);
8406
+ this.state.currentColor = color;
8402
8407
  }
8403
8408
  toggleColorPicker() {
8404
8409
  this.state.showGradient = !this.state.showGradient;
@@ -10035,7 +10040,7 @@ class ScorecardChart extends Component {
10035
10040
  return this.runtime.fontColor;
10036
10041
  }
10037
10042
  get secondaryFontColor() {
10038
- return relativeLuminance(this.primaryFontColor) <= 0.3 ? "#757575" : "#bbbbbb";
10043
+ return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
10039
10044
  }
10040
10045
  get figure() {
10041
10046
  return this.props.figure;
@@ -32766,6 +32771,9 @@ class FilterEvaluationPlugin extends UIPlugin {
32766
32771
  case "CREATE_SHEET":
32767
32772
  this.filterValues[cmd.sheetId] = {};
32768
32773
  break;
32774
+ case "HIDE_COLUMNS_ROWS":
32775
+ this.updateHiddenRows();
32776
+ break;
32769
32777
  case "UPDATE_FILTER":
32770
32778
  this.updateFilter(cmd);
32771
32779
  this.updateHiddenRows();
@@ -32867,9 +32875,16 @@ class FilterEvaluationPlugin extends UIPlugin {
32867
32875
  updateHiddenRows() {
32868
32876
  var _a, _b;
32869
32877
  const sheetId = this.getters.getActiveSheetId();
32870
- const filters = this.getters.getFilters(sheetId);
32878
+ const filters = this.getters
32879
+ .getFilters(sheetId)
32880
+ .sort((filter1, filter2) => filter1.zoneWithHeaders.top - filter2.zoneWithHeaders.top);
32871
32881
  const hiddenRows = new Set();
32872
32882
  for (let filter of filters) {
32883
+ // Disable filters whose header are hidden
32884
+ if (this.getters.isRowHiddenByUser(sheetId, filter.zoneWithHeaders.top))
32885
+ continue;
32886
+ if (hiddenRows.has(filter.zoneWithHeaders.top))
32887
+ continue;
32873
32888
  const filteredValues = (_b = (_a = this.filterValues[sheetId]) === null || _a === void 0 ? void 0 : _a[filter.id]) === null || _b === void 0 ? void 0 : _b.map(toLowerCase);
32874
32889
  if (!filteredValues || !filter.filteredZone)
32875
32890
  continue;
@@ -32902,7 +32917,7 @@ class FilterEvaluationPlugin extends UIPlugin {
32902
32917
  const valuesInFilterZone = filter.filteredZone
32903
32918
  ? positions(filter.filteredZone)
32904
32919
  .map((pos) => { var _a; return (_a = this.getters.getCell(sheetData.id, pos.col, pos.row)) === null || _a === void 0 ? void 0 : _a.formattedValue; })
32905
- .filter(isDefined$1)
32920
+ .filter(isNonEmptyString)
32906
32921
  : [];
32907
32922
  // In xlsx, filtered values = values that are displayed, not values that are hidden
32908
32923
  const xlsxFilteredValues = valuesInFilterZone.filter((val) => !filteredValues.includes(val));
@@ -38174,6 +38189,7 @@ class TopBar extends Component {
38174
38189
  this.state.menuState.parentMenu = menu;
38175
38190
  this.isSelectingMenu = true;
38176
38191
  this.openedEl = ev.target;
38192
+ this.env.model.dispatch("STOP_EDITION");
38177
38193
  }
38178
38194
  closeMenus() {
38179
38195
  this.state.activeTool = "";
@@ -42423,6 +42439,6 @@ function addFunction(functionName, functionDescription) {
42423
42439
  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 };
42424
42440
 
42425
42441
 
42426
- __info__.version = '16.0.2';
42427
- __info__.date = '2023-03-06T07:17:51.313Z';
42428
- __info__.hash = '6b4d816';
42442
+ __info__.version = '16.0.4';
42443
+ __info__.date = '2023-03-16T12:11:01.007Z';
42444
+ __info__.hash = 'ebbb1f0';
@@ -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
  */
@@ -8383,7 +8386,7 @@
8383
8386
  }
8384
8387
  onColorClick(color) {
8385
8388
  if (color) {
8386
- this.props.onColorPicked(color);
8389
+ this.props.onColorPicked(toHex(color));
8387
8390
  }
8388
8391
  }
8389
8392
  getCheckMarkColor() {
@@ -8398,8 +8401,10 @@
8398
8401
  this.state.isCurrentColorInvalid = true;
8399
8402
  return;
8400
8403
  }
8404
+ const color = toHex(this.state.currentColor);
8401
8405
  this.state.isCurrentColorInvalid = false;
8402
- this.props.onColorPicked(this.state.currentColor);
8406
+ this.props.onColorPicked(color);
8407
+ this.state.currentColor = color;
8403
8408
  }
8404
8409
  toggleColorPicker() {
8405
8410
  this.state.showGradient = !this.state.showGradient;
@@ -10036,7 +10041,7 @@
10036
10041
  return this.runtime.fontColor;
10037
10042
  }
10038
10043
  get secondaryFontColor() {
10039
- return relativeLuminance(this.primaryFontColor) <= 0.3 ? "#757575" : "#bbbbbb";
10044
+ return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
10040
10045
  }
10041
10046
  get figure() {
10042
10047
  return this.props.figure;
@@ -32767,6 +32772,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32767
32772
  case "CREATE_SHEET":
32768
32773
  this.filterValues[cmd.sheetId] = {};
32769
32774
  break;
32775
+ case "HIDE_COLUMNS_ROWS":
32776
+ this.updateHiddenRows();
32777
+ break;
32770
32778
  case "UPDATE_FILTER":
32771
32779
  this.updateFilter(cmd);
32772
32780
  this.updateHiddenRows();
@@ -32868,9 +32876,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32868
32876
  updateHiddenRows() {
32869
32877
  var _a, _b;
32870
32878
  const sheetId = this.getters.getActiveSheetId();
32871
- const filters = this.getters.getFilters(sheetId);
32879
+ const filters = this.getters
32880
+ .getFilters(sheetId)
32881
+ .sort((filter1, filter2) => filter1.zoneWithHeaders.top - filter2.zoneWithHeaders.top);
32872
32882
  const hiddenRows = new Set();
32873
32883
  for (let filter of filters) {
32884
+ // Disable filters whose header are hidden
32885
+ if (this.getters.isRowHiddenByUser(sheetId, filter.zoneWithHeaders.top))
32886
+ continue;
32887
+ if (hiddenRows.has(filter.zoneWithHeaders.top))
32888
+ continue;
32874
32889
  const filteredValues = (_b = (_a = this.filterValues[sheetId]) === null || _a === void 0 ? void 0 : _a[filter.id]) === null || _b === void 0 ? void 0 : _b.map(toLowerCase);
32875
32890
  if (!filteredValues || !filter.filteredZone)
32876
32891
  continue;
@@ -32903,7 +32918,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32903
32918
  const valuesInFilterZone = filter.filteredZone
32904
32919
  ? positions(filter.filteredZone)
32905
32920
  .map((pos) => { var _a; return (_a = this.getters.getCell(sheetData.id, pos.col, pos.row)) === null || _a === void 0 ? void 0 : _a.formattedValue; })
32906
- .filter(isDefined$1)
32921
+ .filter(isNonEmptyString)
32907
32922
  : [];
32908
32923
  // In xlsx, filtered values = values that are displayed, not values that are hidden
32909
32924
  const xlsxFilteredValues = valuesInFilterZone.filter((val) => !filteredValues.includes(val));
@@ -38175,6 +38190,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
38175
38190
  this.state.menuState.parentMenu = menu;
38176
38191
  this.isSelectingMenu = true;
38177
38192
  this.openedEl = ev.target;
38193
+ this.env.model.dispatch("STOP_EDITION");
38178
38194
  }
38179
38195
  closeMenus() {
38180
38196
  this.state.activeTool = "";
@@ -42454,9 +42470,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42454
42470
  Object.defineProperty(exports, '__esModule', { value: true });
42455
42471
 
42456
42472
 
42457
- __info__.version = '16.0.2';
42458
- __info__.date = '2023-03-06T07:17:51.313Z';
42459
- __info__.hash = '6b4d816';
42473
+ __info__.version = '16.0.4';
42474
+ __info__.date = '2023-03-16T12:11:01.007Z';
42475
+ __info__.hash = 'ebbb1f0';
42460
42476
 
42461
42477
 
42462
42478
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);