UNPKG

angular2-json-schema-form

Version:
56 lines 3.37 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 index_1 = require("../../library/utilities/index"); var MaterialSelectComponent = (function () { function MaterialSelectComponent(jsf) { this.jsf = jsf; this.controlDisabled = false; this.boundControl = false; this.selectList = []; } MaterialSelectComponent.prototype.ngOnInit = function () { this.options = this.layoutNode.options; this.selectList = index_1.buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, !!this.options.required); this.jsf.initializeControl(this); }; MaterialSelectComponent.prototype.updateValue = function (event) { this.jsf.updateValue(this, this.controlValue); }; return MaterialSelectComponent; }()); __decorate([ core_1.Input(), __metadata("design:type", Number) ], MaterialSelectComponent.prototype, "formID", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], MaterialSelectComponent.prototype, "layoutNode", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], MaterialSelectComponent.prototype, "layoutIndex", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], MaterialSelectComponent.prototype, "dataIndex", void 0); MaterialSelectComponent = __decorate([ core_1.Component({ selector: 'material-select-widget', template: "\n <section [class]=\"options?.htmlClass\">\n <md-select #inputControl\n [(ngModel)]=\"controlValue\"\n [attr.aria-describedby]=\"'control' + layoutNode?._id + 'Status'\"\n [attr.name]=\"controlName\"\n [attr.readonly]=\"options?.readonly ? 'readonly' : null\"\n [class]=\"options?.fieldHtmlClass\"\n [disabled]=\"controlDisabled\"\n [id]=\"'control' + layoutNode?._id\"\n [placeholder]=\"options?.title\"\n [required]=\"options?.required\"\n (onClose)=\"updateValue($event)\">\n <md-option *ngFor=\"let selectItem of selectList\"\n [value]=\"selectItem.value\"\n [attr.selected]=\"selectItem.value === controlValue\">{{selectItem.name}}</md-option>\n </md-select>\n </section>", styles: ["md-select { margin-top: 18px; }"] }), __metadata("design:paramtypes", [json_schema_form_service_1.JsonSchemaFormService]) ], MaterialSelectComponent); exports.MaterialSelectComponent = MaterialSelectComponent; //# sourceMappingURL=material-select.component.js.map