@odoo/o-spreadsheet 16.1.25 → 16.1.27

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.
@@ -4707,7 +4707,7 @@ function createGaugeChartRuntime(chart, getters) {
4707
4707
  });
4708
4708
  return {
4709
4709
  chartJsConfig: config,
4710
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
4710
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
4711
4711
  };
4712
4712
  }
4713
4713
 
@@ -5384,7 +5384,7 @@ function createScorecardChartRuntime(chart, getters) {
5384
5384
  };
5385
5385
  baselineCell = getters.getEvaluatedCell(baselinePosition);
5386
5386
  }
5387
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
5387
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
5388
5388
  return {
5389
5389
  title: _t(chart.title),
5390
5390
  keyValue: formattedKeyValue || keyValue,
@@ -5392,7 +5392,7 @@ function createScorecardChartRuntime(chart, getters) {
5392
5392
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
5393
5393
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
5394
5394
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
5395
- fontColor: chartFontColor(background),
5395
+ fontColor,
5396
5396
  background,
5397
5397
  baselineStyle: chart.baselineMode !== "percentage" && baseline
5398
5398
  ? getters.getCellStyle({
@@ -21761,7 +21761,7 @@ css /* scss */ `
21761
21761
  }
21762
21762
  .o-input-count {
21763
21763
  width: fit-content;
21764
- padding: 4 0 4 4;
21764
+ padding: 4px 0 4px 4px;
21765
21765
  }
21766
21766
  }
21767
21767
  }
@@ -29760,6 +29760,13 @@ class FiltersPlugin extends CorePlugin {
29760
29760
  }
29761
29761
  onDeleteColumnsRows(cmd) {
29762
29762
  for (const table of this.getFilterTables(cmd.sheetId)) {
29763
+ // Remove the filter tables whose data filter headers are in the removed rows.
29764
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
29765
+ const tables = { ...this.tables[cmd.sheetId] };
29766
+ delete tables[table.id];
29767
+ this.history.update("tables", cmd.sheetId, tables);
29768
+ continue;
29769
+ }
29763
29770
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
29764
29771
  if (!zone) {
29765
29772
  const tables = { ...this.tables[cmd.sheetId] };
@@ -29929,7 +29936,11 @@ class HeaderSizePlugin extends CorePlugin {
29929
29936
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
29930
29937
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
29931
29938
  const baseSize = sizes[cmd.base];
29932
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
29939
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
29940
+ manualSize: baseSize.manualSize,
29941
+ computedSize: lazy(baseSize.computedSize()),
29942
+ }));
29943
+ sizes.splice(addIndex, 0, ...sizesToInsert);
29933
29944
  sizes = sizes.map((size, row) => {
29934
29945
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
29935
29946
  // invalidate sizes
@@ -32662,28 +32673,29 @@ class EvaluationChartPlugin extends UIPlugin {
32662
32673
  return this.charts[figureId];
32663
32674
  }
32664
32675
  /**
32665
- * Get the background color of a chart based on the color of the first cell of the main range
32666
- * of the chart. In order of priority, it will return :
32667
- *
32668
- * - the chart background color if one is defined
32669
- * - the fill color of the cell if one is defined
32670
- * - the fill color of the cell from conditional formats if one is defined
32671
- * - the default chart color if no other color is defined
32676
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32672
32677
  */
32673
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32678
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32674
32679
  if (chartBackground)
32675
- return chartBackground;
32680
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32676
32681
  if (!mainRange) {
32677
- return BACKGROUND_CHART_COLOR;
32682
+ return {
32683
+ background: BACKGROUND_CHART_COLOR,
32684
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32685
+ };
32678
32686
  }
32679
32687
  const col = mainRange.zone.left;
32680
32688
  const row = mainRange.zone.top;
32681
32689
  const sheetId = mainRange.sheetId;
32682
32690
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32683
- return style.fillColor || BACKGROUND_CHART_COLOR;
32691
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32692
+ return {
32693
+ background,
32694
+ fontColor: style.textColor || chartFontColor(background),
32695
+ };
32684
32696
  }
32685
32697
  }
32686
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32698
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32687
32699
 
32688
32700
  // -----------------------------------------------------------------------------
32689
32701
  // Constants
@@ -33094,6 +33106,8 @@ class FilterEvaluationPlugin extends UIPlugin {
33094
33106
  case "EVALUATE_CELLS":
33095
33107
  case "ACTIVATE_SHEET":
33096
33108
  case "REMOVE_FILTER_TABLE":
33109
+ case "ADD_COLUMNS_ROWS":
33110
+ case "REMOVE_COLUMNS_ROWS":
33097
33111
  this.isEvaluationDirty = true;
33098
33112
  break;
33099
33113
  case "START":
@@ -44435,6 +44449,6 @@ exports.setTranslationMethod = setTranslationMethod;
44435
44449
  exports.tokenize = tokenize;
44436
44450
 
44437
44451
 
44438
- __info__.version = '16.1.25';
44439
- __info__.date = '2023-10-25T10:02:09.978Z';
44440
- __info__.hash = '708e3d8';
44452
+ __info__.version = '16.1.27';
44453
+ __info__.date = '2023-11-16T11:57:02.419Z';
44454
+ __info__.hash = '81f7214';
@@ -3831,22 +3831,20 @@ declare class EvaluationPlugin extends UIPlugin {
3831
3831
  private isBadExpression;
3832
3832
  }
3833
3833
 
3834
+ interface EvaluationChartStyle {
3835
+ background: Color;
3836
+ fontColor: Color;
3837
+ }
3834
3838
  declare class EvaluationChartPlugin extends UIPlugin {
3835
- static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
3839
+ static getters: readonly ["getChartRuntime", "getStyleOfSingleCellChart"];
3836
3840
  readonly charts: Record<UID, ChartRuntime | undefined>;
3837
3841
  private createRuntimeChart;
3838
3842
  handle(cmd: Command): void;
3839
3843
  getChartRuntime(figureId: UID): ChartRuntime;
3840
3844
  /**
3841
- * Get the background color of a chart based on the color of the first cell of the main range
3842
- * of the chart. In order of priority, it will return :
3843
- *
3844
- * - the chart background color if one is defined
3845
- * - the fill color of the cell if one is defined
3846
- * - the fill color of the cell from conditional formats if one is defined
3847
- * - the default chart color if no other color is defined
3845
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
3848
3846
  */
3849
- getBackgroundOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): Color;
3847
+ getStyleOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): EvaluationChartStyle;
3850
3848
  }
3851
3849
 
3852
3850
  declare class EvaluationConditionalFormatPlugin extends UIPlugin {
@@ -4703,7 +4703,7 @@ function createGaugeChartRuntime(chart, getters) {
4703
4703
  });
4704
4704
  return {
4705
4705
  chartJsConfig: config,
4706
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
4706
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
4707
4707
  };
4708
4708
  }
4709
4709
 
@@ -5380,7 +5380,7 @@ function createScorecardChartRuntime(chart, getters) {
5380
5380
  };
5381
5381
  baselineCell = getters.getEvaluatedCell(baselinePosition);
5382
5382
  }
5383
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
5383
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
5384
5384
  return {
5385
5385
  title: _t(chart.title),
5386
5386
  keyValue: formattedKeyValue || keyValue,
@@ -5388,7 +5388,7 @@ function createScorecardChartRuntime(chart, getters) {
5388
5388
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
5389
5389
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
5390
5390
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
5391
- fontColor: chartFontColor(background),
5391
+ fontColor,
5392
5392
  background,
5393
5393
  baselineStyle: chart.baselineMode !== "percentage" && baseline
5394
5394
  ? getters.getCellStyle({
@@ -21757,7 +21757,7 @@ css /* scss */ `
21757
21757
  }
21758
21758
  .o-input-count {
21759
21759
  width: fit-content;
21760
- padding: 4 0 4 4;
21760
+ padding: 4px 0 4px 4px;
21761
21761
  }
21762
21762
  }
21763
21763
  }
@@ -29756,6 +29756,13 @@ class FiltersPlugin extends CorePlugin {
29756
29756
  }
29757
29757
  onDeleteColumnsRows(cmd) {
29758
29758
  for (const table of this.getFilterTables(cmd.sheetId)) {
29759
+ // Remove the filter tables whose data filter headers are in the removed rows.
29760
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
29761
+ const tables = { ...this.tables[cmd.sheetId] };
29762
+ delete tables[table.id];
29763
+ this.history.update("tables", cmd.sheetId, tables);
29764
+ continue;
29765
+ }
29759
29766
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
29760
29767
  if (!zone) {
29761
29768
  const tables = { ...this.tables[cmd.sheetId] };
@@ -29925,7 +29932,11 @@ class HeaderSizePlugin extends CorePlugin {
29925
29932
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
29926
29933
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
29927
29934
  const baseSize = sizes[cmd.base];
29928
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
29935
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
29936
+ manualSize: baseSize.manualSize,
29937
+ computedSize: lazy(baseSize.computedSize()),
29938
+ }));
29939
+ sizes.splice(addIndex, 0, ...sizesToInsert);
29929
29940
  sizes = sizes.map((size, row) => {
29930
29941
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
29931
29942
  // invalidate sizes
@@ -32658,28 +32669,29 @@ class EvaluationChartPlugin extends UIPlugin {
32658
32669
  return this.charts[figureId];
32659
32670
  }
32660
32671
  /**
32661
- * Get the background color of a chart based on the color of the first cell of the main range
32662
- * of the chart. In order of priority, it will return :
32663
- *
32664
- * - the chart background color if one is defined
32665
- * - the fill color of the cell if one is defined
32666
- * - the fill color of the cell from conditional formats if one is defined
32667
- * - the default chart color if no other color is defined
32672
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32668
32673
  */
32669
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32674
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32670
32675
  if (chartBackground)
32671
- return chartBackground;
32676
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32672
32677
  if (!mainRange) {
32673
- return BACKGROUND_CHART_COLOR;
32678
+ return {
32679
+ background: BACKGROUND_CHART_COLOR,
32680
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32681
+ };
32674
32682
  }
32675
32683
  const col = mainRange.zone.left;
32676
32684
  const row = mainRange.zone.top;
32677
32685
  const sheetId = mainRange.sheetId;
32678
32686
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32679
- return style.fillColor || BACKGROUND_CHART_COLOR;
32687
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32688
+ return {
32689
+ background,
32690
+ fontColor: style.textColor || chartFontColor(background),
32691
+ };
32680
32692
  }
32681
32693
  }
32682
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32694
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32683
32695
 
32684
32696
  // -----------------------------------------------------------------------------
32685
32697
  // Constants
@@ -33090,6 +33102,8 @@ class FilterEvaluationPlugin extends UIPlugin {
33090
33102
  case "EVALUATE_CELLS":
33091
33103
  case "ACTIVATE_SHEET":
33092
33104
  case "REMOVE_FILTER_TABLE":
33105
+ case "ADD_COLUMNS_ROWS":
33106
+ case "REMOVE_COLUMNS_ROWS":
33093
33107
  this.isEvaluationDirty = true;
33094
33108
  break;
33095
33109
  case "START":
@@ -44403,6 +44417,6 @@ function addFunction(functionName, functionDescription) {
44403
44417
  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 };
44404
44418
 
44405
44419
 
44406
- __info__.version = '16.1.25';
44407
- __info__.date = '2023-10-25T10:02:09.978Z';
44408
- __info__.hash = '708e3d8';
44420
+ __info__.version = '16.1.27';
44421
+ __info__.date = '2023-11-16T11:57:02.419Z';
44422
+ __info__.hash = '81f7214';
@@ -4704,7 +4704,7 @@
4704
4704
  });
