all files / floating-action-button/ floating-action-button.js

98.2% Statements 109/111
97.01% Branches 65/67
100% Functions 23/23
98.1% Lines 103/105
18 statements, 7 functions, 29 branches Ignored     
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151                269×   269× 269×   269× 269×       1081×   269× 269× 269× 269×   276× 276× 145× 145× 141× 141×     276×   280×   362× 362× 362× 362× 61×   362× 72×     355× 355×     269× 269× 269×   155× 155× 155× 155×     86× 86× 86×   11× 11×                                        
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/* istanbul ignore next */ 
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../button/button"], function (require, exports, ej2_base_1, ej2_base_2, button_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var FABHIDDEN = 'e-fab-hidden';
    var FIXEDFAB = 'e-fab-fixed';
    var FABTOP = 'e-fab-top';
    var FABBOTTOM = 'e-fab-bottom';
    var FABRIGHT = 'e-fab-right';
    var FABLEFT = 'e-fab-left';
    var FABMIDDLE = 'e-fab-middle';
    var FABCENTER = 'e-fab-center';
    var FabPosition;
    (function (FabPosition) {
        FabPosition["TopLeft"] = "TopLeft";
        FabPosition["TopCenter"] = "TopCenter";
        FabPosition["TopRight"] = "TopRight";
        FabPosition["MiddleLeft"] = "MiddleLeft";
        FabPosition["MiddleCenter"] = "MiddleCenter";
        FabPosition["MiddleRight"] = "MiddleRight";
        FabPosition["BottomLeft"] = "BottomLeft";
        FabPosition["BottomCenter"] = "BottomCenter";
        FabPosition["BottomRight"] = "BottomRight";
    })(FabPosition = exports.FabPosition || (exports.FabPosition = {}));
    var Fab = (function (_super) {
        __extends(Fab, _super);
        function Fab(options, element) {
            return _super.call(this, options, element) || this;
        }
        Fab.prototype.render = function () {
            _super.prototype.render.call(this);
            this.initializeFab();
        };
        Fab.prototype.preRender = function () {
            _super.prototype.preRender.call(this);
            if (!this.element.id) {
                this.element.id = ej2_base_1.getUniqueID('e-' + this.getModuleName());
            }
        };
        Fab.prototype.getPersistData = function () {
            _super.prototype.getPersistData.call(this);
            return this.addOnPersist([]);
        };
        Fab.prototype.getModuleName = function () {
            return 'fab';
        };
        Fab.prototype.initializeFab = function () {
            this.element.classList.add('e-' + _super.prototype.getModuleName.call(this));
            this.checkTarget();
            this.setPosition();
            this.setVisibility();
        };
        Fab.prototype.checkTarget = function () {
            this.isFixed = true;
            if (this.target) {
                this.targetEle = (typeof this.target === 'string') ? ej2_base_2.select(this.target) : this.target;
                if (this.targetEle) {
                    this.isFixed = false;
                    this.targetEle.appendChild(this.element);
                }
            }
            this.element.classList[this.isFixed ? 'add' : 'remove'](FIXEDFAB);
        };
        Fab.prototype.setVisibility = function () {
            this.element.classList[this.visible ? 'remove' : 'add'](FABHIDDEN);
        };
        Fab.prototype.setPosition = function () {
            this.element.classList.add((['BottomLeft', 'BottomCenter', 'BottomRight'].indexOf(this.position) !== -1) ? FABBOTTOM : FABTOP);
            var isRight = ['TopRight', 'MiddleRight', 'BottomRight'].indexOf(this.position) !== -1;
            this.element.classList.add((!(this.enableRtl || isRight) || (this.enableRtl && isRight)) ? FABLEFT : FABRIGHT);
            if (['MiddleLeft', 'MiddleRight', 'MiddleCenter'].indexOf(this.position) !== -1) {
                this.element.classList.add(FABMIDDLE);
            }
            if (['TopCenter', 'BottomCenter', 'MiddleCenter'].indexOf(this.position) !== -1) {
                this.element.classList.add(FABCENTER);
            }
        };
        Fab.prototype.clearPosition = function () {
            this.element.classList.remove(FABTOP, FABBOTTOM, FABMIDDLE);
            this.element.classList.remove(FABRIGHT, FABLEFT, FABCENTER);
        };
        Fab.prototype.refreshPosition = function () {
        };
        Fab.prototype.destroy = function () {
            _super.prototype.destroy.call(this);
            this.element.classList.remove('e-' + _super.prototype.getModuleName.call(this), FIXEDFAB);
            this.clearPosition();
        };
        Fab.prototype.onPropertyChanged = function (newProp, oldProp) {
            _super.prototype.onPropertyChanged.call(this, newProp, oldProp);
            for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
                var prop = _a[_i];
                switch (prop) {
                    case 'enableRtl':
                    case 'position':
                        this.clearPosition();
                        this.setPosition();
                        break;
                    case 'visible':
                        this.setVisibility();
                        break;
                    case 'target':
                        this.checkTarget();
                        this.setPosition();
                        break;
                    case 'currencyCode':
                        this.refresh();
                        break;
                }
            }
        };
        __decorate([
            ej2_base_1.Property('BottomRight')
        ], Fab.prototype, "position", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], Fab.prototype, "target", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], Fab.prototype, "visible", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], Fab.prototype, "isPrimary", void 0);
        Fab = __decorate([
            ej2_base_1.NotifyPropertyChanges
        ], Fab);
        return Fab;
    }(button_1.Button));
    exports.Fab = Fab;
});