angular2-json-schema-form
Version:
Angular 2 JSON Schema Form builder
58 lines • 3.23 kB
JavaScript
;
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 MaterialButtonComponent = (function () {
function MaterialButtonComponent(jsf) {
this.jsf = jsf;
this.controlDisabled = false;
this.boundControl = false;
}
MaterialButtonComponent.prototype.ngOnInit = function () {
this.options = this.layoutNode.options;
this.jsf.initializeControl(this);
};
MaterialButtonComponent.prototype.updateValue = function (event) {
if (typeof this.options.onClick === 'function') {
this.options.onClick(event);
}
else {
this.jsf.updateValue(this, event.target.value);
}
};
return MaterialButtonComponent;
}());
__decorate([
core_1.Input(),
__metadata("design:type", Number)
], MaterialButtonComponent.prototype, "formID", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Object)
], MaterialButtonComponent.prototype, "layoutNode", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Array)
], MaterialButtonComponent.prototype, "layoutIndex", void 0);
__decorate([
core_1.Input(),
__metadata("design:type", Array)
], MaterialButtonComponent.prototype, "dataIndex", void 0);
MaterialButtonComponent = __decorate([
core_1.Component({
selector: 'material-button-widget',
template: "\n <section [class]=\"options?.htmlClass\">\n <button md-raised-button\n [attr.readonly]=\"options?.readonly ? 'readonly' : null\"\n [attr.aria-describedby]=\"'control' + layoutNode?._id + 'Status'\"\n [class]=\"options?.fieldHtmlClass\"\n [color]=\"options?.color || 'primary'\"\n [disabled]=\"controlDisabled\"\n [id]=\"'control' + layoutNode?._id\"\n [name]=\"controlName\"\n [type]=\"layoutNode?.type\"\n [value]=\"controlValue\"\n (click)=\"updateValue($event)\">\n <md-icon *ngIf=\"options?.icon\" class=\"md-24\">{{options?.icon}}</md-icon>\n <span *ngIf=\"options?.title\" [innerHTML]=\"options?.title\"></span>\n </button>\n </section>",
styles: ["button { margin-top: 4px; }"],
}),
__metadata("design:paramtypes", [json_schema_form_service_1.JsonSchemaFormService])
], MaterialButtonComponent);
exports.MaterialButtonComponent = MaterialButtonComponent;
//# sourceMappingURL=material-button.component.js.map