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.
*/
export let IgcDataGridFilterDialogComponent = /*@__PURE__*/ (() => {
    class IgcDataGridFilterDialogComponent extends IgcHTMLElement {
        constructor() {
            super();
            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();
        }
        createImplementation() {
            return new GridFilterDialog();
        }
        /**
         * @hidden
         */
        get i() {
            return this._implementation;
        } /**
                                     * @hidden
                                     */
        static _createFromInternal(internal) {
            if (!internal) {
                return null;
            }
            if (!internal.$type) {
                return null;
            }
            let name = internal.$type.name;
            let externalName = "Igc" + name + "Component";
            if (!TypeRegistrar.isRegistered(externalName)) {
                return null;
            }
            return TypeRegistrar.create(externalName);
        }
        onImplementationCreated() {
        }
        _enqueueSetAttribute(attrName, attrValue) {
            this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
        }
        _flushQueuedAttributes() {
            this._settingAttributes = true;
            for (let i = 0; i < this._queuedSetAttributes.length; i++) {
                this.setAttribute(this._queuedSetAttributes[i].attrName, this._queuedSetAttributes[i].attrValue);
            }
            this._settingAttributes = false;
            this._queuedSetAttributes.length = 0;
        }
        _a(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;
        }
        connectedCallback() {
            if (super["connectedCallback"]) {
                super["connectedCallback"]();
            }
            if (!this._attached) {
                this._attached = true;
                this._flushQueuedAttributes();
            }
        }
        static get observedAttributes() {
            if (IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent == null) {
                let names = getAllPropertyNames(IgcDataGridFilterDialogComponent);
                for (let i = 0; i < names.length; i++) {
                    names[i] = toSpinal(names[i]);
                }
                IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent = names;
            }
            return IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent;
        }
        attributeChangedCallback(name, oldValue, newValue) {
            if (this._settingAttributes) {
                return;
            }
            let setName = fromSpinal(name);
            this._updatingFromAttribute = true;
            this[setName] = newValue;
            this._updatingFromAttribute = false;
        }
        static register() {
            if (!IgcDataGridFilterDialogComponent._isElementRegistered) {
                IgcDataGridFilterDialogComponent._isElementRegistered = true;
                RegisterElementHelper.registerElement(IgcDataGridFilterDialogComponent.htmlTagName, IgcDataGridFilterDialogComponent);
            }
        }
        get isAnimationEnabled() {
            return this.i.x;
        }
        set isAnimationEnabled(v) {
            this.i.x = ensureBool(v);
            this._a("isAnimationEnabled", this.i.x);
        }
        /**
         * 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 pixelScalingRatio() {
            return this.i.ae;
        }
        set pixelScalingRatio(v) {
            this.i.ae = +v;
            this._a("pixelScalingRatio", this.i.ae);
        }
        /**
         * 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 actualPixelScalingRatio() {
            return this.i.ad;
        }
        set actualPixelScalingRatio(v) {
            this.i.ad = +v;
            this._a("actualPixelScalingRatio", this.i.ad);
        }
        get iconColor() {
            return brushToString(this.i.bp);
        }
        set iconColor(v) {
            this.i.bp = stringToBrush(v);
            this._a("iconColor", brushToString(this.i.bp));
        }
        get viewSize() {
            return this.i.af;
        }
        set viewSize(v) {
            this.i.af = +v;
            this._a("viewSize", this.i.af);
        }
        get isOpen() {
            return this.i.y;
        }
        findByName(name) {
            return null;
        }
        get hasUserValues() {
            return this._hasUserValues;
        }
        __m(propertyName) {
            if (!this._inStyling) {
                this._hasUserValues.add(propertyName);
            }
        }
        _styling(container, component, parent) {
            if (this._inStyling) {
                return;
            }
            this._inStyling = true;
            this._stylingContainer = container;
            this._stylingParent = component;
            let genericPrefix = "";
            let typeName = this.i.$type.name;
            if (typeName.indexOf("Xam") === 0) {
                typeName = typeName.substring(3);
            }
            genericPrefix = toSpinal("DataGridFilterDialogComponent");
            let additionalPrefixes = [];
            let prefix = toSpinal(typeName);
            additionalPrefixes.push(prefix + "-");
            let 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);
                }
                let basePrefix = toSpinal(typeName);
                additionalPrefixes.push(basePrefix + "-");
                b = b.baseType;
            }
            if (parent) {
                let parentTypeName = parent.i.$type.name;
                if (parentTypeName.indexOf("Xam") === 0) {
                    parentTypeName = parentTypeName.substring(3);
                }
                let 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;
        }
        notifySizeChanged(width, height) {
            this.i.a8(width, height);
        }
        notifyCellSizeChanged() {
            this.i.a7();
        }
        showIcon() {
            this.i.bk();
        }
        hideIcon() {
            this.i.a5();
        }
        get dialogOpening() {
            return this._dialogOpening;
        }
        set dialogOpening(ev) {
            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 = (o, e) => {
                let 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);
        }
        get filterChanging() {
            return this._filterChanging;
        }
        set filterChanging(ev) {
            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 = (o, e) => {
                let 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);
        }
        get filterChanged() {
            return this._filterChanged;
        }
        set filterChanged(ev) {
            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 = (o, e) => {
                let 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);
        }
        get renderCompleted() {
            return this._renderCompleted;
        }
        set renderCompleted(ev) {
            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 = (o, e) => {
                let 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);
        }
    }
    IgcDataGridFilterDialogComponent._observedAttributesIgcDataGridFilterDialogComponent = null;
    IgcDataGridFilterDialogComponent.htmlTagName = "igc-data-grid-filter-dialog";
    IgcDataGridFilterDialogComponent._isElementRegistered = false;
    return IgcDataGridFilterDialogComponent;
})();
//# sourceMappingURL=igc-data-grid-filter-dialog-component.js.map
