all files / modules/ multi-select.js

100% Statements 53/53
94.12% Branches 16/17
100% Functions 13/13
100% Lines 52/52
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 53× 53× 338× 338×   53×       43× 43× 43× 43× 43×   53× 53× 53× 53× 53× 53× 53×   40× 40×     29× 29×     53× 40× 40× 40×     22× 21× 21×     27×   43×   387×        
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) Eif (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-dropdowns", "./base-module"], function (require, exports, ej2_base_1, ej2_dropdowns_1, base_module_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var MultiSelect = (function () {
        function MultiSelect(parent) {
            this.isPopOpen = false;
            this.compObj = undefined;
            this.parent = parent;
            this.parent.multiSelectModule = this;
            this.base = new base_module_1.Base(this.parent, this);
        }
        MultiSelect.prototype.render = function (e) {
            var compModel = __assign({}, this.parent.model);
            this.openEvent = compModel.open;
            this.closeEvent = compModel.close;
            compModel.open = this.openHandler.bind(this);
            compModel.close = this.closeHandler.bind(this);
            this.compObj = new ej2_dropdowns_1.MultiSelect(compModel);
            this.compObj.appendTo(e.target);
        };
        MultiSelect.prototype.openHandler = function (e) {
            this.isPopOpen = true;
            if (this.openEvent) {
                this.compObj.setProperties({ open: this.openEvent }, true);
                this.compObj.trigger('open', e);
            }
        };
        MultiSelect.prototype.closeHandler = function (e) {
            this.isPopOpen = false;
            if (this.closeEvent) {
                this.compObj.setProperties({ close: this.closeEvent }, true);
                this.compObj.trigger('close', e);
            }
        };
        MultiSelect.prototype.focus = function () {
            if (!this.isPopOpen) {
                var evt = document.createEvent('MouseEvent');
                evt.initEvent('mousedown', true, true);
                ej2_base_1.closest(this.compObj.element, '.e-multi-select-wrapper').dispatchEvent(evt);
            }
        };
        MultiSelect.prototype.updateValue = function (e) {
            if (this.compObj && e.type === 'MultiSelect') {
                this.parent.setProperties({ value: this.compObj.value }, true);
                this.parent.extendModelValue(this.compObj.value);
            }
        };
        MultiSelect.prototype.getRenderValue = function () {
            this.parent.printValue = this.compObj.text;
        };
        MultiSelect.prototype.destroy = function () {
            this.base.destroy();
        };
        MultiSelect.prototype.getModuleName = function () {
            return 'multi-select';
        };
        return MultiSelect;
    }());
    exports.MultiSelect = MultiSelect;
});