UNPKG

angular2-json-schema-form

Version:
50 lines 2.88 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 SectionComponent = (function () { function SectionComponent(jsf) { this.jsf = jsf; this.expanded = true; } SectionComponent.prototype.ngOnInit = function () { this.options = this.layoutNode.options; this.expanded = !this.options.expandable; }; SectionComponent.prototype.expand = function () { if (this.options.expandable) this.expanded = !this.expanded; }; return SectionComponent; }()); __decorate([ core_1.Input(), __metadata("design:type", Object) ], SectionComponent.prototype, "layoutNode", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], SectionComponent.prototype, "layoutIndex", void 0); __decorate([ core_1.Input(), __metadata("design:type", Array) ], SectionComponent.prototype, "dataIndex", void 0); SectionComponent = __decorate([ core_1.Component({ moduleId: module.id, selector: 'section-widget', template: "\n <div\n [class]=\"options?.htmlClass\"\n [class.expandable]=\"options?.expandable && !expanded\"\n [class.expanded]=\"options?.expandable && expanded\">\n <label *ngIf=\"options?.title\"\n [class]=\"options?.labelHtmlClass\"\n [class.sr-only]=\"options?.notitle\"\n [innerHTML]=\"options?.title\"\n (click)=\"expand()\"></label>\n\n <root-widget *ngIf=\"expanded\"\n [layout]=\"layoutNode.items\"\n [dataIndex]=\"dataIndex\"\n [layoutIndex]=\"layoutIndex\"\n [isOrderable]=\"options?.orderable\"></root-widget>\n\n </div>", styles: ["\n .expandable > label:before { content: '\\25B8'; padding-right: .3em; }\n .expanded > label:before { content: '\\25BE'; padding-right: .2em; }\n "], }), __metadata("design:paramtypes", [json_schema_form_service_1.JsonSchemaFormService]) ], SectionComponent); exports.SectionComponent = SectionComponent; //# sourceMappingURL=section.component.js.map