@odoo/o-spreadsheet 17.4.0-alpha.4 → 17.4.0-alpha.5

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.4.0-alpha.4
7
- * @date 2024-06-12T14:00:22.046Z
8
- * @hash cefb0e4
6
+ * @version 17.4.0-alpha.5
7
+ * @date 2024-06-14T10:01:40.605Z
8
+ * @hash 9ceed96
9
9
  */
10
10
 
11
11
  'use strict';
@@ -5284,7 +5284,7 @@ function clipTextWithEllipsis(ctx, text, maxWidth) {
5284
5284
  return text;
5285
5285
  }
5286
5286
  const ellipsis = "…";
5287
- const ellipsisWidth = computeCachedTextWidth(ctx, text);
5287
+ const ellipsisWidth = computeCachedTextWidth(ctx, ellipsis);
5288
5288
  if (width <= ellipsisWidth) {
5289
5289
  return text;
5290
5290
  }
@@ -10424,6 +10424,7 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
10424
10424
  function drawScoreChart(structure, canvas) {
10425
10425
  const ctx = canvas.getContext("2d");
10426
10426
  canvas.width = structure.canvas.width;
10427
+ const availableWidth = canvas.width - DEFAULT_CHART_PADDING;
10427
10428
  canvas.height = structure.canvas.height;
10428
10429
  ctx.fillStyle = structure.canvas.backgroundColor;
10429
10430
  ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
@@ -10432,7 +10433,7 @@ function drawScoreChart(structure, canvas) {
10432
10433
  ctx.fillStyle = structure.title.style.color;
10433
10434
  const baseline = ctx.textBaseline;
10434
10435
  ctx.textBaseline = "middle";
10435
- ctx.fillText(clipTextWithEllipsis(ctx, structure.title.text, canvas.width - structure.title.position.x), structure.title.position.x, structure.title.position.y);
10436
+ ctx.fillText(clipTextWithEllipsis(ctx, structure.title.text, availableWidth - structure.title.position.x), structure.title.position.x, structure.title.position.y);
10436
10437
  ctx.textBaseline = baseline;
10437
10438
  }
10438
10439
  if (structure.baseline) {
@@ -10522,13 +10523,16 @@ function createScorecardChartRuntime(chart, getters) {
10522
10523
  return {
10523
10524
  title: {
10524
10525
  ...chart.title,
10526
+ // chart titles are extracted from .json files and they are translated at runtime here
10525
10527
  text: _t(chart.title.text ?? ""),
10526
10528
  },
10527
10529
  keyValue: formattedKeyValue,
10528
10530
  baselineDisplay,
10529
10531
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
10530
10532
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
10531
- baselineDescr: chart.baselineMode !== "progress" && chart.baselineDescr ? _t(chart.baselineDescr) : "",
10533
+ baselineDescr: chart.baselineMode !== "progress" && chart.baselineDescr
10534
+ ? _t(chart.baselineDescr) // descriptions are extracted from .json files and they are translated at runtime here
10535
+ : "",
10532
10536
  fontColor,
10533
10537
  background,
10534
10538
  baselineStyle: chart.baselineMode !== "percentage" && chart.baselineMode !== "progress" && baseline
@@ -10557,7 +10561,7 @@ function createScorecardChartRuntime(chart, getters) {
10557
10561
  /* Sizes of boxes containing the texts, in percentage of the Chart size */
10558
10562
  const KEY_BOX_HEIGHT_RATIO = 0.8;
10559
10563
  /* Padding at the border of the chart */
10560
- const CHART_PADDING = DEFAULT_CHART_PADDING;
10564
+ const CHART_PADDING = 10;
10561
10565
  const BOTTOM_PADDING_RATIO = 0.05;
10562
10566
  /**
10563
10567
  * Line height (in em)
@@ -10707,6 +10711,7 @@ class ScorecardChartConfigBuilder {
10707
10711
  position: {
10708
10712
  x: (this.width - keyWidth) / 2,
10709
10713
  y: this.height * (0.5 - BOTTOM_PADDING_RATIO * 2) +
10714
+ CHART_PADDING / 2 +
10710
10715
  (titleHeight + keyHeight / (this.baseline || this.baselineDescr ? 2 : 1.2)) / 2,
10711
10716
  },
10712
10717
  };
@@ -10766,7 +10771,8 @@ class ScorecardChartConfigBuilder {
10766
10771
  const remainingWidth = maxLineWidth - baselineValueWidth;
10767
10772
  let baselineDescrFontSize = getFontSizeMatchingWidth(remainingWidth, baselineValueFontSize, (fontSize) => computeTextWidth(this.context, this.baselineDescr, { fontSize }));
10768
10773
  let isBaselineSplit = false;
10769
- if (baselineDescrFontSize < baselineValueFontSize / 2.5) {
10774
+ if (baselineDescrFontSize < baselineValueFontSize / 2.5 &&
10775
+ this.baselineDescr.trim().includes(" ")) {
10770
10776
  isBaselineSplit = true;
10771
10777
  baselineDescrFontSize = Math.floor(baselineValueFontSize / 2.5);
10772
10778
  for (const line of splitTextInTwoLines(this.baselineDescr)) {
@@ -10815,7 +10821,7 @@ class ScorecardChartConfigBuilder {
10815
10821
  /** Get the height of the chart minus all the vertical paddings */
10816
10822
  getDrawableHeight() {
10817
10823
  const verticalPadding = CHART_PADDING + this.height * BOTTOM_PADDING_RATIO;
10818
- let availableHeight = this.height - 2 * verticalPadding;
10824
+ let availableHeight = this.height - verticalPadding;
10819
10825
  availableHeight -= this.title ? DEFAULT_CHART_FONT_SIZE * LINE_HEIGHT : 0;
10820
10826
  return availableHeight;
10821
10827
  }
@@ -10857,6 +10863,11 @@ class ScorecardChart extends owl.Component {
10857
10863
  get runtime() {
10858
10864
  return this.env.model.getters.getChartRuntime(this.props.figure.id);
10859
10865
  }
10866
+ get title() {
10867
+ const title = this.env.model.getters.getChartDefinition(this.props.figure.id).title.text ?? "";
10868
+ // chart titles are extracted from .json files and they are translated at runtime here
10869
+ return _t(title);
10870
+ }
10860
10871
  setup() {
10861
10872
  owl.useEffect(this.createChart.bind(this), () => {
10862
10873
  const canvas = this.canvas.el;
@@ -31680,14 +31691,6 @@ class GaugeChartDesignPanel extends owl.Component {
31680
31691
  const cancelledReasons = [...(this.state.sectionRuleDispatchResult?.reasons || [])];
31681
31692
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
31682
31693
  }
31683
- updateBackgroundColor(color) {
31684
- this.props.updateChart(this.props.figureId, {
31685
- background: color,
31686
- });
31687
- }
31688
- updateTitle(content) {
31689
- this.props.updateChart(this.props.figureId, { title: { text: content } });
31690
- }
31691
31694
  isRangeMinInvalid() {
31692
31695
  return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin" /* CommandResult.EmptyGaugeRangeMin */) ||
31693
31696
  this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN" /* CommandResult.GaugeRangeMinNaN */) ||
@@ -31727,9 +31730,6 @@ class GaugeChartDesignPanel extends owl.Component {
31727
31730
  sectionRule,
31728
31731
  });
31729
31732
  }
31730
- get backgroundColorTitle() {
31731
- return ChartTerms.BackgroundColor;
31732
- }
31733
31733
  }
31734
31734
 
31735
31735
  class LineConfigPanel extends GenericChartConfigPanel {
@@ -31912,9 +31912,6 @@ class ScorecardChartDesignPanel extends owl.Component {
31912
31912
  get humanizeNumbersLabel() {
31913
31913
  return _t("Humanize numbers");
31914
31914
  }
31915
- updateTitle(content) {
31916
- this.props.updateChart(this.props.figureId, { title: { text: content } });
31917
- }
31918
31915
  updateHumanizeNumbers(humanize) {
31919
31916
  this.props.updateChart(this.props.figureId, { humanize });
31920
31917
  }
@@ -31937,9 +31934,6 @@ class ScorecardChartDesignPanel extends owl.Component {
31937
31934
  break;
31938
31935
  }
31939
31936
  }
31940
- get backgroundColorTitle() {
31941
- return ChartTerms.BackgroundColor;
31942
- }
31943
31937
  }
31944
31938
 
31945
31939
  class WaterfallChartDesignPanel extends owl.Component {
@@ -38621,7 +38615,7 @@ class FiguresContainer extends owl.Component {
38621
38615
  });
38622
38616
  }
38623
38617
  getContainerRect(container) {
38624
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
38618
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
38625
38619
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
38626
38620
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
38627
38621
  const width = viewWidth - x;
@@ -51122,22 +51116,6 @@ class PivotCorePlugin extends CorePlugin {
51122
51116
  this.addPivotFormula(cellPosition, formulaId, pivotCell);
51123
51117
  }
51124
51118
  }
51125
- const pivotZone = {
51126
- top: position.row,
51127
- bottom: position.row + pivotCells[0].length - 1,
51128
- left: position.col,
51129
- right: position.col + pivotCells.length - 1,
51130
- };
51131
- const numberOfHeaders = table.columns.length - 1;
51132
- const cmdContent = {
51133
- sheetId: position.sheetId,
51134
- ranges: [this.getters.getRangeDataFromZone(position.sheetId, pivotZone)],
51135
- config: { ...PIVOT_TABLE_CONFIG, numberOfHeaders },
51136
- tableType: "static",
51137
- };
51138
- if (this.canDispatch("CREATE_TABLE", cmdContent).isSuccessful) {
51139
- this.dispatch("CREATE_TABLE", cmdContent);
51140
- }
51141
51119
  }
51142
51120
  resizeSheet(sheetId, { col, row }, table) {
51143
51121
  const colLimit = table.getNumberOfDataColumns() + 1; // +1 for the Top-Left
@@ -55909,6 +55887,9 @@ class Session extends EventBus {
55909
55887
  * Send a snapshot of the spreadsheet to the collaboration server
55910
55888
  */
55911
55889
  snapshot(data) {
55890
+ if (this.pendingMessages.length !== 0) {
55891
+ return;
55892
+ }
55912
55893
  const snapshotId = this.uuidGenerator.uuidv4();
55913
55894
  this.transportService.sendMessage({
55914
55895
  type: "SNAPSHOT",
@@ -67021,6 +67002,6 @@ exports.tokenColors = tokenColors;
67021
67002
  exports.tokenize = tokenize;
67022
67003
 
67023
67004
 
67024
- __info__.version = "17.4.0-alpha.4";
67025
- __info__.date = "2024-06-12T14:00:22.046Z";
67026
- __info__.hash = "cefb0e4";
67005
+ __info__.version = "17.4.0-alpha.5";
67006
+ __info__.date = "2024-06-14T10:01:40.605Z";
67007
+ __info__.hash = "9ceed96";
@@ -7139,8 +7139,6 @@ declare class GaugeChartDesignPanel extends Component<Props$N, SpreadsheetChildE
7139
7139
  protected state: PanelState;
7140
7140
  setup(): void;
7141
7141
  get designErrorMessages(): string[];
7142
- updateBackgroundColor(color: Color): void;
7143
- updateTitle(content: string): void;
7144
7142
  isRangeMinInvalid(): boolean;
7145
7143
  isRangeMaxInvalid(): boolean;
7146
7144
  get isLowerInflectionPointInvalid(): boolean;
@@ -7148,7 +7146,6 @@ declare class GaugeChartDesignPanel extends Component<Props$N, SpreadsheetChildE
7148
7146
  updateSectionColor(target: string, color: Color): void;
7149
7147
  updateSectionRule(sectionRule: SectionRule): void;
7150
7148
  canUpdateSectionRule(sectionRule: SectionRule): void;
7151
- get backgroundColorTitle(): string;
7152
7149
  }
7153
7150
 
7154
7151
  declare class LineConfigPanel extends GenericChartConfigPanel {
@@ -7229,12 +7226,10 @@ declare class ScorecardChartDesignPanel extends Component<Props$L, SpreadsheetCh
7229
7226
  };
7230
7227
  get colorsSectionTitle(): string;
7231
7228
  get humanizeNumbersLabel(): string;
7232
- updateTitle(content: string): void;
7233
7229
  updateHumanizeNumbers(humanize: boolean): void;
7234
7230
  translate(term: any): string;
7235
7231
  updateBaselineDescr(ev: any): void;
7236
7232
  setColor(color: Color, colorPickerId: ColorPickerId): void;
7237
- get backgroundColorTitle(): string;
7238
7233
  }
7239
7234
 
7240
7235
  interface ChartSidePanel {
@@ -7825,6 +7820,7 @@ declare class ScorecardChart extends Component<Props$H, SpreadsheetChildEnv> {
7825
7820
  };
7826
7821
  private canvas;
7827
7822
  get runtime(): ScorecardChartRuntime;
7823
+ get title(): string;
7828
7824
  setup(): void;
7829
7825
  private createChart;
7830
7826
  }
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.4.0-alpha.4
7
- * @date 2024-06-12T14:00:22.046Z
8
- * @hash cefb0e4
6
+ * @version 17.4.0-alpha.5
7
+ * @date 2024-06-14T10:01:40.605Z
8
+ * @hash 9ceed96
9
9
  */
10
10
 
11
11
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -5282,7 +5282,7 @@ function clipTextWithEllipsis(ctx, text, maxWidth) {
5282
5282
  return text;
5283
5283
  }
5284
5284
  const ellipsis = "…";
5285
- const ellipsisWidth = computeCachedTextWidth(ctx, text);
5285
+ const ellipsisWidth = computeCachedTextWidth(ctx, ellipsis);
5286
5286
  if (width <= ellipsisWidth) {
5287
5287
  return text;
5288
5288
  }
@@ -10422,6 +10422,7 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
10422
10422
  function drawScoreChart(structure, canvas) {
10423
10423
  const ctx = canvas.getContext("2d");
10424
10424
  canvas.width = structure.canvas.width;
10425
+ const availableWidth = canvas.width - DEFAULT_CHART_PADDING;
10425
10426
  canvas.height = structure.canvas.height;
10426
10427
  ctx.fillStyle = structure.canvas.backgroundColor;
10427
10428
  ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
@@ -10430,7 +10431,7 @@ function drawScoreChart(structure, canvas) {
10430
10431
  ctx.fillStyle = structure.title.style.color;
10431
10432
  const baseline = ctx.textBaseline;
10432
10433
  ctx.textBaseline = "middle";
10433
- ctx.fillText(clipTextWithEllipsis(ctx, structure.title.text, canvas.width - structure.title.position.x), structure.title.position.x, structure.title.position.y);
10434
+ ctx.fillText(clipTextWithEllipsis(ctx, structure.title.text, availableWidth - structure.title.position.x), structure.title.position.x, structure.title.position.y);
10434
10435
  ctx.textBaseline = baseline;
10435
10436
  }
10436
10437
  if (structure.baseline) {
@@ -10520,13 +10521,16 @@ function createScorecardChartRuntime(chart, getters) {
10520
10521
  return {
10521
10522
  title: {
10522
10523
  ...chart.title,
10524
+ // chart titles are extracted from .json files and they are translated at runtime here
10523
10525
  text: _t(chart.title.text ?? ""),
10524
10526
  },
10525
10527
  keyValue: formattedKeyValue,
10526
10528
  baselineDisplay,
10527
10529
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
10528
10530
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
10529
- baselineDescr: chart.baselineMode !== "progress" && chart.baselineDescr ? _t(chart.baselineDescr) : "",
10531
+ baselineDescr: chart.baselineMode !== "progress" && chart.baselineDescr
10532
+ ? _t(chart.baselineDescr) // descriptions are extracted from .json files and they are translated at runtime here
10533
+ : "",
10530
10534
  fontColor,
10531
10535
  background,
10532
10536
  baselineStyle: chart.baselineMode !== "percentage" && chart.baselineMode !== "progress" && baseline
@@ -10555,7 +10559,7 @@ function createScorecardChartRuntime(chart, getters) {
10555
10559
  /* Sizes of boxes containing the texts, in percentage of the Chart size */
10556
10560
  const KEY_BOX_HEIGHT_RATIO = 0.8;
10557
10561
  /* Padding at the border of the chart */
10558
- const CHART_PADDING = DEFAULT_CHART_PADDING;
10562
+ const CHART_PADDING = 10;
10559
10563
  const BOTTOM_PADDING_RATIO = 0.05;
10560
10564
  /**
10561
10565
  * Line height (in em)
@@ -10705,6 +10709,7 @@ class ScorecardChartConfigBuilder {
10705
10709
  position: {
10706
10710
  x: (this.width - keyWidth) / 2,
10707
10711
  y: this.height * (0.5 - BOTTOM_PADDING_RATIO * 2) +
10712
+ CHART_PADDING / 2 +
10708
10713
  (titleHeight + keyHeight / (this.baseline || this.baselineDescr ? 2 : 1.2)) / 2,
10709
10714
  },
10710
10715
  };
@@ -10764,7 +10769,8 @@ class ScorecardChartConfigBuilder {
10764
10769
  const remainingWidth = maxLineWidth - baselineValueWidth;
10765
10770
  let baselineDescrFontSize = getFontSizeMatchingWidth(remainingWidth, baselineValueFontSize, (fontSize) => computeTextWidth(this.context, this.baselineDescr, { fontSize }));
10766
10771
  let isBaselineSplit = false;
10767
- if (baselineDescrFontSize < baselineValueFontSize / 2.5) {
10772
+ if (baselineDescrFontSize < baselineValueFontSize / 2.5 &&
10773
+ this.baselineDescr.trim().includes(" ")) {
10768
10774
  isBaselineSplit = true;
10769
10775
  baselineDescrFontSize = Math.floor(baselineValueFontSize / 2.5);
10770
10776
  for (const line of splitTextInTwoLines(this.baselineDescr)) {
@@ -10813,7 +10819,7 @@ class ScorecardChartConfigBuilder {
10813
10819
  /** Get the height of the chart minus all the vertical paddings */
10814
10820
  getDrawableHeight() {
10815
10821
  const verticalPadding = CHART_PADDING + this.height * BOTTOM_PADDING_RATIO;
10816
- let availableHeight = this.height - 2 * verticalPadding;
10822
+ let availableHeight = this.height - verticalPadding;
10817
10823
  availableHeight -= this.title ? DEFAULT_CHART_FONT_SIZE * LINE_HEIGHT : 0;
10818
10824
  return availableHeight;
10819
10825
  }
@@ -10855,6 +10861,11 @@ class ScorecardChart extends Component {
10855
10861
  get runtime() {
10856
10862
  return this.env.model.getters.getChartRuntime(this.props.figure.id);
10857
10863
  }
10864
+ get title() {
10865
+ const title = this.env.model.getters.getChartDefinition(this.props.figure.id).title.text ?? "";
10866
+ // chart titles are extracted from .json files and they are translated at runtime here
10867
+ return _t(title);
10868
+ }
10858
10869
  setup() {
10859
10870
  useEffect(this.createChart.bind(this), () => {
10860
10871
  const canvas = this.canvas.el;
@@ -31678,14 +31689,6 @@ class GaugeChartDesignPanel extends Component {
31678
31689
  const cancelledReasons = [...(this.state.sectionRuleDispatchResult?.reasons || [])];
31679
31690
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
31680
31691
  }
31681
- updateBackgroundColor(color) {
31682
- this.props.updateChart(this.props.figureId, {
31683
- background: color,
31684
- });
31685
- }
31686
- updateTitle(content) {
31687
- this.props.updateChart(this.props.figureId, { title: { text: content } });
31688
- }
31689
31692
  isRangeMinInvalid() {
31690
31693
  return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin" /* CommandResult.EmptyGaugeRangeMin */) ||
31691
31694
  this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN" /* CommandResult.GaugeRangeMinNaN */) ||
@@ -31725,9 +31728,6 @@ class GaugeChartDesignPanel extends Component {
31725
31728
  sectionRule,
31726
31729
  });
31727
31730
  }
31728
- get backgroundColorTitle() {
31729
- return ChartTerms.BackgroundColor;
31730
- }
31731
31731
  }
31732
31732
 
31733
31733
  class LineConfigPanel extends GenericChartConfigPanel {
@@ -31910,9 +31910,6 @@ class ScorecardChartDesignPanel extends Component {
31910
31910
  get humanizeNumbersLabel() {
31911
31911
  return _t("Humanize numbers");
31912
31912
  }
31913
- updateTitle(content) {
31914
- this.props.updateChart(this.props.figureId, { title: { text: content } });
31915
- }
31916
31913
  updateHumanizeNumbers(humanize) {
31917
31914
  this.props.updateChart(this.props.figureId, { humanize });
31918
31915
  }
@@ -31935,9 +31932,6 @@ class ScorecardChartDesignPanel extends Component {
31935
31932
  break;
31936
31933
  }
31937
31934
  }
31938
- get backgroundColorTitle() {
31939
- return ChartTerms.BackgroundColor;
31940
- }
31941
31935
  }
31942
31936
 
31943
31937
  class WaterfallChartDesignPanel extends Component {
@@ -38619,7 +38613,7 @@ class FiguresContainer extends Component {
38619
38613
  });
38620
38614
  }
38621
38615
  getContainerRect(container) {
38622
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
38616
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
38623
38617
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
38624
38618
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
38625
38619
  const width = viewWidth - x;
@@ -51120,22 +51114,6 @@ class PivotCorePlugin extends CorePlugin {
51120
51114
  this.addPivotFormula(cellPosition, formulaId, pivotCell);
51121
51115
  }
51122
51116
  }
51123
- const pivotZone = {
51124
- top: position.row,
51125
- bottom: position.row + pivotCells[0].length - 1,
51126
- left: position.col,
51127
- right: position.col + pivotCells.length - 1,
51128
- };
51129
- const numberOfHeaders = table.columns.length - 1;
51130
- const cmdContent = {
51131
- sheetId: position.sheetId,
51132
- ranges: [this.getters.getRangeDataFromZone(position.sheetId, pivotZone)],
51133
- config: { ...PIVOT_TABLE_CONFIG, numberOfHeaders },
51134
- tableType: "static",
51135
- };
51136
- if (this.canDispatch("CREATE_TABLE", cmdContent).isSuccessful) {
51137
- this.dispatch("CREATE_TABLE", cmdContent);
51138
- }
51139
51117
  }
51140
51118
  resizeSheet(sheetId, { col, row }, table) {
51141
51119
  const colLimit = table.getNumberOfDataColumns() + 1; // +1 for the Top-Left
@@ -55907,6 +55885,9 @@ class Session extends EventBus {
55907
55885
  * Send a snapshot of the spreadsheet to the collaboration server
55908
55886
  */
55909
55887
  snapshot(data) {
55888
+ if (this.pendingMessages.length !== 0) {
55889
+ return;
55890
+ }
55910
55891
  const snapshotId = this.uuidGenerator.uuidv4();
55911
55892
  this.transportService.sendMessage({
55912
55893
  type: "SNAPSHOT",
@@ -66976,6 +66957,6 @@ const constants = {
66976
66957
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
66977
66958
 
66978
66959
 
66979
- __info__.version = "17.4.0-alpha.4";
66980
- __info__.date = "2024-06-12T14:00:22.046Z";
66981
- __info__.hash = "cefb0e4";
66960
+ __info__.version = "17.4.0-alpha.5";
66961
+ __info__.date = "2024-06-14T10:01:40.605Z";
66962
+ __info__.hash = "9ceed96";
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.4.0-alpha.4
7
- * @date 2024-06-12T14:00:22.046Z
8
- * @hash cefb0e4
6
+ * @version 17.4.0-alpha.5
7
+ * @date 2024-06-14T10:01:40.605Z
8
+ * @hash 9ceed96
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -5283,7 +5283,7 @@
5283
5283
  return text;
5284
5284
  }
5285
5285
  const ellipsis = "…";
5286
- const ellipsisWidth = computeCachedTextWidth(ctx, text);
5286
+ const ellipsisWidth = computeCachedTextWidth(ctx, ellipsis);
5287
5287
  if (width <= ellipsisWidth) {
5288
5288
  return text;
5289
5289
  }
@@ -10423,6 +10423,7 @@ stores.inject(MyMetaStore, storeInstance);
10423
10423
  function drawScoreChart(structure, canvas) {
10424
10424
  const ctx = canvas.getContext("2d");
10425
10425
  canvas.width = structure.canvas.width;
10426
+ const availableWidth = canvas.width - DEFAULT_CHART_PADDING;
10426
10427
  canvas.height = structure.canvas.height;
10427
10428
  ctx.fillStyle = structure.canvas.backgroundColor;
10428
10429
  ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
@@ -10431,7 +10432,7 @@ stores.inject(MyMetaStore, storeInstance);
10431
10432
  ctx.fillStyle = structure.title.style.color;
10432
10433
  const baseline = ctx.textBaseline;
10433
10434
  ctx.textBaseline = "middle";
10434
- ctx.fillText(clipTextWithEllipsis(ctx, structure.title.text, canvas.width - structure.title.position.x), structure.title.position.x, structure.title.position.y);
10435
+ ctx.fillText(clipTextWithEllipsis(ctx, structure.title.text, availableWidth - structure.title.position.x), structure.title.position.x, structure.title.position.y);
10435
10436
  ctx.textBaseline = baseline;
10436
10437
  }
10437
10438
  if (structure.baseline) {
@@ -10521,13 +10522,16 @@ stores.inject(MyMetaStore, storeInstance);
10521
10522
  return {
10522
10523
  title: {
10523
10524
  ...chart.title,
10525
+ // chart titles are extracted from .json files and they are translated at runtime here
10524
10526
  text: _t(chart.title.text ?? ""),
10525
10527
  },
10526
10528
  keyValue: formattedKeyValue,
10527
10529
  baselineDisplay,
10528
10530
  baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, chart.baselineMode),
10529
10531
  baselineColor: getBaselineColor(baselineCell, chart.baselineMode, keyValueCell, chart.baselineColorUp, chart.baselineColorDown),
10530
- baselineDescr: chart.baselineMode !== "progress" && chart.baselineDescr ? _t(chart.baselineDescr) : "",
10532
+ baselineDescr: chart.baselineMode !== "progress" && chart.baselineDescr
10533
+ ? _t(chart.baselineDescr) // descriptions are extracted from .json files and they are translated at runtime here
10534
+ : "",
10531
10535
  fontColor,
10532
10536
  background,
10533
10537
  baselineStyle: chart.baselineMode !== "percentage" && chart.baselineMode !== "progress" && baseline
@@ -10556,7 +10560,7 @@ stores.inject(MyMetaStore, storeInstance);
10556
10560
  /* Sizes of boxes containing the texts, in percentage of the Chart size */
10557
10561
  const KEY_BOX_HEIGHT_RATIO = 0.8;
10558
10562
  /* Padding at the border of the chart */
10559
- const CHART_PADDING = DEFAULT_CHART_PADDING;
10563
+ const CHART_PADDING = 10;
10560
10564
  const BOTTOM_PADDING_RATIO = 0.05;
10561
10565
  /**
10562
10566
  * Line height (in em)
@@ -10706,6 +10710,7 @@ stores.inject(MyMetaStore, storeInstance);
10706
10710
  position: {
10707
10711
  x: (this.width - keyWidth) / 2,
10708
10712
  y: this.height * (0.5 - BOTTOM_PADDING_RATIO * 2) +
10713
+ CHART_PADDING / 2 +
10709
10714
  (titleHeight + keyHeight / (this.baseline || this.baselineDescr ? 2 : 1.2)) / 2,
10710
10715
  },
10711
10716
  };
@@ -10765,7 +10770,8 @@ stores.inject(MyMetaStore, storeInstance);
10765
10770
  const remainingWidth = maxLineWidth - baselineValueWidth;
10766
10771
  let baselineDescrFontSize = getFontSizeMatchingWidth(remainingWidth, baselineValueFontSize, (fontSize) => computeTextWidth(this.context, this.baselineDescr, { fontSize }));
10767
10772
  let isBaselineSplit = false;
10768
- if (baselineDescrFontSize < baselineValueFontSize / 2.5) {
10773
+ if (baselineDescrFontSize < baselineValueFontSize / 2.5 &&
10774
+ this.baselineDescr.trim().includes(" ")) {
10769
10775
  isBaselineSplit = true;
10770
10776
  baselineDescrFontSize = Math.floor(baselineValueFontSize / 2.5);
10771
10777
  for (const line of splitTextInTwoLines(this.baselineDescr)) {
@@ -10814,7 +10820,7 @@ stores.inject(MyMetaStore, storeInstance);
10814
10820
  /** Get the height of the chart minus all the vertical paddings */
10815
10821
  getDrawableHeight() {
10816
10822
  const verticalPadding = CHART_PADDING + this.height * BOTTOM_PADDING_RATIO;
10817
- let availableHeight = this.height - 2 * verticalPadding;
10823
+ let availableHeight = this.height - verticalPadding;
10818
10824
  availableHeight -= this.title ? DEFAULT_CHART_FONT_SIZE * LINE_HEIGHT : 0;
10819
10825
  return availableHeight;
10820
10826
  }
@@ -10856,6 +10862,11 @@ stores.inject(MyMetaStore, storeInstance);
10856
10862
  get runtime() {
10857
10863
  return this.env.model.getters.getChartRuntime(this.props.figure.id);
10858
10864
  }
10865
+ get title() {
10866
+ const title = this.env.model.getters.getChartDefinition(this.props.figure.id).title.text ?? "";
10867
+ // chart titles are extracted from .json files and they are translated at runtime here
10868
+ return _t(title);
10869
+ }
10859
10870
  setup() {
10860
10871
  owl.useEffect(this.createChart.bind(this), () => {
10861
10872
  const canvas = this.canvas.el;
@@ -31679,14 +31690,6 @@ stores.inject(MyMetaStore, storeInstance);
31679
31690
  const cancelledReasons = [...(this.state.sectionRuleDispatchResult?.reasons || [])];
31680
31691
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
31681
31692
  }
31682
- updateBackgroundColor(color) {
31683
- this.props.updateChart(this.props.figureId, {
31684
- background: color,
31685
- });
31686
- }
31687
- updateTitle(content) {
31688
- this.props.updateChart(this.props.figureId, { title: { text: content } });
31689
- }
31690
31693
  isRangeMinInvalid() {
31691
31694
  return !!(this.state.sectionRuleDispatchResult?.isCancelledBecause("EmptyGaugeRangeMin" /* CommandResult.EmptyGaugeRangeMin */) ||
31692
31695
  this.state.sectionRuleDispatchResult?.isCancelledBecause("GaugeRangeMinNaN" /* CommandResult.GaugeRangeMinNaN */) ||
@@ -31726,9 +31729,6 @@ stores.inject(MyMetaStore, storeInstance);
31726
31729
  sectionRule,
31727
31730
  });
31728
31731
  }
31729
- get backgroundColorTitle() {
31730
- return ChartTerms.BackgroundColor;
31731
- }
31732
31732
  }
31733
31733
 
31734
31734
  class LineConfigPanel extends GenericChartConfigPanel {
@@ -31911,9 +31911,6 @@ stores.inject(MyMetaStore, storeInstance);
31911
31911
  get humanizeNumbersLabel() {
31912
31912
  return _t("Humanize numbers");
31913
31913
  }
31914
- updateTitle(content) {
31915
- this.props.updateChart(this.props.figureId, { title: { text: content } });
31916
- }
31917
31914
  updateHumanizeNumbers(humanize) {
31918
31915
  this.props.updateChart(this.props.figureId, { humanize });
31919
31916
  }
@@ -31936,9 +31933,6 @@ stores.inject(MyMetaStore, storeInstance);
31936
31933
  break;
31937
31934
  }
31938
31935
  }
31939
- get backgroundColorTitle() {
31940
- return ChartTerms.BackgroundColor;
31941
- }
31942
31936
  }
31943
31937
 
31944
31938
  class WaterfallChartDesignPanel extends owl.Component {
@@ -38620,7 +38614,7 @@ stores.inject(MyMetaStore, storeInstance);
38620
38614
  });
38621
38615
  }
38622
38616
  getContainerRect(container) {
38623
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
38617
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
38624
38618
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
38625
38619
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
38626
38620
  const width = viewWidth - x;
@@ -51121,22 +51115,6 @@ stores.inject(MyMetaStore, storeInstance);
51121
51115
  this.addPivotFormula(cellPosition, formulaId, pivotCell);
51122
51116
  }
51123
51117
  }
51124
- const pivotZone = {
51125
- top: position.row,
51126
- bottom: position.row + pivotCells[0].length - 1,
51127
- left: position.col,
51128
- right: position.col + pivotCells.length - 1,
51129
- };
51130
- const numberOfHeaders = table.columns.length - 1;
51131
- const cmdContent = {
51132
- sheetId: position.sheetId,
51133
- ranges: [this.getters.getRangeDataFromZone(position.sheetId, pivotZone)],
51134
- config: { ...PIVOT_TABLE_CONFIG, numberOfHeaders },
51135
- tableType: "static",
51136
- };
51137
- if (this.canDispatch("CREATE_TABLE", cmdContent).isSuccessful) {
51138
- this.dispatch("CREATE_TABLE", cmdContent);
51139
- }
51140
51118
  }
51141
51119
  resizeSheet(sheetId, { col, row }, table) {
51142
51120
  const colLimit = table.getNumberOfDataColumns() + 1; // +1 for the Top-Left
@@ -55908,6 +55886,9 @@ stores.inject(MyMetaStore, storeInstance);
55908
55886
  * Send a snapshot of the spreadsheet to the collaboration server
55909
55887
  */
55910
55888
  snapshot(data) {
55889
+ if (this.pendingMessages.length !== 0) {
55890
+ return;
55891
+ }
55911
55892
  const snapshotId = this.uuidGenerator.uuidv4();
55912
55893
  this.transportService.sendMessage({
55913
55894
  type: "SNAPSHOT",
@@ -67020,9 +67001,9 @@ stores.inject(MyMetaStore, storeInstance);
67020
67001
  exports.tokenize = tokenize;
67021
67002
 
67022
67003
 
67023
- __info__.version = "17.4.0-alpha.4";
67024
- __info__.date = "2024-06-12T14:00:22.046Z";
67025
- __info__.hash = "cefb0e4";
67004
+ __info__.version = "17.4.0-alpha.5";
67005
+ __info__.date = "2024-06-14T10:01:40.605Z";
67006
+ __info__.hash = "9ceed96";
67026
67007
 
67027
67008
 
67028
67009
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);