/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { IgEvent } from "igniteui-webcomponents-core/ES2015/IgEvent";
export class IgcComponentRendererContainerComponent {
    constructor() {
        this.listeners = [];
        this._currentRoot = null;
    }
    static fromElement(ele) {
        if (ele.$$container) {
            return ele.$$container;
        }
        let c = new IgcComponentRendererContainerComponent();
        c.element = ele;
        ele.$$container = c;
        return c;
    }
    replaceRootItem(t, continueActions) {
        for (let i = this.element.children.length - 1; i >= 0; i--) {
            this.element.children[i].remove();
        }
        let C = t;
        if (C.htmlTagName) {
            t = document.createElement(t.htmlTagName);
        }
        else {
            t = new C();
        }
        this._currentRoot = t;
        this.element.appendChild(this._currentRoot);
        this._currentRoot.width = "100%";
        this._currentRoot.height = "100%";
        continueActions(false);
    }
    clearContainer(continueActions) {
        for (let i = this.element.children.length - 1; i >= 0; i--) {
            this.element.children[i].remove();
        }
        continueActions(false);
    }
    getRootObject() {
        return this._currentRoot;
    }
    static isEvent(obj) {
        return obj instanceof IgEvent;
    }
}
