UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

120 lines (119 loc) 4.16 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 { Base, runOn, markType } from "igniteui-react-core"; import { stringIsNullOrEmpty } from "igniteui-react-core"; /** * @hidden */ export let ImageCell = /*@__PURE__*/ (() => { class ImageCell extends GridCellBase { get cr() { return this.cq; } get co() { return this.cn; } set co(a) { this.cn = a; } constructor(a) { super(a); this.cq = null; this.ck = 1; this.cl = 3; this.cs = null; this.cm = false; this.cn = 1; this.cp = null; this.cq = a.createElement("img"); this.cq.listen("load", runOn(this, this.cv)); this.cp = a.createElement("div"); this.cp.setRawStyleProperty("background-size", "contain"); this.cp.setRawStyleProperty("background-repeat", "no-repeat"); this.cp.setRawStyleProperty("background-position", "center"); this.cp.setRawStyleProperty("width", "100%"); this.cp.setRawStyleProperty("height", "100%"); this.ah.setRawStyleProperty("text-align", "left"); this.ah.setRawStyleProperty("vertical-align", "middle"); this.ah.append(this.cp); } cv(a) { this.cm = false; if (!stringIsNullOrEmpty(this.cs)) { this.cp.setRawStyleProperty("opacity", "1"); this.cp.setRawStyleProperty("background-image", "url(" + this.cs + ")"); } } cw(a, b) { if (a == this.cs) { return; } this.ct(); this.cp.setRawStyleProperty("opacity", "0"); if (a == null || a.length == 0) { this.cu(this.cq); return; } if (Base.equalsStatic(a, this.cs)) { return; } this.c0(a, b); let img_ = this.cq.getNativeElement(); if (img_ != null && (img_.complete)) { this.cm = false; this.cq.setRawStyleProperty("opacity", "1"); this.cp.setRawStyleProperty("background-image", "url(" + this.cs + ")"); } } cu(a) { a.setAttribute("src", ""); this.cp.setRawStyleProperty("background-image", ""); } cz(a) { switch (a) { case 1: this.cp.setRawStyleProperty("background-size", "100% 100%"); break; case 2: this.cp.setRawStyleProperty("background-size", "auto"); break; case 0: this.cp.setRawStyleProperty("background-size", "contain"); break; } } c0(a, b) { this.cm = true; this.cs = a; this.cr.setAttribute("src", a); } ct() { if (this.cm) { this.cu(this.cq); this.cs = ""; } } cx(a) { this.ck = a; } cy(a) { this.cl = a; } get_z() { return true; } bs(a, b, c) { super.bs(a, b, c); if (a == "Indent" || a == "IsCollapsable") { this.cp.setRawStyleProperty("margin-left", this.a3 + this.a5 + this.a4 + "px"); } } } ImageCell.$t = /*@__PURE__*/ markType(ImageCell, 'ImageCell', GridCellBase.$); return ImageCell; })();