/*
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 * as tslib_1 from "tslib";
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
 */
var GridColumnSortOptionsView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(GridColumnSortOptionsView, _super);
    function GridColumnSortOptionsView() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _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;
        return _this;
    }
    Object.defineProperty(GridColumnSortOptionsView.prototype, "n", {
        get: function () {
            return this.b;
        },
        enumerable: true,
        configurable: true
    });
    GridColumnSortOptionsView.prototype.x = function () {
        var _this = this;
        var a = this.e;
        var b = this.n;
        var c = a.createElement("div");
        var d = new List$1(DomWrapper_$type, 0);
        var e = ((function () { var 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; })());
        var f = ((function () { var 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);
        var g = [this.o, this.p];
        var h = ((function () { var i = GridColumnOptionsUtilities.h(a, g, d, b.p, b.j, _this.q); _this.q = i.p5; return i.ret; })());
        var i = this.q;
        i.selectionChanged = delegateCombine(i.selectionChanged, runOn(this, this.ac));
        c.append(h);
        return c;
    };
    GridColumnSortOptionsView.prototype.y = function () {
        var a = this.e.createElement("label");
        return a;
    };
    GridColumnSortOptionsView.prototype.ad = function () {
        if (null == this.q) {
            return;
        }
        this.t = true;
        try {
            var 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;
        }
    };
    GridColumnSortOptionsView.prototype.k = function () {
        _super.prototype.k.call(this);
        if (null == this.g || null == this.e) {
            return;
        }
        this.w = this.y();
        this.v = this.x();
        var 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);
    };
    GridColumnSortOptionsView.prototype.m = function () {
        _super.prototype.m.call(this);
        this.ad();
        var 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);
        var b = a.b0 == 1;
        var c = a.b0 == 2;
    };
    GridColumnSortOptionsView.prototype.ac = function (a, b) {
        if (this.t) {
            return;
        }
        var c;
        if (null == this.q || null == this.q.d || 0 == this.q.d.length) {
            c = 0;
        }
        else {
            if (this.q.d.length > 1) {
            }
            var 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 = 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;
}(GridColumnOptionsViewBase));
export { GridColumnSortOptionsView };
/**
 * @hidden
 */
var GridColumnSortOptions = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(GridColumnSortOptions, _super);
    function GridColumnSortOptions() {
        var _this = _super.call(this) || this;
        _this.b2 = "Asc";
        _this.b6 = "Desc";
        return _this;
    }
    GridColumnSortOptions.prototype.f = function () {
        return new GridColumnSortOptionsView();
    };
    GridColumnSortOptions.prototype.get_by = function () {
        return "Sort";
    };
    Object.defineProperty(GridColumnSortOptions.prototype, "by", {
        get: function () {
            return this.get_by();
        },
        enumerable: true,
        configurable: true
    });
    GridColumnSortOptions.prototype.bq = function () {
        if (null == this.column) {
            return false;
        }
        var 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;
    };
    GridColumnSortOptions.prototype.a6 = function (a, b) {
        _super.prototype.a6.call(this, a, b);
        var c = this.column;
        if (null == c) {
            return;
        }
        switch (b.propertyName) {
            case "SortDirection":
                this.b1.m();
                break;
        }
    };
    GridColumnSortOptions.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        this.b1.m();
    };
    GridColumnSortOptions.prototype.bc = function (a, b, c) {
        _super.prototype.bc.call(this, a, b, c);
        switch (a) {
            case "AscendingCaption":
            case "DescendingCaption":
                this.b1.m();
                break;
        }
    };
    Object.defineProperty(GridColumnSortOptions.prototype, "b1", {
        get: function () {
            return this.e;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GridColumnSortOptions.prototype, "b3", {
        get: function () {
            return this.b2;
        },
        set: function (a) {
            if (0 == StringComparer.b.compare(a, this.b2)) {
                return;
            }
            var b = this.b2;
            this.b2 = a;
            this.ba("AscendingCaption", b, this.b2);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GridColumnSortOptions.prototype, "b7", {
        get: function () {
            return this.b6;
        },
        set: function (a) {
            if (0 == StringComparer.b.compare(a, this.b6)) {
                return;
            }
            var b = this.b6;
            this.b6 = a;
            this.ba("DescendingCaption", b, this.b6);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GridColumnSortOptions.prototype, "b0", {
        get: function () {
            var a = this.column;
            if (null != a) {
                var b_1;
                var c = ((function () { var d = GridColumnGroupOptions.b0(a, b_1); b_1 = d.p1; return d.ret; })());
                if (null != c) {
                    var d = GridColumnOptionsUtilities.a(c.c);
                    return d;
                }
                return a.e6;
            }
            return 0;
        },
        set: function (a) {
            var b = this.column;
            if (null != b) {
                var c_1;
                var d = ((function () { var e = GridColumnGroupOptions.b0(b, c_1); c_1 = e.p1; return e.ret; })());
                if (null != d) {
                    var e = b.grid;
                    if (e != null) {
                        var f = a != 0 ? GridColumnOptionsUtilities.c(a) : 0;
                        d.c = f;
                        e.a8.d(c_1);
                        e.a8.n(c_1, d);
                    }
                    return;
                }
                b.e6 = a;
            }
        },
        enumerable: true,
        configurable: true
    });
    GridColumnSortOptions.$t = markType(GridColumnSortOptions, 'GridColumnSortOptions', GridColumnOptionsSimpleSectionBase.$);
    return GridColumnSortOptions;
}(GridColumnOptionsSimpleSectionBase));
export { GridColumnSortOptions };
//# sourceMappingURL=GridColumnSortOptionsView_combined.js.map
