all files / grid/services/ cell-render-factory.js

100% Statements 16/16
100% Branches 8/8
100% Functions 5/5
100% Lines 16/16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27   1195×   17241× 17241× 15956×     231804× 231804×     231803×          
define(["require", "exports", "@syncfusion/ej2-base", "../base/enum"], function (require, exports, ej2_base_1, enum_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CellRendererFactory = (function () {
        function CellRendererFactory() {
            this.cellRenderMap = {};
        }
        CellRendererFactory.prototype.addCellRenderer = function (name, type) {
            name = typeof name === 'string' ? name : ej2_base_1.getEnumValue(enum_1.CellType, name);
            if (ej2_base_1.isNullOrUndefined(this.cellRenderMap["" + name])) {
                this.cellRenderMap["" + name] = type;
            }
        };
        CellRendererFactory.prototype.getCellRenderer = function (name) {
            name = typeof name === 'string' ? name : ej2_base_1.getEnumValue(enum_1.CellType, name);
            if (ej2_base_1.isNullOrUndefined(this.cellRenderMap["" + name])) {
                throw "The cellRenderer " + name + " is not found";
            }
            else {
                return this.cellRenderMap["" + name];
            }
        };
        return CellRendererFactory;
    }());
    exports.CellRendererFactory = CellRendererFactory;
});