react-mutation-mapper 0.8.10 → 0.8.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.
@@ -14,6 +14,7 @@ export declare type TrackProps = {
14
14
  xOffset?: number;
15
15
  defaultFilters?: DataFilter[];
16
16
  idClassPrefix?: string;
17
+ isSubTrack?: boolean;
17
18
  };
18
19
  export default class Track extends React.Component<TrackProps, {}> {
19
20
  private hitZoneConfig;
package/dist/index.es.js CHANGED
@@ -7172,7 +7172,7 @@ var LollipopMutationPlotControls = /** @class */ (function (_super) {
7172
7172
  });
7173
7173
  Object.defineProperty(LollipopMutationPlotControls.prototype, "downloadControls", {
7174
7174
  get: function () {
7175
- return (createElement(DownloadControls, { getSvg: this.props.getSVG, filename: this.props.hugoGeneSymbol + "_lollipop.svg", dontFade: true, type: "button" }));
7175
+ return (createElement(DownloadControls, { getSvg: this.props.getSVG, filename: this.props.hugoGeneSymbol + "_lollipop", dontFade: true, type: "button" }));
7176
7176
  },
7177
7177
  enumerable: false,
7178
7178
  configurable: true
@@ -7794,7 +7794,7 @@ var Track = /** @class */ (function (_super) {
7794
7794
  position: 'relative',
7795
7795
  display: 'flex',
7796
7796
  } },
7797
- createElement("span", { className: classnames(styles$6.trackTitle, 'small') }, this.props.trackTitle),
7797
+ createElement("span", { className: classnames(styles$6.trackTitle, 'small', (this.props.isSubTrack ? 'subtrack-' : '') + "trackTitle") }, this.props.trackTitle),
7798
7798
  createElement("span", null,
7799
7799
  createElement(DefaultTooltip, __assign({ placement: this.getOverlayPlacement(), overlay: this.getOverlay, onVisibleChange: this.onTooltipVisibleChange, destroyTooltipOnHide: true }, this.tooltipVisibleProps), this.hitZone),
7800
7800
  createElement("span", { style: { marginLeft: this.props.xOffset }, onMouseOver: this.onMouseOver },
@@ -8701,7 +8701,7 @@ var PtmTrack = /** @class */ (function (_super) {
8701
8701
  overflow: 'hidden',
8702
8702
  whiteSpace: 'nowrap',
8703
8703
  textOverflow: 'ellipsis',
8704
- } })), width: _this.props.width, proteinLength: _this.props.proteinLength, trackItems: item.specs, idClassPrefix: "ptm-" + index + "-" })); })
8704
+ } })), width: _this.props.width, proteinLength: _this.props.proteinLength, trackItems: item.specs, idClassPrefix: "ptm-" + index + "-", isSubTrack: true })); })
8705
8705
  : null;
8706
8706
  },
8707
8707
  enumerable: false,
@@ -8922,6 +8922,23 @@ var DomainTooltip = function (props) {
8922
8922
  };
8923
8923
 
8924
8924
  var DEFAULT_PROTEIN_LENGTH = 10;
8925
+ var SVG_NS = 'http://www.w3.org/2000/svg';
8926
+ function createTextTag(textNode, style, x, y) {
8927
+ if (style === void 0) { style = ''; }
8928
+ if (x === void 0) { x = 0; }
8929
+ if (y === void 0) { y = 0; }
8930
+ var text = document.createElementNS(SVG_NS, 'text');
8931
+ $$1(text).attr({ style: style, x: x, y: y });
8932
+ if (textNode) {
8933
+ text.append(textNode);
8934
+ }
8935
+ return text;
8936
+ }
8937
+ function createGroupTag(transform) {
8938
+ var group = document.createElementNS(SVG_NS, 'g');
8939
+ group.setAttribute('transform', transform || '');
8940
+ return group;
8941
+ }
8925
8942
  var LollipopMutationPlot = /** @class */ (function (_super) {
8926
8943
  __extends(LollipopMutationPlot, _super);
8927
8944
  function LollipopMutationPlot(props) {
@@ -9349,8 +9366,47 @@ var LollipopMutationPlot = /** @class */ (function (_super) {
9349
9366
  configurable: true,
9350
9367
  writable: true,
9351
9368
  value: function () {
9352
- var svg = $$1(this.divContainer).find('.lollipop-svgnode')[0];
9353
- return svg;
9369
+ var _a, _b;
9370
+ var _this = this;
9371
+ var lollipopSvg = $$1(this.divContainer).find('.lollipop-svgnode')[0];
9372
+ var TEXT_STYLE = 'font-size: 12px; font-family:Arial;';
9373
+ var TRACK_INDENT = 16;
9374
+ var SUBTRACK_INDENT = TRACK_INDENT + 12;
9375
+ var INVISIBLE_SVG_CLASS_NAMES = ['invisible', 'hide-svg'];
9376
+ var outerSvg = document.createElementNS(SVG_NS, 'svg');
9377
+ // Make copy of chart to be used in download
9378
+ var chartClone = lollipopSvg.cloneNode(true);
9379
+ outerSvg.append(chartClone);
9380
+ // Make svg invisible so it does not affect UI
9381
+ (_a = outerSvg.classList).add.apply(_a, INVISIBLE_SVG_CLASS_NAMES);
9382
+ //Add svg to the dom so getBBox can calculate dimensions
9383
+ document.body.appendChild(outerSvg);
9384
+ // Group the tracks and translate below the lollipop chart
9385
+ var allTracksG = createGroupTag("translate(0, " + LollipopPlot.defaultProps.vizHeight + ")");
9386
+ outerSvg.append(allTracksG);
9387
+ var trackSvgList = $$1(this.divContainer).find('.track-svgnode');
9388
+ var trackTitles = $$1(this.divContainer).find('span[class*=trackTitle]');
9389
+ var trackYShift = 0;
9390
+ trackSvgList.each(function (idx, track) {
9391
+ var trackSvgGroup = createGroupTag("translate(" + _this.geneXOffset + "," + trackYShift + ")");
9392
+ trackSvgGroup.appendChild(track.cloneNode(true));
9393
+ var trackNameGroup = createGroupTag("translate(0," + (trackYShift + 8) + ")");
9394
+ var isSubTrack = trackTitles[idx].className.includes('subtrack-');
9395
+ var trackName = createTextTag(document.createTextNode(trackTitles[idx].innerText), TEXT_STYLE, isSubTrack ? SUBTRACK_INDENT : TRACK_INDENT, 0);
9396
+ trackNameGroup.append(trackName);
9397
+ allTracksG.append(trackNameGroup, trackSvgGroup);
9398
+ trackYShift += 20;
9399
+ });
9400
+ // Get the dimensions of the outer SVG before removing from DOM
9401
+ var outerSvgDimensions = outerSvg.getBBox();
9402
+ $$1(outerSvg).attr({
9403
+ width: outerSvgDimensions.width,
9404
+ height: outerSvgDimensions.height,
9405
+ });
9406
+ // Remove unused classes
9407
+ (_b = outerSvg.classList).remove.apply(_b, INVISIBLE_SVG_CLASS_NAMES);
9408
+ document.body.removeChild(outerSvg);
9409
+ return outerSvg;
9354
9410
  }
9355
9411
  });
9356
9412
  Object.defineProperty(LollipopMutationPlot.prototype, "hugoGeneSymbol", {