/*
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 { Size } from "igniteui-webcomponents-core";
import { GridColumnOptionsUtilities } from "./GridColumnOptionsUtilities";
import { runOn, delegateCombine, markType, delegateRemove } from "igniteui-webcomponents-core";
import { GridColumnOptionsSimpleSectionBase } from "./GridColumnOptionsSimpleSectionBase";
import { ColumnGroupDescription } from "./ColumnGroupDescription";
import { StringComparer } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
var GridColumnGroupOptionsView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(GridColumnGroupOptionsView, _super);
    function GridColumnGroupOptionsView() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.s = null;
        _this.p = null;
        _this.r = null;
        _this.o = null;
        _this.t = null;
        _this.q = false;
        return _this;
    }
    Object.defineProperty(GridColumnGroupOptionsView.prototype, "n", {
        get: function () {
            return this.b;
        },
        enumerable: true,
        configurable: true
    });
    GridColumnGroupOptionsView.prototype.x = function () {
        if (null == this.p) {
            return;
        }
        this.q = true;
        try {
            var a = this.n.b3;
            if (a) {
                this.p.svgPath = GridColumnGroupOptionsView.v;
            }
            else {
                this.p.svgPath = GridColumnGroupOptionsView.u;
            }
        }
        finally {
            this.q = false;
        }
    };
    GridColumnGroupOptionsView.prototype.k = function () {
        var _this = this;
        _super.prototype.k.call(this);
        if (null == this.g || null == this.e) {
            return;
        }
        var a = this.e;
        var b = this.n;
        var c = this.g;
        this.r = ((function () { var d = GridColumnOptionsUtilities.g(a, GridColumnGroupOptionsView.u, 1, b.p, b.j, new Size(1, 24, 24), _this.o, _this.p, _this.s, _this.t, false, true, false); _this.o = d.p6; _this.p = d.p7; _this.s = d.p8; _this.t = d.p9; return d.ret; })());
        var d = this.o;
        d.clicked = delegateCombine(d.clicked, runOn(this, this.w));
        c.append(this.r);
    };
    GridColumnGroupOptionsView.prototype.m = function () {
        _super.prototype.m.call(this);
        this.x();
        var a = this.n;
        if (null != this.s) {
            this.s.setRawText(this.n.bw);
            var b = this.n.bu;
            GridColumnOptionsUtilities.j(this.s, b, "inline-block");
            if (b) {
                this.o.s = 1;
                this.o.fv = "stretch";
                this.t.setStyleProperty("justify-content", "space-between");
            }
            else {
                this.o.s = 4;
                this.o.fv = "center";
                this.t.setStyleProperty("justify-content", "center");
            }
            this.s.setStyleProperty("font", a.aa.fontString);
        }
        a.bf(this.o);
    };
    GridColumnGroupOptionsView.prototype.w = function (a, b) {
        if (this.q) {
            return;
        }
        var c = this.n.b3;
        this.n.b3 = !c;
    };
    GridColumnGroupOptionsView.$t = markType(GridColumnGroupOptionsView, 'GridColumnGroupOptionsView', GridColumnOptionsViewBase.$);
    GridColumnGroupOptionsView.u = "M9,19v-2h11v2H9z M9,15v-2h11v2H9z M9,11V9h11v2H9z M7,7V5h13v2H7z M4,5h2v2H4V5z";
    GridColumnGroupOptionsView.v = "M16.8,18.3H9.6v-2h5.2l-2-2H9.6v-2h1.2L3.4,4.9l1.4-1.4l15.6,15.6L19,20.5L16.8,18.3z M20.6,14.3h-2.2l-2-2h4.2V14.3  L20.6,14.3z M20.6,10.3h-6.2l-2-2h8.2L20.6,10.3L20.6,10.3L20.6,10.3z M20.6,6.3H10.4l-2-2h12.2L20.6,6.3L20.6,6.3L20.6,6.3z";
    return GridColumnGroupOptionsView;
}(GridColumnOptionsViewBase));
export { GridColumnGroupOptionsView };
/**
 * @hidden
 */
