igniteui-react-grids
Version:
Ignite UI React grid components.
278 lines (277 loc) • 9.44 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 { 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
*/
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.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; })());
let f = ((() => { let 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);
let g = [this.o, this.p];
let h = ((() => { let i = GridColumnOptionsUtilities.h(this.n, a, g, d, b.p, b.j, this.q); this.q = i.p6; 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.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;
}
}
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.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);
let b = a.b2 == 1;
let c = a.b2 == 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.b2 = 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.b4 = "Asc";
this.b8 = "Desc";
}
f() {
return new GridColumnSortOptionsView();
}
get_b0() {
return "Sort";
}
get b0() {
return this.get_b0();
}
bs() {
if (null == this.column) {
return false;
}
let 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;
}
a7(a, b) {
super.a7(a, b);
let c = this.column;
if (null == c) {
return;
}
switch (b.propertyName) {
case "SortDirection":
this.b3.m();
break;
}
}
ba(a, b) {
super.ba(a, b);
this.b3.m();
}
be(a, b, c) {
super.be(a, b, c);
switch (a) {
case "AscendingCaption":
case "DescendingCaption":
this.b3.m();
break;
}
}
get b3() {
return this.e;
}
get b5() {
return this.b4;
}
set b5(a) {
if (0 == StringComparer.b.compare(a, this.b4)) {
return;
}
let b = this.b4;
this.b4 = a;
this.bc("AscendingCaption", b, this.b4);
}
get b9() {
return this.b8;
}
set b9(a) {
if (0 == StringComparer.b.compare(a, this.b8)) {
return;
}
let b = this.b8;
this.b8 = a;
this.bc("DescendingCaption", b, this.b8);
}
get b2() {
let a = this.column;
if (null != a) {
let b;
let c = ((() => { let d = GridColumnGroupOptions.b2(a, b); b = d.p1; return d.ret; })());
if (null != c) {
let d = GridColumnOptionsUtilities.a(c.c);
return d;
}
return a.hr;
}
return 0;
}
set b2(a) {
let b = this.column;
if (null != b) {
let c;
let d = ((() => { let e = GridColumnGroupOptions.b2(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.groupDescriptions.d(c);
e.groupDescriptions.o(c, d);
}
return;
}
b.hr = a;
}
}
}
GridColumnSortOptions.$t = /*@__PURE__*/ markType(GridColumnSortOptions, 'GridColumnSortOptions', GridColumnOptionsSimpleSectionBase.$);
return GridColumnSortOptions;
})();