/*
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 * as tslib_1 from "tslib";
import { GridCellBase } from "./GridCellBase";
import { Base, runOn, markType } from "igniteui-webcomponents-core";
import { stringIsNullOrEmpty } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
var ImageCell = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(ImageCell, _super);
    function ImageCell(a) {
        var _this = _super.call(this, a) || this;
        _this.ce = null;
        _this.b8 = 1;
        _this.b9 = 3;
        _this.cg = null;
        _this.ca = false;
        _this.cb = 1;
        _this.cd = null;
        _this.ce = a.createElement("img");
        _this.ce.listen("load", runOn(_this, _this.cj));
        _this.cd = a.createElement("div");
        _this.cd.setRawStyleProperty("background-size", "contain");
        _this.cd.setRawStyleProperty("background-repeat", "no-repeat");
        _this.cd.setRawStyleProperty("background-position", "center");
        _this.cd.setRawStyleProperty("width", "100%");
        _this.cd.setRawStyleProperty("height", "100%");
        _this.z.setRawStyleProperty("text-align", "left");
        _this.z.setRawStyleProperty("vertical-align", "middle");
        _this.z.append(_this.cd);
        return _this;
    }
    Object.defineProperty(ImageCell.prototype, "cf", {
        get: function () {
            return this.ce;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ImageCell.prototype, "cc", {
        get: function () {
            return this.cb;
        },
        set: function (a) {
            this.cb = a;
        },
        enumerable: true,
        configurable: true
    });
    ImageCell.prototype.cj = function (a) {
        this.ca = false;
        if (!stringIsNullOrEmpty(this.cg)) {
            this.cd.setRawStyleProperty("opacity", "1");
            this.cd.setRawStyleProperty("background-image", "url(" + this.cg + ")");
        }
    };
    ImageCell.prototype.ck = function (a, b) {
        if (a == this.cg) {
            return;
        }
        this.ch();
        this.cd.setRawStyleProperty("opacity", "0");
        if (a == null || a.length == 0) {
            this.ci(this.ce);
            return;
        }
        if (Base.equalsStatic(a, this.cg)) {
            return;
        }
        this.co(a, b);
        var img_ = this.ce.getNativeElement();
        if (img_ != null && (img_.complete)) {
            this.ca = false;
            this.ce.setRawStyleProperty("opacity", "1");
            this.cd.setRawStyleProperty("background-image", "url(" + this.cg + ")");
        }
    };
    ImageCell.prototype.ci = function (a) {
        a.setAttribute("src", "");
        this.cd.setRawStyleProperty("background-image", "");
    };
    ImageCell.prototype.cn = function (a) {
        switch (a) {
            case 1:
                this.cd.setRawStyleProperty("background-size", "100% 100%");
                break;
            case 2:
                this.cd.setRawStyleProperty("background-size", "auto");
                break;
            case 0:
                this.cd.setRawStyleProperty("background-size", "contain");
                break;
        }
    };
    ImageCell.prototype.co = function (a, b) {
        this.ca = true;
        this.cg = a;
        this.cf.setAttribute("src", a);
    };
    ImageCell.prototype.ch = function () {
        if (this.ca) {
            this.ci(this.ce);
            this.cg = "";
        }
    };
    ImageCell.prototype.cl = function (a) {
        this.b8 = a;
    };
    ImageCell.prototype.cm = function (a) {
        this.b9 = a;
    };
    ImageCell.prototype.get_r = function () {
        return true;
    };
    ImageCell.prototype.bh = function (a, b, c) {
        _super.prototype.bh.call(this, a, b, c);
        if (a == "Indent" || a == "IsCollapsable") {
            this.cd.setRawStyleProperty("margin-left", this.av + this.ax + this.aw + "px");
        }
    };
    ImageCell.$t = markType(ImageCell, 'ImageCell', GridCellBase.$);
    return ImageCell;
}(GridCellBase));
export { ImageCell };
//# sourceMappingURL=ImageCell.js.map
