/*
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 * as tslib_1 from "tslib";
import { TypeRegistrar } from './type';
import { render, html } from './template';
var IgcTemplateContentComponent = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(IgcTemplateContentComponent, _super);
    function IgcTemplateContentComponent() {
        var _this = _super.call(this) || this;
        _this._template = null;
        _this._attached = false;
        _this._context = null;
        _this.template = function (context) {
            return html(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n               <div></div>  \n            "], ["\n               <div></div>  \n            "])));
        };
        return _this;
    }
    Object.defineProperty(IgcTemplateContentComponent.prototype, "template", {
        get: function () {
            return this._template;
        },
        set: function (value) {
            this._template = value;
            this.onTemplateChanged();
        },
        enumerable: true,
        configurable: true
    });
    IgcTemplateContentComponent.prototype.connectedCallback = function () {
        this.attachedCallback();
    };
    IgcTemplateContentComponent.prototype.attachedCallback = function () {
        this._attached = true;
        this.render();
    };
    Object.defineProperty(IgcTemplateContentComponent.prototype, "context", {
        get: function () {
            return this._context;
        },
        set: function (value) {
            if (this._context == null && value == null) {
                return;
            }
            this._context = value;
            this.onContextChanged();
        },
        enumerable: true,
        configurable: true
    });
    IgcTemplateContentComponent.prototype.markChanged = function () {
        this.onContextChanged();
    };
    IgcTemplateContentComponent.prototype.onContextChanged = function () {
        this.render();
    };
    IgcTemplateContentComponent.prototype.onTemplateChanged = function () {
        if (this._attached) {
            this.render();
        }
    };
    IgcTemplateContentComponent.prototype.render = function () {
        if (!this.context || !this.template) {
            if (this.template) {
                render(this.template(this.context), this);
            }
            else {
                this.innerHTML = '';
            }
        }
        else {
            render(this.template(this.context), this);
        }
    };
    Object.defineProperty(IgcTemplateContentComponent.prototype, "owner", {
        get: function () {
            return this._owner;
        },
        set: function (v) {
            this._owner = v;
        },
        enumerable: true,
        configurable: true
    });
    IgcTemplateContentComponent.register = function () {
        if (!IgcTemplateContentComponent._registered) {
            IgcTemplateContentComponent._registered = true;
            if (window.customElements) {
                window.customElements.define(IgcTemplateContentComponent.htmlTagName, IgcTemplateContentComponent);
            }
            else {
                document.registerElement(IgcTemplateContentComponent.htmlTagName, IgcTemplateContentComponent);
            }
            TypeRegistrar.registerCons("IgcTemplateContentComponent", IgcTemplateContentComponent);
        }
    };
    IgcTemplateContentComponent.htmlTagName = "igc-template-content";
    IgcTemplateContentComponent._registered = false;
    return IgcTemplateContentComponent;
}(HTMLElement));
export { IgcTemplateContentComponent };
var templateObject_1;
//# sourceMappingURL=igc-template-content-component.js.map
