@odoo/o-spreadsheet 16.1.12 → 16.1.14

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.
@@ -1703,27 +1703,36 @@ function removeTrailingZeroes(numberString) {
1703
1703
  }
1704
1704
  return numberString.slice(0, i + 1) || undefined;
1705
1705
  }
1706
+ const leadingZeroesRegexp = /^0+/;
1706
1707
  /**
1707
1708
  * Limit the size of the decimal part of a number to the given number of digits.
1708
1709
  */
1709
1710
  function limitDecimalDigits(decimalDigits, maxDecimals) {
1711
+ var _a;
1710
1712
  let integerDigits = "0";
1711
1713
  let resultDecimalDigits = decimalDigits;
1712
1714
  // Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
1713
1715
  // but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
1714
1716
  let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
1715
1717
  const i = maxDecimals;
1716
- if (Number(Number(decimalDigits[i]) < 5)) {
1718
+ if (Number(decimalDigits[i]) < 5) {
1717
1719
  return { integerDigits, decimalDigits: slicedDecimalDigits };
1718
1720
  }
1719
1721
  // round up
1722
+ const leadingZeroes = ((_a = slicedDecimalDigits.match(leadingZeroesRegexp)) === null || _a === void 0 ? void 0 : _a[0]) || "";
1720
1723
  const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
1721
- if (slicedRoundedUp.length > slicedDecimalDigits.length) {
1722
- integerDigits = (Number(integerDigits) + 1).toString();
1724
+ const withoutLeadingZeroes = slicedDecimalDigits.slice(leadingZeroes.length);
1725
+ // e.g. carry over from 99 to 100
1726
+ const carryOver = slicedRoundedUp.length > withoutLeadingZeroes.length;
1727
+ if (carryOver && !leadingZeroes) {
1728
+ integerDigits = "1";
1723
1729
  resultDecimalDigits = undefined;
1724
1730
  }
1731
+ else if (carryOver) {
1732
+ resultDecimalDigits = leadingZeroes.slice(0, -1) + slicedRoundedUp;
1733
+ }
1725
1734
  else {
1726
- resultDecimalDigits = slicedRoundedUp;
1735
+ resultDecimalDigits = leadingZeroes + slicedRoundedUp;
1727
1736
  }
1728
1737
  return { integerDigits, decimalDigits: resultDecimalDigits };
1729
1738
  }
@@ -17341,6 +17350,7 @@ class Composer extends Component {
17341
17350
  (this.autoCompleteState.selectedIndex + 1) % this.autoCompleteState.values.length;
17342
17351
  }
17343
17352
  }
17353
+ this.updateCursorIfNeeded();
17344
17354
  }
