@odoo/o-spreadsheet 16.0.9 → 16.0.10

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.
@@ -6417,6 +6417,12 @@ css /* scss */ `
6417
6417
  height: 25px;
6418
6418
  }
6419
6419
  }
6420
+ /** Make the character a bit bigger
6421
+ compared to its neighbor INPUT box */
6422
+ .o-remove-selection {
6423
+ font-weight: bold;
6424
+ font-size: calc(100% + 4px);
6425
+ }
6420
6426
  }
6421
6427
  `;
6422
6428
  /**
@@ -6493,6 +6499,9 @@ class SelectionInput extends owl.Component {
6493
6499
  (_b = (_a = this.props).onSelectionChanged) === null || _b === void 0 ? void 0 : _b.call(_a, ranges);
6494
6500
  this.previousRanges = ranges;
6495
6501
  }
6502
+ extractRanges(value) {
6503
+ return this.props.hasSingleRange ? value.split(",")[0] : value;
6504
+ }
6496
6505
  focus(rangeId) {
6497
6506
  this.state.isMissing = false;
6498
6507
  this.env.model.dispatch("FOCUS_RANGE", {
@@ -6511,15 +6520,16 @@ class SelectionInput extends owl.Component {
6511
6520
  }
6512
6521
  onInputChanged(rangeId, ev) {
6513
6522
  const target = ev.target;
6523
+ const value = this.extractRanges(target.value);
6514
6524
  this.env.model.dispatch("CHANGE_RANGE", {
6515
6525
  id: this.id,
6516
6526
  rangeId,
6517
- value: target.value,
6527
+ value,
6518
6528
  });
6519
6529
  target.blur();
6520
6530
  this.triggerChange();
6521
6531
  }
6522
- disable() {
6532
+ confirm() {
6523
6533
  var _a, _b;
6524
6534
  this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
6525
6535
  const ranges = this.env.model.getters.getSelectionInputValue(this.id);
@@ -32481,7 +32491,7 @@ class EvaluationPlugin extends UIPlugin {
32481
32491
  // magic "empty" value
32482
32492
  // Returning {value: null} instead of undefined will ensure that we don't
32483
32493
  // fall back on the default value of the argument provided to the formula's compute function
32484
- return { value: null };
32494
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32485
32495
  }
32486
32496
  return getEvaluatedCell(cell);
32487
32497
  }
@@ -34896,6 +34906,9 @@ const uuidGenerator = new UuidGenerator();
34896
34906
  */
34897
34907
  class SelectionInputPlugin extends UIPlugin {
34898
34908
  constructor(getters, state, dispatch, config, selection, initialRanges, inputHasSingleRange) {
34909
+ if (inputHasSingleRange && initialRanges.length > 1) {
34910
+ throw new Error("Input with a single range cannot be instantiated with several range references.");
34911
+ }
34899
34912
  super(getters, state, dispatch, config, selection);
34900
34913
  this.inputHasSingleRange = inputHasSingleRange;
34901
34914
  this.ranges = [];
@@ -34918,6 +34931,11 @@ class SelectionInputPlugin extends UIPlugin {
34918
34931
  return 29 /* CommandResult.MaximumRangesReached */;
34919
34932
  }
34920
34933
  break;
34934
+ case "CHANGE_RANGE":
34935
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
34936
+ return 29 /* CommandResult.MaximumRangesReached */;
34937
+ }
34938
+ break;
34921
34939
  }
34922
34940
  return 0 /* CommandResult.Success */;
34923
34941
  }
@@ -35731,13 +35749,9 @@ class Session extends EventBus {
35731
35749
  }
35732
35750
  loadInitialMessages(messages) {
35733
35751
  this.isReplayingInitialRevisions = true;
35734
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
35735
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
35736
- });
35737
35752
  for (const message of messages) {
35738
35753
  this.onMessageReceived(message);
35739
35754
  }
35740
- this.off("unexpected-revision-id", this);
35741
35755
  this.isReplayingInitialRevisions = false;
35742
35756
  }
