@odoo/o-spreadsheet 16.2.20 → 16.2.21

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.
@@ -7126,7 +7126,7 @@ function createGaugeChartRuntime(chart, getters) {
7126
7126
  });
7127
7127
  return {
7128
7128
  chartJsConfig: config,
7129
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
7129
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
7130
7130
  };
7131
7131
  }
7132
7132
 
@@ -7810,7 +7810,7 @@ function createScorecardChartRuntime(chart, getters) {
7810
7810
  };
7811
7811
  baselineCell = getters.getEvaluatedCell(baselinePosition);
7812
7812
  }
7813
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
7813
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
7814
7814
  return {
7815
7815
  title: _t(chart.title),
7816
7816
  keyValue: formattedKeyValue || keyValue,
@@ -7818,7 +7818,7 @@ function createScorecardChartRuntime(chart, getters) {
7818
7818
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
7819
7819
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
7820
7820
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
7821
- fontColor: chartFontColor(background),
7821
+ fontColor,
7822
7822
  background,
7823
7823
  baselineStyle: chart.baselineMode !== "percentage" && baseline
7824
7824
  ? getters.getCellStyle({
@@ -32270,28 +32270,29 @@ class EvaluationChartPlugin extends UIPlugin {
32270
32270
  return this.charts[figureId];
32271
32271
  }
32272
32272
  /**
32273
- * Get the background color of a chart based on the color of the first cell of the main range
32274
- * of the chart. In order of priority, it will return :
32275
- *
32276
- * - the chart background color if one is defined
32277
- * - the fill color of the cell if one is defined
32278
- * - the fill color of the cell from conditional formats if one is defined
32279
- * - the default chart color if no other color is defined
32273
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32280
32274
  */
32281
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32275
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32282
32276
  if (chartBackground)
32283
- return chartBackground;
32277
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32284
32278
  if (!mainRange) {
32285
- return BACKGROUND_CHART_COLOR;
32279
+ return {
32280
+ background: BACKGROUND_CHART_COLOR,
32281
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32282
+ };
32286
32283
  }
32287
32284
  const col = mainRange.zone.left;
32288
32285
  const row = mainRange.zone.top;
32289
32286
  const sheetId = mainRange.sheetId;
32290
32287
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32291
- return style.fillColor || BACKGROUND_CHART_COLOR;
32288
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32289
+ return {
32290
+ background,
32291
+ fontColor: style.textColor || chartFontColor(background),
32292
+ };
32292
32293
  }
32293
32294
  }
32294
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32295
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32295
32296
 
32296
32297
  // -----------------------------------------------------------------------------
32297
32298
  // Constants
@@ -45534,6 +45535,6 @@ exports.setTranslationMethod = setTranslationMethod;
45534
45535
  exports.tokenize = tokenize;
45535
45536
 
45536
45537
 
45537
- __info__.version = '16.2.20';
45538
- __info__.date = '2023-10-25T10:00:14.966Z';
45539
- __info__.hash = '25a402d';
45538
+ __info__.version = '16.2.21';
45539
+ __info__.date = '2023-11-02T09:31:50.545Z';
45540
+ __info__.hash = 'cc30e85';
@@ -3725,22 +3725,20 @@ declare class EvaluationPlugin extends UIPlugin {
3725
3725
  private isBadExpression;
3726
3726
  }
3727
3727
 
3728
+ interface EvaluationChartStyle {
3729
+ background: Color;
3730
+ fontColor: Color;
3731
+ }
3728
3732
  declare class EvaluationChartPlugin extends UIPlugin {
3729
- static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
3733
+ static getters: readonly ["getChartRuntime", "getStyleOfSingleCellChart"];
3730
3734
  readonly charts: Record<UID, ChartRuntime | undefined>;
3731
3735
  private createRuntimeChart;
3732
3736
  handle(cmd: Command): void;
3733
3737
  getChartRuntime(figureId: UID): ChartRuntime;
3734
3738
  /**
3735
- * Get the background color of a chart based on the color of the first cell of the main range
3736
- * of the chart. In order of priority, it will return :
3737
- *
3738
- * - the chart background color if one is defined
3739
- * - the fill color of the cell if one is defined
3740
- * - the fill color of the cell from conditional formats if one is defined
3741
- * - the default chart color if no other color is defined
3739
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
3742
3740
  */
3743
- getBackgroundOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): Color;
3741
+ getStyleOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): EvaluationChartStyle;
3744
3742
  }
3745
3743
 
3746
3744
  declare class EvaluationConditionalFormatPlugin extends UIPlugin {
@@ -7122,7 +7122,7 @@ function createGaugeChartRuntime(chart, getters) {
7122
7122
  });
7123
7123
  return {
7124
7124
  chartJsConfig: config,
7125
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
7125
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
7126
7126
  };
7127
7127
  }
7128
7128
 
@@ -7806,7 +7806,7 @@ function createScorecardChartRuntime(chart, getters) {
7806
7806
  };
7807
7807
  baselineCell = getters.getEvaluatedCell(baselinePosition);
7808
7808
  }