4705
4705
  return {
4706
4706
  chartJsConfig: config,
4707
- background: getters.getBackgroundOfSingleCellChart(chart.background, dataRange),
4707
+ background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
4708
4708
  };
4709
4709
  }
4710
4710
 
@@ -5381,7 +5381,7 @@
5381
5381
  };
5382
5382
  baselineCell = getters.getEvaluatedCell(baselinePosition);
5383
5383
  }
5384
- const background = getters.getBackgroundOfSingleCellChart(chart.background, chart.keyValue);
5384
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(chart.background, chart.keyValue);
5385
5385
  return {
5386
5386
  title: _t(chart.title),
5387
5387
  keyValue: formattedKeyValue || keyValue,
@@ -5389,7 +5389,7 @@
5389
5389
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
5390
5390
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
5391
5391
  baselineDescr: chart.baselineDescr ? _t(chart.baselineDescr) : "",
5392
- fontColor: chartFontColor(background),
5392
+ fontColor,
5393
5393
  background,
5394
5394
  baselineStyle: chart.baselineMode !== "percentage" && baseline
5395
5395
  ? getters.getCellStyle({
@@ -21758,7 +21758,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
21758
21758
  }
21759
21759
  .o-input-count {
21760
21760
  width: fit-content;
21761
- padding: 4 0 4 4;
21761
+ padding: 4px 0 4px 4px;
21762
21762
  }
21763
21763
  }
21764
21764
  }