var GridColumnGroupOptions = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(GridColumnGroupOptions, _super);
    function GridColumnGroupOptions() {
        return _super.call(this) || this;
    }
    GridColumnGroupOptions.prototype.f = function () {
        return new GridColumnGroupOptionsView();
    };
    GridColumnGroupOptions.prototype.get_by = function () {
        return "Group Column";
    };
    Object.defineProperty(GridColumnGroupOptions.prototype, "by", {
        get: function () {
            return this.get_by();
        },
        enumerable: true,
        configurable: true
    });
    GridColumnGroupOptions.prototype.bq = function () {
        if (null == this.column) {
            return false;
        }
        if (null == this.c) {
            return false;
        }
        return true;
    };
    GridColumnGroupOptions.prototype.bh = function (a, b) {
        if (null != a) {
            a.groupDescriptionsChanged = delegateRemove(a.groupDescriptionsChanged, runOn(this, this.b4));
        }
        if (null != b) {
            b.groupDescriptionsChanged = delegateCombine(b.groupDescriptionsChanged, runOn(this, this.b4));
        }
    };
    GridColumnGroupOptions.prototype.bc = function (a, b, c) {
        _super.prototype.bc.call(this, a, b, c);
    };
    Object.defineProperty(GridColumnGroupOptions.prototype, "b3", {
        get: function () {
            var a;
            var b = this.b1(a);
            a = b.p0;
            return a != -1;
        },
        set: function (a) {
            if (a) {
                this.b5();
            }
            else {
                this.b6();
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(GridColumnGroupOptions.prototype, "b2", {
        get: function () {
            return this.e;
        },
        enumerable: true,
        configurable: true
    });
    GridColumnGroupOptions.prototype.b1 = function (a) {
        var b = this.column;
        return {
            ret: ((function () { var c = GridColumnGroupOptions.b0(b, a); a = c.p1; return c.ret; })()),
            p0: a
        };
    };
    GridColumnGroupOptions.b0 = function (a, b) {
        if (null != a) {
            var c = a.grid;
            if (null != c) {
                var d = a.h4;
                var e = c.a8.i;
                for (var f = 0; f < e.count; f++) {
                    var g = e.item(f);
                    var h = g.f;
                    if (0 == StringComparer.b.compare(d, h)) {
                        b = f;
                        return {
                            ret: g,
                            p1: b
                        };
                    }
                }
            }
        }
        b = -1;
        return {
            ret: null,
            p1: b
        };
    };
    GridColumnGroupOptions.prototype.b5 = function () {
        var a = this.c;
        var b = this.column;
        if (null != a && null != b) {
            var c = new ColumnGroupDescription(1, b.h4);
            var d = b.e6;
            var e = d != 0 ? GridColumnOptionsUtilities.c(d) : 0;
            c.c = e;
            a.a8.g(c);
            b.e6 = 0;
        }
    };
    GridColumnGroupOptions.prototype.b6 = function () {
        var _this = this;
        var a = this.c;
        var b = this.column;
        if (null != a && null != b) {
            var c_1;
            var d = ((function () { var e = _this.b1(c_1); c_1 = e.p0; return e.ret; })());
            if (c_1 != -1) {
                a.a8.d(c_1);
            }
        }
    };
    GridColumnGroupOptions.prototype.b4 = function (a, b) {
        this.b2.m();
    };
    GridColumnGroupOptions.$t = markType(GridColumnGroupOptions, 'GridColumnGroupOptions', GridColumnOptionsSimpleSectionBase.$);
    return GridColumnGroupOptions;
}(GridColumnOptionsSimpleSectionBase));
export { GridColumnGroupOptions };
//# sourceMappingURL=GridColumnGroupOptionsView_combined.js.map
