import ReactDom from 'react-dom';
var ModalCustom = (function () {
    function ModalCustom(modalId) {
        if (modalId === void 0) { modalId = 'react-admin_modal'; }
        this.modalEle = null;
        this.modalId = modalId;
        this.initDom();
    }
    ModalCustom.prototype.initDom = function () {
        this.modalEle = document.getElementById(this.modalId);
        if (!this.modalEle) {
            this.modalEle = document.createElement('div');
            this.modalEle.setAttribute('id', 'react-admin_modal-' + Math.random());
            document.body.appendChild(this.modalEle);
        }
    };
    ModalCustom.prototype.show = function (component) {
        if (!this.modalEle)
            this.initDom();
        ReactDom.render(component, this.modalEle);
    };
    ModalCustom.prototype.destroy = function () {
        if (this.modalEle) {
            ReactDom.unmountComponentAtNode(this.modalEle);
            this.modalEle.parentNode.removeChild(this.modalEle);
            this.modalEle = null;
        }
    };
    return ModalCustom;
}());
export default ModalCustom;
//# sourceMappingURL=index.js.map