@odoo/o-spreadsheet 16.2.20 → 16.2.22

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({
@@ -18736,7 +18736,7 @@ css /* scss */ `
18736
18736
  }
18737
18737
  .o-input-count {
18738
18738
  width: fit-content;
18739
- padding: 4 0 4 4;
18739
+ padding: 4px 0 4px 4px;
18740
18740
  }
18741
18741
  }
18742
18742
  }
@@ -29331,6 +29331,13 @@ class FiltersPlugin extends CorePlugin {
29331
29331
  }
29332
29332
  onDeleteColumnsRows(cmd) {
29333
29333
  for (const table of this.getFilterTables(cmd.sheetId)) {
29334
+ // Remove the filter tables whose data filter headers are in the removed rows.
29335
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
29336
+ const tables = { ...this.tables[cmd.sheetId] };
29337
+ delete tables[table.id];
29338
+ this.history.update("tables", cmd.sheetId, tables);
29339
+ continue;
29340
+ }
29334
29341
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
29335
29342
  if (!zone) {
29336
29343
  const tables = { ...this.tables[cmd.sheetId] };
@@ -32270,28 +32277,29 @@ class EvaluationChartPlugin extends UIPlugin {
32270
32277
  return this.charts[figureId];
32271
32278
  }
32272
32279
  /**
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
32280
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32280
32281
  */
32281
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32282
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32282
32283
  if (chartBackground)
32283
- return chartBackground;
32284
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32284
32285
  if (!mainRange) {
32285
- return BACKGROUND_CHART_COLOR;
32286
+ return {
32287
+ background: BACKGROUND_CHART_COLOR,
32288
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32289
+ };
32286
32290
  }
32287
32291
  const col = mainRange.zone.left;
32288
32292
  const row = mainRange.zone.top;
32289
32293
  const sheetId = mainRange.sheetId;
32290
32294
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32291
- return style.fillColor || BACKGROUND_CHART_COLOR;
32295
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32296
+ return {
32297
+ background,
32298
+ fontColor: style.textColor || chartFontColor(background),
32299
+ };
32292
32300
  }
32293
32301
  }
32294
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32302
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32295
32303
 
32296
32304
  // -----------------------------------------------------------------------------
32297
32305
  // Constants
@@ -32702,6 +32710,8 @@ class FilterEvaluationPlugin extends UIPlugin {
32702
32710
  case "EVALUATE_CELLS":
32703
32711
  case "ACTIVATE_SHEET":
32704
32712
  case "REMOVE_FILTER_TABLE":
32713
+ case "ADD_COLUMNS_ROWS":
32714
+ case "REMOVE_COLUMNS_ROWS":
32705
32715
  this.isEvaluationDirty = true;
32706
32716
  break;
32707
32717
  case "START":
@@ -45534,6 +45544,6 @@ exports.setTranslationMethod = setTranslationMethod;
45534
45544
  exports.tokenize = tokenize;
45535
45545
 
45536
45546
 
45537
- __info__.version = '16.2.20';
45538
- __info__.date = '2023-10-25T10:00:14.966Z';
45539
- __info__.hash = '25a402d';
45547
+ __info__.version = '16.2.22';
45548
+ __info__.date = '2023-11-16T11:57:01.482Z';
45549
+ __info__.hash = 'b78d5dd';
@@ -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({
@@ -18732,7 +18732,7 @@ css /* scss */ `
18732
18732
  }
18733
18733
  .o-input-count {
18734
18734
  width: fit-content;
18735
- padding: 4 0 4 4;
18735
+ padding: 4px 0 4px 4px;
18736
18736
  }
18737
18737
  }
18738
18738
  }
@@ -29327,6 +29327,13 @@ class FiltersPlugin extends CorePlugin {
29327
29327
  }
29328
29328
  onDeleteColumnsRows(cmd) {
29329
29329
  for (const table of this.getFilterTables(cmd.sheetId)) {
29330
+ // Remove the filter tables whose data filter headers are in the removed rows.
29331
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
29332
+ const tables = { ...this.tables[cmd.sheetId] };
29333
+ delete tables[table.id];
29334
+ this.history.update("tables", cmd.sheetId, tables);
29335
+ continue;
29336
+ }
29330
29337
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
29331
29338
  if (!zone) {
29332
29339
  const tables = { ...this.tables[cmd.sheetId] };
@@ -32266,28 +32273,29 @@ class EvaluationChartPlugin extends UIPlugin {
32266
32273
  return this.charts[figureId];
32267
32274
  }
32268
32275
  /**
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
32276
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32276
32277
  */
32277
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32278
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32278
32279
  if (chartBackground)
32279
- return chartBackground;
32280
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32280
32281
  if (!mainRange) {
32281
- return BACKGROUND_CHART_COLOR;
32282
+ return {
32283
+ background: BACKGROUND_CHART_COLOR,
32284
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32285
+ };
32282
32286
  }
32283
32287
  const col = mainRange.zone.left;
32284
32288
  const row = mainRange.zone.top;
32285
32289
  const sheetId = mainRange.sheetId;
32286
32290
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32287
- return style.fillColor || BACKGROUND_CHART_COLOR;
32291
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32292
+ return {
32293
+ background,
32294
+ fontColor: style.textColor || chartFontColor(background),
32295
+ };
32288
32296
  }
32289
32297
  }
