UNPKG

ng5-simple-select

Version:
42 lines 1.97 kB
import { Component, Input, ElementRef } from '@angular/core'; var NgSimpleSelectOptionComponent = (function () { function NgSimpleSelectOptionComponent(element) { this.element = element; this.highlighted = false; } NgSimpleSelectOptionComponent.prototype.ngOnInit = function () { //setting value, if it's not provided if (!this.value) { this.value = this.element.nativeElement.innerText.trim(); } }; NgSimpleSelectOptionComponent.prototype.setParentValue = function () { this.parentChangeFn(this.value); }; NgSimpleSelectOptionComponent.prototype.setParentChangeFn = function (fn) { this.parentChangeFn = fn; }; NgSimpleSelectOptionComponent.prototype.setHighlightedState = function (val) { this.highlighted = val; }; NgSimpleSelectOptionComponent.prototype.getValue = function () { return this.value; }; NgSimpleSelectOptionComponent.decorators = [ { type: Component, args: [{ selector: 'ng-simple-select-option', template: "<div class=\"ng-simple-select-option\" [ngClass]=\"{'ng-simple-select-option--highlighted': highlighted}\" (click)=\"setParentValue()\"> <ng-content></ng-content> </div> ", styles: [".ng-simple-select-option { padding: 1px 5px; cursor: default; } .ng-simple-select-option--highlighted { background-color: gainsboro; } .ng-simple-select-option:hover { background-color: #c3c3c3; } "] },] }, ]; /** @nocollapse */ NgSimpleSelectOptionComponent.ctorParameters = function () { return [ { type: ElementRef, }, ]; }; NgSimpleSelectOptionComponent.propDecorators = { "value": [{ type: Input },], }; return NgSimpleSelectOptionComponent; }()); export { NgSimpleSelectOptionComponent }; //# sourceMappingURL=ng-simple-select-option.component.js.map