/*
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 { ColumnPinningInfo } from "./ColumnPinningInfo";
import { stringIsNullOrWhiteSpace } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let ColumnPinningView = /*@__PURE__*/ (() => {
    class ColumnPinningView extends Base {
        constructor() {
            super();
            this.c = null;
            this.a = null;
            this.b = null;
        }
        f() {
        }
        e(a) {
            if (a == null) {
                this.b = null;
                return;
            }
            this.b = a;
            let b = Math.round(a.rootWrapper.width());
            let c = Math.round(a.rootWrapper.height());
            this.b.rootWrapper.setStyleProperty("position", "relative");
            this.g();
            this.c = this.b.rootWrapper.getChildAt(0);
            this.c.setStyleProperty("margin", "4px 0px 4px 0px");
            this.i();
            this.h();
        }
        g() {
            if (this.b != null) {
                this.b.rootWrapper.setStyleProperty("background-color", this.a.an._fill);
            }
        }
        i() {
            if (this.c != null && this.a.v != null) {
                this.c.setText(this.a.v);
                this.c.setStyleProperty("font", "16px \"Segoe UI\", Verdana");
            }
            this.j();
            this.k();
            this.h();
        }
        j() {
            if (this.c != null && this.a.ao != null) {
                this.c.setStyleProperty("color", this.a.ao._fill);
            }
        }
        k() {
            if (this.c != null && this.a.j != null) {
                this.c.setStyleProperty("font", this.a.j.fontString);
            }
        }
        h() {
            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");
                }
            }
        }
        d() {
        }
    }
    ColumnPinningView.$t = /*@__PURE__*/ markType(ColumnPinningView, 'ColumnPinningView');
    return ColumnPinningView;
})();
/**
 * @hidden
 */
export let ColumnPinning = /*@__PURE__*/ (() => {
    class ColumnPinning 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.am = BrushUtil.g(255, 0, 153, 255);
            this.n = null;
            this.d = 1;
            this.f = 2;
            this.al = BrushUtil.g(255, 248, 248, 248);
            this.m = false;
            let a = new ColumnPinningView();
            a.a = this;
            this.c = a;
            this.c.f();
        }
        ak(a) {
            if (this.h != null) {
                this.h.updateHrMargin(a);
            }
        }
        notifySizeChanged() {
            this.c.d();
        }
        destroy() {
            if (this.h != null) {
                let a = this.h;
                a.checkedChanged = delegateRemove(a.checkedChanged, runOn(this, this.ae));
            }
            this.provideContainer(null, null);
            if (this.a != null) {
                let b = this.a.actualColumns;
                b.collectionChanged = delegateRemove(b.collectionChanged, runOn(this, this.z));
                let c = this.a;
                c.columnPinnedChanged = delegateRemove(c.columnPinnedChanged, runOn(this, this.aj));
            }
        }
        provideContainer(a, b) {
            this.h = b;
            if (this.h != null) {
                let c = this.h;
                c.checkedChanged = delegateCombine(c.checkedChanged, runOn(this, this.ae));
            }
            this.aa();
            this.c.e(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.ad("TargetGrid", b, this.a);
            }
        }
        get v() {
            return this.o;
        }
        set v(a) {
            let b = this.o;
            this.o = a;
            if (b != this.o) {
                this.ad("Title", b, this.o);
            }
        }
        get j() {
            return this.i;
        }
        set j(a) {
            let b = this.i;
            this.i = a;
            if (b != this.i) {
                this.ad("TitleStyle", b, this.i);
            }
        }
        get ao() {
            return this.am;
        }
        set ao(a) {
            let b = this.am;
            this.am = a;
            if (b != this.am) {
                this.ad("TitleColor", b, this.am);
            }
        }
        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.ad("FilterPlaceholderText", b, this.n);
            }
        }
        get e() {
            return this.d;
        }
        set e(a) {
            let b = this.d;
            this.d = a;
            if (b != this.d) {
                this.ad("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.ad("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.f));
            }
        }
        get an() {
            return this.al;
        }
        set an(a) {
            let b = this.al;
            this.al = a;
            if (b != this.al) {
                this.ad("BackgroundColor", b, this.al);
            }
        }
        ad(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            this.af(a, b, c);
        }
        af(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.columnPinnedChanged = delegateRemove(e.columnPinnedChanged, runOn(this, this.aj));
                    }
                    if (this.a != null) {
                        let f = this.a.actualColumns;
                        f.collectionChanged = delegateCombine(f.collectionChanged, runOn(this, this.z));
                        let g = this.a;
                        g.columnPinnedChanged = delegateCombine(g.columnPinnedChanged, runOn(this, this.aj));
                    }
                    this.aa();
                    break;
                case "Title":
                    this.c.i();
                    break;
                case "TitleStyle":
                    this.c.k();
                    break;
                case "TitleColor":
                    this.c.j();
                    break;
                case "FilterPlaceholderText":
                    if (this.h != null) {
                        this.h.a6 = this.s;
                    }
                    break;
                case "BaseTheme":
                    this.ai();
                    break;
                case "Density":
                    this.ah();
                    break;
                case "BackgroundColor":
                    if (this.h != null) {
                        this.h.cr = this.an;
                    }
                    this.c.g();
                    break;
            }
        }
        ai() {
            if (this.h != null) {
                this.h.l = this.e;
            }
        }
        ah() {
            if (this.h != null) {
                this.h.n = this.g;
            }
        }
        aj(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.an;
                let a;
                let b = new ObservableCollection$1(ColumnPinningInfo.$, 0);
                for (let c of fromEnum(this.a.actualColumns)) {
                    a = new ColumnPinningInfo();
                    let d = c.h4;
                    if (c.h8 != null) {
                        d = c.h8;
                    }
                    a.columnName = d;
                    if (c.fk == 1) {
                        a.isPinned = true;
                    }
                    else {
                        a.isPinned = false;
                    }
                    b.add(a);
                }
                this.h.ao = false;
                if (this.s != null) {
                    this.h.a6 = this.s;
                }
                this.h.itemsSource = b;
                let e = "";
                let f = "";
                e = "columnName";
                f = "isPinned";
                this.h.bj = f;
                this.h.a2 = e;
            }
        }
        ae(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) {
                    if (this.a.actualColumns._inner[e].fk == 0) {
                        this.a.actualColumns._inner[e].fk = 1;
                    }
                    else if (this.a.actualColumns._inner[e].fk == 2) {
                        this.a.actualColumns._inner[e].fk = 1;
                    }
                    else {
                        this.a.actualColumns._inner[e].fk = 0;
                    }
                    break;
                }
            }
        }
    }
    ColumnPinning.$t = /*@__PURE__*/ markType(ColumnPinning, 'ColumnPinning', Base.$, [INotifyPropertyChanged_$type]);
    return ColumnPinning;
})();
//# sourceMappingURL=ColumnPinningView_combined.js.map