35743
35757
  /**
@@ -35809,6 +35823,10 @@ class Session extends EventBus {
35809
35823
  onMessageReceived(message) {
35810
35824
  if (this.isAlreadyProcessed(message))
35811
35825
  return;
35826
+ if (this.isWrongServerRevisionId(message)) {
35827
+ this.trigger("unexpected-revision-id");
35828
+ return;
35829
+ }
35812
35830
  switch (message.type) {
35813
35831
  case "CLIENT_MOVED":
35814
35832
  this.onClientMoved(message);
@@ -35835,10 +35853,6 @@ class Session extends EventBus {
35835
35853
  });
35836
35854
  break;
35837
35855
  case "REMOTE_REVISION":
35838
- if (message.serverRevisionId !== this.serverRevisionId) {
35839
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
35840
- return;
35841
- }
35842
35856
  const { clientId, commands } = message;
35843
35857
  const revision = new Revision(message.nextRevisionId, clientId, commands);
35844
35858
  if (revision.clientId !== this.clientId) {
@@ -35970,6 +35984,17 @@ class Session extends EventBus {
35970
35984
  return false;
35971
35985
  }
35972
35986
  }
35987
+ isWrongServerRevisionId(message) {
35988
+ switch (message.type) {
35989
+ case "REMOTE_REVISION":
35990
+ case "REVISION_REDONE":
35991
+ case "REVISION_UNDONE":
35992
+ case "SNAPSHOT_CREATED":
35993
+ return message.serverRevisionId !== this.serverRevisionId;
35994
+ default:
35995
+ return false;
35996
+ }
35997
+ }
35973
35998
  dropPendingHistoryMessages() {
35974
35999
  this.waitingUndoRedoAck = false;
35975
36000
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -37933,7 +37958,6 @@ css /* scss */ `
37933
37958
  color: dimgrey;
37934
37959
  }
37935
37960
  .o-sidePanelClose {
37936
- font-size: 1.5rem;
37937
37961
  padding: 5px 10px;
37938
37962
  cursor: pointer;
37939
37963
  &:hover {
@@ -42779,6 +42803,6 @@ exports.setTranslationMethod = setTranslationMethod;
42779
42803
  exports.tokenize = tokenize;
42780
42804
 
42781
42805
 
42782
- __info__.version = '16.0.9';
42783
- __info__.date = '2023-04-28T12:25:41.572Z';
42784
- __info__.hash = 'e06ca83';
42806
+ __info__.version = '16.0.10';
42807
+ __info__.date = '2023-05-12T10:59:27.820Z';
42808
+ __info__.hash = '115eda7';
@@ -873,7 +873,6 @@ interface CollaborativeEventReceived {
873
873
  }
874
874
  interface UnexpectedRevisionIdEvent {
875
875
  type: "unexpected-revision-id";
876
- revisionId: UID;
877
876
  }
878
877
  interface NewLocalStateUpdateEvent {
879
878
  type: "new-local-state-update";
@@ -2809,6 +2808,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
2809
2808
  private sendPendingMessage;
2810
2809
  private acknowledge;
2811
2810
  private isAlreadyProcessed;
2811
+ isWrongServerRevisionId(message: CollaborationMessage): boolean;
2812
2812
  private dropPendingHistoryMessages;
2813
2813
  }
2814
2814
 
@@ -4862,11 +4862,12 @@ declare class SelectionInput extends Component<Props$y, SpreadsheetChildEnv> {
4862
4862
  checkChange(): void;
4863
4863
  getColor(range: SelectionRange): string;
4864
4864
  private triggerChange;
4865
+ private extractRanges;
4865
4866
  focus(rangeId: string): void;
4866
4867
  addEmptyInput(): void;
4867
4868
  removeInput(rangeId: string): void;
4868
4869
  onInputChanged(rangeId: string, ev: InputEvent): void;
4869
- disable(): void;
4870
+ confirm(): void;
4870
4871
  }
4871
4872
 
4872
4873
  interface Props$x {
@@ -6413,6 +6413,12 @@ css /* scss */ `
6413
6413
  height: 25px;
6414
6414
  }
6415
6415
  }
6416
+ /** Make the character a bit bigger
6417
+ compared to its neighbor INPUT box */
6418
+ .o-remove-selection {
6419
+ font-weight: bold;
6420
+ font-size: calc(100% + 4px);
6421
+ }
6416
6422
  }
