UNPKG

angular2-json-schema-form

Version:
60 lines 3.78 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 MaterialRadiosComponent = (function () { function MaterialRadiosComponent(jsf) { this.jsf = jsf; this.controlDisabled = false; this.boundControl = false; this.layoutOrientation = 'vertical'; this.radiosList = []; } MaterialRadiosComponent.prototype.ngOnInit = function () { this.options = this.layoutNode.options; if (this.layoutNode.type === 'radios-inline' || this.layoutNode.type === 'radiobuttons') { this.layoutOrientation = 'horizontal'; } this.radiosList = index_1.buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, true); this.jsf.initializeControl(this); }; MaterialRadiosComponent.prototype.updateValue = function (value) { this.jsf.updateValue(this, value); }; return MaterialRadiosComponent; }()); __decorate([ core_1.Input(), __metadata("design:type", Number) ], MaterialRadiosComponent.prototype, "formID", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], MaterialRadiosComponent.prototype, "layoutNode", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], MaterialRadiosComponent.prototype, "layoutIndex", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], MaterialRadiosComponent.prototype, "dataIndex", void 0); MaterialRadiosComponent = __decorate([ core_1.Component({ selector: 'material-radios-widget', template: "\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 <md-radio-group\n [attr.aria-describedby]=\"'control' + layoutNode?._id + 'Status'\"\n [attr.readonly]=\"options?.readonly ? 'readonly' : null\"\n [attr.required]=\"options?.required\"\n [class]=\"options?.fieldHtmlClass\"\n [disabled]=\"controlDisabled\"\n [name]=\"controlName\"\n [value]=\"controlValue\">\n <div *ngFor=\"let radioItem of radiosList\">\n <md-radio-button\n [id]=\"'control' + layoutNode?._id + '/' + radioItem?.value\"\n [value]=\"radioItem?.value\"\n (click)=\"updateValue(radioItem?.value)\">\n <span [innerHTML]=\"radioItem?.name\"></span>\n </md-radio-button>\n <span *ngIf=\"layoutOrientation === 'horizontal'\">&nbsp;</span>\n <br *ngIf=\"layoutOrientation === 'vertical'\" />\n </div>\n </md-radio-group>", }), __metadata("design:paramtypes", [json_schema_form_service_1.JsonSchemaFormService]) ], MaterialRadiosComponent); exports.MaterialRadiosComponent = MaterialRadiosComponent; //# sourceMappingURL=material-radios.component.js.map