@odoo/o-spreadsheet 16.3.15 → 16.3.16

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.
@@ -7348,7 +7348,7 @@ function createGaugeChartRuntime(chart, getters) {
7348
7348
  });
7349
7349
  return {
7350
7350
  chartJsConfig: config,
7351
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
7351
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
7352
7352
  };
7353
7353
  }
7354
7354
 
@@ -8069,7 +8069,7 @@ function createScorecardChartRuntime(chart, getters) {
8069
8069
  };
8070
8070
  baselineCell = getters.getEvaluatedCell(baselinePosition);
8071
8071
  }
8072
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
8072
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
8073
8073
  return {
8074
8074
  title: _t(chart.title),
8075
8075
  keyValue: formattedKeyValue || keyValue,
@@ -8077,7 +8077,7 @@ function createScorecardChartRuntime(chart, getters) {
8077
8077
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
8078
8078
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
8079
8079
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
8080
- fontColor: chartFontColor(background),
8080
+ fontColor,
8081
8081
  background,
8082
8082
  baselineStyle: chart.baselineMode !== "percentage" && baseline
8083
8083
  ? getters.getCellStyle({
@@ -33728,7 +33728,7 @@ class EvaluationPlugin extends UIPlugin {
33728
33728
  }
33729
33729
 
33730
33730
  class EvaluationChartPlugin extends UIPlugin {
33731
- static getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
33731
+ static getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
33732
33732
  charts = {};
33733
33733
  createRuntimeChart = chartRuntimeFactory(this.getters);
33734
33734
  handle(cmd) {
@@ -33766,25 +33766,26 @@ class EvaluationChartPlugin extends UIPlugin {
33766
33766
  return this.charts[figureId];
33767
33767
  }
33768
33768
  /**
33769
- * Get the background color of a chart based on the color of the first cell of the main range
33770
- * of the chart. In order of priority, it will return :
33771
- *
33772
- * - the chart background color if one is defined
33773
- * - the fill color of the cell if one is defined
33774
- * - the fill color of the cell from conditional formats if one is defined
33775
- * - the default chart color if no other color is defined
33769
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
33776
33770
  */
33777
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
33771
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
33778
33772
  if (chartBackground)
33779
- return chartBackground;
33773
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
33780
33774
  if (!mainRange) {
33781
- return BACKGROUND_CHART_COLOR;
33775
+ return {
33776
+ background: BACKGROUND_CHART_COLOR,
33777
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
33778
+ };
33782
33779
  }
33783
33780
  const col = mainRange.zone.left;
33784
33781
  const row = mainRange.zone.top;
33785
33782
  const sheetId = mainRange.sheetId;
33786
33783
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
33787
- return style.fillColor || BACKGROUND_CHART_COLOR;
33784
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
33785
+ return {
33786
+ background,
33787
+ fontColor: style.textColor || chartFontColor(background),
33788
+ };
33788
33789
  }
33789
33790
  }
33790
33791
 
@@ -43565,6 +43566,7 @@ css /* scss */ `
43565
43566
  line-height: 1.2;
43566
43567
  font-size: 13px;
43567
43568
  font-weight: 500;
43569
+ background-color: #fff;
43568
43570
 
43569
43571
  .o-topbar-top {
43570
43572
  border-bottom: 1px solid ${SEPARATOR_COLOR};
@@ -46411,14 +46413,14 @@ function convertFigureData(figure, sheet) {
46411
46413
  */
46412
46414
  function figureCoordinates(headers, position) {
46413
46415
  let currentPosition = 0;
46414
- for (const [headerIndex, header] of Object.entries(headers)) {
46416
+ for (const [headerIndex, header] of headers.entries()) {
46415
46417
  if (currentPosition <= position && position < currentPosition + header.size) {
46416
46418
  return {
46417
- index: parseInt(headerIndex),
46419
+ index: headerIndex,
46418
46420
  offset: convertDotValueToEMU(position - currentPosition + FIGURE_BORDER_WIDTH),
46419
46421
  };
46420
46422
  }
46421
- else {
46423
+ else if (headerIndex < headers.length - 1) {
46422
46424
  currentPosition += header.size;
46423
46425
  }
46424
46426
  }
@@ -47795,6 +47797,6 @@ exports.setTranslationMethod = setTranslationMethod;
47795
47797
  exports.tokenize = tokenize;
47796
47798
 
47797
47799
 
47798
- __info__.version = '16.3.15';
47799
- __info__.date = '2023-10-25T10:03:43.272Z';
47800
- __info__.hash = 'fb7c4dd';
47800
+ __info__.version = '16.3.16';
47801
+ __info__.date = '2023-11-02T09:32:13.671Z';
47802
+ __info__.hash = '09607eb';
@@ -3762,22 +3762,20 @@ declare class EvaluationPlugin extends UIPlugin {
3762
3762
  private isBadExpression;
3763
3763
  }
3764
3764
 
3765
+ interface EvaluationChartStyle {
3766
+ background: Color;
3767
+ fontColor: Color;
3768
+ }
3765
3769
  declare class EvaluationChartPlugin extends UIPlugin {
3766
- static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
3770
+ static getters: readonly ["getChartRuntime", "getStyleOfSingleCellChart"];
3767
3771
  readonly charts: Record<UID, ChartRuntime | undefined>;
3768
3772
  private createRuntimeChart;
3769
3773
  handle(cmd: Command): void;
3770
3774
  getChartRuntime(figureId: UID): ChartRuntime;
3771
3775
  /**
3772
- * Get the background color of a chart based on the color of the first cell of the main range
3773
- * of the chart. In order of priority, it will return :
3774
- *
3775
- * - the chart background color if one is defined
3776
- * - the fill color of the cell if one is defined
3777
- * - the fill color of the cell from conditional formats if one is defined
3778
- * - the default chart color if no other color is defined
3776
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
3779
3777
  */
3780
- getBackgroundOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): Color;
3778
+ getStyleOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): EvaluationChartStyle;
3781
3779
  }
3782
3780
 
3783
3781
  declare class EvaluationConditionalFormatPlugin extends UIPlugin {
@@ -7344,7 +7344,7 @@ function createGaugeChartRuntime(chart, getters) {
7344
7344
  });
7345
7345
  return {
7346
7346
  chartJsConfig: config,
7347
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
7347
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
7348
7348
  };
7349
7349
  }
7350
7350
 
@@ -8065,7 +8065,7 @@ function createScorecardChartRuntime(chart, getters) {
8065
8065
  };
8066
8066
  baselineCell = getters.getEvaluatedCell(baselinePosition);
8067
8067
  }
8068
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
8068
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
8069
8069
  return {
8070
8070
  title: _t(chart.title),
8071
8071
  keyValue: formattedKeyValue || keyValue,
@@ -8073,7 +8073,7 @@ function createScorecardChartRuntime(chart, getters) {
8073
8073
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
8074
8074
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
8075
8075
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
8076
- fontColor: chartFontColor(background),
8076
+ fontColor,
8077
8077
  background,
8078
8078
  baselineStyle: chart.baselineMode !== "percentage" && baseline
8079
8079
  ? getters.getCellStyle({
@@ -33724,7 +33724,7 @@ class EvaluationPlugin extends UIPlugin {
33724
33724
  }
33725
33725
 
33726
33726
  class EvaluationChartPlugin extends UIPlugin {
33727
- static getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
33727
+ static getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
33728
33728
  charts = {};
33729
33729
  createRuntimeChart = chartRuntimeFactory(this.getters);
33730
33730
  handle(cmd) {
@@ -33762,25 +33762,26 @@ class EvaluationChartPlugin extends UIPlugin {
33762
33762
  return this.charts[figureId];
33763
33763
  }
33764
33764
  /**
33765
- * Get the background color of a chart based on the color of the first cell of the main range
33766
- * of the chart. In order of priority, it will return :
33767
- *
33768
- * - the chart background color if one is defined
33769
- * - the fill color of the cell if one is defined
33770
- * - the fill color of the cell from conditional formats if one is defined
33771
- * - the default chart color if no other color is defined
33765
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
33772
33766
  */
33773
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
33767
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
33774
33768
  if (chartBackground)
33775
- return chartBackground;
33769
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
33776
33770
  if (!mainRange) {
33777
- return BACKGROUND_CHART_COLOR;
33771
+ return {
33772
+ background: BACKGROUND_CHART_COLOR,
33773
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
33774
+ };
33778
33775
  }
33779
33776
  const col = mainRange.zone.left;
33780
33777
  const row = mainRange.zone.top;
33781
33778
  const sheetId = mainRange.sheetId;
33782
33779
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
33783
- return style.fillColor || BACKGROUND_CHART_COLOR;
33780
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
33781
+ return {
33782
+ background,
33783
+ fontColor: style.textColor || chartFontColor(background),
33784
+ };
33784
33785
  }
33785
33786
  }
33786
33787
 
@@ -43561,6 +43562,7 @@ css /* scss */ `
43561
43562
  line-height: 1.2;
43562
43563
  font-size: 13px;
43563
43564
  font-weight: 500;
43565
+ background-color: #fff;
43564
43566
 
43565
43567
  .o-topbar-top {
43566
43568
  border-bottom: 1px solid ${SEPARATOR_COLOR};
@@ -46407,14 +46409,14 @@ function convertFigureData(figure, sheet) {
46407
46409
  */
46408
46410
  function figureCoordinates(headers, position) {
46409
46411
  let currentPosition = 0;
46410
- for (const [headerIndex, header] of Object.entries(headers)) {
46412
+ for (const [headerIndex, header] of headers.entries()) {
46411
46413
  if (currentPosition <= position && position < currentPosition + header.size) {
46412
46414
  return {
46413
- index: parseInt(headerIndex),
46415
+ index: headerIndex,
46414
46416
  offset: convertDotValueToEMU(position - currentPosition + FIGURE_BORDER_WIDTH),
46415
46417
  };
46416
46418
  }
46417
- else {
46419
+ else if (headerIndex < headers.length - 1) {
46418
46420
  currentPosition += header.size;
46419
46421
  }
46420
46422
  }
@@ -47763,6 +47765,6 @@ function addFunction(functionName, functionDescription) {
47763
47765
  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 };
47764
47766
 
47765
47767
 
47766
- __info__.version = '16.3.15';
47767
- __info__.date = '2023-10-25T10:03:43.272Z';
47768
- __info__.hash = 'fb7c4dd';
47768
+ __info__.version = '16.3.16';
47769
+ __info__.date = '2023-11-02T09:32:13.671Z';
47770
+ __info__.hash = '09607eb';
@@ -7345,7 +7345,7 @@
7345
7345
  });
7346
7346
  return {
7347
7347
  chartJsConfig: config,
7348
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
7348
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
7349
7349
  };
7350
7350
  }
7351
7351
 
@@ -8066,7 +8066,7 @@
8066
8066
  };
8067
8067
  baselineCell = getters.getEvaluatedCell(baselinePosition);
8068
8068
  }
8069
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
8069
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
8070
8070
  return {
8071
8071
  title: _t(chart.title),
8072
8072
  keyValue: formattedKeyValue || keyValue,
@@ -8074,7 +8074,7 @@
8074
8074
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
8075
8075
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
8076
8076
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
8077
- fontColor: chartFontColor(background),
8077
+ fontColor,
8078
8078
  background,
8079
8079
  baselineStyle: chart.baselineMode !== "percentage" && baseline
8080
8080
  ? getters.getCellStyle({
@@ -33725,7 +33725,7 @@
33725
33725
  }
33726
33726
 
33727
33727
  class EvaluationChartPlugin extends UIPlugin {
33728
- static getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
33728
+ static getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
33729
33729
  charts = {};
33730
33730
  createRuntimeChart = chartRuntimeFactory(this.getters);
33731
33731
  handle(cmd) {
@@ -33763,25 +33763,26 @@
33763
33763
  return this.charts[figureId];
33764
33764
  }
33765
33765
  /**
33766
- * Get the background color of a chart based on the color of the first cell of the main range
33767
- * of the chart. In order of priority, it will return :
33768
- *
33769
- * - the chart background color if one is defined
33770
- * - the fill color of the cell if one is defined
33771
- * - the fill color of the cell from conditional formats if one is defined
33772
- * - the default chart color if no other color is defined
33766
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
33773
33767
  */
33774
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
33768
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
33775
33769
  if (chartBackground)
33776
- return chartBackground;
33770
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
33777
33771
  if (!mainRange) {
33778
- return BACKGROUND_CHART_COLOR;
33772
+ return {
33773
+ background: BACKGROUND_CHART_COLOR,
33774
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
33775
+ };
33779
33776
  }
33780
33777
  const col = mainRange.zone.left;
33781
33778
  const row = mainRange.zone.top;
33782
33779
  const sheetId = mainRange.sheetId;
33783
33780
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
33784
- return style.fillColor || BACKGROUND_CHART_COLOR;
33781
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
33782
+ return {
33783
+ background,
33784
+ fontColor: style.textColor || chartFontColor(background),
33785
+ };
33785
33786
  }
33786
33787
  }
33787
33788
 
@@ -43562,6 +43563,7 @@
43562
43563
  line-height: 1.2;
43563
43564
  font-size: 13px;
43564
43565
  font-weight: 500;
43566
+ background-color: #fff;
43565
43567
 
43566
43568
  .o-topbar-top {
43567
43569
  border-bottom: 1px solid ${SEPARATOR_COLOR};
@@ -46408,14 +46410,14 @@
46408
46410
  */
46409
46411
  function figureCoordinates(headers, position) {
46410
46412
  let currentPosition = 0;
46411
- for (const [headerIndex, header] of Object.entries(headers)) {
46413
+ for (const [headerIndex, header] of headers.entries()) {
46412
46414
  if (currentPosition <= position && position < currentPosition + header.size) {
46413
46415
  return {
46414
- index: parseInt(headerIndex),
46416
+ index: headerIndex,
46415
46417
  offset: convertDotValueToEMU(position - currentPosition + FIGURE_BORDER_WIDTH),
46416
46418
  };
46417
46419
  }
46418
- else {
46420
+ else if (headerIndex < headers.length - 1) {
46419
46421
  currentPosition += header.size;
46420
46422
  }
46421
46423
  }
@@ -47794,9 +47796,9 @@
47794
47796
  Object.defineProperty(exports, '__esModule', { value: true });
47795
47797
 
47796
47798
 
47797
- __info__.version = '16.3.15';
47798
- __info__.date = '2023-10-25T10:03:43.272Z';
47799
- __info__.hash = 'fb7c4dd';
47799
+ __info__.version = '16.3.16';
47800
+ __info__.date = '2023-11-02T09:32:13.671Z';
47801
+ __info__.hash = '09607eb';
47800
47802
 
47801
47803
 
47802
47804
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);