igniteui-react-grids
Version:
Ignite UI React grid components.
306 lines (305 loc) • 10.6 kB
JavaScript
/*
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 { __extends } from "tslib";
import { GridColumnOptionsViewBase } from "./GridColumnOptionsViewBase";
import { DomWrapper_$type } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { GridColumnOptionsUtilities } from "./GridColumnOptionsUtilities";
import { runOn, delegateCombine, markType } from "igniteui-react-core";
import { GridColumnOptionsSimpleSectionBase } from "./GridColumnOptionsSimpleSectionBase";
import { StringComparer } from "igniteui-react-core";
import { GridColumnGroupOptions } from "./GridColumnGroupOptions";
/**
* @hidden
*/
var GridColumnSortOptionsView = /** @class */ /*@__PURE__*/ (function (_super) {
__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: false,
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.g(_this.n, a, GridColumnSortOptionsView.ab, b.p, b.j, new Size(1, 18, 18), _this.o, _this.r, _this.u, true, true); _this.o = f.p6; _this.r = f.p7; _this.u = f.p8; return f.ret; })());
var f = ((function () { var g = GridColumnOptionsUtilities.g(_this.n, a, GridColumnSortOptionsView.aa, b.p, b.j, new Size(1, 18, 18), _this.p, _this.s, _this.z, true, true); _this.p = g.p6; _this.s = g.p7; _this.z = g.p8; return g.ret; })());
d.add(e);
d.add(f);
var g = [this.o, this.p];
var h = ((function () { var i = GridColumnOptionsUtilities.h(_this.n, a, g, d, b.p, b.j, _this.q); _this.q = i.p6; 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.b2;
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.by);
if (a.bw) {
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.b5);
}
if (null != this.z) {
this.z.setRawText(this.n.b9);
}
a.bh(this.o);
a.bh(this.p);
a.bg(this.q);
var b = a.b2 == 1;
var c = a.b2 == 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.b2 = 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) {
__extends(GridColumnSortOptions, _super);
function GridColumnSortOptions() {
var _this = _super.call(this) || this;
_this.b4 = "Asc";
_this.b8 = "Desc";
return _this;
}
GridColumnSortOptions.prototype.f = function () {
return new GridColumnSortOptionsView();
};
GridColumnSortOptions.prototype.get_b0 = function () {
return "Sort";
};
Object.defineProperty(GridColumnSortOptions.prototype, "b0", {
get: function () {
return this.get_b0();
},
enumerable: false,
configurable: true
});
GridColumnSortOptions.prototype.bs = function () {
if (null == this.column) {
return false;
}
var a = this.c;
if (null == a) {
return true;
}
switch (a.headerClickAction) {
case 1:
case 3:
case 0:
case 2: return true;
case 4: return false;
default: break;
}
return true;
};
GridColumnSortOptions.prototype.a7 = function (a, b) {
_super.prototype.a7.call(this, a, b);
var c = this.column;
if (null == c) {
return;
}
switch (b.propertyName) {
case "SortDirection":
this.b3.m();
break;
}
};
GridColumnSortOptions.prototype.ba = function (a, b) {
_super.prototype.ba.call(this, a, b);
this.b3.m();
};
GridColumnSortOptions.prototype.be = function (a, b, c) {
_super.prototype.be.call(this, a, b, c);
switch (a) {
case "AscendingCaption":
case "DescendingCaption":
this.b3.m();
break;
}
};
Object.defineProperty(GridColumnSortOptions.prototype, "b3", {
get: function () {
return this.e;
},
enumerable: false,
configurable: true
});
Object.defineProperty(GridColumnSortOptions.prototype, "b5", {
get: function () {
return this.b4;
},
set: function (a) {
if (0 == StringComparer.b.compare(a, this.b4)) {
return;
}
var b = this.b4;
this.b4 = a;
this.bc("AscendingCaption", b, this.b4);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GridColumnSortOptions.prototype, "b9", {
get: function () {
return this.b8;
},
set: function (a) {
if (0 == StringComparer.b.compare(a, this.b8)) {
return;
}
var b = this.b8;
this.b8 = a;
this.bc("DescendingCaption", b, this.b8);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GridColumnSortOptions.prototype, "b2", {
get: function () {
var a = this.column;
if (null != a) {
var b_1;
var c = ((function () { var d = GridColumnGroupOptions.b2(a, b_1); b_1 = d.p1; return d.ret; })());
if (null != c) {
var d = GridColumnOptionsUtilities.a(c.c);
return d;
}
return a.hr;
}
return 0;
},
set: function (a) {
var b = this.column;
if (null != b) {
var c_1;
var d = ((function () { var e = GridColumnGroupOptions.b2(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.groupDescriptions.d(c_1);
e.groupDescriptions.o(c_1, d);
}
return;
}
b.hr = a;
}
},
enumerable: false,
configurable: true
});
GridColumnSortOptions.$t = markType(GridColumnSortOptions, 'GridColumnSortOptions', GridColumnOptionsSimpleSectionBase.$);
return GridColumnSortOptions;
}(GridColumnOptionsSimpleSectionBase));
export { GridColumnSortOptions };