react-mutation-mapper 0.8.65 → 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.
@@ -29,12 +29,15 @@ export declare type LollipopPlotProps = {
29
29
  };
30
30
  export default class LollipopPlot extends React.Component<LollipopPlotProps, {}> {
31
31
  private hitZoneConfig;
32
+ private mirrorVisible;
32
33
  private plot;
33
34
  private handlers;
34
35
  static defaultProps: Partial<LollipopPlotProps>;
35
36
  constructor(props: LollipopPlotProps);
36
37
  private get tooltipVisible();
37
38
  private get hitZone();
39
+ private get mirrorHitZone();
40
+ private onTooltipVisibleChange;
38
41
  toSVGDOMNode(): Element;
39
42
  render(): JSX.Element;
40
43
  }
@@ -8,7 +8,12 @@ export declare type LollipopPlotNoTooltipProps = LollipopPlotProps & {
8
8
  y: number;
9
9
  width: number;
10
10
  height: number;
11
- }, tooltipContent?: JSX.Element, onMouseOver?: () => void, onClick?: () => void, onMouseOut?: () => void, cursor?: string, tooltipPlacement?: string) => void;
11
+ }, tooltipContent?: JSX.Element, mirrorHitRect?: {
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ }, mirrorTooltipContent?: JSX.Element, onMouseOver?: () => void, onClick?: () => void, onMouseOut?: () => void, cursor?: string, tooltipPlacement?: string) => void;
12
17
  onMouseLeave?: () => void;
13
18
  onBackgroundMouseMove?: () => void;
14
19
  };
