/*
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 { Base, runOn, Delegate_$type, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, delegateRemove, enumGetBox, delegateCombine } from "igniteui-webcomponents-core";
import { List$1 } from "igniteui-webcomponents-core";
import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core";
import { Button } from "igniteui-webcomponents-inputs";
import { BrushUtil } from "igniteui-webcomponents-core";
import { ElevationHelper } from "igniteui-webcomponents-inputs";
import { BaseDOMEventProxy } from "igniteui-webcomponents-core";
import { BaseControlTheme_$type } from "igniteui-webcomponents-core";
import { Icon } from "igniteui-webcomponents-inputs";
import { Thickness } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let DataGridToolbarView = /*@__PURE__*/ (() => {
    class DataGridToolbarView extends Base {
        constructor() {
            super();
            this.k = null;
            this.f = null;
            this.d = null;
            this.e = null;
            this.h = null;
            this.i = null;
            this.j = null;
            this.g = null;
            this.a = null;
            this.c = null;
            this.b = new List$1(Delegate_$type, 0);
        }
        s() {
        }
        p(a) {
            if (a == null) {
                this.c = null;
                return;
            }
            this.c = a;
            let b = Math.round(a.rootWrapper.width());
            let c = Math.round(a.rootWrapper.height());
            this.c.rootWrapper.setStyleProperty("position", "relative");
            this.c.rootWrapper.setStyleProperty("display", "flex");
            this.c.rootWrapper.setStyleProperty("justify-content", "space-between");
            this.c.rootWrapper.setStyleProperty("align-items", "center");
            this.c.rootWrapper.setStyleProperty("padding", "4px 16px 4px 16px");
            if (this.a.bb != null) {
                this.c.rootWrapper.setStyleProperty("background-color", this.a.bb._fill);
            }
            this.c.rootWrapper.setStyleProperty("border-width", "1px 1px 0px 1px");
            this.c.rootWrapper.setStyleProperty("border-style", "solid");
            this.c.rootWrapper.setStyleProperty("box-sizing", "border-box");
            this.c.rootWrapper.setStyleProperty("border-color", "rgba(0, 0, 0, 0.2)");
            this.c.rootWrapper.setStyleProperty("border-radius", "3px 3px 0px 0px");
            this.ac();
            this.k = this.c.rootWrapper.getChildAt(0);
            this.y();
            let d = this.c.rootWrapper.getChildAt(1);
            d.setStyleProperty("justify-content", "space-around");
            this.v();
            this.x();
        }
        ac() {
            if (this.c != null) {
                switch (this.a.i) {
                    case 1:
                        this.c.rootWrapper.setStyleProperty("height", "52px");
                        break;
                    case 2:
                        this.c.rootWrapper.setStyleProperty("height", "46px");
                        break;
                    case 3:
                        this.c.rootWrapper.setStyleProperty("height", "44px");
                        break;
                    case 0:
                        this.c.rootWrapper.setStyleProperty("height", "46px");
                        break;
                }
            }
        }
        z() {
            if (this.c != null) {
                if (this.a.bb != null) {
                    this.c.rootWrapper.setStyleProperty("background-color", this.a.bb._fill);
                }
            }
        }
        y() {
            if (this.k != null && this.a.ap != null) {
                this.k.setText(this.a.ap);
                this.k.setStyleProperty("font", "16px \"Segoe UI\", Verdana");
            }
            this.ag();
            this.ah();
        }
        ag() {
            if (this.k != null && this.a.bd != null) {
                this.k.setStyleProperty("color", this.a.bd._fill);
            }
        }
        ah() {
            if (this.k != null && this.a.m != null) {
                this.k.setStyleProperty("font", this.a.m.fontString);
            }
        }
        v() {
            if (this.c != null) {
                let a = this.c.rootWrapper.getChildAt(1);
                this.f = a.getChildAt(0);
                this.f.setProperty("id", "hideBtn");
                this.e = this.c.rootWrapper.getChildAt(2);
                this.w(this.e);
                this.e.setStyleProperty("height", "400px");
                this.e.setStyleProperty("width", "250px");
                let b = this.e.getChildAt(0);
                b.setStyleProperty("height", "calc(100% - 16px)");
                b.setStyleProperty("padding", "4px 16px 4px 16px");
                b.setStyleProperty("box-sizing", "border-box");
                if (this.a.p == true) {
                    if (this.a.j == null) {
                        this.d = this.c.createElement("div");
                        this.a.a2(this.c, this.f, this.d, "Hiding");
                        this.f.listen("click", runOn(this, this.n));
                    }
                    else {
                        this.f.show();
                    }
                }
                else {
                    this.f.hide();
                }
            }
        }
        ad() {
            if (this.d != null) {
                let a = this.d.getChildAt(1);
                a.setText(this.a.r.toString());
            }
        }
        aa() {
            if (this.d != null) {
                if (this.d.getChildCount() > 2) {
                    let a = this.d.getChildAt(2);
                    a.setText(this.a.ab.toString());
                }
                else {
                    let b = this.c.createElement("span");
                    b.setStyleProperty("display", "inline-block");
                    b.setStyleProperty("font-size", "14px");
                    b.setStyleProperty("font-weight", "600");
                    b.setText(this.a.ab);
                    this.d.append(b);
                }
            }
        }
        n(a) {
            if (this.e != null) {
                if (this.g == null || this.g != this.e) {
                    this.l();
                    let b = this.f.getOffset();
                    this.e.setOffset(b.left - this.e.width() + this.f.width(), b.top + this.f.height());
                    this.g = this.e;
                    this.t();
                }
                else {
                    this.l();
                }
            }
            a.stopPropagation();
        }
        x() {
            if (this.c != null) {
                let a = this.c.rootWrapper.getChildAt(1);
                this.h = a.getChildAt(1);
                this.h.setProperty("id", "pinBtn");
                this.j = this.c.rootWrapper.getChildAt(3);
                this.w(this.j);
                this.j.setStyleProperty("height", "400px");
                this.j.setStyleProperty("width", "250px");
                let b = this.j.getChildAt(0);
                b.setStyleProperty("height", "calc(100% - 16px)");
                b.setStyleProperty("padding", "8px 16px 8px 16px");
                b.setStyleProperty("box-sizing", "border-box");
                if (this.a.q == true) {
                    if (this.a.k == null) {
                        this.i = this.c.createElement("div");
                        this.a.a2(this.c, this.h, this.i, "Pinning");
                        this.h.listen("click", runOn(this, this.u));
                    }
                    else {
                        this.h.show();
                    }
                }
                else {
                    this.h.hide();
                }
            }
        }
        ae() {
            if (this.i != null) {
                let a = this.i.getChildAt(1);
                a.setText(this.a.s.toString());
            }
        }
        af() {
            if (this.i != null) {
                if (this.i.getChildCount() > 2) {
                    let a = this.i.getChildAt(2);
                    a.setText(this.a.ag);
                }
                else {
                    let b = this.c.createElement("span");
                    b.setStyleProperty("display", "inline-block");
                    b.setStyleProperty("font-size", "14px");
                    b.setStyleProperty("font-weight", "600");
                    b.setText(this.a.ag);
                    this.i.append(b);
                }
            }
        }
        u(a) {
            if (this.j != null) {
                if (this.g == null || this.g != this.j) {
                    this.l();
                    let b = this.h.getOffset();
                    this.j.setOffset(b.left - this.j.width() + this.h.width(), b.top + this.h.height());
                    this.g = this.j;
                    this.t();
                }
                else {
                    this.l();
                }
            }
            a.stopPropagation();
        }
        w(a) {
            let b = ElevationHelper.e(12, BrushUtil.g(66, 0, 0, 0), BrushUtil.g(30, 0, 0, 0), BrushUtil.g(20, 0, 0, 0), 1);
            a.setStyleProperty("boxShadow", b);
            a.setStyleProperty("background-color", this.a.bc._fill);
            a.setStyleProperty("position", "absolute");
            a.setStyleProperty("z-index", "12000");
            a.setStyleProperty("display", "none");
        }
        ab() {
            if (this.j != null) {
                this.j.setStyleProperty("background-color", this.a.bc._fill);
            }
            if (this.e != null) {
                this.e.setStyleProperty("background-color", this.a.bc._fill);
            }
        }
        t() {
            if (this.g != null) {
                this.b.add(this.c.globalListen("document", "keydown", runOn(this, this.q)));
                this.b.add(this.c.globalListen("document", "click", runOn(this, this.r)));
                this.g.show();
                this.g.listen("click", runOn(this, this.m));
            }
        }
        l() {
            if (this.g != null) {
                for (let a = 0; a < this.b.count; a++) {
                    this.b._inner[a]();
                }
                this.b.clear();
                this.g.unlistenAll();
                this.g.hide();
                this.g = null;
            }
        }
        m(a) {
            a.stopPropagation();
        }
        q(a) {
            if (BaseDOMEventProxy.cv(a) == 8) {
                this.a.at();
            }
        }
        r(a) {
            this.a.at();
        }
        o() {
        }
    }
    DataGridToolbarView.$t = /*@__PURE__*/ markType(DataGridToolbarView, 'DataGridToolbarView');
    return DataGridToolbarView;
})();
/**
 * @hidden
 */
