1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var core_1 = require("@angular/core");
|
4 | var forms_1 = require("@angular/forms");
|
5 | var LayoutModuleConfigComponent = (function () {
|
6 | function LayoutModuleConfigComponent(injector) {
|
7 | this.injector = injector;
|
8 | this.formGroup = new forms_1.FormGroup({
|
9 | layoutMode: new forms_1.FormControl("", [forms_1.Validators.required]),
|
10 | showLeftNavBar: new forms_1.FormControl("", [forms_1.Validators.required]),
|
11 | mainSideNavMode: new forms_1.FormControl("", [forms_1.Validators.required]),
|
12 | showMainSidenav: new forms_1.FormControl("", [forms_1.Validators.required]),
|
13 | stickyLeftNavBar: new forms_1.FormControl("", [forms_1.Validators.required]),
|
14 | showSecondSideNav: new forms_1.FormControl("", [forms_1.Validators.required]),
|
15 | secondSideNavMode: new forms_1.FormControl("", [forms_1.Validators.required]),
|
16 | mainSideNavItems: new forms_1.FormArray([])
|
17 | });
|
18 | this.configChanged = new core_1.EventEmitter();
|
19 | this.roleItems = ["Admin", "User"];
|
20 | this.configFormGroup = this.injector.get("configFormGroup");
|
21 | }
|
22 | Object.defineProperty(LayoutModuleConfigComponent.prototype, "configFormGroup", {
|
23 | set: function (configFormGroup) {
|
24 | var _this = this;
|
25 | configFormGroup.controls.mainSideNavItems.controls.forEach(function (control) {
|
26 | debugger;
|
27 | _this.formGroup.controls.mainSideNavItems.push(new forms_1.FormGroup({
|
28 | route: new forms_1.FormControl("", [forms_1.Validators.required]),
|
29 | icon: new forms_1.FormControl("", [forms_1.Validators.required]),
|
30 |
|
31 | roles: new forms_1.FormArray([new forms_1.FormControl("Admin")]),
|
32 | title: new forms_1.FormControl("", [forms_1.Validators.required])
|
33 | }));
|
34 | });
|
35 | debugger;
|
36 | this.formGroup.patchValue(configFormGroup.value);
|
37 | configFormGroup.valueChanges.subscribe(function (data) {
|
38 | _this.formGroup.patchValue(data);
|
39 | });
|
40 | },
|
41 | enumerable: true,
|
42 | configurable: true
|
43 | });
|
44 | LayoutModuleConfigComponent.decorators = [
|
45 | { type: core_1.Component, args: [{
|
46 | template: "<div fxFlexLayout=\"row\" fxLayoutWrap fxLayoutAlign=\"center center\"> <mat-card [fxFlex]=\"30\"> <mat-card-content fxFlexLayout=\"row\"> <div [formGroup]=\"formGroup\"> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"layout mode\" formControlName=\"layoutMode\"> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"show left navbar\" formControlName=\"showLeftNavBar\"> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"main side nav mode\" formControlName=\"mainSideNavMode\"> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"show main side nav\" formControlName=\"showMainSidenav\"> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"sticky left navbar\" formControlName=\"stickyLeftNavBar\"> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"show second side nav\" formControlName=\"showSecondSideNav\"> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"second side nav mode\" formControlName=\"secondSideNavMode\"> </mat-form-field> </div> </mat-card-content> </mat-card> <mat-card *ngFor=\"let item of formGroup.get('mainSideNavItems').controls\" [fxFlex]=\"30\"> <mat-card-content fxFlexLayout=\"row\"> <div [formGroup]=\"item\"> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"route\" formControlName=\"route\"> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"icon\" formControlName=\"icon\"> </mat-form-field> <mat-form-field> <mat-select placeholder=\"roles\" formControlName=\"roles\" multiple> <mat-option *ngFor=\"let role of roleItems\" [value]=\"role\">{{role}}</mat-option> </mat-select> </mat-form-field> <mat-form-field> <input type=\"text\" (change)=\"configChanged.emit(formGroup.value)\" matInput placeholder=\"title\" formControlName=\"title\"> </mat-form-field> </div> </mat-card-content> </mat-card> </div>"
|
47 | },] },
|
48 | ];
|
49 |
|
50 | LayoutModuleConfigComponent.ctorParameters = function () { return [
|
51 | { type: core_1.Injector, },
|
52 | ]; };
|
53 | LayoutModuleConfigComponent.propDecorators = {
|
54 | "configFormGroup": [{ type: core_1.Input },],
|
55 | "configChanged": [{ type: core_1.Output },],
|
56 | };
|
57 | return LayoutModuleConfigComponent;
|
58 | }());
|
59 | exports.LayoutModuleConfigComponent = LayoutModuleConfigComponent;
|
60 |
|
\ | No newline at end of file |