@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
43 lines • 1.83 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// (C) 2007-2018 GoodData Corporation
var React = require("react");
var ReactDOM = require("react-dom");
var RenderChildrenInPortal = /** @class */ (function (_super) {
__extends(RenderChildrenInPortal, _super);
function RenderChildrenInPortal(props) {
var _this = _super.call(this, props) || this;
var wrapperEl = document.createElement("div");
_this.portalContentWrapperEl = wrapperEl;
return _this;
}
RenderChildrenInPortal.prototype.componentWillMount = function () {
if (this.props.targetElement) {
this.props.targetElement.appendChild(this.portalContentWrapperEl);
}
};
RenderChildrenInPortal.prototype.componentWillUnmount = function () {
if (this.props.targetElement) {
this.props.targetElement.removeChild(this.portalContentWrapperEl);
}
};
RenderChildrenInPortal.prototype.render = function () {
return ReactDOM.createPortal(this.props.children, this.portalContentWrapperEl);
};
return RenderChildrenInPortal;
}(React.Component));
exports.default = RenderChildrenInPortal;
//# sourceMappingURL=RenderChildrenInPortal.js.map