@odoo/o-spreadsheet 16.0.9 → 16.0.11

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.
@@ -6414,6 +6414,12 @@
6414
6414
  height: 25px;
6415
6415
  }
6416
6416
  }
6417
+ /** Make the character a bit bigger
6418
+ compared to its neighbor INPUT box */
6419
+ .o-remove-selection {
6420
+ font-weight: bold;
6421
+ font-size: calc(100% + 4px);
6422
+ }
6417
6423
  }
6418
6424
  `;
6419
6425
  /**
@@ -6490,6 +6496,9 @@
6490
6496
  (_b = (_a = this.props).onSelectionChanged) === null || _b === void 0 ? void 0 : _b.call(_a, ranges);
6491
6497
  this.previousRanges = ranges;
6492
6498
  }
6499
+ extractRanges(value) {
6500
+ return this.props.hasSingleRange ? value.split(",")[0] : value;
6501
+ }
6493
6502
  focus(rangeId) {
6494
6503
  this.state.isMissing = false;
6495
6504
  this.env.model.dispatch("FOCUS_RANGE", {
@@ -6508,15 +6517,16 @@
6508
6517
  }
6509
6518
  onInputChanged(rangeId, ev) {
6510
6519
  const target = ev.target;
6520
+ const value = this.extractRanges(target.value);
6511
6521
  this.env.model.dispatch("CHANGE_RANGE", {
6512
6522
  id: this.id,
6513
6523
  rangeId,
6514
- value: target.value,
6524
+ value,
6515
6525
  });
6516
6526
  target.blur();
6517
6527
  this.triggerChange();
6518
6528
  }
6519
- disable() {
6529
+ confirm() {
6520
6530
  var _a, _b;
6521
6531
  this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
6522
6532
  const ranges = this.env.model.getters.getSelectionInputValue(this.id);
@@ -6565,7 +6575,7 @@
6565
6575
  return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidLabelRange */));
6566
6576
  }
6567
6577
  onUpdateDataSetsHaveTitle(ev) {
6568
- this.props.updateChart({
6578
+ this.props.updateChart(this.props.figureId, {
6569
6579
  dataSetsHaveTitle: ev.target.checked,
6570
6580
  });
6571
6581
  }
@@ -6577,7 +6587,7 @@
6577
6587
  this.dataSeriesRanges = ranges;
6578
6588
  }
6579
6589
  onDataSeriesConfirmed() {
6580
- this.state.datasetDispatchResult = this.props.updateChart({
6590
+ this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
6581
6591
  dataSets: this.dataSeriesRanges,
6582
6592
  });
6583
6593
  }
@@ -6589,7 +6599,7 @@
6589
6599
  this.labelRange = ranges[0];
6590
6600
  }
6591
6601
  onLabelRangeConfirmed() {
6592
- this.state.labelsDispatchResult = this.props.updateChart({
6602
+ this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
6593
6603
  labelRange: this.labelRange,
6594
6604
  });
6595
6605
  }
@@ -6599,7 +6609,7 @@
6599
6609
 
6600
6610
  class BarConfigPanel extends LineBarPieConfigPanel {
6601
6611
  onUpdateStacked(ev) {
6602
- this.props.updateChart({
6612
+ this.props.updateChart(this.props.figureId, {
6603
6613
  stacked: ev.target.checked,
6604
6614
  });
6605
6615
  }
@@ -8347,6 +8357,18 @@
8347
8357
  grid-template-columns: repeat(${ITEMS_PER_LINE}, 1fr);
8348
8358
  grid-gap: ${ITEM_HORIZONTAL_MARGIN * 2}px;
8349
8359
  }
8360
+ .o-color-picker-toggler {
8361
+ display: flex;
8362
+ .o-color-picker-toggler-sign {
8363
+ margin: auto auto;
8364
+ width: 55%;
8365
+ height: 55%;
8366
+ .o-icon {
8367
+ width: 100%;
8368
+ height: 100%;
8369
+ }
8370
+ }
8371
+ }
8350
8372
  .o-color-picker-line-item {
8351
8373
  width: ${ITEM_EDGE_LENGTH}px;
8352
8374
  height: ${ITEM_EDGE_LENGTH}px;
@@ -8563,17 +8585,17 @@
8563
8585
  this.state.fillColorTool = !this.state.fillColorTool;
8564
8586
  }
8565
8587
  updateBackgroundColor(color) {
8566
- this.props.updateChart({
8588
+ this.props.updateChart(this.props.figureId, {
8567
8589
  background: color,
8568
8590
  });
8569
8591
  }
8570
8592
  updateTitle(ev) {
8571
- this.props.updateChart({
8593
+ this.props.updateChart(this.props.figureId, {
8572
8594
  title: ev.target.value,
8573
8595
  });
8574
8596
  }
8575
8597
  updateSelect(attr, ev) {
8576
- this.props.updateChart({
8598
+ this.props.updateChart(this.props.figureId, {
8577
8599
  [attr]: ev.target.value,
8578
8600
  });
8579
8601
  }
@@ -8606,7 +8628,7 @@
8606
8628
  this.dataRange = ranges[0];
8607
8629
  }
8608
8630
  updateDataRange() {
8609
- this.state.dataRangeDispatchResult = this.props.updateChart({
8631
+ this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
8610
8632
  dataRange: this.dataRange,
8611
8633
  });
8612
8634
  }
@@ -8676,12 +8698,12 @@
8676
8698
  }
8677
8699
  updateBackgroundColor(color) {
8678
8700
  this.state.openedMenu = undefined;
8679
- this.props.updateChart({
8701
+ this.props.updateChart(this.props.figureId, {
8680
8702
  background: color,
8681
8703
  });
8682
8704
  }
8683
8705
  updateTitle(ev) {
8684
- this.props.updateChart({
8706
+ this.props.updateChart(this.props.figureId, {
8685
8707
  title: ev.target.value,
8686
8708
  });
8687
8709
  }
@@ -8750,7 +8772,7 @@
8750
8772
  }
8751
8773
  }
8752
8774
  updateSectionRule(sectionRule) {
8753
- this.state.sectionRuleDispatchResult = this.props.updateChart({
8775
+ this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
8754
8776
  sectionRule,
8755
8777
  });
8756
8778
  }
@@ -8770,12 +8792,12 @@
8770
8792
  return false;
8771
8793
  }
8772
8794
  onUpdateLabelsAsText(ev) {
8773
- this.props.updateChart({
8795
+ this.props.updateChart(this.props.figureId, {
8774
8796
  labelsAsText: ev.target.checked,
8775
8797
  });
8776
8798
  }
8777
8799
  onUpdateStacked(ev) {
8778
- this.props.updateChart({
8800
+ this.props.updateChart(this.props.figureId, {
8779
8801
  stacked: ev.target.checked,
8780
8802
  });
8781
8803
  }
@@ -8816,7 +8838,7 @@
8816
8838
  this.keyValue = ranges[0];
8817
8839
  }
8818
8840
  updateKeyValueRange() {
8819
- this.state.keyValueDispatchResult = this.props.updateChart({
8841
+ this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
8820
8842
  keyValue: this.keyValue,
8821
8843
  });
8822
8844
  }
@@ -8824,12 +8846,12 @@
8824
8846
  this.baseline = ranges[0];
8825
8847
  }
8826
8848
  updateBaselineRange() {
8827
- this.state.baselineDispatchResult = this.props.updateChart({
8849
+ this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
8828
8850
  baseline: this.baseline,
8829
8851
  });
8830
8852
  }
8831
8853
  updateBaselineMode(ev) {
8832
- this.props.updateChart({ baselineMode: ev.target.value });
8854
+ this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
8833
8855
  }
8834
8856
  }
8835
8857
  ScorecardChartConfigPanel.template = "o-spreadsheet-ScorecardChartConfigPanel";
@@ -8849,12 +8871,12 @@
8849
8871
  owl.useExternalListener(window, "click", this.onClick);
8850
8872
  }
8851
8873
  updateTitle(ev) {
8852
- this.props.updateChart({
8874
+ this.props.updateChart(this.props.figureId, {
8853
8875
  title: ev.target.value,
8854
8876
  });
8855
8877
  }
8856
8878
  updateBaselineDescr(ev) {
8857
- this.props.updateChart({ baselineDescr: ev.target.value });
8879
+ this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
8858
8880
  }
8859
8881
  openColorPicker(colorPickerId) {
8860
8882
  this.state.openedColorPicker = colorPickerId;
@@ -8862,13 +8884,13 @@
8862
8884
  setColor(color, colorPickerId) {
8863
8885
  switch (colorPickerId) {
8864
8886
  case "backgroundColor":
8865
- this.props.updateChart({ background: color });
8887
+ this.props.updateChart(this.props.figureId, { background: color });
8866
8888
  break;
8867
8889
  case "baselineColorDown":
8868
- this.props.updateChart({ baselineColorDown: color });
8890
+ this.props.updateChart(this.props.figureId, { baselineColorDown: color });
8869
8891
  break;
8870
8892
  case "baselineColorUp":
8871
- this.props.updateChart({ baselineColorUp: color });
8893
+ this.props.updateChart(this.props.figureId, { baselineColorUp: color });
8872
8894
  break;
8873
8895
  }
8874
8896
  this.state.openedColorPicker = undefined;
@@ -8932,16 +8954,9 @@
8932
8954
  }
8933
8955
  `;