export let DataGridToolbar = /*@__PURE__*/ (() => {
    class DataGridToolbar extends Base {
        constructor() {
            super();
            this.e = null;
            this.c = null;
            this.d = null;
            this.r = 0;
            this.s = 0;
            this.j = null;
            this.k = null;
            this.propertyChanged = null;
            this.a = null;
            this.x = null;
            this.l = null;
            this.ba = BrushUtil.g(255, 24, 29, 31);
            this.a8 = BrushUtil.g(255, 248, 248, 248);
            this.a9 = BrushUtil.g(255, 248, 248, 248);
            this.n = false;
            this.t = null;
            this.u = null;
            this.o = false;
            this.v = null;
            this.w = null;
            this.h = 2;
            this.f = 1;
            this.r = 0;
            this.s = 0;
            let a = new DataGridToolbarView();
            a.a = this;
            this.e = a;
            this.e.s();
        }
        notifySizeChanged() {
            this.e.o();
        }
        destroy() {
            this.provideContainer(null, null, null);
            if (this.b != null) {
                let a = this.b;
                a.columnHiddenChanged = delegateRemove(a.columnHiddenChanged, runOn(this, this.a6));
                let b = this.b;
                b.columnPinnedChanged = delegateRemove(b.columnPinnedChanged, runOn(this, this.a7));
            }
        }
        provideContainer(a, b, c) {
            this.c = b;
            this.d = c;
            this.a3();
            this.a4();
            this.e.p(a);
        }
        get b() {
            return this.a;
        }
        set b(a) {
            let b = this.a;
            this.a = a;
            if (b != this.a) {
                this.ax("TargetGrid", b, this.a);
            }
        }
        get ap() {
            return this.x;
        }
        set ap(a) {
            let b = this.x;
            this.x = a;
            if (b != this.x) {
                this.ax("ToolbarTitle", b, this.x);
            }
        }
        get m() {
            return this.l;
        }
        set m(a) {
            let b = this.l;
            this.l = a;
            if (b != this.l) {
                this.ax("ToolbarTitleStyle", b, this.l);
            }
        }
        get bd() {
            return this.ba;
        }
        set bd(a) {
            let b = this.ba;
            this.ba = a;
            if (b != this.ba) {
                this.ax("ToolbarTitleColor", b, this.ba);
            }
        }
        get bb() {
            return this.a8;
        }
        set bb(a) {
            let b = this.a8;
            this.a8 = a;
            if (b != this.a8) {
                this.ax("BackgroundColor", b, this.a8);
            }
        }
        get bc() {
            return this.a9;
        }
        set bc(a) {
            let b = this.a9;
            this.a9 = a;
            if (b != this.a9) {
                this.ax("DialogBackgroundColor", b, this.a9);
            }
        }
        get p() {
            return this.n;
        }
        set p(a) {
            let b = this.n;
            this.n = a;
            if (b != this.n) {
                this.ax("ColumnChooser", b, this.n);
            }
        }
        get ab() {
            return this.t;
        }
        set ab(a) {
            let b = this.t;
            this.t = a;
            if (b != this.t) {
                this.ax("ColumnChooserText", b, this.t);
            }
        }
        get ad() {
            return this.u;
        }
        set ad(a) {
            let b = this.u;
            this.u = a;
            if (b != this.u) {
                this.ax("ColumnChooserTitle", b, this.u);
            }
        }
        get q() {
            return this.o;
        }
        set q(a) {
            let b = this.o;
            this.o = a;
            if (b != this.o) {
                this.ax("ColumnPinning", b, this.o);
            }
        }
        get ag() {
            return this.v;
        }
        set ag(a) {
            let b = this.v;
            this.v = a;
            if (b != this.v) {
                this.ax("ColumnPinningText", b, this.v);
            }
        }
        get ai() {
            return this.w;
        }
        set ai(a) {
            let b = this.w;
            this.w = a;
            if (b != this.w) {
                this.ax("ColumnPinningTitle", b, this.w);
            }
        }
        get i() {
            return this.h;
        }
        set i(a) {
            let b = this.h;
            this.h = a;
            if (b != this.h) {
                this.ax("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.h));
            }
        }
        get g() {
            return this.f;
        }
        set g(a) {
            let b = this.f;
            this.f = a;
            if (b != this.f) {
                this.ax("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, this.f));
            }
        }
        ax(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            this.ay(a, b, c);
        }
        ay(a, b, c) {
            switch (a) {
                case "TargetGrid":
                    this.a3();
                    this.a4();
                    this.a5();
                    this.e.ac();
                    break;
                case "ToolbarTitle":
                    this.e.y();
                    break;
                case "ToolbarTitleStyle":
                    this.e.ah();
                    break;
                case "ToolbarTitleColor":
                    this.e.ag();
                    break;
                case "BackgroundColor":
                    this.e.z();
                    break;
                case "DialogBackgroundColor":
                    this.e.ab();
                    if (this.c != null) {
                        this.c.aq = this.bc;
                    }
                    if (this.d != null) {
                        this.d.an = this.bc;
                    }
                    break;
                case "ColumnChooser":
                    this.a3();
                    this.e.v();
                    break;
                case "ColumnChooserText":
                    this.e.aa();
                    break;
                case "ColumnChooserTitle":
                    if (this.c != null) {
                        this.c.v = this.ad;
                    }
                    break;
                case "ColumnPinning":
                    this.a4();
                    this.e.x();
                    break;
                case "ColumnPinningText":
                    this.e.af();
                    break;
                case "ColumnPinningTitle":
                    if (this.d != null) {
                        this.d.v = this.ai;
                    }
                    break;
                case "Density":
                    this.a0();
                    break;
                case "BaseTheme":
                    this.a1();
                    break;
            }
        }
        a1() {
            if (this.c != null) {
                this.c.e = this.g;
            }
            if (this.d != null) {
                this.d.e = this.g;
            }
            if (this.j != null) {
                this.j.d = this.g;
            }
            if (this.k != null) {
                this.k.d = this.g;
            }
        }
        a0() {
            if (this.i == 0) {
                if (this.b != null) {
                    this.i = this.b.fl;
                }
            }
            if (this.j != null) {
                this.j.h = this.i;
            }
            if (this.k != null) {
                this.k.h = this.i;
            }
            if (this.c != null) {
                this.c.g = this.i;
            }
            if (this.d != null) {
                this.d.g = this.i;
            }
            this.e.ac();
        }
        a2(a, b, c, d) {
            let e = new Button();
            let f = a.getSubRenderer(b);
            e.provideContainer(f);
            e.d = this.g;
            e.h = this.i;
            let g = null;
            let h = null;
            let i = null;
            switch (d) {
                case "Hiding":
                    this.j = e;
                    g = DataGridToolbar.am;
                    h = this.r.toString();
                    if (this.ab != null) {
                        i = this.ab;
                    }
                    break;
                case "Pinning":
                    this.k = e;
                    g = DataGridToolbar.an;
                    h = this.s.toString();
                    if (this.ag != null) {
                        i = this.ag;
                    }
                    break;
            }
            e.s = 2;
            b.setStyleProperty("display", "inline-block");
            b.setStyleProperty("margin-left", "10px");
            c.setStyleProperty("display", "flex");
            c.setStyleProperty("flexDirection", "row");
            c.setStyleProperty("flexWrap", "no-wrap");
            c.setStyleProperty("align-items", "center");
            let j = a.createElement("div");
            j.setStyleProperty("display", "inline-block");
            j.setStyleProperty("margin-right", "5px");
            let k = a.getSubRenderer(j);
            let l = new Icon();
            l.provideContainer(k);
            l.svgPath = g;
            c.append(j);
            let m = a.createElement("span");
            m.setStyleProperty("display", "inline-block");
            m.setStyleProperty("font-size", "12px");
            m.setStyleProperty("font-weight", "600");
            m.setStyleProperty("margin-right", "5px");
            m.setText(h);
            c.append(m);
            if (i != null) {
                let n = a.createElement("span");
                n.setStyleProperty("display", "inline-block");
                n.setStyleProperty("font-size", "12px");
                n.setStyleProperty("font-weight", "600");
                n.setText(i);
                c.append(n);
            }
            e.appendButtonContent(c);
        }
        at() {
            this.e.l();
        }
        a3() {
            if (this.p && this.c != null && this.b != null) {
                if (this.ad != null) {
                    this.c.v = this.ad;
                }
                this.c.b = this.b;
                this.c.e = this.g;
                this.c.aq = this.bc;
                this.c.an(new Thickness(1, -16, 3, -16, 3));
            }
        }
        a4() {
            if (this.q && this.d != null && this.b != null) {
                if (this.ai != null) {
                    this.d.v = this.ai;
                }
                this.d.b = this.b;
                this.d.e = this.g;
                this.d.an = this.bc;
                this.d.ak(new Thickness(1, -16, 3, -16, 3));
            }
        }
        a5() {
            if (this.b != null) {
                let a = this.b;
                a.columnHiddenChanged = delegateCombine(a.columnHiddenChanged, runOn(this, this.a6));
                let b = this.b;
                b.columnPinnedChanged = delegateCombine(b.columnPinnedChanged, runOn(this, this.a7));
                this.av();
            }
        }
        av() {
            if (this.b != null) {
                let a = this.b.actualColumns.count;
                this.r = 0;
                this.s = 0;
                for (let b = 0; b < a; b++) {
                    if (this.b.actualColumns._inner[b].gh == true) {
                        this.r++;
                    }
                    if (this.b.actualColumns._inner[b].fk == 1) {
                        this.s++;
                    }
                }
            }
            this.e.ad();
            this.e.ae();
        }
        a6(a, b) {
            this.av();
        }
        a7(a, b) {
            this.av();
        }
    }
    DataGridToolbar.$t = /*@__PURE__*/ markType(DataGridToolbar, 'DataGridToolbar', Base.$, [INotifyPropertyChanged_$type]);
    DataGridToolbar.am = "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z";
    DataGridToolbar.an = "M13.2,3.8l7.1,7.1l-2.8-0.1l-3.4,3.4l0.1,4.2l-3.5-3.5l-5.4,5.4l-1.4,0l0-1.4l5.4-5.4L5.7,9.8l4.2,0.1l3.4-3.4L13.2,3.8z";
    return DataGridToolbar;
})();
//# sourceMappingURL=DataGridToolbarView_combined.js.map