17345
17355
  processTabKey(ev) {
17346
17356
  var _a;
@@ -17399,9 +17409,12 @@ class Composer extends Component {
17399
17409
  }
17400
17410
  else {
17401
17411
  ev.stopPropagation();
17412
+ this.updateCursorIfNeeded();
17402
17413
  }
17403
- const { start, end } = this.contentHelper.getCurrentSelection();
17414
+ }
17415
+ updateCursorIfNeeded() {
17404
17416
  if (!this.env.model.getters.isSelectingForComposer()) {
17417
+ const { start, end } = this.contentHelper.getCurrentSelection();
17405
17418
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
17406
17419
  this.isKeyStillDown = true;
17407
17420
  }
@@ -19939,7 +19952,7 @@ class LineBarPieConfigPanel extends Component {
19939
19952
  return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
19940
19953
  }
19941
19954
  onUpdateDataSetsHaveTitle(ev) {
19942
- this.props.updateChart({
19955
+ this.props.updateChart(this.props.figureId, {
19943
19956
  dataSetsHaveTitle: ev.target.checked,
19944
19957
  });
19945
19958
  }
@@ -19951,7 +19964,7 @@ class LineBarPieConfigPanel extends Component {
19951
19964
  this.dataSeriesRanges = ranges;
19952
19965
  }
19953
19966
  onDataSeriesConfirmed() {
19954
- this.state.datasetDispatchResult = this.props.updateChart({
19967
+ this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
19955
19968
  dataSets: this.dataSeriesRanges,
19956
19969
  });
19957
19970
  }
@@ -19963,12 +19976,12 @@ class LineBarPieConfigPanel extends Component {
19963
19976
  this.labelRange = ranges[0];
19964
19977
  }
19965
19978
  onLabelRangeConfirmed() {
19966
- this.state.labelsDispatchResult = this.props.updateChart({
19979
+ this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
19967
19980
  labelRange: this.labelRange,
19968
19981
  });
19969
19982
  }
19970
19983
  onUpdateAggregated(ev) {
19971
- this.props.updateChart({
19984
+ this.props.updateChart(this.props.figureId, {
19972
19985
  aggregated: ev.target.checked,
19973
19986
  });
19974
19987
  }
@@ -19983,12 +19996,12 @@ LineBarPieConfigPanel.props = {
19983
19996
 
19984
19997
  class BarConfigPanel extends LineBarPieConfigPanel {
19985
19998
  onUpdateStacked(ev) {
19986
- this.props.updateChart({
19999
+ this.props.updateChart(this.props.figureId, {
19987
20000
  stacked: ev.target.checked,
19988
20001
  });
19989
20002
  }
19990
20003
  onUpdateAggregated(ev) {
19991
- this.props.updateChart({
20004
+ this.props.updateChart(this.props.figureId, {
19992
20005
  aggregated: ev.target.checked,
19993
20006
  });
19994
20007
  }
@@ -20032,6 +20045,7 @@ css /* scss */ `
20032
20045
  .o-color-picker-toggler {
20033
20046
  display: flex;
20034
20047
  .o-color-picker-toggler-sign {
20048
+ display: flex;
20035
20049
  margin: auto auto;
20036
20050
  width: 55%;
20037
20051
  height: 55%;
@@ -20266,17 +20280,17 @@ class LineBarPieDesignPanel extends Component {
20266
20280
  this.state.fillColorTool = !this.state.fillColorTool;
20267
20281
  }
20268
20282
  updateBackgroundColor(color) {
20269
- this.props.updateChart({
20283
+ this.props.updateChart(this.props.figureId, {
20270
20284
  background: color,
20271
20285
  });
20272
20286
  }
20273
20287
  updateTitle(ev) {
20274
- this.props.updateChart({
20288
+ this.props.updateChart(this.props.figureId, {
20275
20289
  title: ev.target.value,
20276
20290
  });
20277
20291
  }
20278
20292
  updateSelect(attr, ev) {
20279
- this.props.updateChart({
20293
+ this.props.updateChart(this.props.figureId, {
20280
20294
  [attr]: ev.target.value,
20281
20295
  });
20282
20296
  }
@@ -20314,7 +20328,7 @@ class GaugeChartConfigPanel extends Component {
20314
20328
  this.dataRange = ranges[0];
20315
20329
  }
20316
20330
  updateDataRange() {
20317
- this.state.dataRangeDispatchResult = this.props.updateChart({
20331
+ this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
20318
20332
  dataRange: this.dataRange,
20319
20333
  });
20320
20334
  }
@@ -20389,12 +20403,12 @@ class GaugeChartDesignPanel extends Component {
20389
20403
  }
20390
20404
  updateBackgroundColor(color) {
20391
20405
  this.state.openedMenu = undefined;
20392
- this.props.updateChart({
20406
+ this.props.updateChart(this.props.figureId, {
20393
20407
  background: color,
20394
20408
  });
20395
20409
  }
20396
20410
  updateTitle(ev) {
20397
- this.props.updateChart({
20411
+ this.props.updateChart(this.props.figureId, {
20398
20412
  title: ev.target.value,
20399
20413
  });
20400
20414
  }
@@ -20463,7 +20477,7 @@ class GaugeChartDesignPanel extends Component {
20463
20477
  }
20464
20478
  }
20465
20479
  updateSectionRule(sectionRule) {
20466
- this.state.sectionRuleDispatchResult = this.props.updateChart({
20480
+ this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
20467
20481
  sectionRule,
20468
20482
  });
20469
20483
  }
@@ -20488,17 +20502,17 @@ class LineConfigPanel extends LineBarPieConfigPanel {
20488
20502
  return false;
20489
20503
  }
20490
20504
  onUpdateLabelsAsText(ev) {
20491
- this.props.updateChart({
20505
+ this.props.updateChart(this.props.figureId, {
20492
20506
  labelsAsText: ev.target.checked,
20493
20507
  });
20494
20508
  }
20495
20509
  onUpdateStacked(ev) {
20496
- this.props.updateChart({
20510
+ this.props.updateChart(this.props.figureId, {
20497
20511
  stacked: ev.target.checked,
20498
20512
  });
20499
20513
  }
20500
20514
  onUpdateAggregated(ev) {
20501
- this.props.updateChart({
20515
+ this.props.updateChart(this.props.figureId, {
20502
20516
  aggregated: ev.target.checked,
20503
20517
  });
20504
20518
  }
@@ -20539,7 +20553,7 @@ class ScorecardChartConfigPanel extends Component {
20539
20553
  this.keyValue = ranges[0];
20540
20554
  }
20541
20555
  updateKeyValueRange() {
20542
- this.state.keyValueDispatchResult = this.props.updateChart({
20556
+ this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
20543
20557
  keyValue: this.keyValue,
20544
20558
  });
20545
20559
  }
@@ -20547,12 +20561,12 @@ class ScorecardChartConfigPanel extends Component {
20547
20561
  this.baseline = ranges[0];
20548
20562
  }
20549
20563
  updateBaselineRange() {
20550
- this.state.baselineDispatchResult = this.props.updateChart({
20564
+ this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
20551
20565
  baseline: this.baseline,
20552
20566
  });
20553
20567
  }
20554
20568
  updateBaselineMode(ev) {
20555
- this.props.updateChart({ baselineMode: ev.target.value });
20569
+ this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
20556
20570
  }
20557
20571
  }
20558
20572
  ScorecardChartConfigPanel.template = "o-spreadsheet-ScorecardChartConfigPanel";
@@ -20577,12 +20591,12 @@ class ScorecardChartDesignPanel extends Component {
20577
20591
  useExternalListener(window, "click", this.onClick);
20578
20592
  }
20579
20593
  updateTitle(ev) {
20580
- this.props.updateChart({
20594
+ this.props.updateChart(this.props.figureId, {
20581
20595
  title: ev.target.value,
20582
20596
  });
20583
20597
  }
20584
20598
  updateBaselineDescr(ev) {
20585
- this.props.updateChart({ baselineDescr: ev.target.value });
20599
+ this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
20586
20600
  }
20587
20601
  openColorPicker(colorPickerId) {
20588
20602
  this.state.openedColorPicker = colorPickerId;
@@ -20590,13 +20604,13 @@ class ScorecardChartDesignPanel extends Component {
20590
20604
  setColor(color, colorPickerId) {
20591
20605
  switch (colorPickerId) {
20592
20606
  case "backgroundColor":
20593
- this.props.updateChart({ background: color });
20607
+ this.props.updateChart(this.props.figureId, { background: color });
20594
20608
  break;
20595
20609
  case "baselineColorDown":
20596
- this.props.updateChart({ baselineColorDown: color });
20610
+ this.props.updateChart(this.props.figureId, { baselineColorDown: color });
20597
20611
  break;
20598
20612
  case "baselineColorUp":
20599
- this.props.updateChart({ baselineColorUp: color });
20613
+ this.props.updateChart(this.props.figureId, { baselineColorUp: color });
20600
20614
  break;
20601
20615
  }
20602
20616
  this.state.openedColorPicker = undefined;
@@ -20665,16 +20679,9 @@ css /* scss */ `
20665
20679
  }
20666
20680
  `;
20667
20681
  class ChartPanel extends Component {
20668
- constructor() {
20669
- super(...arguments);
20670
- this.shouldUpdateChart = true;
20671
- }
20672
20682
  get figureId() {
20673
20683
  return this.state.figureId;
20674
20684
  }
20675
- get sheetId() {
20676
- return this.state.sheetId;
20677
- }
20678
20685
  setup() {
20679
20686
  const selectedFigureId = this.env.model.getters.getSelectedFigureId();
20680
20687
  if (!selectedFigureId) {
@@ -20683,17 +20690,11 @@ class ChartPanel extends Component {
20683
20690
  this.state = useState({
20684
20691
  panel: "configuration",
20685
20692
  figureId: selectedFigureId,
20686
- sheetId: this.env.model.getters.getActiveSheetId(),
20687
20693
  });
20688
20694
  onWillUpdateProps(() => {
20689
20695
  const selectedFigureId = this.env.model.getters.getSelectedFigureId();
20690
20696
  if (selectedFigureId && selectedFigureId !== this.state.figureId) {
20691
20697
  this.state.figureId = selectedFigureId;
20692
- this.state.sheetId = this.env.model.getters.getActiveSheetId();
20693
- this.shouldUpdateChart = false;
20694
- }
20695
- else {
20696
- this.shouldUpdateChart = true;
20697
20698
  }
20698
20699
  if (!this.env.model.getters.isChartDefined(this.figureId)) {
20699
20700
  this.props.onCloseSidePanel();
@@ -20701,8 +20702,8 @@ class ChartPanel extends Component {
20701
20702
  }
20702
20703
  });
20703
20704
  }
20704
- updateChart(updateDefinition) {
20705
- if (!this.shouldUpdateChart) {
20705
+ updateChart(figureId, updateDefinition) {
20706
+ if (figureId !== this.figureId) {
20706
20707
  return;
20707
20708
  }
20708
20709
  const definition = {
@@ -20711,8 +20712,8 @@ class ChartPanel extends Component {
20711
20712
  };
20712
20713
  return this.env.model.dispatch("UPDATE_CHART", {
20713
20714
  definition,
20714
- id: this.figureId,
20715
- sheetId: this.sheetId,
20715
+ id: figureId,
20716
+ sheetId: this.env.model.getters.getFigureSheetId(figureId),
20716
20717
  });
20717
20718
  }
20718
20719
  onTypeChange(type) {
@@ -20724,7 +20725,7 @@ class ChartPanel extends Component {
20724
20725
  this.env.model.dispatch("UPDATE_CHART", {
20725
20726
  definition,
20726
20727
  id: this.figureId,
20727
- sheetId: this.sheetId,
20728
+ sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
20728
20729
  });
20729
20730
  }
20730
20731
  get chartPanel() {
@@ -44239,6 +44240,6 @@ function addFunction(functionName, functionDescription) {
44239
44240
  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 };
44240
44241
 
44241
44242
 
44242
- __info__.version = '16.1.12';
44243
- __info__.date = '2023-05-25T12:56:29.735Z';
44244
- __info__.hash = 'b80dc51';
44243
+ __info__.version = '16.1.14';
44244
+ __info__.date = '2023-06-12T13:50:13.693Z';
44245
+ __info__.hash = 'a51d9fa';
@@ -1704,27 +1704,36 @@
1704
1704
  }
1705
1705
  return numberString.slice(0, i + 1) || undefined;
1706
1706
  }
1707
+ const leadingZeroesRegexp = /^0+/;
1707
1708
  /**
1708
1709
  * Limit the size of the decimal part of a number to the given number of digits.
1709
1710
  */
1710
1711
  function limitDecimalDigits(decimalDigits, maxDecimals) {
1712
+ var _a;
1711
1713
  let integerDigits = "0";
1712
1714
  let resultDecimalDigits = decimalDigits;
1713
1715
  // Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
1714
1716
  // but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
1715
1717
  let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
1716
1718
  const i = maxDecimals;
1717
- if (Number(Number(decimalDigits[i]) < 5)) {
1719
+ if (Number(decimalDigits[i]) < 5) {
1718
1720
  return { integerDigits, decimalDigits: slicedDecimalDigits };
1719
1721
  }
1720
1722
  // round up
1723
+ const leadingZeroes = ((_a = slicedDecimalDigits.match(leadingZeroesRegexp)) === null || _a === void 0 ? void 0 : _a[0]) || "";
1721
1724
  const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
1722
- if (slicedRoundedUp.length > slicedDecimalDigits.length) {
1723
- integerDigits = (Number(integerDigits) + 1).toString();
1725
+ const withoutLeadingZeroes = slicedDecimalDigits.slice(leadingZeroes.length);
1726
+ // e.g. carry over from 99 to 100
1727
+ const carryOver = slicedRoundedUp.length > withoutLeadingZeroes.length;
1728
+ if (carryOver && !leadingZeroes) {
1729
+ integerDigits = "1";
1724
1730
  resultDecimalDigits = undefined;
1725
1731
  }
1732
+ else if (carryOver) {
1733
+ resultDecimalDigits = leadingZeroes.slice(0, -1) + slicedRoundedUp;
1734
+ }
1726
1735
  else {
1727
- resultDecimalDigits = slicedRoundedUp;
1736
+ resultDecimalDigits = leadingZeroes + slicedRoundedUp;
1728
1737
  }
1729
1738
  return { integerDigits, decimalDigits: resultDecimalDigits };
1730
1739
  }
@@ -17342,6 +17351,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17342
17351
  (this.autoCompleteState.selectedIndex + 1) % this.autoCompleteState.values.length;
17343
17352
  }
17344
17353
  }
17354
+ this.updateCursorIfNeeded();
17345
17355
  }
17346
17356
  processTabKey(ev) {
17347
17357
  var _a;
@@ -17400,9 +17410,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17400
17410
  }
17401
17411
  else {
17402
17412
  ev.stopPropagation();
17413
+ this.updateCursorIfNeeded();
17403
17414
  }
17404
- const { start, end } = this.contentHelper.getCurrentSelection();
17415
+ }
17416
+ updateCursorIfNeeded() {
17405
17417
  if (!this.env.model.getters.isSelectingForComposer()) {
17418
+ const { start, end } = this.contentHelper.getCurrentSelection();
17406
17419
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
17407
17420
  this.isKeyStillDown = true;
17408
17421
  }
@@ -19940,7 +19953,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19940
19953
  return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
19941
19954
  }
19942
19955
  onUpdateDataSetsHaveTitle(ev) {
19943
- this.props.updateChart({
19956
+ this.props.updateChart(this.props.figureId, {
19944
19957
  dataSetsHaveTitle: ev.target.checked,
19945
19958
  });
19946
19959
  }
@@ -19952,7 +19965,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19952
19965
  this.dataSeriesRanges = ranges;
19953
19966
  }
19954
19967
  onDataSeriesConfirmed() {
19955
- this.state.datasetDispatchResult = this.props.updateChart({
19968
+ this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
19956
19969
  dataSets: this.dataSeriesRanges,
19957
19970
  });
19958
19971
  }
@@ -19964,12 +19977,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19964
19977
  this.labelRange = ranges[0];
19965
19978
  }
19966
19979
  onLabelRangeConfirmed() {
19967
- this.state.labelsDispatchResult = this.props.updateChart({
19980
+ this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
19968
19981
  labelRange: this.labelRange,
19969
19982
  });
19970
19983
  }
19971
19984
  onUpdateAggregated(ev) {
19972
- this.props.updateChart({
19985
+ this.props.updateChart(this.props.figureId, {
19973
19986
  aggregated: ev.target.checked,
19974
19987
  });
19975
19988
  }
@@ -19984,12 +19997,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
19984
19997
 
19985
19998
  class BarConfigPanel extends LineBarPieConfigPanel {
19986
19999
  onUpdateStacked(ev) {
19987
- this.props.updateChart({
20000
+ this.props.updateChart(this.props.figureId, {
19988
20001
  stacked: ev.target.checked,
19989
20002
  });
19990
20003
  }
19991
20004
  onUpdateAggregated(ev) {
19992
- this.props.updateChart({
20005
+ this.props.updateChart(this.props.figureId, {
19993
20006
  aggregated: ev.target.checked,
19994
20007
  });
19995
20008
  }
@@ -20033,6 +20046,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20033
20046
  .o-color-picker-toggler {
20034
20047
  display: flex;
20035
20048
  .o-color-picker-toggler-sign {
20049
+ display: flex;
20036
20050
  margin: auto auto;
20037
20051
  width: 55%;
20038
20052
  height: 55%;
@@ -20267,17 +20281,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20267
20281
  this.state.fillColorTool = !this.state.fillColorTool;
20268
20282
  }
20269
20283
  updateBackgroundColor(color) {
20270
- this.props.updateChart({
20284
+ this.props.updateChart(this.props.figureId, {
20271
20285
  background: color,
20272
20286
  });
20273
20287
  }
20274
20288
  updateTitle(ev) {
20275
- this.props.updateChart({
20289
+ this.props.updateChart(this.props.figureId, {
20276
20290
  title: ev.target.value,
20277
20291
  });
20278
20292
  }
20279
20293
  updateSelect(attr, ev) {
20280
- this.props.updateChart({
20294
+ this.props.updateChart(this.props.figureId, {
20281
20295
  [attr]: ev.target.value,
20282
20296
  });
20283
20297
  }
@@ -20315,7 +20329,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20315
20329
  this.dataRange = ranges[0];
20316
20330
  }
20317
20331
  updateDataRange() {
20318
- this.state.dataRangeDispatchResult = this.props.updateChart({
20332
+ this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
20319
20333
  dataRange: this.dataRange,
20320
20334
  });
20321
20335
  }
@@ -20390,12 +20404,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20390
20404
  }
20391
20405
  updateBackgroundColor(color) {
20392
20406
  this.state.openedMenu = undefined;
20393
- this.props.updateChart({
20407
+ this.props.updateChart(this.props.figureId, {
20394
20408
  background: color,
20395
20409
  });
20396
20410
  }
20397
20411
  updateTitle(ev) {
20398
- this.props.updateChart({
20412
+ this.props.updateChart(this.props.figureId, {
20399
20413
  title: ev.target.value,
20400
20414
  });
20401
20415
  }
@@ -20464,7 +20478,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20464
20478
  }
20465
20479
  }
20466
20480
  updateSectionRule(sectionRule) {
20467
- this.state.sectionRuleDispatchResult = this.props.updateChart({
20481
+ this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
20468
20482
  sectionRule,
20469
20483
  });
20470
20484
  }
@@ -20489,17 +20503,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20489
20503
  return false;
20490
20504
  }
20491
20505
  onUpdateLabelsAsText(ev) {
20492
- this.props.updateChart({
20506
+ this.props.updateChart(this.props.figureId, {
20493
20507
  labelsAsText: ev.target.checked,
20494
20508
  });
20495
20509
  }
20496
20510
  onUpdateStacked(ev) {
20497
- this.props.updateChart({
20511
+ this.props.updateChart(this.props.figureId, {
20498
20512
  stacked: ev.target.checked,
20499
20513
  });
20500
20514
  }
20501
20515
  onUpdateAggregated(ev) {
20502
- this.props.updateChart({
20516
+ this.props.updateChart(this.props.figureId, {
20503
20517
  aggregated: ev.target.checked,
20504
20518
  });
20505
20519
  }
@@ -20540,7 +20554,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20540
20554
  this.keyValue = ranges[0];
20541
20555
  }
20542
20556
  updateKeyValueRange() {
20543
- this.state.keyValueDispatchResult = this.props.updateChart({
20557
+ this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
20544
20558
  keyValue: this.keyValue,
20545
20559
  });
20546
20560
  }
@@ -20548,12 +20562,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20548
20562
  this.baseline = ranges[0];
20549
20563
  }
20550
20564
  updateBaselineRange() {
20551
- this.state.baselineDispatchResult = this.props.updateChart({
20565
+ this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
20552
20566
  baseline: this.baseline,
20553
20567
  });
20554
20568
  }
20555
20569
  updateBaselineMode(ev) {
20556
- this.props.updateChart({ baselineMode: ev.target.value });
20570
+ this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
20557
20571
  }
20558
20572
  }
20559
20573
  ScorecardChartConfigPanel.template = "o-spreadsheet-ScorecardChartConfigPanel";
@@ -20578,12 +20592,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20578
20592
  owl.useExternalListener(window, "click", this.onClick);
20579
20593
  }
20580
20594
  updateTitle(ev) {
20581
- this.props.updateChart({
20595
+ this.props.updateChart(this.props.figureId, {
20582
20596
  title: ev.target.value,
20583
20597
  });
20584
20598
  }
20585
20599
  updateBaselineDescr(ev) {
20586
- this.props.updateChart({ baselineDescr: ev.target.value });
20600
+ this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
20587
20601
  }
20588
20602
  openColorPicker(colorPickerId) {
20589
20603
  this.state.openedColorPicker = colorPickerId;
@@ -20591,13 +20605,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20591
20605
  setColor(color, colorPickerId) {
20592
20606
  switch (colorPickerId) {
20593
20607
  case "backgroundColor":
20594
- this.props.updateChart({ background: color });
20608
+ this.props.updateChart(this.props.figureId, { background: color });
20595
20609
  break;
20596
20610
  case "baselineColorDown":
20597
- this.props.updateChart({ baselineColorDown: color });
20611
+ this.props.updateChart(this.props.figureId, { baselineColorDown: color });
20598
20612
  break;
20599
20613
  case "baselineColorUp":
20600
- this.props.updateChart({ baselineColorUp: color });
20614
+ this.props.updateChart(this.props.figureId, { baselineColorUp: color });
20601
20615
  break;
20602
20616
  }
20603
20617
  this.state.openedColorPicker = undefined;
@@ -20666,16 +20680,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20666
20680
  }
20667
20681
  `;
20668
20682
  class ChartPanel extends owl.Component {
20669
- constructor() {
20670
- super(...arguments);
20671
- this.shouldUpdateChart = true;
20672
- }
20673
20683
  get figureId() {
20674
20684
  return this.state.figureId;
20675
20685
  }
20676
- get sheetId() {
20677
- return this.state.sheetId;
20678
- }
20679
20686
  setup() {
20680
20687
  const selectedFigureId = this.env.model.getters.getSelectedFigureId();
20681
20688
  if (!selectedFigureId) {
@@ -20684,17 +20691,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20684
20691
  this.state = owl.useState({
20685
20692
  panel: "configuration",
20686
20693
  figureId: selectedFigureId,
20687
- sheetId: this.env.model.getters.getActiveSheetId(),
20688
20694
  });
20689
20695
  owl.onWillUpdateProps(() => {
20690
20696
  const selectedFigureId = this.env.model.getters.getSelectedFigureId();
20691
20697
  if (selectedFigureId && selectedFigureId !== this.state.figureId) {
20692
20698
  this.state.figureId = selectedFigureId;
20693
- this.state.sheetId = this.env.model.getters.getActiveSheetId();
20694
- this.shouldUpdateChart = false;
20695
- }
20696
- else {
20697
- this.shouldUpdateChart = true;
20698
20699
  }
20699
20700
  if (!this.env.model.getters.isChartDefined(this.figureId)) {
20700
20701
  this.props.onCloseSidePanel();
@@ -20702,8 +20703,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20702
20703
  }
20703
20704
  });
20704
20705
  }
20705
- updateChart(updateDefinition) {
20706
- if (!this.shouldUpdateChart) {
20706
+ updateChart(figureId, updateDefinition) {
20707
+ if (figureId !== this.figureId) {
20707
20708
  return;
20708
20709
  }
20709
20710
  const definition = {
@@ -20712,8 +20713,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20712
20713
  };
20713
20714
  return this.env.model.dispatch("UPDATE_CHART", {
20714
20715
  definition,
20715
- id: this.figureId,
20716
- sheetId: this.sheetId,
20716
+ id: figureId,
20717
+ sheetId: this.env.model.getters.getFigureSheetId(figureId),
20717
20718
  });
20718
20719
  }
20719
20720
  onTypeChange(type) {
@@ -20725,7 +20726,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20725
20726
  this.env.model.dispatch("UPDATE_CHART", {
20726
20727
  definition,
20727
20728
  id: this.figureId,
20728
- sheetId: this.sheetId,
20729
+ sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
20729
20730
  });
20730
20731
  }
20731
20732
  get chartPanel() {
@@ -44270,9 +44271,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44270
44271
  Object.defineProperty(exports, '__esModule', { value: true });
44271
44272
 
44272
44273
 
44273
- __info__.version = '16.1.12';
44274
- __info__.date = '2023-05-25T12:56:29.735Z';
44275
- __info__.hash = 'b80dc51';
44274
+ __info__.version = '16.1.14';
44275
+ __info__.date = '2023-06-12T13:50:13.693Z';
44276
+ __info__.hash = 'a51d9fa';
44276
44277
 
44277
44278
 
44278
44279
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);