angular2-json-schema-form
Version:
Angular 2 JSON Schema Form builder
54 lines • 3.76 kB
JavaScript
"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 MaterialInputComponent = (function () {
function MaterialInputComponent(jsf) {
this.jsf = jsf;
this.controlDisabled = false;
this.boundControl = false;
this.autoCompleteList = [];
}
MaterialInputComponent.prototype.ngOnInit = function () {
this.options = this.layoutNode.options;
this.jsf.initializeControl(this);
};
MaterialInputComponent.prototype.updateValue = function (event) {
this.jsf.updateValue(this, event.target.value);
};
return MaterialInputComponent;
}());
__decorate([
core_1.Input(),
__metadata("design:type", Number)
], MaterialInputComponent.prototype, "formID", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Object)
], MaterialInputComponent.prototype, "layoutNode", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Array)
], MaterialInputComponent.prototype, "layoutIndex", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Array)
], MaterialInputComponent.prototype, "dataIndex", void 0);
MaterialInputComponent = __decorate([
core_1.Component({
selector: 'material-input-widget',
template: "\n <section [class]=\"options?.htmlClass\">\n <md-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 [required]=\"options?.required\"\n [class]=\"options?.fieldHtmlClass\"\n [disabled]=\"controlDisabled\"\n [id]=\"'control' + layoutNode?._id\"\n [name]=\"controlName\"\n [placeholder]=\"options?.title\"\n [readonly]=\"options?.readonly ? 'readonly' : null\"\n [style.width]=\"'100%'\"\n [type]=\"layoutNode?.type\"\n [value]=\"controlValue\"\n (input)=\"updateValue($event)\">\n <span *ngIf=\"options?.fieldAddonLeft\"\n md-prefix>{{options?.fieldAddonLeft}}</span>\n <span *ngIf=\"options?.fieldAddonRight\"\n md-suffix>{{options?.fieldAddonRight}}</span>\n <md-hint *ngIf=\"options?.description && !(options?.placeholder && !formControl?.dirty)\"\n align=\"end\">{{options?.description}}</md-hint>\n <md-hint *ngIf=\"!options?.description && options?.placeholder && !formControl?.dirty\"\n align=\"end\">{{options?.placeholder}}</md-hint>\n </md-input>\n </section>",
styles: ["md-input { margin-top: 6px; }"],
}),
__metadata("design:paramtypes", [json_schema_form_service_1.JsonSchemaFormService])
], MaterialInputComponent);
exports.MaterialInputComponent = MaterialInputComponent;
//# sourceMappingURL=material-input.component.js.map