UNPKG

angular2-json-schema-form

Version:
50 lines 3.4 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); }; var core_1 = require("@angular/core"); var json_schema_form_service_1 = require("../library/json-schema-form.service"); var InputComponent = (function () { function InputComponent(jsf) { this.jsf = jsf; this.controlDisabled = false; this.boundControl = false; this.autoCompleteList = []; } InputComponent.prototype.ngOnInit = function () { this.options = this.layoutNode.options; this.jsf.initializeControl(this); }; InputComponent.prototype.updateValue = function (event) { this.jsf.updateValue(this, event.target.value); }; return InputComponent; }()); __decorate([ core_1.Input(), __metadata("design:type", Object) ], InputComponent.prototype, "layoutNode", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], InputComponent.prototype, "layoutIndex", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], InputComponent.prototype, "dataIndex", void 0); InputComponent = __decorate([ core_1.Component({ moduleId: module.id, selector: 'input-widget', template: "\n <div\n [class]=\"options?.htmlClass\">\n <label *ngIf=\"options?.title\"\n [attr.for]=\"'control' + layoutNode?._id\"\n [class]=\"options?.labelHtmlClass\"\n [class.sr-only]=\"options?.notitle\"\n [innerHTML]=\"options?.title\"></label>\n <input #inputControl\n [attr.aria-describedby]=\"'control' + layoutNode?._id + 'Status'\"\n [attr.list]=\"'control' + layoutNode?._id + 'Autocomplete'\"\n [attr.maxlength]=\"options?.maxLength\"\n [attr.minlength]=\"options?.minLength\"\n [attr.pattern]=\"options?.pattern\"\n [attr.placeholder]=\"options?.placeholder\"\n [attr.required]=\"options?.required\"\n [class]=\"options?.fieldHtmlClass\"\n [disabled]=\"controlDisabled\"\n [id]=\"'control' + layoutNode?._id\"\n [name]=\"controlName\"\n [readonly]=\"options?.readonly ? 'readonly' : null\"\n [type]=\"layoutNode?.type\"\n [value]=\"controlValue\"\n (input)=\"updateValue($event)\">\n <datalist *ngIf=\"options?.typeahead?.source\"\n [id]=\"'control' + layoutNode?._id + 'Autocomplete'\">\n <option *ngFor=\"let word of options?.typeahead?.source\"\n [value]=\"word\">\n </datalist>\n </div>", }), __metadata("design:paramtypes", [json_schema_form_service_1.JsonSchemaFormService]) ], InputComponent); exports.InputComponent = InputComponent; //# sourceMappingURL=input.component.js.map