UNPKG

angular2-schema-form

Version:

Angular2 Schema Form (DISCLAIMER: it is not related to angular-schema-form)

37 lines (36 loc) 2.35 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { Component } from '@angular/core'; import { ControlWidget } from '../../widget'; var StringWidget = (function (_super) { __extends(StringWidget, _super); function StringWidget() { return _super !== null && _super.apply(this, arguments) || this; } StringWidget.prototype.getInputType = function () { if (!this.schema.widget.id || this.schema.widget.id === 'string') { return 'text'; } else { return this.schema.widget.id; } }; return StringWidget; }(ControlWidget)); export { StringWidget }; StringWidget.decorators = [ { type: Component, args: [{ selector: 'sf-string-widget', template: "<input *ngIf=\"this.getInputType()==='hidden'; else notHiddenFieldBlock\"\n [attr.name]=\"name\" type=\"hidden\" [formControl]=\"control\">\n<ng-template #notHiddenFieldBlock>\n<div class=\"widget form-group\">\n <label [attr.for]=\"id\" class=\"horizontal control-label\">\n \t{{ schema.title }}\n </label>\n <span *ngIf=\"schema.description\" class=\"formHelp\">{{schema.description}}</span>\n <input [name]=\"name\" [attr.readonly]=\"(schema.widget.id!=='color') && schema.readOnly?true:null\"\n class=\"text-widget.id textline-widget form-control\" [attr.type]=\"this.getInputType()\"\n [attr.id]=\"id\" [formControl]=\"control\" [attr.placeholder]=\"schema.placeholder\"\n [attr.maxLength]=\"schema.maxLength || null\"\n [attr.minLength]=\"schema.minLength || null\"\n [attr.disabled]=\"(schema.widget.id=='color' && schema.readOnly)?true:null\">\n <input *ngIf=\"(schema.widget.id==='color' && schema.readOnly)\" [attr.name]=\"name\" type=\"hidden\" [formControl]=\"control\">\n</div>\n</ng-template>" },] }, ]; /** @nocollapse */ StringWidget.ctorParameters = function () { return []; };