@odoo/o-spreadsheet 16.2.19 → 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({
@@ -19398,7 +19398,7 @@ class ClientTag extends owl.Component {
19398
19398
  left: `${x - 1}px`,
19399
19399
  border: `1px solid ${color}`,
19400
19400
  "background-color": color,
19401
- opacity: this.props.active ? "opacity:1 !important" : undefined,
19401
+ opacity: this.props.active ? "1 !important" : undefined,
19402
19402
  });
19403
19403
  }
19404
19404
  }
@@ -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
@@ -39380,11 +39381,19 @@ class GridSelectionPlugin extends UIPlugin {
39380
39381
  }
39381
39382
  }
39382
39383
  getStatisticFnResults() {
39383
- // get deduplicated cells in zones
39384
- const cells = new Set(this.gridSelection.zones
39385
- .map((zone) => this.getters.getEvaluatedCellsInZone(this.getters.getActiveSheetId(), zone))
39386
- .flat()
39387
- .filter((cell) => cell.type !== CellValueType.empty));
39384
+ const sheetId = this.getters.getActiveSheetId();
39385
+ const cells = new Set();
39386
+ for (const zone of this.gridSelection.zones) {
39387
+ for (const { col, row } of positions(zone)) {
39388
+ if (this.getters.isRowHidden(sheetId, row) || this.getters.isColHidden(sheetId, col)) {
39389
+ continue; // Skip hidden cells
39390
+ }
39391
+ const evaluatedCell = this.getters.getEvaluatedCell({ sheetId, col, row });
39392
+ if (evaluatedCell.type !== CellValueType.empty) {
39393
+ cells.add(evaluatedCell);
39394
+ }
39395
+ }
39396
+ }
39388
39397
  let cellsTypes = new Set();
39389
39398
  let cellsValues = [];
39390
39399
  for (let cell of cells) {
@@ -45526,6 +45535,6 @@ exports.setTranslationMethod = setTranslationMethod;
45526
45535
  exports.tokenize = tokenize;
45527
45536
 
45528
45537
 
45529
- __info__.version = '16.2.19';
45530
- __info__.date = '2023-10-19T14:22:48.890Z';
45531
- __info__.hash = '79980d5';
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({
@@ -19394,7 +19394,7 @@ class ClientTag extends Component {
19394
19394
  left: `${x - 1}px`,
19395
19395
  border: `1px solid ${color}`,
19396
19396
  "background-color": color,
19397
- opacity: this.props.active ? "opacity:1 !important" : undefined,
19397
+ opacity: this.props.active ? "1 !important" : undefined,
19398
19398
  });
19399
19399
  }
19400
19400
  }
@@ -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
@@ -39376,11 +39377,19 @@ class GridSelectionPlugin extends UIPlugin {
39376
39377
  }
39377
39378
  }
39378
39379
  getStatisticFnResults() {
39379
- // get deduplicated cells in zones
39380
- const cells = new Set(this.gridSelection.zones
39381
- .map((zone) => this.getters.getEvaluatedCellsInZone(this.getters.getActiveSheetId(), zone))
39382
- .flat()
39383
- .filter((cell) => cell.type !== CellValueType.empty));
39380
+ const sheetId = this.getters.getActiveSheetId();
39381
+ const cells = new Set();
39382
+ for (const zone of this.gridSelection.zones) {
39383
+ for (const { col, row } of positions(zone)) {
39384
+ if (this.getters.isRowHidden(sheetId, row) || this.getters.isColHidden(sheetId, col)) {
39385
+ continue; // Skip hidden cells
39386
+ }
39387
+ const evaluatedCell = this.getters.getEvaluatedCell({ sheetId, col, row });
39388
+ if (evaluatedCell.type !== CellValueType.empty) {
39389
+ cells.add(evaluatedCell);
39390
+ }
39391
+ }
39392
+ }
39384
39393
  let cellsTypes = new Set();
39385
39394
  let cellsValues = [];
39386
39395
  for (let cell of cells) {
@@ -45494,6 +45503,6 @@ function addFunction(functionName, functionDescription) {
45494
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 };
45495
45504
 
45496
45505
 
45497
- __info__.version = '16.2.19';
45498
- __info__.date = '2023-10-19T14:22:48.890Z';
45499
- __info__.hash = '79980d5';
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({
@@ -19395,7 +19395,7 @@
19395
19395
  left: `${x - 1}px`,
19396
19396
  border: `1px solid ${color}`,
19397
19397
  "background-color": color,
19398
- opacity: this.props.active ? "opacity:1 !important" : undefined,
19398
+ opacity: this.props.active ? "1 !important" : undefined,
19399
19399
  });
19400
19400
  }
19401
19401
  }
@@ -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
@@ -39377,11 +39378,19 @@
39377
39378
  }
39378
39379
  }
39379
39380
  getStatisticFnResults() {
39380
- // get deduplicated cells in zones
39381
- const cells = new Set(this.gridSelection.zones
39382
- .map((zone) => this.getters.getEvaluatedCellsInZone(this.getters.getActiveSheetId(), zone))
39383
- .flat()
39384
- .filter((cell) => cell.type !== CellValueType.empty));
39381
+ const sheetId = this.getters.getActiveSheetId();
39382
+ const cells = new Set();
39383
+ for (const zone of this.gridSelection.zones) {
39384
+ for (const { col, row } of positions(zone)) {
39385
+ if (this.getters.isRowHidden(sheetId, row) || this.getters.isColHidden(sheetId, col)) {
39386
+ continue; // Skip hidden cells
39387
+ }
39388
+ const evaluatedCell = this.getters.getEvaluatedCell({ sheetId, col, row });
39389
+ if (evaluatedCell.type !== CellValueType.empty) {
39390
+ cells.add(evaluatedCell);
39391
+ }
39392
+ }
39393
+ }
39385
39394
  let cellsTypes = new Set();
39386
39395
  let cellsValues = [];
39387
39396
  for (let cell of cells) {
@@ -45525,9 +45534,9 @@
45525
45534
  Object.defineProperty(exports, '__esModule', { value: true });
45526
45535
 
45527
45536
 
45528
- __info__.version = '16.2.19';
45529
- __info__.date = '2023-10-19T14:22:48.890Z';
45530
- __info__.hash = '79980d5';
45537
+ __info__.version = '16.2.21';
45538
+ __info__.date = '2023-11-02T09:31:50.545Z';
45539
+ __info__.hash = 'cc30e85';
45531
45540
 
45532
45541
 
45533
45542
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);