package/dist/index.es.js CHANGED
@@ -4760,16 +4760,26 @@ var LollipopPlotNoTooltip = /** @class */ (function (_super) {
4760
4760
  if (lollipopIndex !== null) {
4761
4761
  var lollipopComponent_1 = this.lollipopComponents[lollipopIndex];
4762
4762
  if (lollipopComponent_1) {
4763
+ // mirrorLollipopComponent refers to the lollipop component, if it exists, in the other group at the same lollipopIndex
4764
+ // this is needed to show tooltips of both lollipop components at same index
4765
+ var mirrorLollipopComponent = ___default.find(this.lollipopComponents, function (l) {
4766
+ return l.props.spec.codon ===
4767
+ lollipopComponent_1.props.spec.codon &&
4768
+ l !== lollipopComponent_1;
4769
+ });
4763
4770
  lollipopComponent_1.isHovered = true;
4764
4771
  if (this.props.setHitZone) {
4765
- this.props.setHitZone(lollipopComponent_1.circleHitRect, lollipopComponent_1.props.spec.tooltip, action(function () {
4772
+ 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, action(function () {
4766
4773
  if (_this.props.dataStore) {
4767
4774
  updatePositionHighlightFilters(_this.props.dataStore, [lollipopComponent_1.props.spec.codon]);
4768
4775
  }
4769
4776
  lollipopComponent_1.isHovered = true;
4770
4777
  }), action(function () {
4771
4778
  return _this.onLollipopClick(lollipopComponent_1.props.spec.codon);
4772
- }));
4779
+ }), undefined, 'pointer', lollipopComponent_1.circleHitRect.y >
4780
+ lollipopComponent_1.props.stickBaseY
4781
+ ? 'bottom'
4782
+ : 'top');
4773
4783
  }
4774
4784
  }
4775
4785
  }
@@ -4780,7 +4790,7 @@ var LollipopPlotNoTooltip = /** @class */ (function (_super) {
4780
4790
  var domainComponent = this.domainComponents[domainIndex];
4781
4791
  if (domainComponent) {
4782
4792
  if (this.props.setHitZone) {
4783
- this.props.setHitZone(domainComponent.hitRect, domainComponent.props.spec.tooltip, undefined, undefined, undefined, 'auto');
4793
+ this.props.setHitZone(domainComponent.hitRect, domainComponent.props.spec.tooltip, undefined, undefined, undefined, undefined, undefined, 'auto');
4784
4794
  }
4785
4795
  }
4786
4796
  }
@@ -4793,7 +4803,7 @@ var LollipopPlotNoTooltip = /** @class */ (function (_super) {
4793
4803
  if (this.props.setHitZone) {
4794
4804
  this.props.setHitZone(sequenceComponent.hitRect, sequenceComponent.props.spec
4795
4805
  ? sequenceComponent.props.spec.tooltip
4796
- : undefined, undefined, undefined, undefined, 'auto');
4806
+ : undefined, undefined, undefined, undefined, undefined, undefined, 'auto');
4797
4807
  }
4798
4808
  }
4799
4809
  }
@@ -5612,6 +5622,12 @@ var LollipopPlot = /** @class */ (function (_super) {
5612
5622
  writable: true,
5613
5623
  value: defaultHitzoneConfig()
5614
5624
  });
5625
+ Object.defineProperty(_this, "mirrorVisible", {
5626
+ enumerable: true,
5627
+ configurable: true,
5628
+ writable: true,
5629
+ value: false
5630
+ }); // lollipop and mirror lollipop share tooltip visibility
5615
5631
  Object.defineProperty(_this, "plot", {
5616
5632
  enumerable: true,
5617
5633
  configurable: true,
@@ -5629,12 +5645,14 @@ var LollipopPlot = /** @class */ (function (_super) {
5629
5645
  ref: function (plot) {
5630
5646
  _this.plot = plot;
5631
5647
  },
5632
- setHitZone: function (hitRect, content, onMouseOver, onClick, onMouseOut, cursor, tooltipPlacement) {
5648
+ setHitZone: function (hitRect, content, mirrorHitRect, mirrorContent, onMouseOver, onClick, onMouseOut, cursor, tooltipPlacement) {
5633
5649
  if (cursor === void 0) { cursor = 'pointer'; }
5634
5650
  if (tooltipPlacement === void 0) { tooltipPlacement = 'top'; }
5635
5651
  _this.hitZoneConfig = {
5636
5652
  hitRect: hitRect,
5637
5653
  content: content,
5654
+ mirrorHitRect: mirrorHitRect,
5655
+ mirrorContent: mirrorContent,
5638
5656
  onMouseOver: onMouseOver,
5639
5657
  onClick: onClick,
5640
5658
  onMouseOut: onMouseOut,
@@ -5644,6 +5662,7 @@ var LollipopPlot = /** @class */ (function (_super) {
5644
5662
  },
5645
5663
  getOverlay: function () { return _this.hitZoneConfig.content; },
5646
5664
  getOverlayPlacement: function () { return _this.hitZoneConfig.tooltipPlacement; },
5665
+ getMirrorOverlay: function () { return _this.hitZoneConfig.mirrorContent; },
5647
5666
  onMouseLeave: function () {
5648
5667
  _this.hitZoneConfig.onMouseOut &&
5649
5668
  _this.hitZoneConfig.onMouseOut();
@@ -5669,6 +5688,25 @@ var LollipopPlot = /** @class */ (function (_super) {
5669
5688
  enumerable: false,
5670
5689
  configurable: true
5671
5690
  });
5691
+ Object.defineProperty(LollipopPlot.prototype, "mirrorHitZone", {
5692
+ // hit zone of mirror lollipop component initialized using config's mirrorHitRect (mirror lollipop location)
5693
+ // used to determine where to apply the mirror lollipop tooltip
5694
+ get: function () {
5695
+ return initHitZoneFromConfig(__assign(__assign({}, this.hitZoneConfig), { hitRect: __assign({}, this.hitZoneConfig.mirrorHitRect) }));
5696
+ },
5697
+ enumerable: false,
5698
+ configurable: true
5699
+ });
5700
+ // handles lollipop and mirror lollipop component simultaneous tooltip visibility
5701
+ // if lollipop tooltip is visible, make mirror lollipop tooltip visible as well
5702
+ Object.defineProperty(LollipopPlot.prototype, "onTooltipVisibleChange", {
5703
+ enumerable: false,
5704
+ configurable: true,
5705
+ writable: true,
5706
+ value: function (visible) {
5707
+ this.mirrorVisible = visible;
5708
+ }
5709
+ });
5672
5710
  Object.defineProperty(LollipopPlot.prototype, "toSVGDOMNode", {
5673
5711
  enumerable: false,
5674
5712
  configurable: true,
@@ -5696,7 +5734,10 @@ var LollipopPlot = /** @class */ (function (_super) {
5696
5734
  position: 'relative',
5697
5735
  display: 'inline-block',
5698
5736
  }, "data-test": "LollipopPlot" },
5699
- React.createElement(DefaultTooltip, __assign({ placement: this.handlers.getOverlayPlacement(), overlay: this.handlers.getOverlay }, tooltipVisibleProps), this.hitZone),
5737
+ React.createElement(DefaultTooltip, __assign({ placement: this.handlers.getOverlayPlacement(), overlay: this.handlers.getOverlay, visible: this.mirrorVisible, onVisibleChange: this.onTooltipVisibleChange }, tooltipVisibleProps), this.hitZone),
5738
+ this.hitZoneConfig.mirrorHitRect && (React.createElement(DefaultTooltip, __assign({ placement: this.handlers.getOverlayPlacement() === 'top'
5739
+ ? 'bottom'
5740
+ : 'top', overlay: this.handlers.getMirrorOverlay, visible: this.mirrorVisible, onVisibleChange: this.onTooltipVisibleChange }, tooltipVisibleProps), this.mirrorHitZone)),
5700
5741
  React.createElement(LollipopPlotNoTooltip, __assign({ ref: this.handlers.ref, setHitZone: this.handlers.setHitZone, onMouseLeave: this.handlers.onMouseLeave, onBackgroundMouseMove: this.handlers.onBackgroundMouseMove }, this.props))));
5701
5742
  }
5702
5743
  });
@@ -5711,12 +5752,21 @@ var LollipopPlot = /** @class */ (function (_super) {
5711
5752
  __decorate([
5712
5753
  observable
5713
5754
  ], LollipopPlot.prototype, "hitZoneConfig", void 0);
5755
+ __decorate([
5756
+ observable
5757
+ ], LollipopPlot.prototype, "mirrorVisible", void 0);
5714
5758
  __decorate([
5715
5759
  computed
5716
5760
  ], LollipopPlot.prototype, "tooltipVisible", null);
5717
5761
  __decorate([
5718
5762
  computed
5719
5763
  ], LollipopPlot.prototype, "hitZone", null);
5764
+ __decorate([
5765
+ computed
5766
+ ], LollipopPlot.prototype, "mirrorHitZone", null);
5767
+ __decorate([
5768
+ action.bound
5769
+ ], LollipopPlot.prototype, "onTooltipVisibleChange", null);
5720
5770
  LollipopPlot = __decorate([
5721
5771
  observer
5722
5772
  ], LollipopPlot);