blumjs
Version:
A UI Package for Angular2
59 lines (58 loc) • 2.96 kB
JavaScript
;
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var OptionComponent = (function () {
function OptionComponent(el) {
this.el = el;
this.disabled = false;
this.pinned = false;
this.onSelect = new core_1.EventEmitter();
this.selected = false;
this.hidden = false;
}
OptionComponent.prototype.ngOnInit = function () {
};
OptionComponent.prototype.select = function () {
if (this.disabled)
return;
this.selected = true;
this.onSelect.emit(this);
};
OptionComponent.prototype.getText = function () {
return this.el.nativeElement.innerText;
};
return OptionComponent;
}());
__decorate([
core_1.Input(),
__metadata("design:type", Boolean)
], OptionComponent.prototype, "disabled", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Boolean)
], OptionComponent.prototype, "pinned", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Object)
], OptionComponent.prototype, "value", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", core_1.EventEmitter)
], OptionComponent.prototype, "onSelect", void 0);
OptionComponent = __decorate([
core_1.Component({
selector: 'bl-option',
template: "\n <a (click)=\"select()\" *ngIf=\"!hidden\" [ngClass]=\"disabled ? 'disabled':''\">\n <ng-content></ng-content>\n </a>\n ",
styles: ["\n a {\n color: black;\n padding: 10px 10px;\n text-decoration: none;\n display: block;\n font-size: 0.9em;\n }\n \n a:hover {\n background: rgb(67, 148, 103);\n color: white;\n cursor: pointer;\n }\n \n .disabled {\n color: grey;\n }\n \n .disabled:hover {\n background-color: white;\n color: black;\n cursor: not-allowed;\n }\n "]
}),
__metadata("design:paramtypes", [core_1.ElementRef])
], OptionComponent);
exports.OptionComponent = OptionComponent;