igniteui-react-grids
Version:
Ignite UI React grid components.
323 lines (322 loc) • 11 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 { GridCellBase } from "./GridCellBase";
import { GridSortIndicator } from "./GridSortIndicator";
import { GridFilterDialog } from "./GridFilterDialog";
import { ColumnOptionsIconBehavior_$type } from "./ColumnOptionsIconBehavior";
import { ColumnOptionsIconAlignment_$type } from "./ColumnOptionsIconAlignment";
import { enumGetBox, runOn, delegateCombine, markType } from "igniteui-react-core";
/**
* @hidden
*/
var TextHeaderCell = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(TextHeaderCell, _super);
function TextHeaderCell(a) {
var _this = _super.call(this, a) || this;
_this.cv = null;
_this.cr = null;
_this.cp = null;
_this.cl = 0;
_this.ck = 0;
_this.cn = 3;
_this.cx = null;
_this.c0 = -1;
_this.cz = -1;
_this.ct = false;
_this.cw = null;
_this.cu = false;
_this.cv = a.createElement("span");
_this.ah.setRawStyleProperty("text-align", "left");
_this.ah.setRawStyleProperty("vertical-align", "middle");
_this.cv.setRawStyleProperty("display", "inline-block");
_this.cv.setRawStyleProperty("line-height", "normal");
_this.cv.setRawStyleProperty("vertical-align", "middle");
_this.cv.setRawStyleProperty("overflow", "hidden");
_this.cv.setRawStyleProperty("white-space", "nowrap");
_this.cv.setRawStyleProperty("text-overflow", "ellipsis");
_this.ah.append(_this.cv);
var b = 18;
var c = 18;
var d = a.createElement("div");
d.setAttribute("aria-hidden", "true");
d.setRawStyleProperty("display", "none");
d.setRawStyleProperty("vertical-align", "middle");
d.setRawStyleProperty("width", b + "px");
d.setRawStyleProperty("height", c + "px");
_this.cw = d;
var e = a.getSubRenderer(d);
_this.cp = new GridFilterDialog();
_this.cp.bn(e, _this.ah, a);
_this.ah.append(d);
_this.cp.be(b, c);
_this.cp.ak = 24;
var f = _this.cp.ab;
_this.cp.ab = false;
_this.cp.bb();
_this.cp.ab = f;
var g = 18;
var h = 18;
d = a.createElement("div");
d.setAttribute("aria-hidden", "true");
d.setRawStyleProperty("display", "inline-block");
d.setRawStyleProperty("vertical-align", "middle");
d.setRawStyleProperty("width", "0px");
d.setRawStyleProperty("height", h + "px");
d.setRawStyleProperty("margin", "0 0 0 5px");
_this.cx = d;
e = a.getSubRenderer(d);
_this.cr = new GridSortIndicator();
_this.cr.l = false;
_this.cr.ax(e);
_this.ah.append(d);
_this.cr.ar(g, h);
var i = _this.cr;
i.propertyChanged = delegateCombine(i.propertyChanged, runOn(_this, _this.c3));
var j = _this.cp;
j.dialogOpening = delegateCombine(j.dialogOpening, runOn(_this, _this.c4));
var k = _this.cp;
k.filterChanging = delegateCombine(k.filterChanging, runOn(_this, _this.c6));
var l = _this.cp;
l.filterChanged = delegateCombine(l.filterChanged, runOn(_this, _this.c5));
_this.ah.listen("mouseenter", runOn(_this, _this.da));
_this.ah.listen("mouseleave", runOn(_this, _this.c9));
return _this;
}
Object.defineProperty(TextHeaderCell.prototype, "cy", {
get: function () {
return this.cv;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TextHeaderCell.prototype, "cs", {
get: function () {
return this.cr;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TextHeaderCell.prototype, "cq", {
get: function () {
return this.cp;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TextHeaderCell.prototype, "co", {
get: function () {
return this.cn;
},
set: function (a) {
var b = this.cn;
this.cn = a;
this.bs("ColumnOptionsIconBehavior", enumGetBox(ColumnOptionsIconBehavior_$type, b), enumGetBox(ColumnOptionsIconBehavior_$type, this.cn));
},
enumerable: false,
configurable: true
});
Object.defineProperty(TextHeaderCell.prototype, "cm", {
get: function () {
return this.cl;
},
set: function (a) {
var b = this.cl;
this.cl = a;
this.bs("ColumnOptionsIconAlignment", enumGetBox(ColumnOptionsIconAlignment_$type, b), enumGetBox(ColumnOptionsIconAlignment_$type, this.cl));
},
enumerable: false,
configurable: true
});
TextHeaderCell.prototype.aa = function (a) {
return true;
};
TextHeaderCell.prototype.b9 = function (a, b) {
_super.prototype.b9.call(this, a, b);
a -= 21;
if (this.cu) {
a -= 15;
}
var c = Math.max(0, a - b);
if (c != this.c0) {
this.c0 = c;
this.cv.setRawStyleProperty("max-width", c.toString() + "px");
}
};
TextHeaderCell.prototype.b3 = function (a, b) {
_super.prototype.b3.call(this, a, b);
var c = Math.max(0, a - b);
if (this.cz != c) {
this.cz = c;
this.cv.setRawStyleProperty("max-height", c.toString() + "px");
}
};
TextHeaderCell.prototype.ca = function (a, b, c, d) {
this.cp.bd();
};
TextHeaderCell.prototype.c3 = function (a, b) {
switch (b.propertyName) {
case "CurrentOpacity":
if (this.cs.r > 0) {
this.cx.setRawStyleProperty("width", "18px");
if (this.ck == 2) {
this.cx.setRawStyleProperty("margin", "0 5px 0 0");
}
else {
this.cx.setRawStyleProperty("margin", "0 0 0 5px");
}
}
else {
this.cx.setRawStyleProperty("width", "0px");
this.cx.setRawStyleProperty("margin", "0");
}
break;
}
};
TextHeaderCell.prototype.da = function (a) {
if (this.b.isGridDragging) {
return;
}
this.cp.ba();
switch (this.co) {
case 2:
case 3:
this.cp.br();
break;
}
};
TextHeaderCell.prototype.c9 = function (a) {
switch (this.co) {
case 2:
case 3:
this.cp.bb();
break;
}
};
TextHeaderCell.prototype.c5 = function (a, b) {
this.b.columnFilterChanged(b.a);
};
TextHeaderCell.prototype.c6 = function (a, b) {
this.b.columnFilterChanging(b.a);
};
TextHeaderCell.prototype.c4 = function (a, b) {
if (this.b != null) {
b.a = this.f.getColumn();
this.b.cancelEditMode(false);
}
};
TextHeaderCell.prototype.bq = function (a, b, c) {
_super.prototype.bq.call(this, a, b, c);
this.ck = c;
this.cp.k = c;
if (c == 2) {
this.ah.removeChild(this.cx);
this.ah.removeChild(this.cw);
this.cv.before(this.cw);
this.cw.before(this.cx);
if (this.cm == 1) {
this.cw.setRawStyleProperty("margin", "0 5px 0 0");
this.cp.l = this.ck;
}
else {
this.cw.setRawStyleProperty("margin", "0");
this.cp.l = 0;
}
}
else {
this.ah.removeChild(this.cx);
this.ah.removeChild(this.cv);
this.cw.before(this.cv);
this.cw.before(this.cx);
if (this.cm == 1) {
this.cw.setRawStyleProperty("margin", "0 0 0 5px");
this.cp.l = this.ck;
}
else {
this.cw.setRawStyleProperty("margin", "0");
this.cp.l = 2;
}
}
};
TextHeaderCell.prototype.b7 = function (a, b, c, d) {
_super.prototype.b7.call(this, a, b, c, d);
this.cp.an = a;
this.cp.ao = c;
};
TextHeaderCell.prototype.c8 = function () {
if (this.cm == 2 || this.cm == 0) {
if (this.ck == 2) {
this.cp.l = 0;
}
else {
this.cp.l = 2;
}
}
else {
this.cp.l = this.ck;
if (this.ck == 2) {
this.cw.setRawStyleProperty("margin", "0 5px 0 0");
}
else {
this.cw.setRawStyleProperty("margin", "0 0 0 5px");
}
}
};
TextHeaderCell.prototype.c7 = function () {
switch (this.co) {
case 1:
this.cp.ab = false;
this.cp.br();
break;
case 2:
this.cp.ab = false;
break;
case 3:
this.cp.ab = true;
break;
}
};
TextHeaderCell.prototype.bs = function (a, b, c) {
_super.prototype.bs.call(this, a, b, c);
switch (a) {
case "ColumnOptionsIconAlignment":
this.c8();
break;
case "ColumnOptionsIconBehavior":
this.c7();
break;
}
};
TextHeaderCell.prototype.onContactStarted = function (e_, a) {
if (e_.button == 2) {
return;
}
var b = this.cp.ad(e_);
if (b) {
this.ct = true;
return;
}
_super.prototype.onContactStarted.call(this, e_, a);
};
TextHeaderCell.prototype.onContactCompleted = function (e_, a) {
if (!this.ct) {
_super.prototype.onContactCompleted.call(this, e_, a);
}
this.ct = false;
};
TextHeaderCell.prototype.detach = function () {
_super.prototype.detach.call(this);
if (this.cp != null) {
}
};
TextHeaderCell.prototype.get_x = function () {
return true;
};
TextHeaderCell.$t = markType(TextHeaderCell, 'TextHeaderCell', GridCellBase.$);
return TextHeaderCell;
}(GridCellBase));
export { TextHeaderCell };