32290
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32298
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32291
32299
 
32292
32300
  // -----------------------------------------------------------------------------
32293
32301
  // Constants
@@ -32698,6 +32706,8 @@ class FilterEvaluationPlugin extends UIPlugin {
32698
32706
  case "EVALUATE_CELLS":
32699
32707
  case "ACTIVATE_SHEET":
32700
32708
  case "REMOVE_FILTER_TABLE":
32709
+ case "ADD_COLUMNS_ROWS":
32710
+ case "REMOVE_COLUMNS_ROWS":
32701
32711
  this.isEvaluationDirty = true;
32702
32712
  break;
32703
32713
  case "START":
@@ -45502,6 +45512,6 @@ function addFunction(functionName, functionDescription) {
45502
45512
  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
45513
 
45504
45514
 
45505
- __info__.version = '16.2.20';
45506
- __info__.date = '2023-10-25T10:00:14.966Z';
45507
- __info__.hash = '25a402d';
45515
+ __info__.version = '16.2.22';
45516
+ __info__.date = '2023-11-16T11:57:01.482Z';
45517
+ __info__.hash = 'b78d5dd';
@@ -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({
@@ -18733,7 +18733,7 @@
18733
18733
  }
18734
18734
  .o-input-count {
18735
18735
  width: fit-content;
18736
- padding: 4 0 4 4;
18736
+ padding: 4px 0 4px 4px;
18737
18737
  }
18738
18738
  }
18739
18739
  }
@@ -29328,6 +29328,13 @@
29328
29328
  }
29329
29329
  onDeleteColumnsRows(cmd) {
29330
29330
  for (const table of this.getFilterTables(cmd.sheetId)) {
29331
+ // Remove the filter tables whose data filter headers are in the removed rows.
29332
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
29333
+ const tables = { ...this.tables[cmd.sheetId] };
29334
+ delete tables[table.id];
29335
+ this.history.update("tables", cmd.sheetId, tables);
29336
+ continue;
29337
+ }
29331
29338
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
29332
29339
  if (!zone) {
29333
29340
  const tables = { ...this.tables[cmd.sheetId] };
@@ -32267,28 +32274,29 @@
32267
32274
  return this.charts[figureId];
32268
32275
  }
32269
32276
  /**
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
32277
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32277
32278
  */
32278
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32279
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32279
32280
  if (chartBackground)
32280
- return chartBackground;
32281
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32281
32282
  if (!mainRange) {
32282
- return BACKGROUND_CHART_COLOR;
32283
+ return {
32284
+ background: BACKGROUND_CHART_COLOR,
32285
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32286
+ };
32283
32287
  }
32284
32288
  const col = mainRange.zone.left;
32285
32289
  const row = mainRange.zone.top;
32286
32290
  const sheetId = mainRange.sheetId;
32287
32291
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32288
- return style.fillColor || BACKGROUND_CHART_COLOR;
32292
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32293
+ return {
32294
+ background,
32295
+ fontColor: style.textColor || chartFontColor(background),
32296
+ };
32289
32297
  }
32290
32298
  }
32291
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32299
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32292
32300
 
32293
32301
  // -----------------------------------------------------------------------------
32294
32302
  // Constants
@@ -32699,6 +32707,8 @@
32699
32707
  case "EVALUATE_CELLS":
32700
32708
  case "ACTIVATE_SHEET":
32701
32709
  case "REMOVE_FILTER_TABLE":
32710
+ case "ADD_COLUMNS_ROWS":
32711
+ case "REMOVE_COLUMNS_ROWS":
32702
32712
  this.isEvaluationDirty = true;
32703
32713
  break;
32704
32714
  case "START":
@@ -45533,9 +45543,9 @@
45533
45543
  Object.defineProperty(exports, '__esModule', { value: true });
45534
45544
 
45535
45545
 
45536
- __info__.version = '16.2.20';
45537
- __info__.date = '2023-10-25T10:00:14.966Z';
45538
- __info__.hash = '25a402d';
45546
+ __info__.version = '16.2.22';
45547
+ __info__.date = '2023-11-16T11:57:01.482Z';
45548
+ __info__.hash = 'b78d5dd';
45539
45549
 
45540
45550
 
45541
45551
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);