8934
8956
  class ChartPanel extends owl.Component {
8935
- constructor() {
8936
- super(...arguments);
8937
- this.shouldUpdateChart = true;
8938
- }
8939
8957
  get figureId() {
8940
8958
  return this.state.figureId;
8941
8959
  }
8942
- get sheetId() {
8943
- return this.state.sheetId;
8944
- }
8945
8960
  setup() {
8946
8961
  const selectedFigureId = this.env.model.getters.getSelectedFigureId();
8947
8962
  if (!selectedFigureId) {
@@ -8950,17 +8965,11 @@
8950
8965
  this.state = owl.useState({
8951
8966
  panel: "configuration",
8952
8967
  figureId: selectedFigureId,
8953
- sheetId: this.env.model.getters.getActiveSheetId(),
8954
8968
  });
8955
8969
  owl.onWillUpdateProps(() => {
8956
8970
  const selectedFigureId = this.env.model.getters.getSelectedFigureId();
8957
8971
  if (selectedFigureId && selectedFigureId !== this.state.figureId) {
8958
8972
  this.state.figureId = selectedFigureId;
8959
- this.state.sheetId = this.env.model.getters.getActiveSheetId();
8960
- this.shouldUpdateChart = false;
8961
- }
8962
- else {
8963
- this.shouldUpdateChart = true;
8964
8973
  }
8965
8974
  if (!this.env.model.getters.isChartDefined(this.figureId)) {
8966
8975
  this.props.onCloseSidePanel();
@@ -8968,8 +8977,8 @@
8968
8977
  }
8969
8978
  });
8970
8979
  }
8971
- updateChart(updateDefinition) {
8972
- if (!this.shouldUpdateChart) {
8980
+ updateChart(figureId, updateDefinition) {
8981
+ if (figureId !== this.figureId) {
8973
8982
  return;
8974
8983
  }
8975
8984
  const definition = {
@@ -8978,8 +8987,8 @@
8978
8987
  };
8979
8988
  return this.env.model.dispatch("UPDATE_CHART", {
8980
8989
  definition,
8981
- id: this.figureId,
8982
- sheetId: this.sheetId,
8990
+ id: figureId,
8991
+ sheetId: this.env.model.getters.getFigureSheetId(figureId),
8983
8992
  });
8984
8993
  }
8985
8994
  onTypeChange(type) {
@@ -8991,7 +9000,7 @@
8991
9000
  this.env.model.dispatch("UPDATE_CHART", {
8992
9001
  definition,
8993
9002
  id: this.figureId,
8994
- sheetId: this.sheetId,
9003
+ sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
8995
9004
  });
8996
9005
  }
8997
9006
  get chartPanel() {
@@ -32478,7 +32487,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32478
32487
  // magic "empty" value
32479
32488
  // Returning {value: null} instead of undefined will ensure that we don't
32480
32489
  // fall back on the default value of the argument provided to the formula's compute function
32481
- return { value: null };
32490
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32482
32491
  }
32483
32492
  return getEvaluatedCell(cell);
32484
32493
  }
@@ -34893,6 +34902,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34893
34902
  */
34894
34903
  class SelectionInputPlugin extends UIPlugin {
34895
34904
  constructor(getters, state, dispatch, config, selection, initialRanges, inputHasSingleRange) {
34905
+ if (inputHasSingleRange && initialRanges.length > 1) {
34906
+ throw new Error("Input with a single range cannot be instantiated with several range references.");
34907
+ }
34896
34908
  super(getters, state, dispatch, config, selection);
34897
34909
  this.inputHasSingleRange = inputHasSingleRange;
34898
34910
  this.ranges = [];
@@ -34915,6 +34927,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34915
34927
  return 29 /* CommandResult.MaximumRangesReached */;
34916
34928
  }
34917
34929
  break;
34930
+ case "CHANGE_RANGE":
34931
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
34932
+ return 29 /* CommandResult.MaximumRangesReached */;
34933
+ }
34934
+ break;
34918
34935
  }
34919
34936
  return 0 /* CommandResult.Success */;
34920
34937
  }
@@ -35728,13 +35745,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35728
35745
  }