7809
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
7809
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
7810
7810
  return {
7811
7811
  title: _t(chart.title),
7812
7812
  keyValue: formattedKeyValue || keyValue,
@@ -7814,7 +7814,7 @@ function createScorecardChartRuntime(chart, getters) {
7814
7814
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
7815
7815
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
7816
7816
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
7817
- fontColor: chartFontColor(background),
7817
+ fontColor,
7818
7818
  background,
7819
7819
  baselineStyle: chart.baselineMode !== "percentage" && baseline
7820
7820
  ? getters.getCellStyle({
@@ -32266,28 +32266,29 @@ class EvaluationChartPlugin extends UIPlugin {
32266
32266
  return this.charts[figureId];
32267
32267
  }
32268
32268
  /**
32269
- * Get the background color of a chart based on the color of the first cell of the main range
32270
- * of the chart. In order of priority, it will return :
32271
- *
32272
- * - the chart background color if one is defined
32273
- * - the fill color of the cell if one is defined
32274
- * - the fill color of the cell from conditional formats if one is defined
32275
- * - the default chart color if no other color is defined
32269
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32276
32270
  */
32277
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32271
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32278
32272
  if (chartBackground)
32279
- return chartBackground;
32273
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32280
32274
  if (!mainRange) {
32281
- return BACKGROUND_CHART_COLOR;
32275
+ return {
32276
+ background: BACKGROUND_CHART_COLOR,
32277
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32278
+ };
32282
32279
  }
32283
32280
  const col = mainRange.zone.left;
32284
32281
  const row = mainRange.zone.top;
32285
32282
  const sheetId = mainRange.sheetId;
32286
32283
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32287
- return style.fillColor || BACKGROUND_CHART_COLOR;
32284
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32285
+ return {
32286
+ background,
32287
+ fontColor: style.textColor || chartFontColor(background),
32288
+ };
32288
32289
  }
32289
32290
  }
32290
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32291
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32291
32292
 
32292
32293
  // -----------------------------------------------------------------------------
32293
32294
  // Constants
@@ -45502,6 +45503,6 @@ function addFunction(functionName, functionDescription) {
45502
45503
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, 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, setTranslationMethod, tokenize };
45503
45504
 
45504
45505
 
45505
- __info__.version = '16.2.20';
45506
- __info__.date = '2023-10-25T10:00:14.966Z';
45507
- __info__.hash = '25a402d';
45506
+ __info__.version = '16.2.21';
45507
+ __info__.date = '2023-11-02T09:31:50.545Z';
45508
+ __info__.hash = 'cc30e85';
@@ -7123,7 +7123,7 @@
7123
7123
  });
7124
7124
  return {
7125
7125
  chartJsConfig: config,
7126
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
7126
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
7127
7127
  };
7128
7128
  }
7129
7129
 
@@ -7807,7 +7807,7 @@
7807
7807
  };
7808
7808
  baselineCell = getters.getEvaluatedCell(baselinePosition);
7809
7809
  }
7810
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
7810
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
7811
7811
  return {
7812
7812
  title: _t(chart.title),
7813
7813
  keyValue: formattedKeyValue || keyValue,
@@ -7815,7 +7815,7 @@
7815
7815
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
7816
7816
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
7817
7817
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
7818
- fontColor: chartFontColor(background),
7818
+ fontColor,
7819
7819
  background,
7820
7820
  baselineStyle: chart.baselineMode !== "percentage" && baseline
7821
7821
  ? getters.getCellStyle({
@@ -32267,28 +32267,29 @@
32267
32267
  return this.charts[figureId];
32268
32268
  }
32269
32269
  /**
32270
- * Get the background color of a chart based on the color of the first cell of the main range
32271
- * of the chart. In order of priority, it will return :
32272
- *
32273
- * - the chart background color if one is defined
32274
- * - the fill color of the cell if one is defined
32275
- * - the fill color of the cell from conditional formats if one is defined
32276
- * - the default chart color if no other color is defined
32270
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32277
32271
  */
32278
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32272
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32279
32273
  if (chartBackground)
32280
- return chartBackground;
32274
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32281
32275
  if (!mainRange) {
32282
- return BACKGROUND_CHART_COLOR;
32276
+ return {
32277
+ background: BACKGROUND_CHART_COLOR,
32278
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32279
+ };
32283
32280
  }
32284
32281
  const col = mainRange.zone.left;
32285
32282
  const row = mainRange.zone.top;
32286
32283
  const sheetId = mainRange.sheetId;
32287
32284
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32288
- return style.fillColor || BACKGROUND_CHART_COLOR;
32285
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32286
+ return {
32287
+ background,
32288
+ fontColor: style.textColor || chartFontColor(background),
32289
+ };
32289
32290
  }
32290
32291
  }
32291
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32292
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32292
32293
 
32293
32294
  // -----------------------------------------------------------------------------
32294
32295
  // Constants
@@ -45533,9 +45534,9 @@
45533
45534
  Object.defineProperty(exports, '__esModule', { value: true });
45534
45535
 
45535
45536
 
45536
- __info__.version = '16.2.20';
45537
- __info__.date = '2023-10-25T10:00:14.966Z';
45538
- __info__.hash = '25a402d';
45537
+ __info__.version = '16.2.21';
45538
+ __info__.date = '2023-11-02T09:31:50.545Z';
45539
+ __info__.hash = 'cc30e85';
45539
45540
 
45540
45541
 
45541
45542
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);