all files / amd/components/button/ buttonElement.js

98% Statements 49/50
85.37% Branches 35/41
100% Functions 10/10
100% Lines 45/45
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     14×         14× 14× 14× 14×   14× 14× 11×     14×   14×   14× 14× 14×         14× 14× 14× 98×   98×            
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;
    Iif (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) Eif (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;
};
var __metadata = this && this.__metadata || function (k, v) {
    Eif (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
define(["require", "exports", "aurelia-framework", "./../../config"], function (require, exports, aurelia_framework_1, config_1) {
    "use strict";
 
    var ButtonElement = function () {
        function ButtonElement() {
            this.disabled = false;
            this.flat = false;
            this.floating = false;
            this.large = false;
        }
        ButtonElement.prototype.attached = function () {
            var _this = this;
            if (this.flat) {
                this.element.classList.add("btn-flat");
            } else if (this.floating) {
                this.element.classList.add("btn-floating");
            } else {
                this.element.classList.add("btn");
            }
            if (this.large) {
                this.element.classList.add("btn-large");
            }
            if (this.disabled) {
                this.element.classList.add("disabled");
            }
            this.element.classList.add("waves-effect");
            this.waves = this.waves.trim().toLowerCase();
            if (this.waves !== "") {
                if (!config_1.config.allowedWaves.some(function (val) {
                    return val === _this.waves;
                })) {
                    return;
                }
                this.element.classList.add("waves-" + this.waves);
            }
        };
        ButtonElement.prototype.detached = function () {
            var _this = this;
            this.element.classList.remove("btn-flat", "btn-floating", "btn-large", "btn", "disabled", "waves-effect");
            config_1.config.allowedWaves.map(function (val) {
                return "waves-" + val;
            }).forEach(function (val) {
                return _this.element.classList.remove(val);
            });
        };
        __decorate([aurelia_framework_1.bindable(), __metadata('design:type', Object)], ButtonElement.prototype, "disabled", void 0);
        __decorate([aurelia_framework_1.bindable(), __metadata('design:type', Object)], ButtonElement.prototype, "flat", void 0);
        __decorate([aurelia_framework_1.bindable(), __metadata('design:type', Object)], ButtonElement.prototype, "floating", void 0);
        __decorate([aurelia_framework_1.bindable(), __metadata('design:type', Object)], ButtonElement.prototype, "large", void 0);
        __decorate([aurelia_framework_1.bindable({ defaultValue: "" }), __metadata('design:type', String)], ButtonElement.prototype, "waves", void 0);
        ButtonElement = __decorate([aurelia_framework_1.customElement(config_1.config.button), aurelia_framework_1.containerless(), aurelia_framework_1.inlineView("<template><a ref='element'><slot></slot></a></template>"), __metadata('design:paramtypes', [])], ButtonElement);
        return ButtonElement;
    }();
    exports.ButtonElement = ButtonElement;
});
 
//# sourceMappingURL=buttonElement.js.map