6417
6423
  `;
6418
6424
  /**
@@ -6489,6 +6495,9 @@ class SelectionInput extends Component {
6489
6495
  (_b = (_a = this.props).onSelectionChanged) === null || _b === void 0 ? void 0 : _b.call(_a, ranges);
6490
6496
  this.previousRanges = ranges;
6491
6497
  }
6498
+ extractRanges(value) {
6499
+ return this.props.hasSingleRange ? value.split(",")[0] : value;
6500
+ }
6492
6501
  focus(rangeId) {
6493
6502
  this.state.isMissing = false;
6494
6503
  this.env.model.dispatch("FOCUS_RANGE", {
@@ -6507,15 +6516,16 @@ class SelectionInput extends Component {
6507
6516
  }
6508
6517
  onInputChanged(rangeId, ev) {
6509
6518
  const target = ev.target;
6519
+ const value = this.extractRanges(target.value);
6510
6520
  this.env.model.dispatch("CHANGE_RANGE", {
6511
6521
  id: this.id,
6512
6522
  rangeId,
6513
- value: target.value,
6523
+ value,
6514
6524
  });
6515
6525
  target.blur();
6516
6526
  this.triggerChange();
6517
6527
  }
6518
- disable() {
6528
+ confirm() {
6519
6529
  var _a, _b;
6520
6530
  this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
6521
6531
  const ranges = this.env.model.getters.getSelectionInputValue(this.id);
@@ -32477,7 +32487,7 @@ class EvaluationPlugin extends UIPlugin {
32477
32487
  // magic "empty" value
32478
32488
  // Returning {value: null} instead of undefined will ensure that we don't
32479
32489
  // fall back on the default value of the argument provided to the formula's compute function
32480
- return { value: null };
32490
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32481
32491
  }
32482
32492
  return getEvaluatedCell(cell);
32483
32493
  }
@@ -34892,6 +34902,9 @@ const uuidGenerator = new UuidGenerator();
34892
34902
  */
34893
34903
  class SelectionInputPlugin extends UIPlugin {
34894
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
+ }
34895
34908
  super(getters, state, dispatch, config, selection);
34896
34909
  this.inputHasSingleRange = inputHasSingleRange;
34897
34910
  this.ranges = [];
@@ -34914,6 +34927,11 @@ class SelectionInputPlugin extends UIPlugin {
34914
34927
  return 29 /* CommandResult.MaximumRangesReached */;
34915
34928
  }
34916
34929
  break;
34930
+ case "CHANGE_RANGE":
34931
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
34932
+ return 29 /* CommandResult.MaximumRangesReached */;
34933
+ }
34934
+ break;
34917
34935
  }
34918
34936
  return 0 /* CommandResult.Success */;
34919
34937
  }
@@ -35727,13 +35745,9 @@ class Session extends EventBus {
35727
35745
  }
35728
35746
  loadInitialMessages(messages) {
35729
35747
  this.isReplayingInitialRevisions = true;
35730
- this.on("unexpected-revision-id", this, ({ revisionId }) => {
35731
- throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
35732
- });
35733
35748
  for (const message of messages) {
35734
35749
  this.onMessageReceived(message);
35735
35750
  }
35736
- this.off("unexpected-revision-id", this);
35737
35751
  this.isReplayingInitialRevisions = false;
35738
35752
  }
35739
35753
  /**
@@ -35805,6 +35819,10 @@ class Session extends EventBus {
35805
35819
  onMessageReceived(message) {
35806
35820
  if (this.isAlreadyProcessed(message))
35807
35821
  return;
35822
+ if (this.isWrongServerRevisionId(message)) {
35823
+ this.trigger("unexpected-revision-id");
35824
+ return;
35825
+ }
35808
35826
  switch (message.type) {
35809
35827
  case "CLIENT_MOVED":
35810
35828
  this.onClientMoved(message);
@@ -35831,10 +35849,6 @@ class Session extends EventBus {
35831
35849
  });
35832
35850
  break;
35833
35851
  case "REMOTE_REVISION":
35834
- if (message.serverRevisionId !== this.serverRevisionId) {
35835
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
35836
- return;
35837
- }
35838
35852
  const { clientId, commands } = message;
35839
35853
  const revision = new Revision(message.nextRevisionId, clientId, commands);
35840
35854
  if (revision.clientId !== this.clientId) {
@@ -35966,6 +35980,17 @@ class Session extends EventBus {
35966
35980
  return false;
35967
35981
  }
35968
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
+ }
35969
35994
  dropPendingHistoryMessages() {
35970
35995
  this.waitingUndoRedoAck = false;
35971
35996
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -37929,7 +37954,6 @@ css /* scss */ `
37929
37954
  color: dimgrey;
37930
37955
  }
