igniteui-react-grids
Version:
Ignite UI React grid components.
323 lines (322 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 { 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
*/
var GridColumnMoveOptionsView = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(GridColumnMoveOptionsView, _super);
function GridColumnMoveOptionsView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.q = null;
_this.v = null;
_this.w = null;
_this.o = null;
_this.p = null;
_this.r = null;
return _this;
}
Object.defineProperty(GridColumnMoveOptionsView.prototype, "n", {
get: function () {
return this.b;
},
enumerable: false,
configurable: true
});
GridColumnMoveOptionsView.prototype.s = function () {
var _this = this;
var a = this.e;
var b = a.createElement("div");
var 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");
var d = ((function () { var e = _this.u(true, _this.v); _this.v = e.p1; return e.ret; })());
var e = ((function () { var f = _this.u(false, _this.w); _this.w = f.p1; return f.ret; })());
c.append(d);
c.append(e);
return b;
};
GridColumnMoveOptionsView.prototype.t = function () {
var a = this.e.createElement("label");
return a;
};
GridColumnMoveOptionsView.prototype.u = function (a, b) {
var _this = this;
var c = this.e;
var d = this.n;
var e = a ? GridColumnMoveOptionsView.x : GridColumnMoveOptionsView.y;
var f;
var g;
var h;
var i = ((function () { var 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
};
};
GridColumnMoveOptionsView.prototype.k = function () {
_super.prototype.k.call(this);
if (null == this.g || null == this.e) {
return;
}
this.r = this.t();
this.q = this.s();
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.r);
a.append(this.q);
};
GridColumnMoveOptionsView.prototype.ab = function () {
var a = this.n.b5();
var b = this.n.b6();
if (null != this.o) {
this.o.disabled = !a;
}
if (null != this.p) {
this.p.disabled = !b;
}
};
GridColumnMoveOptionsView.prototype.m = function () {
_super.prototype.m.call(this);
var a = this.n;
if (null != this.r) {
this.r.setRawText(a.by);
var 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);
};
GridColumnMoveOptionsView.prototype.z = function (a, b) {
this.n.cg();
};
GridColumnMoveOptionsView.prototype.aa = function (a, b) {
this.n.ci();
};
GridColumnMoveOptionsView.$t = 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;
}(GridColumnOptionsViewBase));
export { GridColumnMoveOptionsView };
/**
* @hidden
*/
var GridColumnMoveOptions = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(GridColumnMoveOptions, _super);
function GridColumnMoveOptions() {
var _this = _super.call(this) || this;
_this.b3 = false;
_this.b7 = "Left";
_this.cb = "Right";
return _this;
}
GridColumnMoveOptions.prototype.f = function () {
return new GridColumnMoveOptionsView();
};
GridColumnMoveOptions.prototype.get_b0 = function () {
return "Move";
};
Object.defineProperty(GridColumnMoveOptions.prototype, "b0", {
get: function () {
return this.get_b0();
},
enumerable: false,
configurable: true
});
GridColumnMoveOptions.prototype.bs = function () {
if (null == this.column) {
return false;
}
var a = this.c;
if (null == a) {
return false;
}
switch (a.columnMovingMode) {
case 0: return true;
case 1: return false;
default: break;
}
return true;
};
GridColumnMoveOptions.prototype.a8 = function (a, b) {
_super.prototype.a8.call(this, a, b);
this.b2.ab();
};
GridColumnMoveOptions.prototype.a9 = function (a, b) {
_super.prototype.a9.call(this, a, b);
this.b3 = true;
};
GridColumnMoveOptions.prototype.a5 = function (a, b) {
_super.prototype.a5.call(this, a, b);
if (this.b3) {
this.b2.ab();
this.b3 = false;
}
};
GridColumnMoveOptions.prototype.a6 = function () {
_super.prototype.a6.call(this);
this.b2.ab();
};
GridColumnMoveOptions.prototype.a7 = function (a, b) {
_super.prototype.a7.call(this, a, b);
var c = this.column;
if (null == c) {
return;
}
switch (b.propertyName) {
case "Pinned":
this.b2.ab();
break;
}
};
GridColumnMoveOptions.prototype.be = function (a, b, c) {
_super.prototype.be.call(this, a, b, c);
switch (a) {
case "MoveLeftCaption":
case "MoveRightCaption":
this.b2.m();
break;
}
};
Object.defineProperty(GridColumnMoveOptions.prototype, "b2", {
get: function () {
return this.e;
},
enumerable: false,
configurable: true
});
Object.defineProperty(GridColumnMoveOptions.prototype, "b8", {
get: function () {
return this.b7;
},
set: function (a) {
if (0 == StringComparer.b.compare(a, this.b7)) {
return;
}
var b = this.b7;
this.b7 = a;
this.bc("MoveLeftCaption", b, this.b7);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GridColumnMoveOptions.prototype, "cc", {
get: function () {
return this.cb;
},
set: function (a) {
if (0 == StringComparer.b.compare(a, this.cb)) {
return;
}
var b = this.cb;
this.cb = a;
this.bc("MoveRightCaption", b, this.cb);
},
enumerable: false,
configurable: true
});
GridColumnMoveOptions.prototype.b4 = function (a) {
var b = this.column;
if (null == b) {
return false;
}
var c = b.grid;
if (null == c) {
return false;
}
var d = c.actualColumns;
var e = d.indexOf(b);
if (e < 0) {
return false;
}
if (a) {
return this.c.canMoveColumnLeft(e);
}
else {
return this.c.canMoveColumnRight(e);
}
};
GridColumnMoveOptions.prototype.cf = function (a) {
var b = this.column;
if (null == b) {
return;
}
var c = this.c;
if (null == c) {
return;
}
if (!this.b4(a)) {
return;
}
var d = c.actualColumns;
var e = d.indexOf(b);
b.m0("Moved");
if (a) {
c.moveColumnLeft(e);
}
else {
c.moveColumnRight(e);
}
};
GridColumnMoveOptions.prototype.b5 = function () {
return this.b4(true);
};
GridColumnMoveOptions.prototype.b6 = function () {
return this.b4(false);
};
GridColumnMoveOptions.prototype.cg = function () {
this.cf(true);
};
GridColumnMoveOptions.prototype.ci = function () {
this.cf(false);
};
GridColumnMoveOptions.prototype.ch = function (a, b) {
this.cg();
};
GridColumnMoveOptions.prototype.cj = function (a, b) {
this.ci();
};
GridColumnMoveOptions.$t = markType(GridColumnMoveOptions, 'GridColumnMoveOptions', GridColumnOptionsSimpleSectionBase.$);
return GridColumnMoveOptions;
}(GridColumnOptionsSimpleSectionBase));
export { GridColumnMoveOptions };