35729
35746
  loadInitialMessages(messages) {
35730
35747
  this.isReplayingInitialRevisions = true;
35731
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
35732
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
35733
- });
35734
35748
  for (const message of messages) {
35735
35749
  this.onMessageReceived(message);
35736
35750
  }
35737
- this.off("unexpected-revision-id", this);
35738
35751
  this.isReplayingInitialRevisions = false;
35739
35752
  }
35740
35753
  /**
@@ -35806,6 +35819,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35806
35819
  onMessageReceived(message) {
35807
35820
  if (this.isAlreadyProcessed(message))
35808
35821
  return;
35822
+ if (this.isWrongServerRevisionId(message)) {
35823
+ this.trigger("unexpected-revision-id");
35824
+ return;
35825
+ }
35809
35826
  switch (message.type) {
35810
35827
  case "CLIENT_MOVED":
35811
35828
  this.onClientMoved(message);
@@ -35832,10 +35849,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35832
35849
  });
35833
35850
  break;
35834
35851
  case "REMOTE_REVISION":
35835
- if (message.serverRevisionId !== this.serverRevisionId) {
35836
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
35837
- return;
35838
- }
35839
35852
  const { clientId, commands } = message;
35840
35853
  const revision = new Revision(message.nextRevisionId, clientId, commands);
35841
35854
  if (revision.clientId !== this.clientId) {
@@ -35967,6 +35980,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35967
35980
  return false;
35968
35981
  }
35969
35982
  }
35983
+ isWrongServerRevisionId(message) {
35984
+ switch (message.type) {
35985
+ case "REMOTE_REVISION":
35986
+ case "REVISION_REDONE":
35987
+ case "REVISION_UNDONE":
35988
+ case "SNAPSHOT_CREATED":
35989
+ return message.serverRevisionId !== this.serverRevisionId;
35990
+ default:
35991
+ return false;
35992
+ }
35993
+ }
35970
35994
  dropPendingHistoryMessages() {
35971
35995
  this.waitingUndoRedoAck = false;
35972
35996
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -37930,7 +37954,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37930
37954
  color: dimgrey;
37931
37955
  }
37932
37956
  .o-sidePanelClose {
37933
- font-size: 1.5rem;
37934
37957
  padding: 5px 10px;
37935
37958
  cursor: pointer;
37936
37959
  &:hover {
@@ -42778,9 +42801,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42778
42801
  Object.defineProperty(exports, '__esModule', { value: true });
42779
42802
 
42780
42803
 
42781
- __info__.version = '16.0.9';
42782
- __info__.date = '2023-04-28T12:25:41.572Z';
42783
- __info__.hash = 'e06ca83';
42804
+ __info__.version = '16.0.11';
42805
+ __info__.date = '2023-05-25T12:57:28.152Z';
42806
+ __info__.hash = 'd27e998';
42784
42807
 
42785
42808
 
42786
42809
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);