import * as tslib_1 from "tslib";
import { IgcHTMLElement } from "igniteui-webcomponents-core";
import { GridExpansionIndicator } from "./GridExpansionIndicator";
import { TypeRegistrar } from "igniteui-webcomponents-core";
import { NamePatcher, getAllPropertyNames, fromSpinal, toSpinal, ensureBool, brushToString, stringToBrush, initializePropertiesFromCss } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
var IgcDataGridExpansionIndicatorComponent = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(IgcDataGridExpansionIndicatorComponent, _super);
    function IgcDataGridExpansionIndicatorComponent() {
        var _this = _super.call(this) || this;
        _this._settingAttributes = false;
        _this._attached = false;
        _this._queuedSetAttributes = [];
        _this._updatingFromAttribute = false;
        _this.__p = null;
        _this._hasUserValues = new Set();
        _this._stylingContainer = null;
        _this._stylingParent = null;
        _this._inStyling = false;
        if (_this._styling) {
            NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this));
        }
        _this._implementation = _this.createImplementation();
        _this._implementation.externalObject = _this;
        _this.onImplementationCreated();
        return _this;
    }
    IgcDataGridExpansionIndicatorComponent.prototype.createImplementation = function () {
        return new GridExpansionIndicator();
    };
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent.prototype, "i", {
        /**
         * @hidden
         */
        get: function () {
            return this._implementation;
        } /**
                                     * @hidden
                                     */,
        enumerable: true,
        configurable: true
    });
    IgcDataGridExpansionIndicatorComponent._createFromInternal = function (internal) {
        if (!internal) {
            return null;
        }
        if (!internal.$type) {
            return null;
        }
        var name = internal.$type.name;
        var externalName = "Igc" + name + "Component";
        if (!TypeRegistrar.isRegistered(externalName)) {
            return null;
        }
        return TypeRegistrar.create(externalName);
    };
    IgcDataGridExpansionIndicatorComponent.prototype.onImplementationCreated = function () {
    };
    IgcDataGridExpansionIndicatorComponent.prototype._enqueueSetAttribute = function (attrName, attrValue) {
        this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
    };
    IgcDataGridExpansionIndicatorComponent.prototype._flushQueuedAttributes = function () {
        this._settingAttributes = true;
        for (var i = 0; i < this._queuedSetAttributes.length; i++) {
            this.setAttribute(this._queuedSetAttributes[i].attrName, this._queuedSetAttributes[i].attrValue);
        }
        this._settingAttributes = false;
        this._queuedSetAttributes.length = 0;
    };
    IgcDataGridExpansionIndicatorComponent.prototype._a = function (attrName, attrValue) {
        if (this._updatingFromAttribute) {
            return;
        }
        if (attrValue) {
            attrValue = attrValue.toString();
        }
        this._settingAttributes = true;
        attrName = toSpinal(attrName);
        if (this._attached) {
            this.setAttribute(attrName, attrValue);
        }
        else {
            this._enqueueSetAttribute(attrName, attrValue);
        }
        this._settingAttributes = false;
    };
    IgcDataGridExpansionIndicatorComponent.prototype.connectedCallback = function () {
        if (_super.prototype["connectedCallback"]) {
            _super.prototype["connectedCallback"].call(this);
        }
        if (!this._attached) {
            this._attached = true;
            this._flushQueuedAttributes();
        }
    };
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent, "observedAttributes", {
        get: function () {
            if (IgcDataGridExpansionIndicatorComponent._observedAttributesIgcDataGridExpansionIndicatorComponent == null) {
                var names = getAllPropertyNames(IgcDataGridExpansionIndicatorComponent);
                for (var i = 0; i < names.length; i++) {
                    names[i] = toSpinal(names[i]);
                }
                IgcDataGridExpansionIndicatorComponent._observedAttributesIgcDataGridExpansionIndicatorComponent = names;
            }
            return IgcDataGridExpansionIndicatorComponent._observedAttributesIgcDataGridExpansionIndicatorComponent;
        },
        enumerable: true,
        configurable: true
    });
    IgcDataGridExpansionIndicatorComponent.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
        if (this._settingAttributes) {
            return;
        }
        var setName = fromSpinal(name);
        this._updatingFromAttribute = true;
        this[setName] = newValue;
        this._updatingFromAttribute = false;
    };
    IgcDataGridExpansionIndicatorComponent.register = function () {
        if (!IgcDataGridExpansionIndicatorComponent._isElementRegistered) {
            IgcDataGridExpansionIndicatorComponent._isElementRegistered = true;
            RegisterElementHelper.registerElement(IgcDataGridExpansionIndicatorComponent.htmlTagName, IgcDataGridExpansionIndicatorComponent);
        }
    };
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent.prototype, "isExpanded", {
        /**
         * Gets or sets the expansion state of the indicator.
        */
        get: function () {
            return this.i.g;
        },
        set: function (v) {
            this.i.g = ensureBool(v);
            this._a("isExpanded", this.i.g);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent.prototype, "iconColor", {
        /**
         * Gets or sets the color of the indicator.
        */
        get: function () {
            return brushToString(this.i.ae);
        },
        set: function (v) {
            this.i.ae = stringToBrush(v);
            this._a("iconColor", brushToString(this.i.ae));
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent.prototype, "isAnimationEnabled", {
        /**
         * Gets or sets whether animations are enabled.
        */
        get: function () {
            return this.i.f;
        },
        set: function (v) {
            this.i.f = ensureBool(v);
            this._a("isAnimationEnabled", this.i.f);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent.prototype, "pixelScalingRatio", {
        /**
         * Gets or sets the scaling value used to affect the pixel density of the control.
         * A higher scaling ratio will produce crisper visuals at the expense of memory.  Lower values will cause the control
         * to appear blurry.
        */
        get: function () {
            return this.i.m;
        },
        set: function (v) {
            this.i.m = +v;
            this._a("pixelScalingRatio", this.i.m);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent.prototype, "actualPixelScalingRatio", {
        /**
         * Gets the actual pixel scaling ratio used to affect the pixel density of the control.
         * A higher scaling ratio will produce crisper visuals at the expense of memory.  Lower values will cause the control
         * to appear blurry.
        */
        get: function () {
            return this.i.j;
        },
        set: function (v) {
            this.i.j = +v;
            this._a("actualPixelScalingRatio", this.i.j);
        },
        enumerable: true,
        configurable: true
    });
    IgcDataGridExpansionIndicatorComponent.prototype.findByName = function (name) {
        return null;
    };
    Object.defineProperty(IgcDataGridExpansionIndicatorComponent.prototype, "hasUserValues", {
        get: function () {
            return this._hasUserValues;
        },
        enumerable: true,
        configurable: true
    });
    IgcDataGridExpansionIndicatorComponent.prototype.__m = function (propertyName) {
        if (!this._inStyling) {
            this._hasUserValues.add(propertyName);
        }
    };
    IgcDataGridExpansionIndicatorComponent.prototype._styling = function (container, component, parent) {
        if (this._inStyling) {
            return;
        }
        this._inStyling = true;
        this._stylingContainer = container;
        this._stylingParent = component;
        var genericPrefix = "";
        var typeName = this.i.$type.name;
        if (typeName.indexOf("Xam") === 0) {
            typeName = typeName.substring(3);
        }
        genericPrefix = toSpinal("DataGridExpansionIndicatorComponent");
        var additionalPrefixes = [];
        var prefix = toSpinal(typeName);
        additionalPrefixes.push(prefix + "-");
        var b = this.i.$type.baseType;
        while (b && b.name != "Object" &&
            b.name != "Base" &&
            b.name != "Control" &&
            b.Name != "DependencyObject" &&
            b.Name != "FrameworkElement") {
            typeName = b.name;
            if (typeName.indexOf("Xam") === 0) {
                typeName = typeName.substring(3);
            }
            var basePrefix = toSpinal(typeName);
            additionalPrefixes.push(basePrefix + "-");
            b = b.baseType;
        }
        if (parent) {
            var parentTypeName = parent.i.$type.name;
            if (parentTypeName.indexOf("Xam") === 0) {
                parentTypeName = parentTypeName.substring(3);
            }
            var parentPrefix = toSpinal(parentTypeName);
            additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
            additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
        }
        initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
        if (this._otherStyling) {
            this._otherStyling(container, component, parent);
        }
        this._inStyling = false;
    };
    IgcDataGridExpansionIndicatorComponent.prototype.notifySizeChanged = function (width, height) {
        this.i.y(width, height);
    };
    IgcDataGridExpansionIndicatorComponent._observedAttributesIgcDataGridExpansionIndicatorComponent = null;
    IgcDataGridExpansionIndicatorComponent.htmlTagName = "igc-data-grid-expansion-indicator";
    IgcDataGridExpansionIndicatorComponent._isElementRegistered = false;
    return IgcDataGridExpansionIndicatorComponent;
}(IgcHTMLElement));
export { IgcDataGridExpansionIndicatorComponent };
//# sourceMappingURL=igc-data-grid-expansion-indicator-component.js.map
