/*
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, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateRemove, delegateCombine, enumGetBox, fromEnum } from "igniteui-webcomponents-core";
import { SRProvider } from "igniteui-webcomponents-core";
import { BaseControlTheme_$type } from "igniteui-webcomponents-core";
import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core";
import { BrushUtil } from "igniteui-webcomponents-core";
import { ObservableCollection$1 } from "igniteui-webcomponents-core";
import { ColumnChooserInfo } from "./ColumnChooserInfo";
import { stringIsNullOrWhiteSpace } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let ColumnChooserView = /*@__PURE__*/ (() => {
    class ColumnChooserView extends Base {
        constructor() {
            super();
            this.d = null;
            this.c = null;
            this.e = null;
            this.a = null;
            this.b = null;
        }
        h() {
        }
        g(a) {
            if (a == null) {
                this.b = null;
                return;
            }
            this.b = a;
            this.e = this.b.rootWrapper.getChildAt(0);
            this.e.setStyleProperty("margin", "4px 0px 4px 0px");
            this.k();
            this.j();
            let b = Math.round(a.rootWrapper.width());
            let c = Math.round(a.rootWrapper.height());
            this.b.rootWrapper.setStyleProperty("position", "relative");
            this.i();
        }
        i() {
            if (this.b != null) {
                this.b.rootWrapper.setStyleProperty("background-color", this.a.aq._fill);
            }
        }
        j() {
            if (this.b != null) {
                let a = this.b.rootWrapper.getChildAt(1);
                a.setStyleProperty("width", "100%");
                if (this.a.v != null) {
                    a.setStyleProperty("height", "calc(100% - 25px");
                }
                else {
                    a.setStyleProperty("height", "calc(100% - 5px");
                }
            }
        }
        k() {
            if (this.e != null && this.a.v != null) {
                this.e.setText(this.a.v);
                this.e.setStyleProperty("font", "16px \"Segoe UI\", Verdana");
            }
            this.l();
            this.m();
            this.j();
        }
        l() {
            if (this.e != null && this.a.ar != null) {
                this.e.setStyleProperty("color", this.a.ar._fill);
            }
        }
        m() {
            if (this.e != null && this.a.j != null) {
                this.e.setStyleProperty("font", this.a.j.fontString);
            }
        }
        f() {
        }
    }
    ColumnChooserView.$t = /*@__PURE__*/ markType(ColumnChooserView, 'ColumnChooserView');
    return ColumnChooserView;
})();
/**
 * @hidden
 */
