UNPKG

innotec-materials

Version:

Innotec Materials is an UI framework who's desgined for all products of Innotec GmbH. Innotec Materials is based on Angular 2 an bootstrap.

143 lines 5.75 kB
"use strict"; 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); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var forms_1 = require("@angular/forms"); var noop = function () { }; var CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return SliderComponent; }), multi: true }; var SliderComponent = (function () { function SliderComponent() { this.checklistCheckpoint = false; this.checklistItemDisplayText = ['?', ':-(', ':-|', ':-)']; this._value = ''; this._onTouchedCallback = noop; this._onChangeCallback = noop; } Object.defineProperty(SliderComponent.prototype, "value", { get: function () { if (!this._value) { return '0'; } return this._value; }, set: function (v) { if (v !== this._value) { this._value = v; this.checkClass(); this._onChangeCallback(v); } }, enumerable: true, configurable: true }); ; SliderComponent.prototype.onTouched = function () { this._onTouchedCallback(); }; SliderComponent.prototype.writeValue = function (value) { this._value = value; this.checkClass(); }; SliderComponent.prototype.registerOnChange = function (fn) { this._onChangeCallback = fn; }; SliderComponent.prototype.registerOnTouched = function (fn) { this._onTouchedCallback = fn; }; SliderComponent.prototype.checkClass = function () { if (this.checklistCheckpoint) { if (typeof this.checklistItemDisplayText === 'string') { this.fieldvaluetext = this.checklistItemDisplayText[this._value]; } else { this.fieldvaluetext = this.checklistItemDisplayText[this._value]; } } else { this.fieldvaluetext = this._value; } if (this.checklistCheckpoint) { switch (this._value) { case 0: case '0': this.sliderclass = 'slider unused'; this.emotionclass = 'icon-special-char-questionmark'; this.fieldvaluetext = undefined; break; case 1: case '1': this.emotionclass = 'icon-emoticon-sad'; this.sliderclass = 'slider malfunc'; this.fieldvaluetext = undefined; break; case 2: case '2': this.emotionclass = 'icon-emoticon-neutral'; this.sliderclass = 'slider warn'; this.fieldvaluetext = undefined; break; case 3: case '3': this.emotionclass = 'icon-emoticon-happy'; this.sliderclass = 'slider ok'; this.fieldvaluetext = undefined; break; default: this.sliderclass = 'slider notused'; this.emotionclass = 'icon-special-char-questionmark'; this.fieldvaluetext = undefined; } } }; SliderComponent.prototype.ngOnInit = function () { this.sliderclass = 'slider'; if (this.checklistCheckpoint) { this.minrange = 0; this.maxrange = 3; this._value = 0; } this.checkClass(); }; __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], SliderComponent.prototype, "checklistCheckpoint", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], SliderComponent.prototype, "checklistItemDisplayText", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], SliderComponent.prototype, "maxrange", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], SliderComponent.prototype, "minrange", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], SliderComponent.prototype, "label", void 0); SliderComponent = __decorate([ core_1.Component({ selector: 'md-slider', template: "\n <div class=\"slider_comp\"><label class=\"filled inputlabel\">{{ label }}</label><label class=\"emotion emotionclass\" [class]=\"emotionclass\"></label><input type=\"range\" [class]=\"sliderclass\" [min]=\"minrange\" [max]=\"maxrange\" [(ngModel)]=\"value\"/><div class=\"slider-value\">{{ fieldvaluetext }}</div></div>\n ", providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR] }) ], SliderComponent); return SliderComponent; }()); exports.SliderComponent = SliderComponent; //# sourceMappingURL=slider.component.js.map