UNPKG

104 kBJavaScriptView Raw
1import { stringTemplate } from '@soushians/shared';
2import { getFormModuleConfig } from '@soushians/config';
3import { BehaviorSubject as BehaviorSubject$1 } from 'rxjs/BehaviorSubject';
4import { BehaviorSubject, Subject } from 'rxjs';
5import { SelectionModel } from '@angular/cdk/collections';
6import { CommonModule } from '@angular/common';
7import { HttpClient, HttpClientModule } from '@angular/common/http';
8import { FlexLayoutModule } from '@angular/flex-layout';
9import { MatTableDataSource, MatExpansionModule, MatSnackBarModule, MatIconModule, MatButtonModule, MatCardModule, MatSelectModule, MatInputModule, MatFormFieldModule, MatTabsModule, MatRadioModule, MatSlideToggleModule, MatDividerModule, MatCheckboxModule, MatTableModule, MatDatepickerModule } from '@angular/material';
10import { FormGroup, FormControl, Validators, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
11import 'rxjs/Observable';
12import { Store, StoreModule } from '@ngrx/store';
13import { __decorate, __metadata, __extends, __assign } from 'tslib';
14import 'rxjs/add/operator/map';
15import 'rxjs/add/operator/mergeMap';
16import 'rxjs/add/operator/switchMap';
17import { InjectionToken, Inject, Injectable, Component, Input, Output, EventEmitter, NgModule, ViewContainerRef, ComponentFactoryResolver, Compiler, Directive, defineInjectable, inject } from '@angular/core';
18import { ActivatedRoute, Router, RouterModule } from '@angular/router';
19import { Actions, Effect, EffectsModule } from '@ngrx/effects';
20import { of } from 'rxjs/observable/of';
21import { filter, map, take, switchMap, takeUntil, catchError } from 'rxjs/operators';
22
23/**
24 * @fileoverview added by tsickle
25 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
26 */
27var AddFormApiModel;
28(function (AddFormApiModel) {
29 var Request = /** @class */ (function () {
30 function Request(initValue) {
31 if (initValue === void 0) { initValue = /** @type {?} */ ({}); }
32 var _this = this;
33 Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
34 }
35 /**
36 * @return {?}
37 */
38 Request.prototype.getRequestBody = /**
39 * @return {?}
40 */
41 function () {
42 return {
43 name: this.name,
44 form: this.form,
45 events: this.events
46 };
47 };
48 Object.defineProperty(Request, "formGroup", {
49 get: /**
50 * @return {?}
51 */
52 function () {
53 return new FormGroup({
54 _id: new FormControl("", [Validators.required]),
55 name: new FormControl("", [Validators.required]),
56 title: new FormControl("", [Validators.required]),
57 form: new FormControl({}),
58 events: new FormGroup({
59 accept: new FormGroup({
60 show: new FormControl(false),
61 text: new FormControl("ثبت")
62 }),
63 cancel: new FormGroup({
64 show: new FormControl(false),
65 text: new FormControl("انصراف")
66 })
67 })
68 });
69 },
70 enumerable: true,
71 configurable: true
72 });
73 return Request;
74 }());
75 AddFormApiModel.Request = Request;
76 var Response = /** @class */ (function () {
77 function Response() {
78 }
79 return Response;
80 }());
81 AddFormApiModel.Response = Response;
82})(AddFormApiModel || (AddFormApiModel = {}));
83
84/**
85 * @fileoverview added by tsickle
86 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
87 */
88var EditFormApiModel;
89(function (EditFormApiModel) {
90 var Request = /** @class */ (function () {
91 function Request(initValue) {
92 if (initValue === void 0) { initValue = /** @type {?} */ ({}); }
93 var _this = this;
94 Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
95 }
96 /**
97 * @return {?}
98 */
99 Request.prototype.getRequestBody = /**
100 * @return {?}
101 */
102 function () {
103 return {
104 _id: this._id,
105 name: this.name,
106 form: this.form,
107 events: this.events
108 };
109 };
110 Object.defineProperty(Request, "formGroup", {
111 get: /**
112 * @return {?}
113 */
114 function () {
115 return new FormGroup({
116 _id: new FormControl("", [Validators.required]),
117 name: new FormControl("", [Validators.required]),
118 form: new FormControl({}),
119 events: new FormGroup({
120 accept: new FormGroup({
121 show: new FormControl(false),
122 text: new FormControl("ثبت")
123 }),
124 cancel: new FormGroup({
125 show: new FormControl(false),
126 text: new FormControl("انصراف")
127 })
128 })
129 });
130 },
131 enumerable: true,
132 configurable: true
133 });
134 return Request;
135 }());
136 EditFormApiModel.Request = Request;
137 var Response = /** @class */ (function () {
138 function Response() {
139 }
140 return Response;
141 }());
142 EditFormApiModel.Response = Response;
143})(EditFormApiModel || (EditFormApiModel = {}));
144
145/**
146 * @fileoverview added by tsickle
147 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
148 */
149var FormListApiModel;
150(function (FormListApiModel) {
151 var Request = /** @class */ (function () {
152 function Request(initValue) {
153 if (initValue === void 0) { initValue = /** @type {?} */ ({}); }
154 var _this = this;
155 Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
156 }
157 /**
158 * @return {?}
159 */
160 Request.prototype.getRequestBody = /**
161 * @return {?}
162 */
163 function () {
164 return {
165 Name: this.Name,
166 Controls: this.Controls
167 };
168 };
169 Object.defineProperty(Request, "formGroup", {
170 get: /**
171 * @return {?}
172 */
173 function () {
174 return new FormGroup({
175 Name: new FormControl("", [Validators.required]),
176 Controls: new FormGroup({})
177 });
178 },
179 enumerable: true,
180 configurable: true
181 });
182 return Request;
183 }());
184 FormListApiModel.Request = Request;
185 var Response = /** @class */ (function () {
186 function Response() {
187 }
188 return Response;
189 }());
190 FormListApiModel.Response = Response;
191})(FormListApiModel || (FormListApiModel = {}));
192
193/**
194 * @fileoverview added by tsickle
195 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
196 */
197var Validator = /** @class */ (function () {
198 function Validator() {
199 this.required = {
200 active: false,
201 message: "این فیلد الزامی است"
202 };
203 this.minlength = {
204 active: false,
205 message: "حداقل تعداد کارکترها",
206 value: 5
207 };
208 this.email = {
209 active: false,
210 message: "لطفا ایمیل صحیح وارد نمایید"
211 };
212 }
213 return Validator;
214}());
215
216/**
217 * @fileoverview added by tsickle
218 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
219 */
220var FieldConfig = /** @class */ (function () {
221 function FieldConfig(type) {
222 this.type = type;
223 if (type != "control")
224 this.fields = [];
225 this.width = 3;
226 this.validator = new Validator();
227 }
228 return FieldConfig;
229}());
230
231/**
232 * @fileoverview added by tsickle
233 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
234 */
235var FormSchemaModel = /** @class */ (function () {
236 function FormSchemaModel() {
237 this.events = {
238 accept: {
239 show: false,
240 text: "ثبت"
241 },
242 cancel: {
243 show: false,
244 text: "انصراف"
245 }
246 };
247 this.form = new FieldConfig("group");
248 }
249 /**
250 * @return {?}
251 */
252 FormSchemaModel.prototype.init = /**
253 * @return {?}
254 */
255 function () {
256 this._id = (Math.random() * 10).toString();
257 };
258 return FormSchemaModel;
259}());
260
261/**
262 * @fileoverview added by tsickle
263 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
264 */
265
266/**
267 * @fileoverview added by tsickle
268 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
269 */
270/** @type {?} */
271var MODULE_DEFAULT_CONFIG = {
272 env: {
273 production: false,
274 frontend_server: "frontend/server/did/not/set",
275 server: "server/did/not/set"
276 },
277 endpoints: {
278 addForm: "",
279 editForm: "",
280 getForm: "",
281 getList: "",
282 deleteForm: "",
283 captchaUrl: ""
284 },
285};
286/** @type {?} */
287var MODULE_CONFIG_TOKEN = new InjectionToken("FormModuleConfig");
288
289/**
290 * @fileoverview added by tsickle
291 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
292 */
293var FormConfigurationService = /** @class */ (function () {
294 function FormConfigurationService(configFile, store) {
295 var _this = this;
296 this.store = store;
297 this.config$ = new BehaviorSubject(MODULE_DEFAULT_CONFIG);
298 this._config = Object.assign({}, MODULE_DEFAULT_CONFIG, configFile);
299 this.config$.next(this._config);
300 this.store.select(getFormModuleConfig).subscribe(function (userConfig) {
301 if (!userConfig)
302 return;
303 _this._config = Object.assign({}, _this._config, userConfig.Config);
304 _this.config$.next(_this._config);
305 });
306 }
307 Object.defineProperty(FormConfigurationService.prototype, "config", {
308 get: /**
309 * @return {?}
310 */
311 function () {
312 return this._config;
313 },
314 enumerable: true,
315 configurable: true
316 });
317 FormConfigurationService.decorators = [
318 { type: Injectable, args: [{
319 providedIn: "root"
320 },] }
321 ];
322 /** @nocollapse */
323 FormConfigurationService.ctorParameters = function () { return [
324 { type: undefined, decorators: [{ type: Inject, args: [MODULE_CONFIG_TOKEN,] }] },
325 { type: Store }
326 ]; };
327 /** @nocollapse */ FormConfigurationService.ngInjectableDef = defineInjectable({ factory: function FormConfigurationService_Factory() { return new FormConfigurationService(inject(MODULE_CONFIG_TOKEN), inject(Store)); }, token: FormConfigurationService, providedIn: "root" });
328 return FormConfigurationService;
329}());
330
331/**
332 * @fileoverview added by tsickle
333 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
334 */
335var FormService = /** @class */ (function () {
336 function FormService(http, store, configurationService) {
337 this.http = http;
338 this.store = store;
339 this.configurationService = configurationService;
340 }
341 /**
342 * @param {?} data
343 * @return {?}
344 */
345 FormService.prototype.add = /**
346 * @param {?} data
347 * @return {?}
348 */
349 function (data) {
350 var _this = this;
351 /** @type {?} */
352 var model = new AddFormApiModel.Request(data);
353 return this.configurationService.config$
354 .filter(function (config) { return config.endpoints.addForm != ""; })
355 .take(1)
356 .switchMap(function (config) {
357 return _this.http.post(config.env.frontend_server + config.endpoints.addForm, model.getRequestBody());
358 })
359 .map(function (response) { return response.Result; });
360 };
361 /**
362 * @param {?} _id
363 * @return {?}
364 */
365 FormService.prototype.get = /**
366 * @param {?} _id
367 * @return {?}
368 */
369 function (_id) {
370 var _this = this;
371 return this.configurationService.config$
372 .filter(function (config) { return config.endpoints.getForm != ""; })
373 .take(1)
374 .switchMap(function (config) {
375 return _this.http.get(stringTemplate(config.env.frontend_server + config.endpoints.getForm, { _id: _id }));
376 })
377 .map(function (response) { return response.Result; });
378 };
379 /**
380 * @return {?}
381 */
382 FormService.prototype.getList = /**
383 * @return {?}
384 */
385 function () {
386 var _this = this;
387 return this.configurationService.config$
388 .filter(function (config) { return config.endpoints.getList != ""; })
389 .switchMap(function (config) { return _this.http.get(config.env.frontend_server + config.endpoints.getList); })
390 .map(function (response) { return response.Result; });
391 };
392 /**
393 * @param {?} data
394 * @return {?}
395 */
396 FormService.prototype.update = /**
397 * @param {?} data
398 * @return {?}
399 */
400 function (data) {
401 var _this = this;
402 /** @type {?} */
403 var model = new EditFormApiModel.Request(data);
404 return this.configurationService.config$
405 .filter(function (config) { return config.endpoints.editForm != ""; })
406 .take(1)
407 .switchMap(function (config) {
408 return _this.http.put(config.env.frontend_server + config.endpoints.editForm, model.getRequestBody());
409 })
410 .map(function (response) { return response.Result; });
411 };
412 /**
413 * @param {?} _id
414 * @return {?}
415 */
416 FormService.prototype.delete = /**
417 * @param {?} _id
418 * @return {?}
419 */
420 function (_id) {
421 var _this = this;
422 return this.configurationService.config$
423 .filter(function (config) { return config.endpoints.deleteForm != ""; })
424 .switchMap(function (config) { return _this.http.get(config.env.frontend_server + config.endpoints.deleteForm); });
425 };
426 /**
427 * @param {?} _id
428 * @return {?}
429 */
430 FormService.prototype.selectFormById = /**
431 * @param {?} _id
432 * @return {?}
433 */
434 function (_id) {
435 /** @type {?} */
436 var subject = new BehaviorSubject$1(undefined);
437 this.store
438 .select(function (state) { return state.form.list.data; })
439 .pipe(filter(function (forms) { return forms != null; }), map(function (forms) { return forms.find(function (form) { return form._id == _id; }); }))
440 .subscribe(function (formSchemaModel) { return subject.next(formSchemaModel); });
441 return subject.asObservable();
442 };
443 FormService.decorators = [
444 { type: Injectable, args: [{
445 providedIn: "root"
446 },] }
447 ];
448 /** @nocollapse */
449 FormService.ctorParameters = function () { return [
450 { type: HttpClient },
451 { type: Store },
452 { type: FormConfigurationService }
453 ]; };
454 /** @nocollapse */ FormService.ngInjectableDef = defineInjectable({ factory: function FormService_Factory() { return new FormService(inject(HttpClient), inject(Store), inject(FormConfigurationService)); }, token: FormService, providedIn: "root" });
455 return FormService;
456}());
457
458/**
459 * @fileoverview added by tsickle
460 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
461 */
462var SelectComponent = /** @class */ (function () {
463 function SelectComponent() {
464 }
465 SelectComponent.decorators = [
466 { type: Component, args: [{
467 selector: "ngs-form-control-select",
468 template: "<div [formGroup]=\"group\">\r\n<mat-form-field>\r\n <mat-select [formControlName]=\"config.name\" [placeholder]=\"config.title\">\r\n <mat-option *ngFor=\"let option of config.options\" [value]=\"option.value\">{{option.key}}</mat-option>\r\n </mat-select>\r\n</mat-form-field>\r\n</div>",
469 styles: [":host{display:block}.mat-form-field{width:100%}"]
470 }] }
471 ];
472 /** @nocollapse */
473 SelectComponent.ctorParameters = function () { return []; };
474 return SelectComponent;
475}());
476
477/**
478 * @fileoverview added by tsickle
479 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
480 */
481
482/**
483 * @fileoverview added by tsickle
484 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
485 */
486var CheckboxComponent = /** @class */ (function () {
487 function CheckboxComponent() {
488 }
489 CheckboxComponent.decorators = [
490 { type: Component, args: [{
491 selector: "ngs-form-control-checkbox",
492 template: "<div [formGroup]=\"group\">\r\n <mat-checkbox [formControlName]=\"config.name\">\r\n {{config.title}}\r\n </mat-checkbox>\r\n</div>",
493 styles: [":host{display:block}.mat-form-field{width:100%}"]
494 }] }
495 ];
496 /** @nocollapse */
497 CheckboxComponent.ctorParameters = function () { return []; };
498 return CheckboxComponent;
499}());
500
501/**
502 * @fileoverview added by tsickle
503 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
504 */
505
506/**
507 * @fileoverview added by tsickle
508 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
509 */
510var EmailComponent = /** @class */ (function () {
511 function EmailComponent() {
512 }
513 /**
514 * @return {?}
515 */
516 EmailComponent.prototype.ngOnInit = /**
517 * @return {?}
518 */
519 function () { };
520 EmailComponent.decorators = [
521 { type: Component, args: [{
522 selector: "ngs-form-control-email",
523 template: "<div [formGroup]=\"group\">\r\n<mat-form-field fxFlexFill>\r\n <input matInput [type]=\"config.inputType\" [placeholder]=\"config.title\" [formControlName]=\"config.name\">\r\n</mat-form-field>\r\n</div>",
524 styles: [":host{display:block}.mat-form-field{width:100%}"]
525 }] }
526 ];
527 /** @nocollapse */
528 EmailComponent.ctorParameters = function () { return []; };
529 return EmailComponent;
530}());
531
532/**
533 * @fileoverview added by tsickle
534 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
535 */
536
537/**
538 * @fileoverview added by tsickle
539 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
540 */
541var ColorComponent = /** @class */ (function () {
542 function ColorComponent() {
543 }
544 /**
545 * @return {?}
546 */
547 ColorComponent.prototype.ngOnInit = /**
548 * @return {?}
549 */
550 function () { };
551 ColorComponent.decorators = [
552 { type: Component, args: [{
553 selector: "ngs-form-control-color",
554 template: "<div [formGroup]=\"form\">\r\n<mat-form-field fxFlexFill>\r\n <input matInput [type]=\"schema.inputType\" [placeholder]=\"schema.title\" [formControlName]=\"schema.name\">\r\n</mat-form-field>\r\n</div>",
555 styles: [":host{display:block}.mat-form-field{width:100%}"]
556 }] }
557 ];
558 /** @nocollapse */
559 ColorComponent.ctorParameters = function () { return []; };
560 ColorComponent.propDecorators = {
561 form: [{ type: Input }],
562 schema: [{ type: Input }]
563 };
564 return ColorComponent;
565}());
566
567/**
568 * @fileoverview added by tsickle
569 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
570 */
571
572/**
573 * @fileoverview added by tsickle
574 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
575 */
576var TableComponent = /** @class */ (function () {
577 function TableComponent(http) {
578 this.http = http;
579 this.selection = new SelectionModel(true, []);
580 this.ready = false;
581 }
582 /**
583 * @return {?}
584 */
585 TableComponent.prototype.ngOnInit = /**
586 * @return {?}
587 */
588 function () {
589 var _this = this;
590 this.http.get(this.schema.dataEndpoint).subscribe(function (data) {
591 _this.ready = true;
592 _this.displayedColumns = data.displayedColumns;
593 _this.filedDisplayedColumns = data.filedDisplayedColumns;
594 _this.dataSource = new MatTableDataSource(data.dataSource);
595 });
596 };
597 /** Whether the number of selected elements matches the total number of rows. */
598 /**
599 * Whether the number of selected elements matches the total number of rows.
600 * @return {?}
601 */
602 TableComponent.prototype.isAllSelected = /**
603 * Whether the number of selected elements matches the total number of rows.
604 * @return {?}
605 */
606 function () {
607 var _a;
608 /** @type {?} */
609 var numSelected = this.selection.selected.length;
610 this.form.patchValue((_a = {},
611 _a[this.schema.name] = this.selection.selected,
612 _a));
613 /** @type {?} */
614 var numRows = this.dataSource.data.length;
615 return numSelected === numRows;
616 };
617 /** Selects all rows if they are not all selected; otherwise clear selection. */
618 /**
619 * Selects all rows if they are not all selected; otherwise clear selection.
620 * @return {?}
621 */
622 TableComponent.prototype.masterToggle = /**
623 * Selects all rows if they are not all selected; otherwise clear selection.
624 * @return {?}
625 */
626 function () {
627 var _this = this;
628 this.isAllSelected() ? this.selection.clear() : this.dataSource.data.forEach(function (row) { return _this.selection.select(row); });
629 };
630 TableComponent.decorators = [
631 { type: Component, args: [{
632 selector: "ngs-form-control-table",
633 template: "<div class=\"example-container mat-elevation-z8\" *ngIf=\"ready\">\r\n <mat-table #table [dataSource]=\"dataSource\">\r\n \r\n <ng-container matColumnDef=\"select\">\r\n <mat-header-cell *matHeaderCellDef>\r\n <mat-checkbox (change)=\"$event ? masterToggle() : null\"\r\n [checked]=\"selection.hasValue() && isAllSelected()\"\r\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\">\r\n </mat-checkbox>\r\n </mat-header-cell>\r\n <mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? selection.toggle(row) : null\"\r\n [checked]=\"selection.isSelected(row)\">\r\n </mat-checkbox>\r\n </mat-cell>\r\n </ng-container>\r\n\r\n <div *ngFor=\"let col of filedDisplayedColumns\">\r\n <ng-container [matColumnDef]=\"col\">\r\n <mat-header-cell *matHeaderCellDef> {{col}} </mat-header-cell>\r\n <mat-cell *matCellDef=\"let element\"> {{element[col]}} </mat-cell>\r\n </ng-container>\r\n </div>\r\n \r\n <ng-container matColumnDef=\"actions\">\r\n <mat-header-cell *matHeaderCellDef></mat-header-cell>\r\n <mat-cell class='left-align' *matCellDef=\"let row\">\r\n <button mat-icon-button>\r\n <mat-icon aria-label=\"\u0627\u0646\u062A\u062E\u0627\u0628\">arrow_back</mat-icon>\r\n </button>\r\n </mat-cell>\r\n </ng-container>\r\n \r\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\r\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\" (click)=\"selection.toggle(row)\"></mat-row>\r\n\r\n </mat-table>\r\n </div>\r\n\r\n\r\n<!-- <mat-form-field fxFlexFill [formGroup]=\"form\">\r\n \r\n <input matInput [id]=\"schema.name\" [type]=\"schema.inputType\" [placeholder]=\"schema.title\" [formControlName]=\"schema.name\">\r\n \r\n <mat-error *ngIf=\"form.get(schema.name).errors?.required\">\r\n {{schema.validator.required.message}}\r\n </mat-error>\r\n <mat-error *ngIf=\"form.get(schema.name).errors?.minlength\">\r\n {{schema.validator.minlength.message}}\r\n </mat-error>\r\n <mat-error *ngIf=\"form.get(schema.name).email?.minlength\">\r\n {{schema.validator.email.message}}\r\n </mat-error>\r\n</mat-form-field> -->\r\n \r\n <!-- <div *ngIf=\"form.get(schema.name).invalid && (form.get(schema.name).dirty || form.get(schema.name).touched)\" class=\"alert alert-danger\">\r\n </div> -->",
634 styles: [":host{display:block}.mat-form-field{width:100%}"]
635 }] }
636 ];
637 /** @nocollapse */
638 TableComponent.ctorParameters = function () { return [
639 { type: HttpClient }
640 ]; };
641 TableComponent.propDecorators = {
642 form: [{ type: Input }],
643 schema: [{ type: Input }]
644 };
645 return TableComponent;
646}());
647
648/**
649 * @fileoverview added by tsickle
650 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
651 */
652
653/**
654 * @fileoverview added by tsickle
655 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
656 */
657var NumberComponent = /** @class */ (function () {
658 function NumberComponent() {
659 }
660 /**
661 * @return {?}
662 */
663 NumberComponent.prototype.ngOnInit = /**
664 * @return {?}
665 */
666 function () { };
667 NumberComponent.decorators = [
668 { type: Component, args: [{
669 selector: "ngs-form-control-number",
670 template: "<div [formGroup]=\"form\">\r\n <mat-form-field fxFlexFill>\r\n <input matInput [type]=\"schema.inputType\" [placeholder]=\"schema.title\" [formControlName]=\"schema.name\">\r\n </mat-form-field>\r\n</div>",
671 styles: [":host{display:block}.mat-form-field{width:100%}"]
672 }] }
673 ];
674 /** @nocollapse */
675 NumberComponent.ctorParameters = function () { return []; };
676 NumberComponent.propDecorators = {
677 form: [{ type: Input }],
678 schema: [{ type: Input }]
679 };
680 return NumberComponent;
681}());
682
683/**
684 * @fileoverview added by tsickle
685 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
686 */
687
688/**
689 * @fileoverview added by tsickle
690 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
691 */
692var TextComponent = /** @class */ (function () {
693 function TextComponent() {
694 }
695 TextComponent.decorators = [
696 { type: Component, args: [{
697 selector: "ngs-form-control-text",
698 template: "<mat-form-field fxFlexFill [formGroup]=\"group\">\r\n\r\n <input matInput [id]=\"config.name\" [type]=\"config.inputType\" [placeholder]=\"config.title\" [formControlName]=\"config.name\">\r\n\r\n <mat-error *ngIf=\"group.get(config.name).errors?.required\">\r\n {{config.validator.required.message}}\r\n </mat-error>\r\n <mat-error *ngIf=\"group.get(config.name).errors?.minlength\">\r\n {{config.validator.minlength.message}}\r\n </mat-error>\r\n <!-- <mat-error *ngIf=\"group.get(config.name).email?.minlength\">\r\n {{config.validator.email.message}}\r\n </mat-error> -->\r\n\r\n <!-- <div *ngIf=\"form.get(config.name).invalid && (form.get(config.name).dirty || form.get(config.name).touched)\" class=\"alert alert-danger\">\r\n </div> -->\r\n\r\n</mat-form-field>",
699 styles: [":host{display:block}.mat-form-field{width:100%}"]
700 }] }
701 ];
702 /** @nocollapse */
703 TextComponent.ctorParameters = function () { return []; };
704 return TextComponent;
705}());
706
707/**
708 * @fileoverview added by tsickle
709 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
710 */
711
712/**
713 * @fileoverview added by tsickle
714 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
715 */
716
717/**
718 * @fileoverview added by tsickle
719 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
720 */
721/** @enum {string} */
722var FormsListActionTypes = {
723 FORMS_LIST: "[FORM][LIST] FORMS_LIST",
724 FORMS_LIST_START: "[FORM][LIST] FORMS_LIST_START",
725 FORMS_LIST_SUCCEED: "[FORM][LIST] FORMS_LIST_SUCCEED",
726 FORMS_LIST_FAILED: "[FORM][LIST] FORMS_LIST_FAILED",
727 ADD_FORM_SCHEMA: "[FORM][LIST] ADD_FORM_SCHEMA",
728 FORM_SCHEMA_UPDATE: "[FORM][LIST] FORM_SCHEMA_UPDATE",
729 GET_FORM_SCHEMA: "[FORM][LIST] GET_FORM_SCHEMA",
730 FORM_SCHEMA_FETCHED: "[FORM][LIST] FORM_SCHEMA_FETCHED",
731};
732var FormsListAction = /** @class */ (function () {
733 function FormsListAction() {
734 this.type = FormsListActionTypes.FORMS_LIST;
735 }
736 return FormsListAction;
737}());
738var FormsListStartAction = /** @class */ (function () {
739 function FormsListStartAction() {
740 this.type = FormsListActionTypes.FORMS_LIST_START;
741 }
742 return FormsListStartAction;
743}());
744var FormsListSucceedAction = /** @class */ (function () {
745 function FormsListSucceedAction(payload) {
746 this.payload = payload;
747 this.type = FormsListActionTypes.FORMS_LIST_SUCCEED;
748 }
749 return FormsListSucceedAction;
750}());
751var FormsListFailedAction = /** @class */ (function () {
752 function FormsListFailedAction() {
753 this.type = FormsListActionTypes.FORMS_LIST_FAILED;
754 }
755 return FormsListFailedAction;
756}());
757var UpdateFormSchemaAction = /** @class */ (function () {
758 function UpdateFormSchemaAction(payload) {
759 this.payload = payload;
760 this.type = FormsListActionTypes.FORM_SCHEMA_UPDATE;
761 }
762 return UpdateFormSchemaAction;
763}());
764var AddFormSchemaAction = /** @class */ (function () {
765 function AddFormSchemaAction(payload) {
766 this.payload = payload;
767 this.type = FormsListActionTypes.ADD_FORM_SCHEMA;
768 }
769 return AddFormSchemaAction;
770}());
771var GetFormSchemaAction = /** @class */ (function () {
772 function GetFormSchemaAction(payload) {
773 this.payload = payload;
774 this.type = FormsListActionTypes.GET_FORM_SCHEMA;
775 }
776 return GetFormSchemaAction;
777}());
778var FormSchemaFechedAction = /** @class */ (function () {
779 function FormSchemaFechedAction(payload) {
780 this.payload = payload;
781 this.type = FormsListActionTypes.FORM_SCHEMA_FETCHED;
782 }
783 return FormSchemaFechedAction;
784}());
785
786/**
787 * @fileoverview added by tsickle
788 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
789 */
790var DateFormInputControlComponent = /** @class */ (function () {
791 function DateFormInputControlComponent() {
792 }
793 DateFormInputControlComponent.decorators = [
794 { type: Component, args: [{
795 selector: "ngs-form-control-date",
796 template: "<mat-form-field fxFlexFill [formGroup]=\"group\">\r\n\r\n <!-- <input matInput [id]=\"config.name\" [type]=\"config.inputType\" [placeholder]=\"config.title\" [formControlName]=\"config.name\"> -->\r\n <input matInput [id]=\"config.name\" [matDatepicker]=\"_datepicker\" [placeholder]=\"config.title\" [formControlName]=\"config.name\">\r\n <mat-datepicker-toggle matSuffix [for]=\"_datepicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #_datepicker></mat-datepicker>\r\n\r\n <mat-error *ngIf=\"group.get(config.name).errors?.required\">\r\n {{config.validator.required.message}}\r\n </mat-error>\r\n <mat-error *ngIf=\"group.get(config.name).errors?.minlength\">\r\n {{config.validator.minlength.message}}\r\n </mat-error>\r\n <!-- <mat-error *ngIf=\"group.get(config.name).email?.minlength\">\r\n {{config.validator.email.message}}\r\n </mat-error> -->\r\n\r\n <!-- <div *ngIf=\"form.get(config.name).invalid && (form.get(config.name).dirty || form.get(config.name).touched)\" class=\"alert alert-danger\">\r\n </div> -->\r\n\r\n</mat-form-field>\r\n\r\n<!-- \r\n\r\n<div [formGroup]=\"formGroup\">\r\n <div class=\"field-wrapper\">\r\n <div [@filedAnimation]=\"mode\">\r\n <mat-form-field class=\"fit\" [(ngClass)]=\"mode\">\r\n <input matInput [matDatepicker]=\"_datepicker\" [placeholder]=\"placeholder\" [formControlName]=\"controlName\">\r\n <mat-datepicker-toggle matSuffix [for]=\"_datepicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #_datepicker></mat-datepicker>\r\n \r\n <mat-icon class=\"tooltip md-18\" *ngIf=\"tooltip\" [matTooltip]=\"tooltip\">help</mat-icon>\r\n </mat-form-field>\r\n <div class=\"value-box\"> \r\n <span class=\"name\">\r\n {{ placeholder }} :\r\n </span>\r\n <span class=\"value\">\r\n {{(DisplayValue$ | async | persianDate)}} \r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</div> -->",
797 styles: [":host{display:block}.mat-form-field{width:100%}"]
798 }] }
799 ];
800 /** @nocollapse */
801 DateFormInputControlComponent.ctorParameters = function () { return []; };
802 return DateFormInputControlComponent;
803}());
804
805/**
806 * @fileoverview added by tsickle
807 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
808 */
809var FileFormInputControlComponent = /** @class */ (function () {
810 function FileFormInputControlComponent() {
811 }
812 FileFormInputControlComponent.decorators = [
813 { type: Component, args: [{
814 selector: "ngs-form-control-file",
815 template: "<div fxFlexFill [formGroup]=\"group\">\r\n\r\n <!-- <input matInput [id]=\"config.name\" [type]=\"config.inputType\" [placeholder]=\"config.title\" [formControlName]=\"config.name\"> -->\r\n <input [id]=\"config.name\" [type]=\"config.inputType\" [placeholder]=\"config.title\" [formControlName]=\"config.name\">\r\n\r\n <mat-error *ngIf=\"group.get(config.name).errors?.required\">\r\n {{config.validator.required.message}}\r\n </mat-error>\r\n <mat-error *ngIf=\"group.get(config.name).errors?.minlength\">\r\n {{config.validator.minlength.message}}\r\n </mat-error>\r\n <!-- <mat-error *ngIf=\"group.get(config.name).email?.minlength\">\r\n {{config.validator.email.message}}\r\n </mat-error> -->\r\n\r\n <!-- <div *ngIf=\"form.get(config.name).invalid && (form.get(config.name).dirty || form.get(config.name).touched)\" class=\"alert alert-danger\">\r\n </div> -->\r\n\r\n</div>\r\n\r\n<!-- \r\n\r\n<div [formGroup]=\"formGroup\">\r\n <div class=\"field-wrapper\">\r\n <div [@filedAnimation]=\"mode\">\r\n <mat-form-field class=\"fit\" [(ngClass)]=\"mode\">\r\n <input matInput [matDatepicker]=\"_datepicker\" [placeholder]=\"placeholder\" [formControlName]=\"controlName\">\r\n <mat-datepicker-toggle matSuffix [for]=\"_datepicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #_datepicker></mat-datepicker>\r\n \r\n <mat-icon class=\"tooltip md-18\" *ngIf=\"tooltip\" [matTooltip]=\"tooltip\">help</mat-icon>\r\n </mat-form-field>\r\n <div class=\"value-box\"> \r\n <span class=\"name\">\r\n {{ placeholder }} :\r\n </span>\r\n <span class=\"value\">\r\n {{(DisplayValue$ | async | persianDate)}} \r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</div> -->",
816 styles: [":host{display:block}.mat-form-field{width:100%}"]
817 }] }
818 ];
819 /** @nocollapse */
820 FileFormInputControlComponent.ctorParameters = function () { return []; };
821 return FileFormInputControlComponent;
822}());
823
824/**
825 * @fileoverview added by tsickle
826 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
827 */
828var FormCaptchaService = /** @class */ (function () {
829 function FormCaptchaService(http, store, configurationService) {
830 this.http = http;
831 this.store = store;
832 this.configurationService = configurationService;
833 }
834 /**
835 * @return {?}
836 */
837 FormCaptchaService.prototype.getCaptcha = /**
838 * @return {?}
839 */
840 function () {
841 var _this = this;
842 debugger;
843 return this.configurationService.config$.pipe(filter(function (captcha) { return captcha.endpoints.captchaUrl != ""; }), take(1), switchMap(function (captcha) {
844 return _this.http.get(captcha.env.server + captcha.endpoints.captchaUrl);
845 }), map(function (response) { return response.Result; }));
846 };
847 /**
848 * @return {?}
849 */
850 FormCaptchaService.prototype.sendCaptcha = /**
851 * @return {?}
852 */
853 function () {
854 var _this = this;
855 return this.configurationService.config$.pipe(filter(function (config) { return config.endpoints.getList != ""; }), switchMap(function (config) { return _this.http.get(config.env.server + config.endpoints.getList); }), map(function (response) { return response.Result; }));
856 };
857 FormCaptchaService.decorators = [
858 { type: Injectable, args: [{
859 providedIn: "root"
860 },] }
861 ];
862 /** @nocollapse */
863 FormCaptchaService.ctorParameters = function () { return [
864 { type: HttpClient },
865 { type: Store },
866 { type: FormConfigurationService }
867 ]; };
868 /** @nocollapse */ FormCaptchaService.ngInjectableDef = defineInjectable({ factory: function FormCaptchaService_Factory() { return new FormCaptchaService(inject(HttpClient), inject(Store), inject(FormConfigurationService)); }, token: FormCaptchaService, providedIn: "root" });
869 return FormCaptchaService;
870}());
871
872/**
873 * @fileoverview added by tsickle
874 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
875 */
876var CaptchaModel = /** @class */ (function () {
877 function CaptchaModel(_a) {
878 var _b = _a === void 0 ? {} : _a, captchaImg = _b.captchaImg, captchaCode = _b.captchaCode;
879 this.captchaImg = captchaImg + "?" + Math.random();
880 this.captchaCode = captchaCode || "";
881 }
882 return CaptchaModel;
883}());
884var UpsertCaptchaApiModel;
885(function (UpsertCaptchaApiModel) {
886 var Request = /** @class */ (function () {
887 function Request(initValue) {
888 if (initValue === void 0) { initValue = {}; }
889 var _this = this;
890 Object.keys(initValue).forEach(function (key) { return (_this[key] = initValue[key]); });
891 }
892 /**
893 * @return {?}
894 */
895 Request.prototype.getRequestBody = /**
896 * @return {?}
897 */
898 function () {
899 return this.Captcha.captchaCode;
900 };
901 return Request;
902 }());
903 UpsertCaptchaApiModel.Request = Request;
904 var Response = /** @class */ (function () {
905 function Response() {
906 }
907 return Response;
908 }());
909 UpsertCaptchaApiModel.Response = Response;
910})(UpsertCaptchaApiModel || (UpsertCaptchaApiModel = {}));
911
912/**
913 * @fileoverview added by tsickle
914 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
915 */
916var FormCaptchaComponent = /** @class */ (function () {
917 function FormCaptchaComponent(service, store, configurationService) {
918 // this.captcha = new CaptchaModel({
919 // captchaImg: "http://172.22.34.28:8001/api/authentication/captcha"
920 // });
921 this.service = service;
922 this.store = store;
923 this.configurationService = configurationService;
924 this._captcha_generate();
925 }
926 /**
927 * @return {?}
928 */
929 FormCaptchaComponent.prototype.ngOnInit = /**
930 * @return {?}
931 */
932 function () {
933 debugger;
934 };
935 /**
936 * @return {?}
937 */
938 FormCaptchaComponent.prototype.refresh = /**
939 * @return {?}
940 */
941 function () {
942 this.captcha.captchaImg = this._captcha_generate() + ("?" + Math.random());
943 };
944 /**
945 * @return {?}
946 */
947 FormCaptchaComponent.prototype._captcha_generate = /**
948 * @return {?}
949 */
950 function () {
951 var _this = this;
952 this.configurationService.config$.pipe(map(function (config) { return config.env.server + config.endpoints.captchaUrl; })).subscribe(function (captcha) {
953 _this.captcha = new CaptchaModel({
954 captchaImg: captcha
955 });
956 });
957 };
958 FormCaptchaComponent.decorators = [
959 { type: Component, args: [{
960 selector: "lib-form-captcha",
961 template: "<div fxLayout=\"row wrap\" fxLayoutAlign=\"start center\">\r\n <img [src]=\"captcha.captchaImg\" />\r\n\r\n <button mat-icon-button color=\"primary\" (click)=\"refresh()\">\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n\r\n <div [formGroup]=\"group\">\r\n <mat-form-field fxFlex>\r\n <input matInput [id]=\"config.name\" [placeholder]=\"config.title\" [formControlName]=\"config.name\" />\r\n </mat-form-field>\r\n </div>\r\n</div>",
962 styles: ["img{border:1px solid #e4e4e4}"]
963 }] }
964 ];
965 /** @nocollapse */
966 FormCaptchaComponent.ctorParameters = function () { return [
967 { type: FormCaptchaService },
968 { type: Store },
969 { type: FormConfigurationService }
970 ]; };
971 return FormCaptchaComponent;
972}());
973
974/**
975 * @fileoverview added by tsickle
976 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
977 */
978
979/**
980 * @fileoverview added by tsickle
981 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
982 */
983var FormViewComponent = /** @class */ (function () {
984 function FormViewComponent(service, compiler, resolver, store) {
985 var _this = this;
986 this.service = service;
987 this.compiler = compiler;
988 this.resolver = resolver;
989 this.store = store;
990 this.unsubscribe = new Subject();
991 this.accept = new EventEmitter();
992 this.cancel = new EventEmitter();
993 this.card = false;
994 this.formGroupCreated = false;
995 this.schema$ = new BehaviorSubject$1(undefined);
996 this.schema$.pipe(takeUntil(this.unsubscribe)).subscribe(function (schema) {
997 if (!schema)
998 return;
999 _this.formGroup = /** @type {?} */ (_this.createFrom(schema.form));
1000 if (!schema.form.name)
1001 return;
1002 _this.formGroupCreated = true;
1003 });
1004 }
1005 Object.defineProperty(FormViewComponent.prototype, "id", {
1006 set: /**
1007 * @param {?} id
1008 * @return {?}
1009 */
1010 function (id) {
1011 var _this = this;
1012 if (!this.local)
1013 this.store.dispatch(new GetFormSchemaAction(id));
1014 this.service
1015 .selectFormById(id)
1016 .pipe(takeUntil(this.unsubscribe))
1017 .subscribe(function (schema) { return _this.schema$.next(schema); });
1018 },
1019 enumerable: true,
1020 configurable: true
1021 });
1022 Object.defineProperty(FormViewComponent.prototype, "schema", {
1023 set: /**
1024 * @param {?} schema
1025 * @return {?}
1026 */
1027 function (schema) {
1028 this.schema$.next(schema);
1029 },
1030 enumerable: true,
1031 configurable: true
1032 });
1033 /**
1034 * @return {?}
1035 */
1036 FormViewComponent.prototype.ngOnDestroy = /**
1037 * @return {?}
1038 */
1039 function () {
1040 this.unsubscribe.next();
1041 this.unsubscribe.complete();
1042 };
1043 /**
1044 * @param {?} schema
1045 * @return {?}
1046 */
1047 FormViewComponent.prototype.generate = /**
1048 * @param {?} schema
1049 * @return {?}
1050 */
1051 function (schema) {
1052 this.schema$.next(schema);
1053 };
1054 /**
1055 * @param {?} data
1056 * @param {?=} parentPath
1057 * @return {?}
1058 */
1059 FormViewComponent.prototype.createFrom = /**
1060 * @param {?} data
1061 * @param {?=} parentPath
1062 * @return {?}
1063 */
1064 function (data, parentPath) {
1065 var _this = this;
1066 if (parentPath === void 0) { parentPath = ""; }
1067 if (data.type == "control") {
1068 /** @type {?} */
1069 var formGroupPath = void 0;
1070 if (data.parentType == "array") ;
1071 else if (data.parentType == "group") {
1072 formGroupPath = parentPath;
1073 parentPath = parentPath + ".controls." + ((/** @type {?} */ (data))).name;
1074 }
1075 /** @type {?} */
1076 var validators = [];
1077 if (data.validator.required && data.validator.required.active) {
1078 validators.push(Validators.required);
1079 }
1080 if (data.validator.minlength && data.validator.minlength.active) {
1081 validators.push(Validators.minLength(data.validator.minlength.value));
1082 }
1083 if (data.validator.email && data.validator.email.active) {
1084 validators.push(Validators.email);
1085 }
1086 /** @type {?} */
1087 var ctr = new FormControl(data.value, validators);
1088 (/** @type {?} */ (ctr)).schema = data;
1089 (/** @type {?} */ (ctr)).schema.path = parentPath;
1090 (/** @type {?} */ (ctr)).schema.formGroupPath = formGroupPath;
1091 return ctr;
1092 }
1093 else if (data.type == "group") {
1094 /** @type {?} */
1095 var formGroup_1 = new FormGroup({});
1096 if (data.parentType == undefined) {
1097 parentPath = (/** @type {?} */ (data)).name;
1098 }
1099 else if (data.parentType == "array") {
1100 parentPath = parentPath + ".controls[" + ((/** @type {?} */ (data))).name + "]";
1101 }
1102 else if (data.parentType == "group") {
1103 parentPath = parentPath + ".controls." + ((/** @type {?} */ (data))).name;
1104 }
1105 (/** @type {?} */ (formGroup_1)).schema = data;
1106 (/** @type {?} */ (formGroup_1)).schema.path = parentPath;
1107 data.fields.forEach(function (item) {
1108 item.parentType = "group";
1109 formGroup_1.addControl(item.name, _this.createFrom(item, parentPath));
1110 });
1111 return formGroup_1;
1112 }
1113 else {
1114 /** @type {?} */
1115 var formArray_1 = new FormArray([]);
1116 parentPath =
1117 parentPath == "" ? (/** @type {?} */ (data)).name : parentPath + ".controls." + ((/** @type {?} */ (data))).name;
1118 (/** @type {?} */ (formArray_1)).schema = data;
1119 (/** @type {?} */ (formArray_1)).schema.path = parentPath;
1120 data.fields.forEach(function (item, idx) {
1121 item.parentType = "array";
1122 item.name = idx.toString();
1123 formArray_1.controls.push(_this.createFrom(item, parentPath));
1124 });
1125 return formArray_1;
1126 }
1127 };
1128 /**
1129 * @return {?}
1130 */
1131 FormViewComponent.prototype.accepted = /**
1132 * @return {?}
1133 */
1134 function () {
1135 this.accept.emit(this.formGroup);
1136 };
1137 /**
1138 * @return {?}
1139 */
1140 FormViewComponent.prototype.canceled = /**
1141 * @return {?}
1142 */
1143 function () {
1144 this.cancel.emit(this.formGroup);
1145 };
1146 FormViewComponent.decorators = [
1147 { type: Component, args: [{
1148 selector: "ngs-form-view",
1149 template: "<div fxFlex=\"nogrow\" fxLayoutAlign=\"center center\" class=\"main-container\">\r\n <form *ngIf=\"formGroupCreated && card\" class=\"ngs-dynamic-form\" [formGroup]=\"formGroup\" (ngSubmit)=\"accepted()\">\r\n <mat-card>\r\n <mat-card-title>\r\n {{(schema$ | async)?.name}}\r\n </mat-card-title>\r\n <mat-card-content fxLayout=\"row wrap\" fxLayoutGap=\"25px\">\r\n <div *ngFor=\"let field of (schema$ | async)?.form.fields;\" [fxFlex]=\"field.width * 10\">\r\n <ng-container *ngIf=\"field && field.inputType\" dynamicField [config]=\"field\" [group]=\"formGroup\"></ng-container>\r\n </div>\r\n </mat-card-content>\r\n <mat-card-actions align=\"end\">\r\n <button type=\"button\" *ngIf=\"(schema$ | async)?.events.cancel.show\" (click)=\"cancel.emit()\" mat-button color=\"primary\">{{(schema$\r\n | async)?.events.cancel.text}}</button>\r\n <button type=\"submit\" *ngIf=\"(schema$ | async)?.events.accept.show\" mat-raised-button color=\"primary\">{{(schema$\r\n | async)?.events.accept.text}}</button>\r\n </mat-card-actions>\r\n </mat-card>\r\n </form>\r\n <form *ngIf=\"formGroupCreated && !card\" class=\"ngs-dynamic-form\" [formGroup]=\"formGroup\" (ngSubmit)=\"accepted()\">\r\n <div>\r\n <h3>\r\n {{(schema$ | async)?.name}}\r\n </h3>\r\n <div fxLayout=\"row wrap\" fxLayoutGap=\"5px\">\r\n <div *ngFor=\"let field of (schema$ | async)?.form.fields;\" [fxFlex]=\"field.width * 10\">\r\n <ng-container dynamicField [config]=\"field\" [group]=\"formGroup\"></ng-container>\r\n </div>\r\n </div>\r\n <div>\r\n <button type=\"button\" *ngIf=\"(schema$ | async)?.events.cancel.show\" (click)=\"cancel.emit()\" mat-button color=\"primary\">{{(schema$\r\n | async)?.events.cancel.text}}</button>\r\n <button type=\"submit\" *ngIf=\"(schema$ | async)?.events.accept.show\" mat-raised-button color=\"primary\">{{(schema$\r\n | async)?.events.accept.text}}</button>\r\n </div>\r\n </div>\r\n </form>\r\n\r\n</div>",
1150 styles: [""]
1151 }] }
1152 ];
1153 /** @nocollapse */
1154 FormViewComponent.ctorParameters = function () { return [
1155 { type: FormService },
1156 { type: Compiler },
1157 { type: ComponentFactoryResolver },
1158 { type: Store }
1159 ]; };
1160 FormViewComponent.propDecorators = {
1161 accept: [{ type: Output }],
1162 cancel: [{ type: Output }],
1163 local: [{ type: Input }],
1164 card: [{ type: Input }],
1165 id: [{ type: Input }],
1166 schema: [{ type: Input }]
1167 };
1168 return FormViewComponent;
1169}());
1170/** @type {?} */
1171var components = {
1172 checkbox: CheckboxComponent,
1173 text: TextComponent,
1174 password: TextComponent,
1175 date: DateFormInputControlComponent,
1176 file: FileFormInputControlComponent,
1177 table: TableComponent,
1178 color: ColorComponent,
1179 email: EmailComponent,
1180 captcha: FormCaptchaComponent,
1181 select: SelectComponent
1182};
1183var DynamicFieldDirective = /** @class */ (function () {
1184 function DynamicFieldDirective(resolver, container) {
1185 this.resolver = resolver;
1186 this.container = container;
1187 }
1188 /**
1189 * @return {?}
1190 */
1191 DynamicFieldDirective.prototype.ngOnChanges = /**
1192 * @return {?}
1193 */
1194 function () {
1195 debugger;
1196 if (this.component) {
1197 this.component.instance.config = this.config;
1198 this.component.instance.group = this.group;
1199 }
1200 };
1201 /**
1202 * @return {?}
1203 */
1204 DynamicFieldDirective.prototype.ngOnInit = /**
1205 * @return {?}
1206 */
1207 function () {
1208 debugger;
1209 if (this.config.inputType == undefined)
1210 return;
1211 if (!components[this.config.inputType]) {
1212 /** @type {?} */
1213 var supportedTypes = Object.keys(components).join(", ");
1214 throw new Error("Trying to use an unsupported type (" + this.config.inputType + ").\n\t\t Supported types: " + supportedTypes);
1215 }
1216 /** @type {?} */
1217 var component = this.resolver.resolveComponentFactory(components[this.config.inputType]);
1218 this.component = this.container.createComponent(component);
1219 this.component.instance.config = this.config;
1220 this.component.instance.group = this.group;
1221 };
1222 DynamicFieldDirective.decorators = [
1223 { type: Directive, args: [{
1224 selector: "[dynamicField]"
1225 },] }
1226 ];
1227 /** @nocollapse */
1228 DynamicFieldDirective.ctorParameters = function () { return [
1229 { type: ComponentFactoryResolver },
1230 { type: ViewContainerRef }
1231 ]; };
1232 DynamicFieldDirective.propDecorators = {
1233 config: [{ type: Input }],
1234 group: [{ type: Input }]
1235 };
1236 return DynamicFieldDirective;
1237}());
1238
1239/**
1240 * @fileoverview added by tsickle
1241 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1242 */
1243/** @type {?} */
1244var initialState = {
1245 status: "pristine",
1246 data: []
1247};
1248/**
1249 * @param {?=} state
1250 * @param {?=} action
1251 * @return {?}
1252 */
1253function reducer(state, action) {
1254 if (state === void 0) { state = initialState; }
1255 switch (action.type) {
1256 case FormsListActionTypes.FORMS_LIST: {
1257 return __assign({}, state, { status: "dirty" });
1258 }
1259 case FormsListActionTypes.FORMS_LIST_START: {
1260 return __assign({}, state, { status: "pending" });
1261 }
1262 case FormsListActionTypes.FORMS_LIST_SUCCEED: {
1263 return __assign({}, state, { data: action.payload, status: "succeed" });
1264 }
1265 case FormsListActionTypes.FORMS_LIST_FAILED: {
1266 return __assign({}, state, { status: "failed" });
1267 }
1268 case FormsListActionTypes.FORM_SCHEMA_UPDATE: {
1269 /** @type {?} */
1270 var data = state.data.concat();
1271 /** @type {?} */
1272 var entityIdx = state.data.findIndex(function (form) { return form._id == action.payload._id; });
1273 if (entityIdx > -1) {
1274 data[entityIdx] = Object.assign({}, data[entityIdx], action.payload);
1275 }
1276 else {
1277 data.push(action.payload);
1278 }
1279 return __assign({}, state, { data: data });
1280 }
1281 case FormsListActionTypes.ADD_FORM_SCHEMA: {
1282 /** @type {?} */
1283 var data = state.data.concat();
1284 /** @type {?} */
1285 var entityIdx = state.data.findIndex(function (form) { return form._id == action.payload._id; });
1286 if (entityIdx > -1) {
1287 data[entityIdx] = Object.assign({}, data[entityIdx], action.payload);
1288 }
1289 else {
1290 data.push(action.payload);
1291 }
1292 return __assign({}, state, { data: data });
1293 }
1294 case FormsListActionTypes.FORM_SCHEMA_FETCHED: {
1295 /** @type {?} */
1296 var data = state.data.concat();
1297 /** @type {?} */
1298 var entityIdx = state.data.findIndex(function (form) { return form._id == action.payload._id; });
1299 if (entityIdx > -1) {
1300 data[entityIdx] = Object.assign({}, data[entityIdx], action.payload);
1301 }
1302 else {
1303 data.push(action.payload);
1304 }
1305 return __assign({}, state, { data: data });
1306 }
1307 default: {
1308 return state;
1309 }
1310 }
1311}
1312
1313/**
1314 * @fileoverview added by tsickle
1315 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1316 */
1317/** @type {?} */
1318var FormReducers = {
1319 list: reducer
1320};
1321
1322/**
1323 * @fileoverview added by tsickle
1324 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1325 */
1326var FormGroupComponent = /** @class */ (function () {
1327 function FormGroupComponent() {
1328 this.noHeader = false;
1329 this.changes = new EventEmitter();
1330 this.delete = new EventEmitter();
1331 }
1332 /**
1333 * @return {?}
1334 */
1335 FormGroupComponent.prototype.changed = /**
1336 * @return {?}
1337 */
1338 function () {
1339 this.changes.emit();
1340 };
1341 /**
1342 * @param {?} root
1343 * @return {?}
1344 */
1345 FormGroupComponent.prototype.addFormGroup = /**
1346 * @param {?} root
1347 * @return {?}
1348 */
1349 function (root) {
1350 /** @type {?} */
1351 var group = new FieldConfig("group");
1352 group.fields = [];
1353 root.fields.push(group);
1354 this.schema.id = this.schema.id + 1;
1355 return group;
1356 };
1357 /**
1358 * @param {?} root
1359 * @return {?}
1360 */
1361 FormGroupComponent.prototype.addFormArray = /**
1362 * @param {?} root
1363 * @return {?}
1364 */
1365 function (root) {
1366 /** @type {?} */
1367 var array = new FieldConfig("array");
1368 array.fields = [];
1369 root.fields.push(array);
1370 return array;
1371 };
1372 /**
1373 * @param {?} root
1374 * @return {?}
1375 */
1376 FormGroupComponent.prototype.addFormControl = /**
1377 * @param {?} root
1378 * @return {?}
1379 */
1380 function (root) {
1381 /** @type {?} */
1382 var control = new FieldConfig("control");
1383 root.fields.push(control);
1384 return control;
1385 };
1386 /**
1387 * @param {?} idx
1388 * @return {?}
1389 */
1390 FormGroupComponent.prototype.deleteFormGroup = /**
1391 * @param {?} idx
1392 * @return {?}
1393 */
1394 function (idx) {
1395 this.schema.fields.splice(idx, 1);
1396 };
1397 FormGroupComponent.decorators = [
1398 { type: Component, args: [{
1399 selector: "app-form-group",
1400 template: "<div>\r\n\r\n <mat-form-field *ngIf=\"!noHeader\">\r\n <input matInput [(ngModel)]=\"schema.name\" placeholder=\"Name\">\r\n </mat-form-field>\r\n\r\n <mat-form-field *ngIf=\"!noHeader\">\r\n <input matInput [(ngModel)]=\"schema.title\" placeholder=\"\u0639\u0646\u0648\u0627\u0646\">\r\n </mat-form-field>\r\n\r\n <div class=\"button-row\">\r\n <button mat-button color=\"primary\" (click)=\"addFormGroup(schema)\"> addFormGroup </button>\r\n <button mat-button color=\"primary\" (click)=\"addFormArray(schema)\"> addFormArray </button>\r\n <button mat-button color=\"primary\" (click)=\"addFormControl(schema)\">addFormControl</button>\r\n </div>\r\n\r\n <div *ngFor=\"let field of schema.fields;let i = index\">\r\n <div [ngSwitch]=\"field.type\">\r\n <app-form-group *ngSwitchCase=\"'group'\" [schema]=\"field\" (change)=\"changed()\"></app-form-group>\r\n <!-- <app-form-array *ngSwitchCase=\"'array'\" [schema]=\"field\" (change)=\"changed()\"></app-form-array> -->\r\n <app-form-control *ngSwitchCase=\"'control'\" [schema]=\"field\" (changes)=\"changed()\" (delete)=\"deleteFormGroup(i)\"></app-form-control>\r\n </div>\r\n </div>\r\n</div>"
1401 }] }
1402 ];
1403 /** @nocollapse */
1404 FormGroupComponent.ctorParameters = function () { return []; };
1405 FormGroupComponent.propDecorators = {
1406 schema: [{ type: Input }],
1407 noHeader: [{ type: Input }],
1408 changes: [{ type: Output }],
1409 delete: [{ type: Output }]
1410 };
1411 return FormGroupComponent;
1412}());
1413
1414/**
1415 * @fileoverview added by tsickle
1416 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1417 */
1418var FormArrayComponent = /** @class */ (function () {
1419 function FormArrayComponent() {
1420 this.changes = new EventEmitter();
1421 }
1422 /**
1423 * @return {?}
1424 */
1425 FormArrayComponent.prototype.changed = /**
1426 * @return {?}
1427 */
1428 function () {
1429 this.changes.emit();
1430 };
1431 /**
1432 * @param {?} root
1433 * @return {?}
1434 */
1435 FormArrayComponent.prototype.addFormGroup = /**
1436 * @param {?} root
1437 * @return {?}
1438 */
1439 function (root) {
1440 /** @type {?} */
1441 var group = new FieldConfig("group");
1442 group.fields = [];
1443 root.fields.push(group);
1444 return group;
1445 };
1446 /**
1447 * @param {?} root
1448 * @return {?}
1449 */
1450 FormArrayComponent.prototype.addFormArray = /**
1451 * @param {?} root
1452 * @return {?}
1453 */
1454 function (root) {
1455 /** @type {?} */
1456 var array = new FieldConfig("array");
1457 array.fields = [];
1458 root.fields.push(array);
1459 return array;
1460 };
1461 /**
1462 * @param {?} root
1463 * @return {?}
1464 */
1465 FormArrayComponent.prototype.addFormControl = /**
1466 * @param {?} root
1467 * @return {?}
1468 */
1469 function (root) {
1470 /** @type {?} */
1471 var control = new FieldConfig("control");
1472 root.fields.push(control);
1473 return control;
1474 };
1475 FormArrayComponent.decorators = [
1476 { type: Component, args: [{
1477 selector: "app-form-array",
1478 template: "<mat-card>\r\n <mat-card-content>\r\n <mat-form-field>\r\n <input matInput [(ngModel)]=\"schema.name\" placeholder=\"Name\">\r\n </mat-form-field>\r\n \r\n <div class=\"button-row\">\r\n <button mat-button color=\"primary\" (click)=\"addFormGroup(schema)\">addFormGroup</button>\r\n <button mat-button color=\"primary\" (click)=\"addFormArray(schema)\">addFormArray</button>\r\n <!-- <button mat-button color=\"primary\" (click)=\"addFormControl(schema)\">addFormControl</button> -->\r\n </div>\r\n \r\n <div *ngFor=\"let field of schema.fields\">\r\n <div [ngSwitch]=\"field.type\">\r\n <app-form-group *ngSwitchCase=\"'group'\" [schema]=\"field\" (changes)=\"changed()\"></app-form-group>\r\n <app-form-array *ngSwitchCase=\"'array'\" [schema]=\"field\" (changes)=\"changed()\"></app-form-array>\r\n <!-- <app-form-control *ngSwitchCase=\"'control'\" [schema]=\"field\" (change)=\"changed($event)\"></app-form-control> -->\r\n </div>\r\n </div>\r\n \r\n </mat-card-content>\r\n</mat-card>"
1479 }] }
1480 ];
1481 /** @nocollapse */
1482 FormArrayComponent.ctorParameters = function () { return []; };
1483 FormArrayComponent.propDecorators = {
1484 schema: [{ type: Input }],
1485 changes: [{ type: Output }]
1486 };
1487 return FormArrayComponent;
1488}());
1489
1490/**
1491 * @fileoverview added by tsickle
1492 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1493 */
1494var FormControlComponent = /** @class */ (function () {
1495 function FormControlComponent() {
1496 this.changes = new EventEmitter();
1497 this.delete = new EventEmitter();
1498 this.width = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
1499 this.options = new FormArray([
1500 new FormGroup({
1501 key: new FormControl(),
1502 value: new FormControl()
1503 })
1504 ]);
1505 this.tableOptions = new FormGroup({
1506 dataEndpoint: new FormControl("")
1507 });
1508 }
1509 /**
1510 * @return {?}
1511 */
1512 FormControlComponent.prototype.changed = /**
1513 * @return {?}
1514 */
1515 function () {
1516 if ([this.schema.name, this.schema.title, this.schema.inputType].some(function (item) { return !item; }))
1517 return true;
1518 if (this.schema.inputType == "table") {
1519 this.schema.options = this.tableOptions.value;
1520 }
1521 else if (this.schema.inputType == "select") {
1522 this.schema.options = this.options.value;
1523 }
1524 this.changes.emit();
1525 };
1526 /**
1527 * @return {?}
1528 */
1529 FormControlComponent.prototype.addOption = /**
1530 * @return {?}
1531 */
1532 function () {
1533 this.options.push(new FormGroup({
1534 key: new FormControl(),
1535 value: new FormControl()
1536 }));
1537 };
1538 /**
1539 * @param {?} i
1540 * @return {?}
1541 */
1542 FormControlComponent.prototype.removeOption = /**
1543 * @param {?} i
1544 * @return {?}
1545 */
1546 function (i) {
1547 this.options.controls.splice(i, 1);
1548 };
1549 /**
1550 * @return {?}
1551 */
1552 FormControlComponent.prototype.insertOptions = /**
1553 * @return {?}
1554 */
1555 function () {
1556 this.schema.options = this.options.value;
1557 };
1558 FormControlComponent.decorators = [
1559 { type: Component, args: [{
1560 selector: "app-form-control",
1561 template: "<mat-expansion-panel>\r\n <mat-expansion-panel-header>\r\n <mat-panel-title fxLayout=\"row\" fxLayoutAlign=\"start center\">\r\n <button mat-icon-button (click)=\"delete.emit()\">\r\n <mat-icon aria-label=\"icon-button\">delete_forever</mat-icon>\r\n </button>\r\n <span>{{schema.name}}</span>\r\n\r\n </mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <div fxLayout=\"row wrap\" fxLayoutGap=\"10px\">\r\n <mat-form-field fxFlex>\r\n <input matInput [(ngModel)]=\"schema.name\" (change)=\"changed()\" placeholder=\"Name\">\r\n </mat-form-field>\r\n\r\n <mat-form-field fxFlex>\r\n <input matInput [(ngModel)]=\"schema.title\" (change)=\"changed()\" placeholder=\"Placeholder\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field fxFlex>\r\n <mat-select [(ngModel)]=\"schema.inputType\" (change)=\"changed()\" placeholder=\"Input Type\">\r\n <mat-option value=\"table\">table</mat-option>\r\n <mat-option value=\"select\">select</mat-option>\r\n <mat-option value=\"text\">text</mat-option>\r\n <mat-option value=\"number\">number</mat-option>\r\n <mat-option value=\"email\">email</mat-option>\r\n <mat-option value=\"color\">color</mat-option>\r\n <mat-option value=\"radio\">radio</mat-option>\r\n <mat-option value=\"checkbox\">checkbox</mat-option>\r\n <mat-option value=\"checkbox\">captcha</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div fxLayout=\"row wrap\" fxLayoutGap=\"10px\">\r\n <mat-form-field fxFlex>\r\n <input matInput [(ngModel)]=\"schema.value\" (change)=\"changed()\" placeholder=\"Value\" />\r\n </mat-form-field>\r\n\r\n <mat-form-field fxFlex>\r\n <mat-select [(ngModel)]=\"schema.width\" (change)=\"changed()\" placeholder=\"width\">\r\n <mat-option *ngFor=\"let item of width\" [value]=\"item\">{{item}}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div fxLayout=\"column\" fxLayoutGap=\"10px\">\r\n <div *ngIf=\"schema.inputType=='table'\" [formGroup]=\"tableOptions\">\r\n <mat-form-field>\r\n <input matInput (change)=\"changed()\" formControlName=\"dataEndpoint\" placeholder=\"dataEndpoint\" />\r\n </mat-form-field>\r\n </div>\r\n\r\n <div *ngIf=\"schema.inputType=='select'\">\r\n [options]\r\n <button (click)=\"addOption()\">+</button>\r\n <button (click)=\"insertOptions()\">insert</button>\r\n <div *ngFor=\"let option of options.controls;index as i\">\r\n {{i}}\r\n <div [formGroup]=\"options.controls[i]\">\r\n <mat-form-field>\r\n <input matInput (change)=\"changed()\" formControlName=\"key\" placeholder=\"key\" />\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput (change)=\"changed()\" formControlName=\"value\" placeholder=\"value\" />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </div>\r\n <br />\r\n <mat-card fxLayout=\"column\">\r\n <mat-slide-toggle (change)=\"changed()\" [(ngModel)]=\"schema.validator.required.active\">\u0627\u062C\u0628\u0627\u0631\u06CC</mat-slide-toggle>\r\n <mat-form-field>\r\n <input matInput (change)=\"changed()\" [(ngModel)]=\"schema.validator.required.message\" placeholder=\"\u067E\u06CC\u063A\u0627\u0645\" />\r\n </mat-form-field>\r\n </mat-card>\r\n <mat-card fxLayout=\"column\">\r\n <mat-slide-toggle (change)=\"changed()\" [(ngModel)]=\"schema.validator.email.active\">\u0627\u06CC\u0645\u06CC\u0644</mat-slide-toggle>\r\n <mat-form-field>\r\n <input matInput (change)=\"changed()\" [(ngModel)]=\"schema.validator.email.message\" placeholder=\"\u067E\u06CC\u063A\u0627\u0645\" />\r\n </mat-form-field>\r\n </mat-card>\r\n <mat-card fxLayout=\"column\">\r\n <mat-slide-toggle (change)=\"changed()\" [(ngModel)]=\"schema.validator.minlength.active\">\u062D\u062F\u0627\u0642\u0644 \u062A\u0639\u062F\u0627\u062F \u06A9\u0627\u0631\u0627\u06A9\u062A\u0631</mat-slide-toggle>\r\n <mat-form-field>\r\n <input matInput (change)=\"changed()\" [(ngModel)]=\"schema.validator.minlength.message\" placeholder=\"\u067E\u06CC\u063A\u0627\u0645\" />\r\n </mat-form-field>\r\n <mat-form-field>\r\n <input matInput (change)=\"changed()\" [(ngModel)]=\"schema.validator.minlength.value\" placeholder=\"\u062A\u0639\u062F\u0627\u062F \u062D\u062F\u0627\u0642\u0644 \u06A9\u0627\u0631\u0627\u06A9\u062A\u0631\" />\r\n </mat-form-field>\r\n </mat-card>\r\n </div>\r\n</mat-expansion-panel>"
1562 }] }
1563 ];
1564 /** @nocollapse */
1565 FormControlComponent.ctorParameters = function () { return []; };
1566 FormControlComponent.propDecorators = {
1567 schema: [{ type: Input }],
1568 changes: [{ type: Output }],
1569 delete: [{ type: Output }]
1570 };
1571 return FormControlComponent;
1572}());
1573
1574/**
1575 * @fileoverview added by tsickle
1576 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1577 */
1578/** @enum {string} */
1579var EditFormActionTypes = {
1580 EDIT_FORM: "[FORM][EDIT] EDIT_FORM",
1581 EDIT_FORM_START: "[FORM][EDIT] EDIT_FORM_START",
1582 EDIT_FORM_SUCCEED: "[FORM][EDIT] EDIT_FORM_SUCCEED",
1583 EDIT_FORM_FAILED: "[FORM][EDIT] EDIT_FORM_FAILED",
1584};
1585var EditFormAction = /** @class */ (function () {
1586 function EditFormAction(payload) {
1587 this.payload = payload;
1588 this.type = EditFormActionTypes.EDIT_FORM;
1589 }
1590 return EditFormAction;
1591}());
1592var EditFormStartAction = /** @class */ (function () {
1593 function EditFormStartAction(payload) {
1594 this.payload = payload;
1595 this.type = EditFormActionTypes.EDIT_FORM_START;
1596 }
1597 return EditFormStartAction;
1598}());
1599var EditFormSucceedAction = /** @class */ (function () {
1600 function EditFormSucceedAction(payload) {
1601 this.payload = payload;
1602 this.type = EditFormActionTypes.EDIT_FORM_SUCCEED;
1603 }
1604 return EditFormSucceedAction;
1605}());
1606var EditFormFailedAction = /** @class */ (function () {
1607 function EditFormFailedAction() {
1608 this.type = EditFormActionTypes.EDIT_FORM_FAILED;
1609 }
1610 return EditFormFailedAction;
1611}());
1612
1613/**
1614 * @fileoverview added by tsickle
1615 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1616 */
1617/** @enum {string} */
1618var AddFormActionTypes = {
1619 ADD_FORM: "[FORM][ADD] ADD_FORM_PROFILE",
1620 ADD_FORM_START: "[FORM][ADD] ADD_FORM_START",
1621 ADD_FORM_SUCCEED: "[FORM][ADD] ADD_FORM_SUCCEED",
1622 ADD_FORM_FAILED: "[FORM][ADD] ADD_FORM_FAILED",
1623};
1624var AddFormAction = /** @class */ (function () {
1625 function AddFormAction(payload) {
1626 this.payload = payload;
1627 this.type = AddFormActionTypes.ADD_FORM;
1628 }
1629 return AddFormAction;
1630}());
1631var AddFormStartAction = /** @class */ (function () {
1632 function AddFormStartAction(payload) {
1633 this.payload = payload;
1634 this.type = AddFormActionTypes.ADD_FORM_START;
1635 }
1636 return AddFormStartAction;
1637}());
1638var AddFormSucceedAction = /** @class */ (function () {
1639 function AddFormSucceedAction() {
1640 this.type = AddFormActionTypes.ADD_FORM_SUCCEED;
1641 }
1642 return AddFormSucceedAction;
1643}());
1644var AddFormFailedAction = /** @class */ (function () {
1645 function AddFormFailedAction() {
1646 this.type = AddFormActionTypes.ADD_FORM_FAILED;
1647 }
1648 return AddFormFailedAction;
1649}());
1650
1651/**
1652 * @fileoverview added by tsickle
1653 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1654 */
1655var AddFormContainerComponent = /** @class */ (function () {
1656 function AddFormContainerComponent(store, service) {
1657 this.store = store;
1658 this.service = service;
1659 }
1660 /**
1661 * @return {?}
1662 */
1663 AddFormContainerComponent.prototype.ngOnInit = /**
1664 * @return {?}
1665 */
1666 function () {
1667 this.schema = new FormSchemaModel();
1668 this.schema.init();
1669 this.store.dispatch(new AddFormSchemaAction(this.schema));
1670 };
1671 /**
1672 * @param {?} form
1673 * @return {?}
1674 */
1675 AddFormContainerComponent.prototype.add = /**
1676 * @param {?} form
1677 * @return {?}
1678 */
1679 function (form) {
1680 this.store.dispatch(new AddFormAction(form));
1681 };
1682 /**
1683 * @param {?} form
1684 * @return {?}
1685 */
1686 AddFormContainerComponent.prototype.update_schema = /**
1687 * @param {?} form
1688 * @return {?}
1689 */
1690 function (form) {
1691 this.store.dispatch(new UpdateFormSchemaAction(form));
1692 };
1693 AddFormContainerComponent.decorators = [
1694 { type: Component, args: [{
1695 template: "<ngs-form-add \n\t\t\t\t\t[schema]=\"schema\" \n\t\t\t\t\t(changes)=\"update_schema($event)\" \n\t\t\t\t\t(submited)=add($event)\n\t\t\t\t></ngs-form-add>"
1696 }] }
1697 ];
1698 /** @nocollapse */
1699 AddFormContainerComponent.ctorParameters = function () { return [
1700 { type: Store },
1701 { type: FormService }
1702 ]; };
1703 return AddFormContainerComponent;
1704}());
1705
1706/**
1707 * @fileoverview added by tsickle
1708 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1709 */
1710
1711/**
1712 * @fileoverview added by tsickle
1713 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1714 */
1715var EditFormContainerComponent = /** @class */ (function (_super) {
1716 __extends(EditFormContainerComponent, _super);
1717 function EditFormContainerComponent(service, route, store) {
1718 var _this = _super.call(this, store, service) || this;
1719 _this.service = service;
1720 _this.route = route;
1721 _this.store = store;
1722 _this.formGroup = EditFormApiModel.Request.formGroup;
1723 return _this;
1724 }
1725 /**
1726 * @return {?}
1727 */
1728 EditFormContainerComponent.prototype.ngOnInit = /**
1729 * @return {?}
1730 */
1731 function () {
1732 var _this = this;
1733 this.route.params
1734 .map(function (params) { return params["_id"]; })
1735 .subscribe(function (id) { return _this.store.dispatch(new GetFormSchemaAction(id)); });
1736 this.route.params
1737 .map(function (params) { return params["_id"]; })
1738 .switchMap(function (id) { return _this.service.selectFormById(id); })
1739 .filter(function (data) { return data != null; })
1740 .take(1)
1741 .subscribe(function (formSchema) {
1742 _this.schema = formSchema;
1743 _this.formGroup.patchValue(formSchema);
1744 });
1745 };
1746 /**
1747 * @param {?} data
1748 * @return {?}
1749 */
1750 EditFormContainerComponent.prototype.update = /**
1751 * @param {?} data
1752 * @return {?}
1753 */
1754 function (data) {
1755 this.store.dispatch(new EditFormAction(data));
1756 };
1757 EditFormContainerComponent.decorators = [
1758 { type: Component, args: [{
1759 template: "<edit-form\n\t\t\t\t\t[formGroup]=\"formGroup\"\n\t\t\t\t\t[schema]=\"schema\"\n\t\t\t\t\t(changes)=\"update_schema($event)\"\n\t\t\t\t\t(submited)=\"update($event)\">\n\t\t\t\t</edit-form>"
1760 }] }
1761 ];
1762 /** @nocollapse */
1763 EditFormContainerComponent.ctorParameters = function () { return [
1764 { type: FormService },
1765 { type: ActivatedRoute },
1766 { type: Store }
1767 ]; };
1768 return EditFormContainerComponent;
1769}(AddFormContainerComponent));
1770
1771/**
1772 * @fileoverview added by tsickle
1773 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1774 */
1775var AddFormComponent = /** @class */ (function () {
1776 function AddFormComponent() {
1777 this.formGroup = AddFormApiModel.Request.formGroup;
1778 this.submited = new EventEmitter();
1779 this.changes = new EventEmitter();
1780 }
1781 /**
1782 * @return {?}
1783 */
1784 AddFormComponent.prototype.emit = /**
1785 * @return {?}
1786 */
1787 function () {
1788 this.formGroup.patchValue({ form: this.schema.form });
1789 this.submited.emit(this.formGroup.value);
1790 };
1791 /**
1792 * @return {?}
1793 */
1794 AddFormComponent.prototype.changed = /**
1795 * @return {?}
1796 */
1797 function () {
1798 this.formGroup.patchValue({ form: this.schema.form });
1799 this.changes.emit(this.formGroup.value);
1800 };
1801 /**
1802 * @param {?} $event
1803 * @return {?}
1804 */
1805 AddFormComponent.prototype.changeOrder = /**
1806 * @param {?} $event
1807 * @return {?}
1808 */
1809 function ($event) { };
1810 /**
1811 * @param {?} root
1812 * @return {?}
1813 */
1814 AddFormComponent.prototype.addFormGroup = /**
1815 * @param {?} root
1816 * @return {?}
1817 */
1818 function (root) {
1819 /** @type {?} */
1820 var group = new FieldConfig("group");
1821 group.fields = [];
1822 root.fields.push(group);
1823 return group;
1824 };
1825 /**
1826 * @param {?} root
1827 * @return {?}
1828 */
1829 AddFormComponent.prototype.addFormArray = /**
1830 * @param {?} root
1831 * @return {?}
1832 */
1833 function (root) {
1834 /** @type {?} */
1835 var array = new FieldConfig("array");
1836 array.fields = [];
1837 root.fields.push(array);
1838 return array;
1839 };
1840 /**
1841 * @param {?} root
1842 * @return {?}
1843 */
1844 AddFormComponent.prototype.addFormControl = /**
1845 * @param {?} root
1846 * @return {?}
1847 */
1848 function (root) {
1849 /** @type {?} */
1850 var control = new FieldConfig("control");
1851 root.fields.push(control);
1852 return control;
1853 };
1854 AddFormComponent.decorators = [
1855 { type: Component, args: [{
1856 selector: "ngs-form-add",
1857 template: "<div fxLayout=\"row\" *ngIf=\"schema\">\r\n <div [fxFlex]=\"50\" *ngIf=\"formGroup\">\r\n <form [formGroup]=\"formGroup\">\r\n <mat-card>\r\n <mat-card-title>\u0627\u06CC\u062C\u0627\u062F \u0641\u0631\u0645 \u062C\u062F\u06CC\u062F</mat-card-title>\r\n <mat-card-content>\r\n <mat-form-field>\r\n <input type=\"text\" matInput (change)=\"changed()\" placeholder=\"\u0646\u0627\u0645 \u0641\u0631\u0645\" formControlName=\"name\">\r\n </mat-form-field>\r\n <!-- <div class=\"button-row\">\r\n <button mat-button color=\"primary\" (click)=\"addFormGroup(schema.form)\">Add form group</button>\r\n <button mat-button color=\"primary\" (click)=\"addFormArray(schema.form)\">Add form array</button>\r\n <button mat-button color=\"primary\" (click)=\"addFormControl(schema.form)\">Add form control</button>\r\n </div> -->\r\n </mat-card-content>\r\n </mat-card>\r\n <mat-card>\r\n <mat-card-content>\r\n <div [ngSwitch]=\"schema.form?.type\">\r\n <app-form-group *ngSwitchCase=\"'group'\" [schema]=\"schema.form\" noHeader=\"true\" (changes)=\"changed()\"></app-form-group>\r\n <app-form-array *ngSwitchCase=\"'array'\" [schema]=\"schema.form\" (changes)=\"changed()\"></app-form-array>\r\n </div>\r\n </mat-card-content>\r\n <mat-card-actions>\r\n <!-- <button mat-raised-button color=\"primary\" (click)=\"form.generate(schema)\">\u0627\u06CC\u062C\u0627\u062F \u0641\u0631\u0645</button> -->\r\n <button mat-raised-button color=\"primary\" (click)=\"emit()\" type=\"submit\">\u062B\u0628\u062A</button>\r\n </mat-card-actions>\r\n\r\n <div [formGroup]=\"$any(formGroup.controls.events).controls.accept\">\r\n <mat-slide-toggle (change)=\"changed()\" formControlName=\"show\">\u0646\u0645\u0627\u06CC\u0634 \u062A\u0627\u06CC\u06CC\u062F</mat-slide-toggle>\r\n <mat-form-field>\r\n <input type=\"text\" (change)=\"changed()\" matInput placeholder=\"\u0645\u062A\u0646 \u062A\u0627\u06CC\u06CC\u062F\" formControlName=\"text\">\r\n </mat-form-field>\r\n </div>\r\n <div [formGroup]=\"$any(formGroup.controls.events).controls.cancel\">\r\n <mat-slide-toggle (change)=\"changed()\" formControlName=\"show\">\u0646\u0645\u0627\u06CC\u0634 \u0627\u0646\u0635\u0631\u0627\u0641</mat-slide-toggle>\r\n <mat-form-field>\r\n <input type=\"text\" (change)=\"changed()\" matInput placeholder=\"\u0645\u062A\u0646 \u0627\u0646\u0635\u0631\u0627\u0641\" formControlName=\"text\">\r\n </mat-form-field>\r\n </div>\r\n\r\n </mat-card>\r\n </form>\r\n </div>\r\n <div [fxFlex]=\"50\">\r\n <ngs-form-view [local]='true' [id]=\"schema._id\"></ngs-form-view>\r\n </div>\r\n</div>"
1858 }] }
1859 ];
1860 AddFormComponent.propDecorators = {
1861 schema: [{ type: Input }],
1862 formGroup: [{ type: Input }],
1863 submited: [{ type: Output }],
1864 changes: [{ type: Output }]
1865 };
1866 return AddFormComponent;
1867}());
1868
1869/**
1870 * @fileoverview added by tsickle
1871 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1872 */
1873
1874/**
1875 * @fileoverview added by tsickle
1876 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1877 */
1878var EditFormComponent = /** @class */ (function (_super) {
1879 __extends(EditFormComponent, _super);
1880 function EditFormComponent() {
1881 return _super !== null && _super.apply(this, arguments) || this;
1882 }
1883 /**
1884 * @return {?}
1885 */
1886 EditFormComponent.prototype.emit = /**
1887 * @return {?}
1888 */
1889 function () {
1890 if (!this.formGroup.valid)
1891 return;
1892 return this.submited.emit(this.formGroup.value);
1893 };
1894 EditFormComponent.decorators = [
1895 { type: Component, args: [{
1896 selector: "edit-form",
1897 template: "<div fxLayout=\"row\" fxLayoutAlign=\"center\" fxLayoutGap=\"25px\" class=\"main-container\">\r\n\r\n <div class=\"content-action\">\r\n <mat-card fxLayout=\"column\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start\" class=\"with-sticky-action\">\r\n <div fxLayout=\"row wrap\" *ngIf=\"schema\" fxFlex=\"100\" fxLayoutAlign=\"start start\" fxLayoutAlign.lt-md=\"center\">\r\n <div fxFlex.gt-md=\"50\" fxFlex.lt-md=\"100\" *ngIf=\"formGroup\">\r\n <form [formGroup]=\"formGroup\">\r\n <mat-card>\r\n <mat-card-title>\u0627\u06CC\u062C\u0627\u062F \u0641\u0631\u0645 \u062C\u062F\u06CC\u062F</mat-card-title>\r\n <mat-card-content>\r\n <mat-form-field>\r\n <input type=\"text\" matInput (change)=\"changed()\" placeholder=\"\u0646\u0627\u0645 \u0641\u0631\u0645\" formControlName=\"name\">\r\n </mat-form-field>\r\n <!-- <div class=\"button-row\">\r\n <button mat-button color=\"primary\" (click)=\"addFormGroup(schema.form)\">Add form group</button>\r\n <button mat-button color=\"primary\" (click)=\"addFormArray(schema.form)\">Add form array</button>\r\n <button mat-button color=\"primary\" (click)=\"addFormControl(schema.form)\">Add form control</button>\r\n </div> -->\r\n <mat-divider></mat-divider>\r\n <div [ngSwitch]=\"schema.form?.type\" class=\"schema-form\">\r\n <app-form-group *ngSwitchCase=\"'group'\" [schema]=\"schema.form\" noHeader=\"true\" (changes)=\"changed()\"></app-form-group>\r\n <app-form-array *ngSwitchCase=\"'array'\" [schema]=\"schema.form\" (changes)=\"changed()\"></app-form-array>\r\n </div>\r\n\r\n <mat-divider></mat-divider>\r\n <div class=\"form-buttons\" fxLayout=\"row wrap\" fxLayoutGap=\"10px\">\r\n\r\n <div fxLayout=\"column\" [formGroup]=\"$any(formGroup.controls.events).controls.accept\">\r\n <mat-slide-toggle (change)=\"changed()\" formControlName=\"show\">\u0646\u0645\u0627\u06CC\u0634 \u062A\u0627\u06CC\u06CC\u062F</mat-slide-toggle>\r\n <mat-form-field>\r\n <input type=\"text\" (change)=\"changed()\" matInput placeholder=\"\u0645\u062A\u0646 \u062A\u0627\u06CC\u06CC\u062F\" formControlName=\"text\">\r\n </mat-form-field>\r\n </div>\r\n <div fxLayout=\"column\" [formGroup]=\"$any(formGroup.controls.events).controls.cancel\">\r\n <mat-slide-toggle (change)=\"changed()\" formControlName=\"show\">\u0646\u0645\u0627\u06CC\u0634 \u0627\u0646\u0635\u0631\u0627\u0641</mat-slide-toggle>\r\n <mat-form-field>\r\n <input type=\"text\" (change)=\"changed()\" matInput placeholder=\"\u0645\u062A\u0646 \u0627\u0646\u0635\u0631\u0627\u0641\" formControlName=\"text\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n\r\n <mat-card-actions>\r\n <!-- <button mat-raised-button color=\"primary\" (click)=\"$any(form).generate(schema)\">\u0627\u06CC\u062C\u0627\u062F \u0641\u0631\u0645</button> -->\r\n <button mat-raised-button color=\"primary\" (click)=\"emit()\" type=\"submit\">\u062B\u0628\u062A</button>\r\n </mat-card-actions>\r\n\r\n </mat-card-content>\r\n </mat-card>\r\n </form>\r\n </div>\r\n <div fxFlex.gt-md=\"50\" fxFlex.lt-md=\"100\" fxLayoutAlign=\"center start\">\r\n <ngs-form-view [local]='true' [id]=\" schema._id\">\r\n </ngs-form-view>\r\n\r\n </div>\r\n </div>\r\n </mat-card>\r\n </div>\r\n</div>",
1898 styles: [".form-buttons,.schema-form{padding:25px 10px}"]
1899 }] }
1900 ];
1901 EditFormComponent.propDecorators = {
1902 schema: [{ type: Input }]
1903 };
1904 return EditFormComponent;
1905}(AddFormComponent));
1906
1907/**
1908 * @fileoverview added by tsickle
1909 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1910 */
1911var FormListContainerComponent = /** @class */ (function () {
1912 function FormListContainerComponent(store) {
1913 this.store = store;
1914 this.data$ = this.store.select(function (state) { return state.form.list.data; });
1915 }
1916 /**
1917 * @return {?}
1918 */
1919 FormListContainerComponent.prototype.ngOnInit = /**
1920 * @return {?}
1921 */
1922 function () {
1923 this.store.dispatch(new FormsListAction());
1924 };
1925 FormListContainerComponent.decorators = [
1926 { type: Component, args: [{
1927 template: "<form-list\n\t\t\t\t\t[data]=\"data$\">\n\t\t\t\t</form-list>"
1928 }] }
1929 ];
1930 /** @nocollapse */
1931 FormListContainerComponent.ctorParameters = function () { return [
1932 { type: Store }
1933 ]; };
1934 return FormListContainerComponent;
1935}());
1936
1937/**
1938 * @fileoverview added by tsickle
1939 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1940 */
1941var FormListComponent = /** @class */ (function () {
1942 function FormListComponent() {
1943 }
1944 FormListComponent.decorators = [
1945 { type: Component, args: [{
1946 selector: "form-list",
1947 template: "<div fxLayout=\"row\" fxLayoutAlign=\"center\" fxLayoutGap=\"25px\" class=\"main-container\">\r\n\r\n <div class=\"content-action\">\r\n <mat-card class=\"with-sticky-action\">\r\n <mat-card-header>\r\n <mat-card-title fxLayout=\"row\" fxLayoutGap=\"5px\">\r\n <mat-icon>assignment</mat-icon>\r\n <span>\u0645\u062F\u06CC\u0631\u06CC\u062A \u0641\u0631\u0645 \u0647\u0627</span>\r\n </mat-card-title>\r\n <mat-card-subtitle fxLayout=\"row\" fxLayoutAlign=\"space-between center\">\r\n <span>\r\n \u0634\u0627\u0645\u0644 \u062A\u0645\u0627\u0645\u06CC \u062F\u0631\u062E\u0648\u0627\u0633\u062A\u200C\u0647\u0627 \u0627\u0632 \u0642\u0628\u06CC\u0644 \u062F\u0627\u0626\u0631\u06CC\u060C \u062C\u0645\u0639\u200C\u0622\u0648\u0631\u06CC \u0648 ...\r\n </span>\r\n </mat-card-subtitle>\r\n </mat-card-header>\r\n\r\n <div fxLayout=\"row wrap\" fxLayoutGap=\"10px\" fxLayoutAlign=\"start\">\r\n\r\n <button fxFlex.lt-lg=\"19\" fxFlex.lg=\"24\" fxFlex.md=\"32\" fxFlex.sm=\"49\" fxFlex.xs=\"100\" class='link'\r\n mat-raised-button [routerLink]=\"['edit' , item._id]\" *ngFor=\"let item of (data$ | async)\">\r\n <div fxLayout='column' fxLayoutAlign='center center'>\r\n <mat-icon color='primary'>settings</mat-icon>\r\n <h3 class='title'>{{item.name}}</h3>\r\n </div>\r\n </button>\r\n\r\n </div>\r\n </mat-card>\r\n </div>\r\n</div>",
1948 styles: ["button.link{padding:25px 15px;margin:.5%;box-sizing:border-box}button mat-icon{font-size:34px;width:34px;height:34px}"]
1949 }] }
1950 ];
1951 FormListComponent.propDecorators = {
1952 data$: [{ type: Input, args: ["data",] }]
1953 };
1954 return FormListComponent;
1955}());
1956
1957/**
1958 * @fileoverview added by tsickle
1959 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1960 */
1961var MainContainerComponent = /** @class */ (function () {
1962 function MainContainerComponent(route, store) {
1963 this.route = route;
1964 this.store = store;
1965 }
1966 MainContainerComponent.decorators = [
1967 { type: Component, args: [{
1968 template: "<router-outlet></router-outlet>"
1969 }] }
1970 ];
1971 /** @nocollapse */
1972 MainContainerComponent.ctorParameters = function () { return [
1973 { type: ActivatedRoute },
1974 { type: Store }
1975 ]; };
1976 return MainContainerComponent;
1977}());
1978
1979/**
1980 * @fileoverview added by tsickle
1981 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1982 */
1983var AddFormEffects = /** @class */ (function () {
1984 function AddFormEffects(actions$, router, service) {
1985 var _this = this;
1986 this.actions$ = actions$;
1987 this.router = router;
1988 this.service = service;
1989 this.AddForm$ = this.actions$
1990 .ofType(AddFormActionTypes.ADD_FORM)
1991 .pipe(map(function (action) { return action.payload; }), map(function (data) { return new AddFormStartAction(data); }));
1992 this.AddFormStart$ = this.actions$
1993 .ofType(AddFormActionTypes.ADD_FORM_START)
1994 .pipe(map(function (action) { return action.payload; }), switchMap(function (data) { return _this.service.add(data); }), map(function (res) { return new AddFormSucceedAction(); }), catchError(function () { return of(new AddFormFailedAction()); }));
1995 }
1996 AddFormEffects.decorators = [
1997 { type: Injectable }
1998 ];
1999 /** @nocollapse */
2000 AddFormEffects.ctorParameters = function () { return [
2001 { type: Actions },
2002 { type: Router },
2003 { type: FormService }
2004 ]; };
2005 __decorate([
2006 Effect(),
2007 __metadata("design:type", Object)
2008 ], AddFormEffects.prototype, "AddForm$", void 0);
2009 __decorate([
2010 Effect(),
2011 __metadata("design:type", Object)
2012 ], AddFormEffects.prototype, "AddFormStart$", void 0);
2013 return AddFormEffects;
2014}());
2015
2016/**
2017 * @fileoverview added by tsickle
2018 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2019 */
2020
2021/**
2022 * @fileoverview added by tsickle
2023 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2024 */
2025
2026/**
2027 * @fileoverview added by tsickle
2028 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2029 */
2030var FormsListEffects = /** @class */ (function () {
2031 function FormsListEffects(actions$, router, service) {
2032 var _this = this;
2033 this.actions$ = actions$;
2034 this.router = router;
2035 this.service = service;
2036 this.EditProfileRequest$ = this.actions$.ofType(FormsListActionTypes.FORMS_LIST).map(function (data) { return new FormsListStartAction(); });
2037 this.GetForm$ = this.actions$
2038 .ofType(FormsListActionTypes.GET_FORM_SCHEMA)
2039 .pipe(map(function (action) { return action.payload; }), switchMap(function (id) { return _this.service.get(id); }), map(function (formSchema) { return new FormSchemaFechedAction(formSchema); }));
2040 this.get_forms_list$ = this.actions$
2041 .ofType(FormsListActionTypes.FORMS_LIST_START)
2042 .pipe(switchMap(function (data) { return _this.service.getList(); }), map(function (res) { return new FormsListSucceedAction(res); }), catchError(function () { return of(new FormsListFailedAction()); }));
2043 }
2044 FormsListEffects.decorators = [
2045 { type: Injectable }
2046 ];
2047 /** @nocollapse */
2048 FormsListEffects.ctorParameters = function () { return [
2049 { type: Actions },
2050 { type: Router },
2051 { type: FormService }
2052 ]; };
2053 __decorate([
2054 Effect(),
2055 __metadata("design:type", Object)
2056 ], FormsListEffects.prototype, "EditProfileRequest$", void 0);
2057 __decorate([
2058 Effect(),
2059 __metadata("design:type", Object)
2060 ], FormsListEffects.prototype, "GetForm$", void 0);
2061 __decorate([
2062 Effect(),
2063 __metadata("design:type", Object)
2064 ], FormsListEffects.prototype, "get_forms_list$", void 0);
2065 return FormsListEffects;
2066}());
2067
2068/**
2069 * @fileoverview added by tsickle
2070 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2071 */
2072
2073/**
2074 * @fileoverview added by tsickle
2075 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2076 */
2077var EditFormEffects = /** @class */ (function () {
2078 function EditFormEffects(actions$, router, service) {
2079 var _this = this;
2080 this.actions$ = actions$;
2081 this.router = router;
2082 this.service = service;
2083 this.EditForm$ = this.actions$
2084 .ofType(EditFormActionTypes.EDIT_FORM)
2085 .pipe(map(function (action) { return action.payload; }), map(function (data) { return new EditFormStartAction(data); }));
2086 this.EditFormStart$ = this.actions$
2087 .ofType(EditFormActionTypes.EDIT_FORM_START)
2088 .pipe(map(function (action) { return action.payload; }), switchMap(function (data) { return _this.service.update(data); }), map(function (formSchema) { return new EditFormSucceedAction(formSchema); }), catchError(function () { return of(new EditFormFailedAction()); }));
2089 this.UpdateFormsListStart$ = this.actions$
2090 .ofType(EditFormActionTypes.EDIT_FORM_SUCCEED)
2091 .pipe(map(function (action) { return action.payload; }), map(function (formSchema) { return new UpdateFormSchemaAction(formSchema); }));
2092 }
2093 EditFormEffects.decorators = [
2094 { type: Injectable }
2095 ];
2096 /** @nocollapse */
2097 EditFormEffects.ctorParameters = function () { return [
2098 { type: Actions },
2099 { type: Router },
2100 { type: FormService }
2101 ]; };
2102 __decorate([
2103 Effect(),
2104 __metadata("design:type", Object)
2105 ], EditFormEffects.prototype, "EditForm$", void 0);
2106 __decorate([
2107 Effect(),
2108 __metadata("design:type", Object)
2109 ], EditFormEffects.prototype, "EditFormStart$", void 0);
2110 __decorate([
2111 Effect(),
2112 __metadata("design:type", Object)
2113 ], EditFormEffects.prototype, "UpdateFormsListStart$", void 0);
2114 return EditFormEffects;
2115}());
2116
2117/**
2118 * @fileoverview added by tsickle
2119 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2120 */
2121/** @type {?} */
2122var routes = [
2123 {
2124 path: "form",
2125 component: MainContainerComponent,
2126 children: [
2127 {
2128 path: "add",
2129 component: AddFormContainerComponent
2130 },
2131 {
2132 path: "edit/:_id",
2133 component: EditFormContainerComponent
2134 },
2135 {
2136 path: "",
2137 component: FormListContainerComponent
2138 }
2139 ]
2140 }
2141];
2142/** @type {?} */
2143var RoutingModule = RouterModule.forChild(routes);
2144
2145/**
2146 * @fileoverview added by tsickle
2147 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2148 */
2149/** @enum {string} */
2150var CaptchaActionTypes = {
2151 GET_CAPTCHA: "[CAPTCHA][GET] GET_CAPTCHA",
2152 GET_CAPTCHA_START: "[CAPTCHA][GET] GET_CAPTCHA_START",
2153 GET_CAPTCHA_SUCCEED: "[CAPTCHA][GET] GET_CAPTCHA_SUCCEED",
2154 GET_CAPTCHA_FAILED: "[CAPTCHA][GET] GET_CAPTCHA_FAILED",
2155};
2156var GetCaptchaStartAction = /** @class */ (function () {
2157 function GetCaptchaStartAction(payload) {
2158 this.payload = payload;
2159 this.type = CaptchaActionTypes.GET_CAPTCHA_START;
2160 }
2161 return GetCaptchaStartAction;
2162}());
2163var GetCaptchaSucceedAction = /** @class */ (function () {
2164 function GetCaptchaSucceedAction() {
2165 this.type = CaptchaActionTypes.GET_CAPTCHA_SUCCEED;
2166 }
2167 return GetCaptchaSucceedAction;
2168}());
2169var GetCaptchaFailedAction = /** @class */ (function () {
2170 function GetCaptchaFailedAction() {
2171 this.type = CaptchaActionTypes.GET_CAPTCHA_FAILED;
2172 }
2173 return GetCaptchaFailedAction;
2174}());
2175
2176/**
2177 * @fileoverview added by tsickle
2178 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2179 */
2180var CaptchaEffects = /** @class */ (function () {
2181 function CaptchaEffects(actions$, router, service) {
2182 var _this = this;
2183 this.actions$ = actions$;
2184 this.router = router;
2185 this.service = service;
2186 this.GetCaptcha$ = this.actions$
2187 .ofType(CaptchaActionTypes.GET_CAPTCHA)
2188 .pipe(map(function (action) { return action.payload; }), map(function (data) { return new GetCaptchaStartAction(data); }));
2189 this.AddFormStart$ = this.actions$
2190 .ofType(CaptchaActionTypes.GET_CAPTCHA_START)
2191 .pipe(map(function (action) { return action.payload; }), switchMap(function (data) { return _this.service.getCaptcha(); }), map(function (res) { return new GetCaptchaSucceedAction(); }), catchError(function () { return of(new GetCaptchaFailedAction()); }));
2192 }
2193 CaptchaEffects.decorators = [
2194 { type: Injectable }
2195 ];
2196 /** @nocollapse */
2197 CaptchaEffects.ctorParameters = function () { return [
2198 { type: Actions },
2199 { type: Router },
2200 { type: FormCaptchaService }
2201 ]; };
2202 __decorate([
2203 Effect(),
2204 __metadata("design:type", Object)
2205 ], CaptchaEffects.prototype, "GetCaptcha$", void 0);
2206 __decorate([
2207 Effect(),
2208 __metadata("design:type", Object)
2209 ], CaptchaEffects.prototype, "AddFormStart$", void 0);
2210 return CaptchaEffects;
2211}());
2212
2213/**
2214 * @fileoverview added by tsickle
2215 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2216 */
2217var NgsFormModule = /** @class */ (function () {
2218 function NgsFormModule() {
2219 }
2220 /**
2221 * @param {?=} config
2222 * @return {?}
2223 */
2224 NgsFormModule.forRoot = /**
2225 * @param {?=} config
2226 * @return {?}
2227 */
2228 function (config) {
2229 return {
2230 ngModule: RootNgsFormModule,
2231 providers: [{ provide: MODULE_CONFIG_TOKEN, useValue: config }, FormConfigurationService]
2232 };
2233 };
2234 NgsFormModule.decorators = [
2235 { type: NgModule, args: [{
2236 imports: [
2237 HttpClientModule,
2238 FormsModule,
2239 RouterModule,
2240 CommonModule,
2241 MatExpansionModule,
2242 MatSnackBarModule,
2243 MatIconModule,
2244 MatDatepickerModule,
2245 MatButtonModule,
2246 MatCardModule,
2247 MatCheckboxModule,
2248 MatTableModule,
2249 MatSelectModule,
2250 MatInputModule,
2251 MatFormFieldModule,
2252 MatTabsModule,
2253 MatDividerModule,
2254 FlexLayoutModule,
2255 MatRadioModule,
2256 MatSlideToggleModule,
2257 ReactiveFormsModule
2258 ],
2259 declarations: [
2260 EditFormContainerComponent,
2261 EditFormComponent,
2262 FormListContainerComponent,
2263 FormListComponent,
2264 AddFormContainerComponent,
2265 MainContainerComponent,
2266 AddFormComponent,
2267 FormGroupComponent,
2268 FormArrayComponent,
2269 FormControlComponent,
2270 FormViewComponent,
2271 DynamicFieldDirective,
2272 SelectComponent,
2273 CheckboxComponent,
2274 EmailComponent,
2275 ColorComponent,
2276 DateFormInputControlComponent,
2277 FileFormInputControlComponent,
2278 TextComponent,
2279 NumberComponent,
2280 TableComponent,
2281 FormCaptchaComponent
2282 ],
2283 entryComponents: [
2284 SelectComponent,
2285 CheckboxComponent,
2286 EmailComponent,
2287 ColorComponent,
2288 DateFormInputControlComponent,
2289 FileFormInputControlComponent,
2290 TextComponent,
2291 NumberComponent,
2292 TableComponent,
2293 FormCaptchaComponent
2294 ],
2295 exports: [FormViewComponent]
2296 },] }
2297 ];
2298 return NgsFormModule;
2299}());
2300var RootNgsFormModule = /** @class */ (function () {
2301 function RootNgsFormModule() {
2302 }
2303 RootNgsFormModule.decorators = [
2304 { type: NgModule, args: [{
2305 imports: [
2306 NgsFormModule,
2307 StoreModule.forFeature("form", FormReducers),
2308 EffectsModule.forFeature([AddFormEffects, EditFormEffects, FormsListEffects, CaptchaEffects]),
2309 RoutingModule
2310 ],
2311 exports: [NgsFormModule]
2312 },] }
2313 ];
2314 return RootNgsFormModule;
2315}());
2316
2317/**
2318 * @fileoverview added by tsickle
2319 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2320 */
2321
2322/**
2323 * @fileoverview added by tsickle
2324 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
2325 */
2326
2327export { FormService, FormViewComponent, DynamicFieldDirective, NgsFormModule, RootNgsFormModule, AddFormComponent as ɵi, AddFormContainerComponent as ɵg, AddFormContainerComponent as ɵl, AddFormEffects as ɵbd, AddFormComponent as ɵn, CaptchaEffects as ɵbg, FormArrayComponent as ɵp, FormControlComponent as ɵq, FormGroupComponent as ɵo, EditFormContainerComponent as ɵf, EditFormEffects as ɵbe, EditFormComponent as ɵh, RoutingModule as ɵbh, MODULE_CONFIG_TOKEN as ɵa, FormListContainerComponent as ɵj, FormListComponent as ɵk, FormsListEffects as ɵbf, reducer as ɵbc, MainContainerComponent as ɵm, FormReducers as ɵb, FormCaptchaService as ɵbb, FormConfigurationService as ɵd, CheckboxComponent as ɵs, ColorComponent as ɵu, DateFormInputControlComponent as ɵv, EmailComponent as ɵt, FileFormInputControlComponent as ɵw, FormCaptchaComponent as ɵba, NumberComponent as ɵy, SelectComponent as ɵr, TableComponent as ɵz, TextComponent as ɵx };
2328
2329//# sourceMappingURL=soushians-form.js.map
\No newline at end of file