@@ -29757,6 +29757,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29757
29757
  }
29758
29758
  onDeleteColumnsRows(cmd) {
29759
29759
  for (const table of this.getFilterTables(cmd.sheetId)) {
29760
+ // Remove the filter tables whose data filter headers are in the removed rows.
29761
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
29762
+ const tables = { ...this.tables[cmd.sheetId] };
29763
+ delete tables[table.id];
29764
+ this.history.update("tables", cmd.sheetId, tables);
29765
+ continue;
29766
+ }
29760
29767
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
29761
29768
  if (!zone) {
29762
29769
  const tables = { ...this.tables[cmd.sheetId] };
@@ -29926,7 +29933,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29926
29933
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
29927
29934
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
29928
29935
  const baseSize = sizes[cmd.base];
29929
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
29936
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
29937
+ manualSize: baseSize.manualSize,
29938
+ computedSize: lazy(baseSize.computedSize()),
29939
+ }));
29940
+ sizes.splice(addIndex, 0, ...sizesToInsert);
29930
29941
  sizes = sizes.map((size, row) => {
29931
29942
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
29932
29943
  // invalidate sizes
@@ -32659,28 +32670,29 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32659
32670
  return this.charts[figureId];
32660
32671
  }
32661
32672
  /**
32662
- * Get the background color of a chart based on the color of the first cell of the main range
32663
- * of the chart. In order of priority, it will return :
32664
- *
32665
- * - the chart background color if one is defined
32666
- * - the fill color of the cell if one is defined
32667
- * - the fill color of the cell from conditional formats if one is defined
32668
- * - the default chart color if no other color is defined
32673
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
32669
32674
  */
32670
- getBackgroundOfSingleCellChart(chartBackground, mainRange) {
32675
+ getStyleOfSingleCellChart(chartBackground, mainRange) {
32671
32676
  if (chartBackground)
32672
- return chartBackground;
32677
+ return { background: chartBackground, fontColor: chartFontColor(chartBackground) };
32673
32678
  if (!mainRange) {
32674
- return BACKGROUND_CHART_COLOR;
32679
+ return {
32680
+ background: BACKGROUND_CHART_COLOR,
32681
+ fontColor: chartFontColor(BACKGROUND_CHART_COLOR),
32682
+ };
32675
32683
  }
32676
32684
  const col = mainRange.zone.left;
32677
32685
  const row = mainRange.zone.top;
32678
32686
  const sheetId = mainRange.sheetId;
32679
32687
  const style = this.getters.getCellComputedStyle({ sheetId, col, row });
32680
- return style.fillColor || BACKGROUND_CHART_COLOR;
32688
+ const background = style.fillColor || BACKGROUND_CHART_COLOR;
32689
+ return {
32690
+ background,
32691
+ fontColor: style.textColor || chartFontColor(background),
32692
+ };
32681
32693
  }
32682
32694
  }
32683
- EvaluationChartPlugin.getters = ["getChartRuntime", "getBackgroundOfSingleCellChart"];
32695
+ EvaluationChartPlugin.getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
32684
32696
 
32685
32697
  // -----------------------------------------------------------------------------
32686
32698
  // Constants
@@ -33091,6 +33103,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
33091
33103
  case "EVALUATE_CELLS":
33092
33104
  case "ACTIVATE_SHEET":
33093
33105
  case "REMOVE_FILTER_TABLE":
33106
+ case "ADD_COLUMNS_ROWS":
33107
+ case "REMOVE_COLUMNS_ROWS":
33094
33108
  this.isEvaluationDirty = true;
33095
33109
  break;
33096
33110
  case "START":
@@ -44434,9 +44448,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44434
44448
  Object.defineProperty(exports, '__esModule', { value: true });
44435
44449
 
44436
44450
 
44437
- __info__.version = '16.1.25';
44438
- __info__.date = '2023-10-25T10:02:09.978Z';
44439
- __info__.hash = '708e3d8';
44451
+ __info__.version = '16.1.27';
44452
+ __info__.date = '2023-11-16T11:57:02.419Z';
44453
+ __info__.hash = '81f7214';
44440
44454
 
44441
44455
 
44442
44456
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);