/*
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 { GridColumnOptionsViewBase } from "./GridColumnOptionsViewBase";
import { DomWrapper_$type } from "igniteui-webcomponents-core";
import { List$1 } from "igniteui-webcomponents-core";
import { Size } from "igniteui-webcomponents-core";
import { GridColumnOptionsUtilities } from "./GridColumnOptionsUtilities";
import { runOn, delegateCombine, markType } from "igniteui-webcomponents-core";
import { GridColumnOptionsSimpleSectionBase } from "./GridColumnOptionsSimpleSectionBase";
import { StringComparer } from "igniteui-webcomponents-core";
import { GridColumnGroupOptions } from "./GridColumnGroupOptions";
/**
 * @hidden
 */
export let GridColumnSortOptionsView = /*@__PURE__*/ (() => {
    class GridColumnSortOptionsView extends GridColumnOptionsViewBase {
        constructor() {
            super(...arguments);
            this.v = null;
            this.u = null;
            this.z = null;
            this.q = null;
            this.w = null;
            this.o = null;
            this.p = null;
            this.r = null;
            this.s = null;
            this.t = false;
        }
        get n() {
            return this.b;
        }
        x() {
            let a = this.e;
            let b = this.n;
            let c = a.createElement("div");
            let d = new List$1(DomWrapper_$type, 0);
            let e = ((() => { let f = GridColumnOptionsUtilities.f(a, GridColumnSortOptionsView.ab, b.p, b.j, new Size(1, 18, 18), this.o, this.r, this.u, true, true); this.o = f.p5; this.r = f.p6; this.u = f.p7; return f.ret; })());
            let f = ((() => { let g = GridColumnOptionsUtilities.f(a, GridColumnSortOptionsView.aa, b.p, b.j, new Size(1, 18, 18), this.p, this.s, this.z, true, true); this.p = g.p5; this.s = g.p6; this.z = g.p7; return g.ret; })());
            d.add(e);
            d.add(f);
            let g = [this.o, this.p];
            let h = ((() => { let i = GridColumnOptionsUtilities.h(a, g, d, b.p, b.j, this.q); this.q = i.p5; return i.ret; })());
            let i = this.q;
            i.selectionChanged = delegateCombine(i.selectionChanged, runOn(this, this.ac));
            c.append(h);
            return c;
        }
        y() {
            let a = this.e.createElement("label");
            return a;
        }
        ad() {
            if (null == this.q) {
                return;
            }
            this.t = true;
            try {
                let a = this.n.b0;
                switch (a) {
                    case 0:
                        this.q.d = [];
                        break;
                    case 1:
                        this.q.d = [0];
                        break;
                    case 2:
                        this.q.d = [1];
                        break;
                }
            }
            finally {
                this.t = false;
            }
        }
        k() {
            super.k();
            if (null == this.g || null == this.e) {
                return;
            }
            this.w = this.y();
            this.v = this.x();
            let a = this.g;
            a.setStyleProperty("display", "flex");
            a.setStyleProperty("flex-direction", "row");
            a.setStyleProperty("flex-wrap", "no-wrap");
            a.setStyleProperty("justify-content", "space-between");
            a.setStyleProperty("align-items", "center");
            a.append(this.w);
            a.append(this.v);
        }
        m() {
            super.m();
            this.ad();
            let a = this.n;
            if (null != this.w) {
                this.w.setRawText(a.bw);
                if (a.bu) {
                    this.g.setStyleProperty("display", "flex");
                    this.w.setStyleProperty("display", "inline-block");
                }
                else {
                    this.g.setStyleProperty("display", "block");
                    this.w.setStyleProperty("display", "none");
                }
                this.w.setStyleProperty("font", a.aa.fontString);
            }
            if (null != this.u) {
                this.u.setRawText(this.n.b3);
            }
            if (null != this.z) {
                this.z.setRawText(this.n.b7);
            }
            a.bf(this.o);
            a.bf(this.p);
            a.be(this.q);
            let b = a.b0 == 1;
            let c = a.b0 == 2;
        }
        ac(a, b) {
            if (this.t) {
                return;
            }
            let c;
            if (null == this.q || null == this.q.d || 0 == this.q.d.length) {
                c = 0;
            }
            else {
                if (this.q.d.length > 1) {
                }
                let d = this.q.d[0];
                switch (d) {
                    case 0:
                        c = 1;
                        break;
                    case 1:
                        c = 2;
                        break;
                    default:
                        c = 0;
                        break;
                }
            }
            this.n.b0 = c;
        }
    }
    GridColumnSortOptionsView.$t = /*@__PURE__*/ markType(GridColumnSortOptionsView, 'GridColumnSortOptionsView', GridColumnOptionsViewBase.$);
    GridColumnSortOptionsView.ab = "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z";
    GridColumnSortOptionsView.aa = "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z";
    return GridColumnSortOptionsView;
})();
/**
 * @hidden
 */
