import * as tslib_1 from "tslib";
import { IgcHTMLElement } from "igniteui-webcomponents-core";
import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core";
import { IgcGridFilterDialogOpeningEventArgs } from "./igc-grid-filter-dialog-opening-event-args";
import { IgcGridFilterDialogFilterChangeEventArgs } from "./igc-grid-filter-dialog-filter-change-event-args";
import { IgcFilterDialogRenderCompletedEventArgs } from "./igc-filter-dialog-render-completed-event-args";
import { GridFilterDialog } from "./GridFilterDialog";
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";
/**
 * An advanced grid for displaying data.
*/
var IgcDataGridFilterDialogComponent = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(IgcDataGridFilterDialogComponent, _super);
    function IgcDataGridFilterDialogComponent() {
        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;
        _this._dialogOpening = null;
        _this._dialogOpening_wrapped = null;
        _this._filterChanging = null;
        _this._filterChanging_wrapped = null;
        _this._filterChanged = null;
        _this._filterChanged_wrapped = null;
        _this._renderCompleted = null;
        _this._renderCompleted_wrapped = null;
        if (_this._styling) {
            NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this));
        }
        _this._implementation = _this.createImplementation();
        _this._implementation.externalObject = _this;
        _this.onImplementationCreated();
        return _this;
    }
    IgcDataGridFilterDialogComponent.prototype.createImplementation = function () {
        return new GridFilterDialog();
    };
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "i", {
        /**
         * @hidden
         */
        get: function () {
            return this._implementation;
        } /**
                                     * @hidden
                                     */,
        enumerable: true,
        configurable: true
    });
    IgcDataGridFilterDialogComponent._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);
    };
    IgcDataGridFilterDialogComponent.prototype.onImplementationCreated = function () {
    };
    IgcDataGridFilterDialogComponent.prototype._enqueueSetAttribute = function (attrName, attrValue) {
        this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
    };
    IgcDataGridFilterDialogComponent.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;
    };
    IgcDataGridFilterDialogComponent.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;
    };
    IgcDataGridFilterDialogComponent.prototype.connectedCallback = function () {
        if (_super.prototype["connectedCallback"]) {
            _super.prototype["connectedCallback"].call(this);
        }
        if (!this._attached) {
            this._attached = true;
            this._flushQueuedAttributes();
        }
    };
    Object.defineProperty(IgcDataGridFilterDialogComponent, "observedAttributes", {
        get: function () {
            if (IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent == null) {
                var names = getAllPropertyNames(IgcDataGridFilterDialogComponent);
                for (var i = 0; i < names.length; i++) {
                    names[i] = toSpinal(names[i]);
                }
                IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent = names;
            }
            return IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent;
        },
        enumerable: true,
        configurable: true
    });
    IgcDataGridFilterDialogComponent.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
        if (this._settingAttributes) {
            return;
        }
        var setName = fromSpinal(name);
        this._updatingFromAttribute = true;
        this[setName] = newValue;
        this._updatingFromAttribute = false;
    };
    IgcDataGridFilterDialogComponent.register = function () {
        if (!IgcDataGridFilterDialogComponent._isElementRegistered) {
            IgcDataGridFilterDialogComponent._isElementRegistered = true;
            RegisterElementHelper.registerElement(IgcDataGridFilterDialogComponent.htmlTagName, IgcDataGridFilterDialogComponent);
        }
    };
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "isAnimationEnabled", {
        get: function () {
            return this.i.x;
        },
        set: function (v) {
            this.i.x = ensureBool(v);
            this._a("isAnimationEnabled", this.i.x);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.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.ae;
        },
        set: function (v) {
            this.i.ae = +v;
            this._a("pixelScalingRatio", this.i.ae);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.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.ad;
        },
        set: function (v) {
            this.i.ad = +v;
            this._a("actualPixelScalingRatio", this.i.ad);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "iconColor", {
        get: function () {
            return brushToString(this.i.bp);
        },
        set: function (v) {
            this.i.bp = stringToBrush(v);
            this._a("iconColor", brushToString(this.i.bp));
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "viewSize", {
        get: function () {
            return this.i.af;
        },
        set: function (v) {
            this.i.af = +v;
            this._a("viewSize", this.i.af);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "isOpen", {
        get: function () {
            return this.i.y;
        },
        enumerable: true,
        configurable: true
    });
    IgcDataGridFilterDialogComponent.prototype.findByName = function (name) {
        return null;
    };
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "hasUserValues", {
        get: function () {
            return this._hasUserValues;
        },
        enumerable: true,
        configurable: true
    });
    IgcDataGridFilterDialogComponent.prototype.__m = function (propertyName) {
        if (!this._inStyling) {
            this._hasUserValues.add(propertyName);
        }
    };
    IgcDataGridFilterDialogComponent.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("DataGridFilterDialogComponent");
        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;
    };
    IgcDataGridFilterDialogComponent.prototype.notifySizeChanged = function (width, height) {
        this.i.a8(width, height);
    };
    IgcDataGridFilterDialogComponent.prototype.notifyCellSizeChanged = function () {
        this.i.a7();
    };
    IgcDataGridFilterDialogComponent.prototype.showIcon = function () {
        this.i.bk();
    };
    IgcDataGridFilterDialogComponent.prototype.hideIcon = function () {
        this.i.a5();
    };
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "dialogOpening", {
        get: function () {
            return this._dialogOpening;
        },
        set: function (ev) {
            var _this = this;
            if (this._dialogOpening_wrapped !== null) {
                this.i.dialogOpening = delegateRemove(this.i.dialogOpening, this._dialogOpening_wrapped);
                this._dialogOpening_wrapped = null;
                this._dialogOpening = null;
            }
            this._dialogOpening = ev;
            this._dialogOpening_wrapped = function (o, e) {
                var outerArgs = new IgcGridFilterDialogOpeningEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeDialogOpening) {
                    _this.beforeDialogOpening(_this, outerArgs);
                }
                if (_this._dialogOpening) {
                    _this._dialogOpening(_this, outerArgs);
                }
            };
            this.i.dialogOpening = delegateCombine(this.i.dialogOpening, this._dialogOpening_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "filterChanging", {
        get: function () {
            return this._filterChanging;
        },
        set: function (ev) {
            var _this = this;
            if (this._filterChanging_wrapped !== null) {
                this.i.filterChanging = delegateRemove(this.i.filterChanging, this._filterChanging_wrapped);
                this._filterChanging_wrapped = null;
                this._filterChanging = null;
            }
            this._filterChanging = ev;
            this._filterChanging_wrapped = function (o, e) {
                var outerArgs = new IgcGridFilterDialogFilterChangeEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeFilterChanging) {
                    _this.beforeFilterChanging(_this, outerArgs);
                }
                if (_this._filterChanging) {
                    _this._filterChanging(_this, outerArgs);
                }
            };
            this.i.filterChanging = delegateCombine(this.i.filterChanging, this._filterChanging_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "filterChanged", {
        get: function () {
            return this._filterChanged;
        },
        set: function (ev) {
            var _this = this;
            if (this._filterChanged_wrapped !== null) {
                this.i.filterChanged = delegateRemove(this.i.filterChanged, this._filterChanged_wrapped);
                this._filterChanged_wrapped = null;
                this._filterChanged = null;
            }
            this._filterChanged = ev;
            this._filterChanged_wrapped = function (o, e) {
                var outerArgs = new IgcGridFilterDialogFilterChangeEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeFilterChanged) {
                    _this.beforeFilterChanged(_this, outerArgs);
                }
                if (_this._filterChanged) {
                    _this._filterChanged(_this, outerArgs);
                }
            };
            this.i.filterChanged = delegateCombine(this.i.filterChanged, this._filterChanged_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgcDataGridFilterDialogComponent.prototype, "renderCompleted", {
        get: function () {
            return this._renderCompleted;
        },
        set: function (ev) {
            var _this = this;
            if (this._renderCompleted_wrapped !== null) {
                this.i.renderCompleted = delegateRemove(this.i.renderCompleted, this._renderCompleted_wrapped);
                this._renderCompleted_wrapped = null;
                this._renderCompleted = null;
            }
            this._renderCompleted = ev;
            this._renderCompleted_wrapped = function (o, e) {
                var outerArgs = new IgcFilterDialogRenderCompletedEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeRenderCompleted) {
                    _this.beforeRenderCompleted(_this, outerArgs);
                }
                if (_this._renderCompleted) {
                    _this._renderCompleted(_this, outerArgs);
                }
            };
            this.i.renderCompleted = delegateCombine(this.i.renderCompleted, this._renderCompleted_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent = null;
    IgcDataGridFilterDialogComponent.htmlTagName = "igc-data-grid-filter-dialog";
    IgcDataGridFilterDialogComponent._isElementRegistered = false;
    return IgcDataGridFilterDialogComponent;
}(IgcHTMLElement));
export { IgcDataGridFilterDialogComponent };
//# sourceMappingURL=igc-data-grid-filter-dialog-component.js.map
