all files / actions/ tooltip.js

100% Statements 34/34
100% Branches 4/4
100% Functions 8/8
100% Lines 34/34
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                                                
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-popups", "../base/css-constant"], function (require, exports, ej2_base_1, ej2_popups_1, cls) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var KanbanTooltip = (function () {
        function KanbanTooltip(parent) {
            this.parent = parent;
            this.renderTooltip();
        }
        KanbanTooltip.prototype.renderTooltip = function () {
            this.tooltipObj = new ej2_popups_1.Tooltip({
                cssClass: this.parent.cssClass + ' ' + cls.TOOLTIP_CLASS,
                enableRtl: this.parent.enableRtl,
                mouseTrail: !this.parent.isAdaptive,
                offsetY: 5,
                position: 'BottomCenter',
                showTipPointer: true,
                target: '.' + cls.TOOLTIP_TEXT_CLASS,
                beforeRender: this.onBeforeRender.bind(this),
                beforeClose: this.onBeforeClose.bind(this)
            });
            this.tooltipObj.appendTo(this.parent.element);
            this.tooltipObj.isStringTemplate = true;
        };
        KanbanTooltip.prototype.onBeforeRender = function (args) {
            if (this.parent.dragAndDropModule.isDragging) {
                args.cancel = true;
                return;
            }
            var tooltipContent;
            if (this.parent.tooltipTemplate) {
                tooltipContent = ej2_base_1.createElement('div');
                var target = ej2_base_1.closest(args.target, '.' + cls.CARD_CLASS);
                var data = this.parent.getCardDetails(target);
                var templateId = this.parent.element.id + '_tooltipTemplate';
                var tooltipTemplate = this.parent.templateParser(this.parent.tooltipTemplate)(data, this.parent, 'tooltipTemplate', templateId, false);
                ej2_base_1.append(tooltipTemplate, tooltipContent);
                this.parent.renderTemplates();
            }
            else {
                tooltipContent = ej2_base_1.initializeCSPTemplate(function () {
                    return "<div class=\"e-card-header-caption\">" + args.target.innerText + "</div>";
                });
            }
            this.tooltipObj.setProperties({ content: tooltipContent }, true);
        };
        KanbanTooltip.prototype.onBeforeClose = function () {
            this.parent.resetTemplates(['tooltipTemplate']);
        };
        KanbanTooltip.prototype.destroy = function () {
            this.tooltipObj.destroy();
            ej2_base_1.addClass([this.parent.element], 'e-control');
            this.tooltipObj = null;
        };
        return KanbanTooltip;
    }());
    exports.KanbanTooltip = KanbanTooltip;
});