UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

301 lines (300 loc) 10.3 kB
/* 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 { 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 */ export let TextHeaderCell = /*@__PURE__*/ (() => { class TextHeaderCell extends GridCellBase { get cy() { return this.cv; } get cs() { return this.cr; } get cq() { return this.cp; } get co() { return this.cn; } set co(a) { let b = this.cn; this.cn = a; this.bs("ColumnOptionsIconBehavior", enumGetBox(ColumnOptionsIconBehavior_$type, b), enumGetBox(ColumnOptionsIconBehavior_$type, this.cn)); } get cm() { return this.cl; } set cm(a) { let b = this.cl; this.cl = a; this.bs("ColumnOptionsIconAlignment", enumGetBox(ColumnOptionsIconAlignment_$type, b), enumGetBox(ColumnOptionsIconAlignment_$type, this.cl)); } aa(a) { return true; } b9(a, b) { super.b9(a, b); a -= 21; if (this.cu) { a -= 15; } let c = Math.max(0, a - b); if (c != this.c0) { this.c0 = c; this.cv.setRawStyleProperty("max-width", c.toString() + "px"); } } b3(a, b) { super.b3(a, b); let c = Math.max(0, a - b); if (this.cz != c) { this.cz = c; this.cv.setRawStyleProperty("max-height", c.toString() + "px"); } } ca(a, b, c, d) { this.cp.bd(); } constructor(a) { super(a); 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); let b = 18; let c = 18; let 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; let 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; let f = this.cp.ab; this.cp.ab = false; this.cp.bb(); this.cp.ab = f; let g = 18; let 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); let i = this.cr; i.propertyChanged = delegateCombine(i.propertyChanged, runOn(this, this.c3)); let j = this.cp; j.dialogOpening = delegateCombine(j.dialogOpening, runOn(this, this.c4)); let k = this.cp; k.filterChanging = delegateCombine(k.filterChanging, runOn(this, this.c6)); let 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)); } c3(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; } } da(a) { if (this.b.isGridDragging) { return; } this.cp.ba(); switch (this.co) { case 2: case 3: this.cp.br(); break; } } c9(a) { switch (this.co) { case 2: case 3: this.cp.bb(); break; } } c5(a, b) { this.b.columnFilterChanged(b.a); } c6(a, b) { this.b.columnFilterChanging(b.a); } c4(a, b) { if (this.b != null) { b.a = this.f.getColumn(); this.b.cancelEditMode(false); } } bq(a, b, c) { super.bq(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; } } } b7(a, b, c, d) { super.b7(a, b, c, d); this.cp.an = a; this.cp.ao = c; } c8() { 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"); } } } c7() { 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; } } bs(a, b, c) { super.bs(a, b, c); switch (a) { case "ColumnOptionsIconAlignment": this.c8(); break; case "ColumnOptionsIconBehavior": this.c7(); break; } } onContactStarted(e_, a) { if (e_.button == 2) { return; } let b = this.cp.ad(e_); if (b) { this.ct = true; return; } super.onContactStarted(e_, a); } onContactCompleted(e_, a) { if (!this.ct) { super.onContactCompleted(e_, a); } this.ct = false; } detach() { super.detach(); if (this.cp != null) { } } get_x() { return true; } } TextHeaderCell.$t = /*@__PURE__*/ markType(TextHeaderCell, 'TextHeaderCell', GridCellBase.$); return TextHeaderCell; })();