react-mutation-mapper 0.8.64 → 0.8.66

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.
package/dist/index.js CHANGED
@@ -4797,16 +4797,26 @@ var LollipopPlotNoTooltip = /** @class */ (function (_super) {
4797
4797
  if (lollipopIndex !== null) {
4798
4798
  var lollipopComponent_1 = this.lollipopComponents[lollipopIndex];
4799
4799
  if (lollipopComponent_1) {
4800
+ // mirrorLollipopComponent refers to the lollipop component, if it exists, in the other group at the same lollipopIndex
4801
+ // this is needed to show tooltips of both lollipop components at same index
4802
+ var mirrorLollipopComponent = ___default["default"].find(this.lollipopComponents, function (l) {
4803
+ return l.props.spec.codon ===
4804
+ lollipopComponent_1.props.spec.codon &&
4805
+ l !== lollipopComponent_1;
4806
+ });
4800
4807
  lollipopComponent_1.isHovered = true;
4801
4808
  if (this.props.setHitZone) {
4802
- this.props.setHitZone(lollipopComponent_1.circleHitRect, lollipopComponent_1.props.spec.tooltip, mobx.action(function () {
4809
+ this.props.setHitZone(lollipopComponent_1.circleHitRect, lollipopComponent_1.props.spec.tooltip, mirrorLollipopComponent === null || mirrorLollipopComponent === void 0 ? void 0 : mirrorLollipopComponent.circleHitRect, mirrorLollipopComponent === null || mirrorLollipopComponent === void 0 ? void 0 : mirrorLollipopComponent.props.spec.tooltip, mobx.action(function () {
4803
4810
  if (_this.props.dataStore) {
4804
4811
  updatePositionHighlightFilters(_this.props.dataStore, [lollipopComponent_1.props.spec.codon]);
4805
4812
  }
4806
4813
  lollipopComponent_1.isHovered = true;
4807
4814
  }), mobx.action(function () {
4808
4815
  return _this.onLollipopClick(lollipopComponent_1.props.spec.codon);
4809
- }));
4816
+ }), undefined, 'pointer', lollipopComponent_1.circleHitRect.y >
4817
+ lollipopComponent_1.props.stickBaseY
4818
+ ? 'bottom'
4819
+ : 'top');
4810
4820
  }
4811
4821
  }
4812
4822
  }
@@ -4817,7 +4827,7 @@ var LollipopPlotNoTooltip = /** @class */ (function (_super) {
4817
4827
  var domainComponent = this.domainComponents[domainIndex];
4818
4828
  if (domainComponent) {
4819
4829
  if (this.props.setHitZone) {
4820
- this.props.setHitZone(domainComponent.hitRect, domainComponent.props.spec.tooltip, undefined, undefined, undefined, 'auto');
4830
+ this.props.setHitZone(domainComponent.hitRect, domainComponent.props.spec.tooltip, undefined, undefined, undefined, undefined, undefined, 'auto');
4821
4831
  }
4822
4832
  }
4823
4833
  }
@@ -4830,7 +4840,7 @@ var LollipopPlotNoTooltip = /** @class */ (function (_super) {
4830
4840
  if (this.props.setHitZone) {
4831
4841
  this.props.setHitZone(sequenceComponent.hitRect, sequenceComponent.props.spec
4832
4842
  ? sequenceComponent.props.spec.tooltip
4833
- : undefined, undefined, undefined, undefined, 'auto');
4843
+ : undefined, undefined, undefined, undefined, undefined, undefined, 'auto');
4834
4844
  }
4835
4845
  }
4836
4846
  }
@@ -5649,6 +5659,12 @@ var LollipopPlot = /** @class */ (function (_super) {
5649
5659
  writable: true,
5650
5660
  value: cbioportalFrontendCommons.defaultHitzoneConfig()
5651
5661
  });
5662
+ Object.defineProperty(_this, "mirrorVisible", {
5663
+ enumerable: true,
5664
+ configurable: true,
5665
+ writable: true,
5666
+ value: false
5667
+ }); // lollipop and mirror lollipop share tooltip visibility
5652
5668
  Object.defineProperty(_this, "plot", {
5653
5669
  enumerable: true,
5654
5670
  configurable: true,
@@ -5666,12 +5682,14 @@ var LollipopPlot = /** @class */ (function (_super) {
5666
5682
  ref: function (plot) {
5667
5683
  _this.plot = plot;
5668
5684
  },
5669
- setHitZone: function (hitRect, content, onMouseOver, onClick, onMouseOut, cursor, tooltipPlacement) {
5685
+ setHitZone: function (hitRect, content, mirrorHitRect, mirrorContent, onMouseOver, onClick, onMouseOut, cursor, tooltipPlacement) {
5670
5686
  if (cursor === void 0) { cursor = 'pointer'; }
5671
5687
  if (tooltipPlacement === void 0) { tooltipPlacement = 'top'; }
5672
5688
  _this.hitZoneConfig = {
5673
5689
  hitRect: hitRect,
5674
5690
  content: content,
5691
+ mirrorHitRect: mirrorHitRect,
5692
+ mirrorContent: mirrorContent,
5675
5693
  onMouseOver: onMouseOver,
5676
5694
  onClick: onClick,
5677
5695
  onMouseOut: onMouseOut,
@@ -5681,6 +5699,7 @@ var LollipopPlot = /** @class */ (function (_super) {
5681
5699
  },
5682
5700
  getOverlay: function () { return _this.hitZoneConfig.content; },
5683
5701
  getOverlayPlacement: function () { return _this.hitZoneConfig.tooltipPlacement; },
5702
+ getMirrorOverlay: function () { return _this.hitZoneConfig.mirrorContent; },
5684
5703
  onMouseLeave: function () {
5685
5704
  _this.hitZoneConfig.onMouseOut &&
5686
5705
  _this.hitZoneConfig.onMouseOut();
@@ -5706,6 +5725,25 @@ var LollipopPlot = /** @class */ (function (_super) {
5706
5725
  enumerable: false,
5707
5726
  configurable: true
5708
5727
  });
5728
+ Object.defineProperty(LollipopPlot.prototype, "mirrorHitZone", {
5729
+ // hit zone of mirror lollipop component initialized using config's mirrorHitRect (mirror lollipop location)
5730
+ // used to determine where to apply the mirror lollipop tooltip
5731
+ get: function () {
5732
+ return cbioportalFrontendCommons.initHitZoneFromConfig(tslib.__assign(tslib.__assign({}, this.hitZoneConfig), { hitRect: tslib.__assign({}, this.hitZoneConfig.mirrorHitRect) }));
5733
+ },
5734
+ enumerable: false,
5735
+ configurable: true
5736
+ });
5737
+ // handles lollipop and mirror lollipop component simultaneous tooltip visibility
5738
+ // if lollipop tooltip is visible, make mirror lollipop tooltip visible as well
5739
+ Object.defineProperty(LollipopPlot.prototype, "onTooltipVisibleChange", {
5740
+ enumerable: false,
5741
+ configurable: true,
5742
+ writable: true,
5743
+ value: function (visible) {
5744
+ this.mirrorVisible = visible;
5745
+ }
5746
+ });
5709
5747
  Object.defineProperty(LollipopPlot.prototype, "toSVGDOMNode", {
5710
5748
  enumerable: false,
5711
5749
  configurable: true,
@@ -5733,7 +5771,10 @@ var LollipopPlot = /** @class */ (function (_super) {
5733
5771
  position: 'relative',
5734
5772
  display: 'inline-block',
5735
5773
  }, "data-test": "LollipopPlot" },
5736
- React__namespace.createElement(cbioportalFrontendCommons.DefaultTooltip, tslib.__assign({ placement: this.handlers.getOverlayPlacement(), overlay: this.handlers.getOverlay }, tooltipVisibleProps), this.hitZone),
5774
+ React__namespace.createElement(cbioportalFrontendCommons.DefaultTooltip, tslib.__assign({ placement: this.handlers.getOverlayPlacement(), overlay: this.handlers.getOverlay, visible: this.mirrorVisible, onVisibleChange: this.onTooltipVisibleChange }, tooltipVisibleProps), this.hitZone),
5775
+ this.hitZoneConfig.mirrorHitRect && (React__namespace.createElement(cbioportalFrontendCommons.DefaultTooltip, tslib.__assign({ placement: this.handlers.getOverlayPlacement() === 'top'
5776
+ ? 'bottom'
5777
+ : 'top', overlay: this.handlers.getMirrorOverlay, visible: this.mirrorVisible, onVisibleChange: this.onTooltipVisibleChange }, tooltipVisibleProps), this.mirrorHitZone)),
5737
5778
  React__namespace.createElement(LollipopPlotNoTooltip, tslib.__assign({ ref: this.handlers.ref, setHitZone: this.handlers.setHitZone, onMouseLeave: this.handlers.onMouseLeave, onBackgroundMouseMove: this.handlers.onBackgroundMouseMove }, this.props))));
5738
5779
  }
5739
5780
  });
@@ -5748,12 +5789,21 @@ var LollipopPlot = /** @class */ (function (_super) {
5748
5789
  tslib.__decorate([
5749
5790
  mobx.observable
5750
5791
  ], LollipopPlot.prototype, "hitZoneConfig", void 0);
5792
+ tslib.__decorate([
5793
+ mobx.observable
5794
+ ], LollipopPlot.prototype, "mirrorVisible", void 0);
5751
5795
  tslib.__decorate([
5752
5796
  mobx.computed
5753
5797
  ], LollipopPlot.prototype, "tooltipVisible", null);
5754
5798
  tslib.__decorate([
5755
5799
  mobx.computed
5756
5800
  ], LollipopPlot.prototype, "hitZone", null);
5801
+ tslib.__decorate([
5802
+ mobx.computed
5803
+ ], LollipopPlot.prototype, "mirrorHitZone", null);
5804
+ tslib.__decorate([
5805
+ mobx.action.bound
5806
+ ], LollipopPlot.prototype, "onTooltipVisibleChange", null);
5757
5807
  LollipopPlot = tslib.__decorate([
5758
5808
  mobxReact.observer
5759
5809
  ], LollipopPlot);