37931
37956
  .o-sidePanelClose {
37932
- font-size: 1.5rem;
37933
37957
  padding: 5px 10px;
37934
37958
  cursor: pointer;
37935
37959
  &:hover {
@@ -42747,6 +42771,6 @@ function addFunction(functionName, functionDescription) {
42747
42771
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
42748
42772
 
42749
42773
 
42750
- __info__.version = '16.0.9';
42751
- __info__.date = '2023-04-28T12:25:41.572Z';
42752
- __info__.hash = 'e06ca83';
42774
+ __info__.version = '16.0.10';
42775
+ __info__.date = '2023-05-12T10:59:27.820Z';
42776
+ __info__.hash = '115eda7';
@@ -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);
@@ -32478,7 +32488,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32478
32488
  // magic "empty" value
32479
32489
  // Returning {value: null} instead of undefined will ensure that we don't
32480
32490
  // fall back on the default value of the argument provided to the formula's compute function
32481
- return { value: null };
32491
+ return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
32482
32492
  }
32483
32493
  return getEvaluatedCell(cell);
32484
32494
  }
@@ -34893,6 +34903,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34893
34903
  */
34894
34904
  class SelectionInputPlugin extends UIPlugin {
34895
34905
  constructor(getters, state, dispatch, config, selection, initialRanges, inputHasSingleRange) {
34906
+ if (inputHasSingleRange && initialRanges.length > 1) {
34907
+ throw new Error("Input with a single range cannot be instantiated with several range references.");
34908
+ }
34896
34909
  super(getters, state, dispatch, config, selection);
34897
34910
  this.inputHasSingleRange = inputHasSingleRange;
34898
34911
  this.ranges = [];
@@ -34915,6 +34928,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34915
34928
  return 29 /* CommandResult.MaximumRangesReached */;
34916
34929
  }
34917
34930
  break;
34931
+ case "CHANGE_RANGE":
34932
+ if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
34933
+ return 29 /* CommandResult.MaximumRangesReached */;
34934
+ }
34935
+ break;
34918
34936
  }
34919
34937
  return 0 /* CommandResult.Success */;
34920
34938
  }
@@ -35728,13 +35746,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35728
35746
  }
35729
35747
  loadInitialMessages(messages) {
35730
35748
  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
35749
  for (const message of messages) {
35735
35750
  this.onMessageReceived(message);
35736
35751
  }
35737
- this.off("unexpected-revision-id", this);
35738
35752
  this.isReplayingInitialRevisions = false;
35739
35753
  }
35740
35754
  /**
@@ -35806,6 +35820,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35806
35820
  onMessageReceived(message) {
35807
35821
  if (this.isAlreadyProcessed(message))
35808
35822
  return;
35823
+ if (this.isWrongServerRevisionId(message)) {
35824
+ this.trigger("unexpected-revision-id");
35825
+ return;
35826
+ }
35809
35827
  switch (message.type) {
35810
35828
  case "CLIENT_MOVED":
35811
35829
  this.onClientMoved(message);
@@ -35832,10 +35850,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35832
35850
  });
35833
35851
  break;
35834
35852
  case "REMOTE_REVISION":
35835
- if (message.serverRevisionId !== this.serverRevisionId) {
35836
- this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
35837
- return;
35838
- }
35839
35853
  const { clientId, commands } = message;
35840
35854
  const revision = new Revision(message.nextRevisionId, clientId, commands);
35841
35855
  if (revision.clientId !== this.clientId) {
@@ -35967,6 +35981,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
35967
35981
  return false;
35968
35982
  }
35969
35983
  }
35984
+ isWrongServerRevisionId(message) {
35985
+ switch (message.type) {
35986
+ case "REMOTE_REVISION":
35987
+ case "REVISION_REDONE":
35988
+ case "REVISION_UNDONE":
35989
+ case "SNAPSHOT_CREATED":
35990
+ return message.serverRevisionId !== this.serverRevisionId;
35991
+ default:
35992
+ return false;
35993
+ }
35994
+ }
35970
35995
  dropPendingHistoryMessages() {
35971
35996
  this.waitingUndoRedoAck = false;
35972
35997
  this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
@@ -37930,7 +37955,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37930
37955
  color: dimgrey;
37931
37956
  }
37932
37957
  .o-sidePanelClose {
37933
- font-size: 1.5rem;
37934
37958
  padding: 5px 10px;
37935
37959
  cursor: pointer;
37936
37960
  &:hover {
@@ -42778,9 +42802,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42778
42802
  Object.defineProperty(exports, '__esModule', { value: true });
42779
42803
 
42780
42804
 
42781
- __info__.version = '16.0.9';
42782
- __info__.date = '2023-04-28T12:25:41.572Z';
42783
- __info__.hash = 'e06ca83';
42805
+ __info__.version = '16.0.10';
42806
+ __info__.date = '2023-05-12T10:59:27.820Z';
42807
+ __info__.hash = '115eda7';
42784
42808
 
42785
42809
 
42786
42810
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);