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.

78 lines 3.1 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 SwitchComponent; }), multi: true }; var SwitchComponent = (function () { function SwitchComponent() { this._value = ''; this._onTouchedCallback = noop; this._onChangeCallback = noop; } Object.defineProperty(SwitchComponent.prototype, "value", { get: function () { if (!this._value) { return false; } return this._value; }, set: function (v) { if (v !== this._value) { this._value = v; this._onChangeCallback(v); } }, enumerable: true, configurable: true }); ; SwitchComponent.prototype.onTouched = function () { this._onTouchedCallback(); }; SwitchComponent.prototype.writeValue = function (value) { this._value = value; }; SwitchComponent.prototype.registerOnChange = function (fn) { this._onChangeCallback = fn; }; SwitchComponent.prototype.registerOnTouched = function (fn) { this._onTouchedCallback = fn; }; SwitchComponent.prototype.ngOnInit = function () { var _this = this; setTimeout(function () { if (!_this.value) { _this.value = false; } }, 0); }; __decorate([ core_1.Input(), __metadata("design:type", String) ], SwitchComponent.prototype, "labeltext", void 0); SwitchComponent = __decorate([ core_1.Component({ selector: 'md-switch', template: "\n <label class=\"switch\"><input class=\"switchbox\" type=\"checkbox\" [(ngModel)]=\"value\"/><div class=\"switchbox-thumb\"></div><div class=\"labeltext\">{{ labeltext }}</div></label>\n ", encapsulation: core_1.ViewEncapsulation.None, providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR] }) ], SwitchComponent); return SwitchComponent; }()); exports.SwitchComponent = SwitchComponent; //# sourceMappingURL=switch.component.js.map