igniteui-react-grids
Version:
Ignite UI React grid components.
298 lines (297 loc) • 9.13 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 { 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";
/**
* @hidden
*/
export let GridColumnMoveOptionsView = /*@__PURE__*/ (() => {
class GridColumnMoveOptionsView extends GridColumnOptionsViewBase {
constructor() {
super(...arguments);
this.q = null;
this.v = null;
this.w = null;
this.o = null;
this.p = null;
this.r = null;
}
get n() {
return this.b;
}
s() {
let a = this.e;
let b = a.createElement("div");
let c = a.createElement("div");
b.append(c);
c.setStyleProperty("display", "flex");
c.setStyleProperty("flexDirection", "row");
c.setStyleProperty("flexWrap", "no-wrap");
c.setStyleProperty("justify-content", "center");
let d = ((() => { let e = this.u(true, this.v); this.v = e.p1; return e.ret; })());
let e = ((() => { let f = this.u(false, this.w); this.w = f.p1; return f.ret; })());
c.append(d);
c.append(e);
return b;
}
t() {
let a = this.e.createElement("label");
return a;
}
u(a, b) {
let c = this.e;
let d = this.n;
let e = a ? GridColumnMoveOptionsView.x : GridColumnMoveOptionsView.y;
let f;
let g;
let h;
let i = ((() => { let j = GridColumnOptionsUtilities.f(this.n, c, e, 1, d.p, d.j, new Size(1, 18, 18), f, g, b, h, a, false); f = j.p7; g = j.p8; b = j.p9; h = j.p10; return j.ret; })());
if (a) {
this.o = f;
f.clicked = delegateCombine(f.clicked, runOn(this, this.z));
}
else {
this.p = f;
f.clicked = delegateCombine(f.clicked, runOn(this, this.aa));
}
return {
ret: i,
p1: b
};
}
k() {
super.k();
if (null == this.g || null == this.e) {
return;
}
this.r = this.t();
this.q = this.s();
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.r);
a.append(this.q);
}
ab() {
let a = this.n.b5();
let b = this.n.b6();
if (null != this.o) {
this.o.disabled = !a;
}
if (null != this.p) {
this.p.disabled = !b;
}
}
m() {
super.m();
let a = this.n;
if (null != this.r) {
this.r.setRawText(a.by);
let b = a.bw;
if (a.bw) {
this.g.setStyleProperty("display", "flex");
this.r.setStyleProperty("display", "inline-block");
}
else {
this.g.setStyleProperty("display", "block");
this.r.setStyleProperty("display", "none");
}
this.r.setStyleProperty("font", a.aa.fontString);
}
if (null != this.v) {
this.v.setRawText(this.n.b8);
}
if (null != this.w) {
this.w.setRawText(this.n.cc);
}
a.bh(this.o);
a.bh(this.p);
}
z(a, b) {
this.n.cg();
}
aa(a, b) {
this.n.ci();
}
}
GridColumnMoveOptionsView.$t = /*@__PURE__*/ markType(GridColumnMoveOptionsView, 'GridColumnMoveOptionsView', GridColumnOptionsViewBase.$);
GridColumnMoveOptionsView.x = "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z";
GridColumnMoveOptionsView.y = "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z";
return GridColumnMoveOptionsView;
})();
/**
* @hidden
*/
export let GridColumnMoveOptions = /*@__PURE__*/ (() => {
class GridColumnMoveOptions extends GridColumnOptionsSimpleSectionBase {
constructor() {
super();
this.b3 = false;
this.b7 = "Left";
this.cb = "Right";
}
f() {
return new GridColumnMoveOptionsView();
}
get_b0() {
return "Move";
}
get b0() {
return this.get_b0();
}
bs() {
if (null == this.column) {
return false;
}
let a = this.c;
if (null == a) {
return false;
}
switch (a.columnMovingMode) {
case 0: return true;
case 1: return false;
default: break;
}
return true;
}
a8(a, b) {
super.a8(a, b);
this.b2.ab();
}
a9(a, b) {
super.a9(a, b);
this.b3 = true;
}
a5(a, b) {
super.a5(a, b);
if (this.b3) {
this.b2.ab();
this.b3 = false;
}
}
a6() {
super.a6();
this.b2.ab();
}
a7(a, b) {
super.a7(a, b);
let c = this.column;
if (null == c) {
return;
}
switch (b.propertyName) {
case "Pinned":
this.b2.ab();
break;
}
}
be(a, b, c) {
super.be(a, b, c);
switch (a) {
case "MoveLeftCaption":
case "MoveRightCaption":
this.b2.m();
break;
}
}
get b2() {
return this.e;
}
get b8() {
return this.b7;
}
set b8(a) {
if (0 == StringComparer.b.compare(a, this.b7)) {
return;
}
let b = this.b7;
this.b7 = a;
this.bc("MoveLeftCaption", b, this.b7);
}
get cc() {
return this.cb;
}
set cc(a) {
if (0 == StringComparer.b.compare(a, this.cb)) {
return;
}
let b = this.cb;
this.cb = a;
this.bc("MoveRightCaption", b, this.cb);
}
b4(a) {
let b = this.column;
if (null == b) {
return false;
}
let c = b.grid;
if (null == c) {
return false;
}
let d = c.actualColumns;
let e = d.indexOf(b);
if (e < 0) {
return false;
}
if (a) {
return this.c.canMoveColumnLeft(e);
}
else {
return this.c.canMoveColumnRight(e);
}
}
cf(a) {
let b = this.column;
if (null == b) {
return;
}
let c = this.c;
if (null == c) {
return;
}
if (!this.b4(a)) {
return;
}
let d = c.actualColumns;
let e = d.indexOf(b);
b.mz("Moved");
if (a) {
c.moveColumnLeft(e);
}
else {
c.moveColumnRight(e);
}
}
b5() {
return this.b4(true);
}
b6() {
return this.b4(false);
}
cg() {
this.cf(true);
}
ci() {
this.cf(false);
}
ch(a, b) {
this.cg();
}
cj(a, b) {
this.ci();
}
}
GridColumnMoveOptions.$t = /*@__PURE__*/ markType(GridColumnMoveOptions, 'GridColumnMoveOptions', GridColumnOptionsSimpleSectionBase.$);
return GridColumnMoveOptions;
})();