export let ColumnChooser = /*@__PURE__*/ (() => {
    class ColumnChooser extends Base {
        constructor() {
            super();
            this.c = null;
            this.h = null;
            this.propertyChanged = null;
            this.m = false;
            this.k = null;
            this.a = null;
            this.o = null;
            this.i = null;
            this.ap = BrushUtil.g(255, 0, 153, 255);
            this.n = null;
            this.d = 1;
            this.f = 2;
            this.ao = BrushUtil.g(255, 248, 248, 248);
            this.m = false;
            let a = new ColumnChooserView();
            a.a = this;
            this.c = a;
            this.c.h();
        }
        notifySizeChanged() {
            this.c.f();
        }
        destroy() {
            if (this.h != null) {
                let a = this.h;
                a.checkedChanged = delegateRemove(a.checkedChanged, runOn(this, this.ac));
                let b = this.h;
                b.selectAllCheckboxChanged = delegateRemove(b.selectAllCheckboxChanged, runOn(this, this.ad));
            }
            this.provideContainer(null, null);
            if (this.a != null) {
                let c = this.a.actualColumns;
                c.collectionChanged = delegateRemove(c.collectionChanged, runOn(this, this.z));
                let d = this.a;
                d.columnHiddenChanged = delegateRemove(d.columnHiddenChanged, runOn(this, this.am));
            }
        }
        provideContainer(a, b) {
            this.h = b;
            if (this.h != null) {
                let c = this.h;
                c.checkedChanged = delegateCombine(c.checkedChanged, runOn(this, this.ac));
                let d = this.h;
                d.selectAllCheckboxChanged = delegateCombine(d.selectAllCheckboxChanged, runOn(this, this.ad));
            }
            this.aa();
            this.c.g(a);
        }
        get l() {
            if (this.k == null) {
                this.k = new SRProvider(this.c.b);
                this.k.cb("DataGrid");
            }
            return this.k;
        }
        get b() {
            return this.a;
        }
        set b(a) {
            let b = this.a;
            this.a = a;
            if (b != this.a) {
                this.ag("TargetGrid", b, this.a);
            }
        }
        get v() {
            return this.o;
        }
        set v(a) {
            let b = this.o;
            this.o = a;
            if (b != this.o) {
                this.ag("Title", b, this.o);
            }
        }
        get j() {
            return this.i;
        }
        set j(a) {
            let b = this.i;
            this.i = a;
            if (b != this.i) {
                this.ag("TitleStyle", b, this.i);
            }
        }
        get ar() {
            return this.ap;
        }
        set ar(a) {
            let b = this.ap;
            this.ap = a;
            if (b != this.ap) {
                this.ag("TitleColor", b, this.ap);
            }
        }
        get s() {
            return this.n != null ? this.n : !stringIsNullOrWhiteSpace(this.l.b1("Filter_Columns_List")) ? this.l.b1("Filter_Columns_List") : "Filter columns list ...";
        }
        set s(a) {
            let b = this.n;
            this.n = a;
            if (b != this.n) {
                this.ag("FilterPlaceholderText", b, this.n);
            }
        }
        get e() {
            return this.d;
        }
        set e(a) {
            let b = this.d;
            this.d = a;
            if (b != this.d) {
                this.ag("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, this.d));
            }
        }
        get g() {
            return this.f;
        }
        set g(a) {
            let b = this.f;
            this.f = a;
            if (b != this.f) {
                this.ag("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.f));
            }
        }
        get aq() {
            return this.ao;
        }
        set aq(a) {
            let b = this.ao;
            this.ao = a;
            if (b != this.ao) {
                this.ag("BackgroundColor", b, this.ao);
            }
        }
        ag(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            this.ah(a, b, c);
        }
        ah(a, b, c) {
            switch (a) {
                case "TargetGrid":
                    if (b != null) {
                        let d = b.actualColumns;
                        d.collectionChanged = delegateRemove(d.collectionChanged, runOn(this, this.z));
                        let e = b;
                        e.columnHiddenChanged = delegateRemove(e.columnHiddenChanged, runOn(this, this.am));
                    }
                    if (this.a != null) {
                        let f = this.a.actualColumns;
                        f.collectionChanged = delegateCombine(f.collectionChanged, runOn(this, this.z));
                        let g = this.a;
                        g.columnHiddenChanged = delegateCombine(g.columnHiddenChanged, runOn(this, this.am));
                    }
                    this.aa();
                    break;
                case "Title":
                    this.c.k();
                    break;
                case "TitleStyle":
                    this.c.m();
                    break;
                case "TitleColor":
                    this.c.l();
                    break;
                case "FilterPlaceholderText":
                    if (this.h != null) {
                        this.h.a6 = this.s;
                    }
                    break;
                case "BaseTheme":
                    this.ak();
                    break;
                case "Density":
                    this.aj();
                    break;
                case "BackgroundColor":
                    if (this.h != null) {
                        this.h.cr = this.aq;
                    }
                    this.c.i();
                    break;
            }
        }
        ak() {
            if (this.h != null) {
                this.h.l = this.e;
            }
        }
        aj() {
            if (this.h != null) {
                this.h.n = this.g;
            }
        }
        am(a, b) {
            if (this.m == false) {
                this.aa();
            }
            this.m = false;
        }
        z(a, b) {
            this.aa();
        }
        aa() {
            if (this.a != null && this.h != null) {
                this.h.l = this.e;
                this.h.n = this.g;
                this.h.cr = this.aq;
                let a;
                let b = new ObservableCollection$1(ColumnChooserInfo.$, 0);
                for (let c of fromEnum(this.a.actualColumns)) {
                    a = new ColumnChooserInfo();
                    let d = c.h4;
                    if (c.h8 != null) {
                        d = c.h8;
                    }
                    a.columnName = d;
                    a.isNotHidden = !c.gh;
                    b.add(a);
                }
                if (this.s != null) {
                    this.h.a6 = this.s;
                }
                this.h.itemsSource = b;
                let e = "";
                let f = "";
                e = "columnName";
                f = "isNotHidden";
                this.h.bj = f;
                this.h.a2 = e;
                this.h.ao = true;
            }
        }
        an(a) {
            if (this.h != null) {
                this.h.updateHrMargin(a);
            }
        }
        al() {
            this.h.ch();
            if (this.a != null) {
                for (let a of fromEnum(this.a.actualColumns)) {
                    this.m = true;
                    a.gh = false;
                }
            }
        }
        ae() {
            this.h.bs();
            if (this.a != null) {
                for (let a of fromEnum(this.a.actualColumns)) {
                    this.m = true;
                    a.gh = true;
                }
            }
        }
        ad(a, b) {
            this.m = true;
            if (b.a) {
                this.al();
            }
            else {
                this.ae();
            }
        }
        ac(a, b) {
            this.m = true;
            let c = this.h.h.actualDataSource.getItemAtIndex(b.b);
            let d = this.a.actualColumns.count;
            for (let e = 0; e < d; e++) {
                if (this.a.actualColumns._inner[e].h4 == c.columnName || this.a.actualColumns._inner[e].il == c.columnName || this.a.actualColumns._inner[e].h8 == c.columnName) {
                    this.a.actualColumns._inner[e].gh = !b.a;
                }
            }
        }
    }
    ColumnChooser.$t = /*@__PURE__*/ markType(ColumnChooser, 'ColumnChooser', Base.$, [INotifyPropertyChanged_$type]);
    return ColumnChooser;
})();
//# sourceMappingURL=ColumnChooserView_combined.js.map