export let GridColumnSortOptions = /*@__PURE__*/ (() => {
    class GridColumnSortOptions extends GridColumnOptionsSimpleSectionBase {
        constructor() {
            super();
            this.b2 = "Asc";
            this.b6 = "Desc";
        }
        f() {
            return new GridColumnSortOptionsView();
        }
        get_by() {
            return "Sort";
        }
        get by() {
            return this.get_by();
        }
        bq() {
            if (null == this.column) {
                return false;
            }
            let a = this.c;
            if (null == a) {
                return true;
            }
            switch (a.d5) {
                case 1:
                case 3:
                case 0:
                case 2: return true;
                case 4: return false;
                default: break;
            }
            return true;
        }
        a6(a, b) {
            super.a6(a, b);
            let c = this.column;
            if (null == c) {
                return;
            }
            switch (b.propertyName) {
                case "SortDirection":
                    this.b1.m();
                    break;
            }
        }
        a8(a, b) {
            super.a8(a, b);
            this.b1.m();
        }
        bc(a, b, c) {
            super.bc(a, b, c);
            switch (a) {
                case "AscendingCaption":
                case "DescendingCaption":
                    this.b1.m();
                    break;
            }
        }
        get b1() {
            return this.e;
        }
        get b3() {
            return this.b2;
        }
        set b3(a) {
            if (0 == StringComparer.b.compare(a, this.b2)) {
                return;
            }
            let b = this.b2;
            this.b2 = a;
            this.ba("AscendingCaption", b, this.b2);
        }
        get b7() {
            return this.b6;
        }
        set b7(a) {
            if (0 == StringComparer.b.compare(a, this.b6)) {
                return;
            }
            let b = this.b6;
            this.b6 = a;
            this.ba("DescendingCaption", b, this.b6);
        }
        get b0() {
            let a = this.column;
            if (null != a) {
                let b;
                let c = ((() => { let d = GridColumnGroupOptions.b0(a, b); b = d.p1; return d.ret; })());
                if (null != c) {
                    let d = GridColumnOptionsUtilities.a(c.c);
                    return d;
                }
                return a.e6;
            }
            return 0;
        }
        set b0(a) {
            let b = this.column;
            if (null != b) {
                let c;
                let d = ((() => { let e = GridColumnGroupOptions.b0(b, c); c = e.p1; return e.ret; })());
                if (null != d) {
                    let e = b.grid;
                    if (e != null) {
                        let f = a != 0 ? GridColumnOptionsUtilities.c(a) : 0;
                        d.c = f;
                        e.a8.d(c);
                        e.a8.n(c, d);
                    }
                    return;
                }
                b.e6 = a;
            }
        }
    }
    GridColumnSortOptions.$t = /*@__PURE__*/ markType(GridColumnSortOptions, 'GridColumnSortOptions', GridColumnOptionsSimpleSectionBase.$);
    return GridColumnSortOptions;
})();
//# sourceMappingURL=GridColumnSortOptionsView_combined.js.map
