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