1 | import { InjectionToken, Injectable, Inject, ɵɵdefineInjectable, ɵɵinject, Component, Input, EventEmitter, Compiler, ComponentFactoryResolver, Output, Directive, ViewContainerRef, NgModule } from '@angular/core';
|
2 | import { HttpClient, HttpClientModule } from '@angular/common/http';
|
3 | import { Store, StoreModule } from '@ngrx/store';
|
4 | import { BehaviorSubject as BehaviorSubject$1 } from 'rxjs/BehaviorSubject';
|
5 | import { filter, map, take, switchMap, takeUntil, catchError } from 'rxjs/operators';
|
6 | import { stringTemplate } from '@soushians/shared';
|
7 | import { FormGroup, FormControl, Validators, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
8 | import { BehaviorSubject, Subject } from 'rxjs';
|
9 | import { getFormModuleConfig } from '@soushians/config';
|
10 | import { MatTableDataSource, MatExpansionModule, MatSnackBarModule, MatIconModule, MatDatepickerModule, MatButtonModule, MatCardModule, MatCheckboxModule, MatTableModule, MatSelectModule, MatInputModule, MatFormFieldModule, MatTabsModule, MatDividerModule, MatRadioModule, MatSlideToggleModule } from '@angular/material';
|
11 | import { SelectionModel } from '@angular/cdk/collections';
|
12 | import { CommonModule } from '@angular/common';
|
13 | import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
14 | import { FlexLayoutModule } from '@angular/flex-layout';
|
15 | import { ofType, Actions, Effect, EffectsModule } from '@ngrx/effects';
|
16 | import { __assign, __extends, __decorate, __metadata } from 'tslib';
|
17 | import 'rxjs/Observable';
|
18 | import 'rxjs/add/operator/map';
|
19 | import 'rxjs/add/operator/mergeMap';
|
20 | import 'rxjs/add/operator/switchMap';
|
21 | import { of } from 'rxjs/observable/of';
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | var AddFormApiModel;
|
28 | (function (AddFormApiModel) {
|
29 | var Request = (function () {
|
30 | function Request(initValue) {
|
31 | var _this = this;
|
32 | if (initValue === void 0) { initValue = ( ({})); }
|
33 | Object.keys(initValue).forEach(( |
34 |
|
35 |
|
36 |
|
37 | function (key) { return (_this[key] = initValue[key]); }));
|
38 | }
|
39 | |
40 |
|
41 |
|
42 | Request.prototype.getRequestBody = |
43 |
|
44 |
|
45 | function () {
|
46 | return {
|
47 | name: this.name,
|
48 | form: this.form,
|
49 | events: this.events
|
50 | };
|
51 | };
|
52 | Object.defineProperty(Request, "formGroup", {
|
53 | get: /**
|
54 | * @return {?}
|
55 | */
|
56 | function () {
|
57 | return new FormGroup({
|
58 | _id: new FormControl("", [Validators.required]),
|
59 | name: new FormControl("", [Validators.required]),
|
60 | title: new FormControl("", [Validators.required]),
|
61 | form: new FormControl({}),
|
62 | events: new FormGroup({
|
63 | accept: new FormGroup({
|
64 | show: new FormControl(false),
|
65 | text: new FormControl("ثبت")
|
66 | }),
|
67 | cancel: new FormGroup({
|
68 | show: new FormControl(false),
|
69 | text: new FormControl("انصراف")
|
70 | })
|
71 | })
|
72 | });
|
73 | },
|
74 | enumerable: true,
|
75 | configurable: true
|
76 | });
|
77 | return Request;
|
78 | }());
|
79 | AddFormApiModel.Request = Request;
|
80 | if (false) {
|
81 |
|
82 | Request.prototype._id;
|
83 |
|
84 | Request.prototype.name;
|
85 |
|
86 | Request.prototype.form;
|
87 |
|
88 | Request.prototype.events;
|
89 | }
|
90 | var Response = (function () {
|
91 | function Response() {
|
92 | }
|
93 | return Response;
|
94 | }());
|
95 | AddFormApiModel.Response = Response;
|
96 | if (false) {
|
97 |
|
98 | Response.prototype.Result;
|
99 | }
|
100 | })(AddFormApiModel || (AddFormApiModel = {}));
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 | var EditFormApiModel;
|
107 | (function (EditFormApiModel) {
|
108 | var Request = (function () {
|
109 | function Request(initValue) {
|
110 | var _this = this;
|
111 | if (initValue === void 0) { initValue = ( ({})); }
|
112 | Object.keys(initValue).forEach(( |
113 |
|
114 |
|
115 |
|
116 | function (key) { return (_this[key] = initValue[key]); }));
|
117 | }
|
118 | |
119 |
|
120 |
|
121 | Request.prototype.getRequestBody = |
122 |
|
123 |
|
124 | function () {
|
125 | return {
|
126 | _id: this._id,
|
127 | name: this.name,
|
128 | form: this.form,
|
129 | events: this.events
|
130 | };
|
131 | };
|
132 | Object.defineProperty(Request, "formGroup", {
|
133 | get: /**
|
134 | * @return {?}
|
135 | */
|
136 | function () {
|
137 | return new FormGroup({
|
138 | _id: new FormControl("", [Validators.required]),
|
139 | name: new FormControl("", [Validators.required]),
|
140 | form: new FormControl({}),
|
141 | events: new FormGroup({
|
142 | accept: new FormGroup({
|
143 | show: new FormControl(false),
|
144 | text: new FormControl("ثبت")
|
145 | }),
|
146 | cancel: new FormGroup({
|
147 | show: new FormControl(false),
|
148 | text: new FormControl("انصراف")
|
149 | })
|
150 | })
|
151 | });
|
152 | },
|
153 | enumerable: true,
|
154 | configurable: true
|
155 | });
|
156 | return Request;
|
157 | }());
|
158 | EditFormApiModel.Request = Request;
|
159 | if (false) {
|
160 |
|
161 | Request.prototype._id;
|
162 |
|
163 | Request.prototype.name;
|
164 |
|
165 | Request.prototype.form;
|
166 |
|
167 | Request.prototype.events;
|
168 | }
|
169 | var Response = (function () {
|
170 | function Response() {
|
171 | }
|
172 | return Response;
|
173 | }());
|
174 | EditFormApiModel.Response = Response;
|
175 | if (false) {
|
176 |
|
177 | Response.prototype.Result;
|
178 | }
|
179 | })(EditFormApiModel || (EditFormApiModel = {}));
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | var FormListApiModel;
|
186 | (function (FormListApiModel) {
|
187 | var Request = (function () {
|
188 | function Request(initValue) {
|
189 | var _this = this;
|
190 | if (initValue === void 0) { initValue = ( ({})); }
|
191 | Object.keys(initValue).forEach(( |
192 |
|
193 |
|
194 |
|
195 | function (key) { return (_this[key] = initValue[key]); }));
|
196 | }
|
197 | |
198 |
|
199 |
|
200 | Request.prototype.getRequestBody = |
201 |
|
202 |
|
203 | function () {
|
204 | return {
|
205 | Name: this.Name,
|
206 | Controls: this.Controls
|
207 | };
|
208 | };
|
209 | Object.defineProperty(Request, "formGroup", {
|
210 | get: /**
|
211 | * @return {?}
|
212 | */
|
213 | function () {
|
214 | return new FormGroup({
|
215 | Name: new FormControl("", [Validators.required]),
|
216 | Controls: new FormGroup({})
|
217 | });
|
218 | },
|
219 | enumerable: true,
|
220 | configurable: true
|
221 | });
|
222 | return Request;
|
223 | }());
|
224 | FormListApiModel.Request = Request;
|
225 | if (false) {
|
226 |
|
227 | Request.prototype.Name;
|
228 |
|
229 | Request.prototype.Controls;
|
230 | }
|
231 | var Response = (function () {
|
232 | function Response() {
|
233 | }
|
234 | return Response;
|
235 | }());
|
236 | FormListApiModel.Response = Response;
|
237 | if (false) {
|
238 |
|
239 | Response.prototype.Result;
|
240 | }
|
241 | })(FormListApiModel || (FormListApiModel = {}));
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 | function validation() { }
|
251 | if (false) {
|
252 |
|
253 | validation.prototype.active;
|
254 |
|
255 | validation.prototype.message;
|
256 |
|
257 | validation.prototype.value;
|
258 | }
|
259 | var Validator = (function () {
|
260 | function Validator() {
|
261 | this.required = {
|
262 | active: false,
|
263 | message: "این فیلد الزامی است"
|
264 | };
|
265 | this.minlength = {
|
266 | active: false,
|
267 | message: "حداقل تعداد کارکترها",
|
268 | value: 5
|
269 | };
|
270 | this.email = {
|
271 | active: false,
|
272 | message: "لطفا ایمیل صحیح وارد نمایید"
|
273 | };
|
274 | }
|
275 | return Validator;
|
276 | }());
|
277 | if (false) {
|
278 |
|
279 | Validator.prototype.required;
|
280 |
|
281 | Validator.prototype.minlength;
|
282 |
|
283 | Validator.prototype.email;
|
284 | }
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | var FieldConfig = (function () {
|
291 | function FieldConfig(type) {
|
292 | this.type = type;
|
293 | if (type != "control")
|
294 | this.fields = [];
|
295 | this.width = 3;
|
296 | this.validator = new Validator();
|
297 | }
|
298 | return FieldConfig;
|
299 | }());
|
300 | if (false) {
|
301 |
|
302 | FieldConfig.prototype.id;
|
303 |
|
304 | FieldConfig.prototype.type;
|
305 |
|
306 | FieldConfig.prototype.name;
|
307 |
|
308 | FieldConfig.prototype.subtype;
|
309 |
|
310 | FieldConfig.prototype.disabled;
|
311 |
|
312 | FieldConfig.prototype.title;
|
313 |
|
314 | FieldConfig.prototype.parentType;
|
315 |
|
316 | FieldConfig.prototype.formGroupPath;
|
317 |
|
318 | FieldConfig.prototype.path;
|
319 |
|
320 | FieldConfig.prototype.inputType;
|
321 |
|
322 | FieldConfig.prototype.value;
|
323 |
|
324 | FieldConfig.prototype.order;
|
325 |
|
326 | FieldConfig.prototype.width;
|
327 |
|
328 | FieldConfig.prototype.options;
|
329 |
|
330 | FieldConfig.prototype.dataEndpoint;
|
331 |
|
332 | FieldConfig.prototype.optionsEndpoint;
|
333 |
|
334 | FieldConfig.prototype.fields;
|
335 |
|
336 | FieldConfig.prototype.validator;
|
337 | }
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 | var FormSchemaModel = (function () {
|
344 | function FormSchemaModel() {
|
345 | this.events = {
|
346 | accept: {
|
347 | show: false,
|
348 | text: "ثبت"
|
349 | },
|
350 | cancel: {
|
351 | show: false,
|
352 | text: "انصراف"
|
353 | }
|
354 | };
|
355 | this.form = new FieldConfig("group");
|
356 | }
|
357 | |
358 |
|
359 |
|
360 | FormSchemaModel.prototype.init = |
361 |
|
362 |
|
363 | function () {
|
364 | this._id = (Math.random() * 10).toString();
|
365 | };
|
366 | return FormSchemaModel;
|
367 | }());
|
368 | if (false) {
|
369 |
|
370 | FormSchemaModel.prototype._id;
|
371 |
|
372 | FormSchemaModel.prototype.name;
|
373 |
|
374 | FormSchemaModel.prototype.description;
|
375 |
|
376 | FormSchemaModel.prototype.form;
|
377 |
|
378 | FormSchemaModel.prototype.events;
|
379 | }
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 | function Field() { }
|
389 | if (false) {
|
390 |
|
391 | Field.prototype.config;
|
392 |
|
393 | Field.prototype.group;
|
394 | }
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | function FormModuleConfig() { }
|
409 | if (false) {
|
410 |
|
411 | FormModuleConfig.prototype.env;
|
412 |
|
413 | FormModuleConfig.prototype.endpoints;
|
414 | }
|
415 |
|
416 | var MODULE_DEFAULT_CONFIG = {
|
417 | env: {
|
418 | production: false,
|
419 | frontend_server: "frontend/server/did/not/set",
|
420 | server: "server/did/not/set"
|
421 | },
|
422 | endpoints: {
|
423 | addForm: "",
|
424 | editForm: "",
|
425 | getForm: "",
|
426 | getList: "",
|
427 | deleteForm: "",
|
428 | captchaUrl: ""
|
429 | },
|
430 | };
|
431 |
|
432 | var MODULE_CONFIG_TOKEN = new InjectionToken("FormModuleConfig");
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 | var FormConfigurationService = (function () {
|
439 | function FormConfigurationService(configFile, store) {
|
440 | var _this = this;
|
441 | this.store = store;
|
442 | this.config$ = new BehaviorSubject(MODULE_DEFAULT_CONFIG);
|
443 | this._config = Object.assign({}, MODULE_DEFAULT_CONFIG, configFile);
|
444 | this.config$.next(this._config);
|
445 | this.store.select(getFormModuleConfig).subscribe(( |
446 |
|
447 |
|
448 |
|
449 | function (userConfig) {
|
450 | if (!userConfig)
|
451 | return;
|
452 | _this._config = Object.assign({}, _this._config, userConfig.Config);
|
453 | _this.config$.next(_this._config);
|
454 | }));
|
455 | }
|
456 | Object.defineProperty(FormConfigurationService.prototype, "config", {
|
457 | get: /**
|
458 | * @return {?}
|
459 | */
|
460 | function () {
|
461 | return this._config;
|
462 | },
|
463 | enumerable: true,
|
464 | configurable: true
|
465 | });
|
466 | FormConfigurationService.decorators = [
|
467 | { type: Injectable, args: [{
|
468 | providedIn: "root"
|
469 | },] }
|
470 | ];
|
471 |
|
472 | FormConfigurationService.ctorParameters = function () { return [
|
473 | { type: undefined, decorators: [{ type: Inject, args: [MODULE_CONFIG_TOKEN,] }] },
|
474 | { type: Store }
|
475 | ]; };
|
476 | FormConfigurationService.ngInjectableDef = ɵɵdefineInjectable({ factory: function FormConfigurationService_Factory() { return new FormConfigurationService(ɵɵinject(MODULE_CONFIG_TOKEN), ɵɵinject(Store)); }, token: FormConfigurationService, providedIn: "root" });
|
477 | return FormConfigurationService;
|
478 | }());
|
479 | if (false) {
|
480 | |
481 |
|
482 |
|
483 |
|
484 | FormConfigurationService.prototype._config;
|
485 |
|
486 | FormConfigurationService.prototype.config$;
|
487 | |
488 |
|
489 |
|
490 |
|
491 | FormConfigurationService.prototype.store;
|
492 | }
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 | var FormService = (function () {
|
499 | function FormService(http, store, configurationService) {
|
500 | this.http = http;
|
501 | this.store = store;
|
502 | this.configurationService = configurationService;
|
503 | }
|
504 | |
505 |
|
506 |
|
507 |
|
508 | FormService.prototype.add = |
509 |
|
510 |
|
511 |
|
512 | function (data) {
|
513 | var _this = this;
|
514 |
|
515 | var model = new AddFormApiModel.Request(data);
|
516 | return this.configurationService.config$
|
517 | .filter(( |
518 |
|
519 |
|
520 |
|
521 | function (config) { return config.endpoints.addForm != ""; }))
|
522 | .take(1)
|
523 | .switchMap(( |
524 |
|
525 |
|
526 |
|
527 | function (config) {
|
528 | return _this.http.post(config.env.frontend_server + config.endpoints.addForm, model.getRequestBody());
|
529 | }))
|
530 | .map(( |
531 |
|
532 |
|
533 |
|
534 | function (response) { return response.Result; }));
|
535 | };
|
536 | |
537 |
|
538 |
|
539 |
|
540 | FormService.prototype.get = |
541 |
|
542 |
|
543 |
|
544 | function (_id) {
|
545 | var _this = this;
|
546 | return this.configurationService.config$
|
547 | .filter(( |
548 |
|
549 |
|
550 |
|
551 | function (config) { return config.endpoints.getForm != ""; }))
|
552 | .take(1)
|
553 | .switchMap(( |
554 |
|
555 |
|
556 |
|
557 | function (config) {
|
558 | return _this.http.get(stringTemplate(config.env.frontend_server + config.endpoints.getForm, { _id: _id }));
|
559 | }))
|
560 | .map(( |
561 |
|
562 |
|
563 |
|
564 | function (response) { return response.Result; }));
|
565 | };
|
566 | |
567 |
|
568 |
|
569 | FormService.prototype.getList = |
570 |
|
571 |
|
572 | function () {
|
573 | var _this = this;
|
574 | return this.configurationService.config$
|
575 | .filter(( |
576 |
|
577 |
|
578 |
|
579 | function (config) { return config.endpoints.getList != ""; }))
|
580 | .switchMap(( |
581 |
|
582 |
|
583 |
|
584 | function (config) { return _this.http.get(config.env.frontend_server + config.endpoints.getList); }))
|
585 | .map(( |
586 |
|
587 |
|
588 |
|
589 | function (response) { return response.Result; }));
|
590 | };
|
591 | |
592 |
|
593 |
|
594 |
|
595 | FormService.prototype.update = |
596 |
|
597 |
|
598 |
|
599 | function (data) {
|
600 | var _this = this;
|
601 |
|
602 | var model = new EditFormApiModel.Request(data);
|
603 | return this.configurationService.config$
|
604 | .filter(( |
605 |
|
606 |
|
607 |
|
608 | function (config) { return config.endpoints.editForm != ""; }))
|
609 | .take(1)
|
610 | .switchMap(( |
611 |
|
612 |
|
613 |
|
614 | function (config) {
|
615 | return _this.http.put(config.env.frontend_server + config.endpoints.editForm, model.getRequestBody());
|
616 | }))
|
617 | .map(( |
618 |
|
619 |
|
620 |
|
621 | function (response) { return response.Result; }));
|
622 | };
|
623 | |
624 |
|
625 |
|
626 |
|
627 | FormService.prototype.delete = |
628 |
|
629 |
|
630 |
|
631 | function (_id) {
|
632 | var _this = this;
|
633 | return this.configurationService.config$
|
634 | .filter(( |
635 |
|
636 |
|
637 |
|
638 | function (config) { return config.endpoints.deleteForm != ""; }))
|
639 | .switchMap(( |
640 |
|
641 |
|
642 |
|
643 | function (config) { return _this.http.get(config.env.frontend_server + config.endpoints.deleteForm); }));
|
644 | };
|
645 | |
646 |
|
647 |
|
648 |
|
649 | FormService.prototype.selectFormById = |
650 |
|
651 |
|
652 |
|
653 | function (_id) {
|
654 |
|
655 | var subject = new BehaviorSubject$1(undefined);
|
656 | this.store
|
657 | .select(( |
658 |
|
659 |
|
660 |
|
661 | function (state) { return state.form.list.data; }))
|
662 | .pipe(filter(( |
663 |
|
664 |
|
665 |
|
666 | function (forms) { return forms != null; })), map(( |
667 |
|
668 |
|
669 |
|
670 | function (forms) { return forms.find(( |
671 |
|
672 |
|
673 |
|
674 | function (form) { return form._id == _id; })); })))
|
675 | .subscribe(( |
676 |
|
677 |
|
678 |
|
679 | function (formSchemaModel) { return subject.next(formSchemaModel); }));
|
680 | return subject.asObservable();
|
681 | };
|
682 | FormService.decorators = [
|
683 | { type: Injectable, args: [{
|
684 | providedIn: "root"
|
685 | },] }
|
686 | ];
|
687 |
|
688 | FormService.ctorParameters = function () { return [
|
689 | { type: HttpClient },
|
690 | { type: Store },
|
691 | { type: FormConfigurationService }
|
692 | ]; };
|
693 | FormService.ngInjectableDef = ɵɵdefineInjectable({ factory: function FormService_Factory() { return new FormService(ɵɵinject(HttpClient), ɵɵinject(Store), ɵɵinject(FormConfigurationService)); }, token: FormService, providedIn: "root" });
|
694 | return FormService;
|
695 | }());
|
696 | if (false) {
|
697 | |
698 |
|
699 |
|
700 |
|
701 | FormService.prototype.http;
|
702 | |
703 |
|
704 |
|
705 |
|
706 | FormService.prototype.store;
|
707 | |
708 |
|
709 |
|
710 |
|
711 | FormService.prototype.configurationService;
|
712 | }
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 | var SelectComponent = (function () {
|
719 | function SelectComponent() {
|
720 | }
|
721 | SelectComponent.decorators = [
|
722 | { type: Component, args: [{
|
723 | selector: "ngs-form-control-select",
|
724 | 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>",
|
725 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
726 | }] }
|
727 | ];
|
728 |
|
729 | SelectComponent.ctorParameters = function () { return []; };
|
730 | return SelectComponent;
|
731 | }());
|
732 | if (false) {
|
733 |
|
734 | SelectComponent.prototype.config;
|
735 |
|
736 | SelectComponent.prototype.group;
|
737 | }
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 | var CheckboxComponent = (function () {
|
749 | function CheckboxComponent() {
|
750 | }
|
751 | CheckboxComponent.decorators = [
|
752 | { type: Component, args: [{
|
753 | selector: "ngs-form-control-checkbox",
|
754 | template: "<div [formGroup]=\"group\">\r\n <mat-checkbox [formControlName]=\"config.name\">\r\n {{config.title}}\r\n </mat-checkbox>\r\n</div>",
|
755 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
756 | }] }
|
757 | ];
|
758 |
|
759 | CheckboxComponent.ctorParameters = function () { return []; };
|
760 | return CheckboxComponent;
|
761 | }());
|
762 | if (false) {
|
763 |
|
764 | CheckboxComponent.prototype.config;
|
765 |
|
766 | CheckboxComponent.prototype.group;
|
767 | }
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 | var EmailComponent = (function () {
|
779 | function EmailComponent() {
|
780 | }
|
781 | |
782 |
|
783 |
|
784 | EmailComponent.prototype.ngOnInit = |
785 |
|
786 |
|
787 | function () { };
|
788 | EmailComponent.decorators = [
|
789 | { type: Component, args: [{
|
790 | selector: "ngs-form-control-email",
|
791 | 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>",
|
792 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
793 | }] }
|
794 | ];
|
795 |
|
796 | EmailComponent.ctorParameters = function () { return []; };
|
797 | return EmailComponent;
|
798 | }());
|
799 | if (false) {
|
800 |
|
801 | EmailComponent.prototype.config;
|
802 |
|
803 | EmailComponent.prototype.group;
|
804 | }
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 | var ColorComponent = (function () {
|
816 | function ColorComponent() {
|
817 | }
|
818 | |
819 |
|
820 |
|
821 | ColorComponent.prototype.ngOnInit = |
822 |
|
823 |
|
824 | function () { };
|
825 | ColorComponent.decorators = [
|
826 | { type: Component, args: [{
|
827 | selector: "ngs-form-control-color",
|
828 | 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>",
|
829 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
830 | }] }
|
831 | ];
|
832 |
|
833 | ColorComponent.ctorParameters = function () { return []; };
|
834 | ColorComponent.propDecorators = {
|
835 | form: [{ type: Input }],
|
836 | schema: [{ type: Input }]
|
837 | };
|
838 | return ColorComponent;
|
839 | }());
|
840 | if (false) {
|
841 |
|
842 | ColorComponent.prototype.config;
|
843 |
|
844 | ColorComponent.prototype.group;
|
845 |
|
846 | ColorComponent.prototype.form;
|
847 |
|
848 | ColorComponent.prototype.schema;
|
849 | }
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 | var TableComponent = (function () {
|
861 | function TableComponent(http) {
|
862 | this.http = http;
|
863 | this.selection = new SelectionModel(true, []);
|
864 | this.ready = false;
|
865 | }
|
866 | |
867 |
|
868 |
|
869 | TableComponent.prototype.ngOnInit = |
870 |
|
871 |
|
872 | function () {
|
873 | var _this = this;
|
874 | this.http.get(this.schema.dataEndpoint).subscribe(( |
875 |
|
876 |
|
877 |
|
878 | function (data) {
|
879 | _this.ready = true;
|
880 | _this.displayedColumns = data.displayedColumns;
|
881 | _this.filedDisplayedColumns = data.filedDisplayedColumns;
|
882 | _this.dataSource = new MatTableDataSource(data.dataSource);
|
883 | }));
|
884 | };
|
885 |
|
886 | |
887 |
|
888 |
|
889 |
|
890 | TableComponent.prototype.isAllSelected = |
891 |
|
892 |
|
893 |
|
894 | function () {
|
895 | var _a;
|
896 |
|
897 | var numSelected = this.selection.selected.length;
|
898 | this.form.patchValue((_a = {},
|
899 | _a[this.schema.name] = this.selection.selected,
|
900 | _a));
|
901 |
|
902 | var numRows = this.dataSource.data.length;
|
903 | return numSelected === numRows;
|
904 | };
|
905 |
|
906 | |
907 |
|
908 |
|
909 |
|
910 | TableComponent.prototype.masterToggle = |
911 |
|
912 |
|
913 |
|
914 | function () {
|
915 | var _this = this;
|
916 | this.isAllSelected() ? this.selection.clear() : this.dataSource.data.forEach(( |
917 |
|
918 |
|
919 |
|
920 | function (row) { return _this.selection.select(row); }));
|
921 | };
|
922 | TableComponent.decorators = [
|
923 | { type: Component, args: [{
|
924 | selector: "ngs-form-control-table",
|
925 | 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> -->",
|
926 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
927 | }] }
|
928 | ];
|
929 |
|
930 | TableComponent.ctorParameters = function () { return [
|
931 | { type: HttpClient }
|
932 | ]; };
|
933 | TableComponent.propDecorators = {
|
934 | form: [{ type: Input }],
|
935 | schema: [{ type: Input }]
|
936 | };
|
937 | return TableComponent;
|
938 | }());
|
939 | if (false) {
|
940 |
|
941 | TableComponent.prototype.config;
|
942 |
|
943 | TableComponent.prototype.group;
|
944 |
|
945 | TableComponent.prototype.form;
|
946 |
|
947 | TableComponent.prototype.schema;
|
948 |
|
949 | TableComponent.prototype.ready;
|
950 |
|
951 | TableComponent.prototype.displayedColumns;
|
952 |
|
953 | TableComponent.prototype.filedDisplayedColumns;
|
954 |
|
955 | TableComponent.prototype.dataSource;
|
956 |
|
957 | TableComponent.prototype.selection;
|
958 | |
959 |
|
960 |
|
961 |
|
962 | TableComponent.prototype.http;
|
963 | }
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 | var NumberComponent = (function () {
|
975 | function NumberComponent() {
|
976 | }
|
977 | |
978 |
|
979 |
|
980 | NumberComponent.prototype.ngOnInit = |
981 |
|
982 |
|
983 | function () { };
|
984 | NumberComponent.decorators = [
|
985 | { type: Component, args: [{
|
986 | selector: "ngs-form-control-number",
|
987 | 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>",
|
988 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
989 | }] }
|
990 | ];
|
991 |
|
992 | NumberComponent.ctorParameters = function () { return []; };
|
993 | NumberComponent.propDecorators = {
|
994 | form: [{ type: Input }],
|
995 | schema: [{ type: Input }]
|
996 | };
|
997 | return NumberComponent;
|
998 | }());
|
999 | if (false) {
|
1000 |
|
1001 | NumberComponent.prototype.form;
|
1002 |
|
1003 | NumberComponent.prototype.schema;
|
1004 | }
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 | var TextComponent = (function () {
|
1016 | function TextComponent() {
|
1017 | }
|
1018 | TextComponent.decorators = [
|
1019 | { type: Component, args: [{
|
1020 | selector: "ngs-form-control-text",
|
1021 | 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>",
|
1022 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
1023 | }] }
|
1024 | ];
|
1025 |
|
1026 | TextComponent.ctorParameters = function () { return []; };
|
1027 | return TextComponent;
|
1028 | }());
|
1029 | if (false) {
|
1030 |
|
1031 | TextComponent.prototype.config;
|
1032 |
|
1033 | TextComponent.prototype.group;
|
1034 | }
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 | var FormsListActionTypes = {
|
1052 | FORMS_LIST: "[FORM][LIST] FORMS_LIST",
|
1053 | FORMS_LIST_START: "[FORM][LIST] FORMS_LIST_START",
|
1054 | FORMS_LIST_SUCCEED: "[FORM][LIST] FORMS_LIST_SUCCEED",
|
1055 | FORMS_LIST_FAILED: "[FORM][LIST] FORMS_LIST_FAILED",
|
1056 | ADD_FORM_SCHEMA: "[FORM][LIST] ADD_FORM_SCHEMA",
|
1057 | FORM_SCHEMA_UPDATE: "[FORM][LIST] FORM_SCHEMA_UPDATE",
|
1058 | GET_FORM_SCHEMA: "[FORM][LIST] GET_FORM_SCHEMA",
|
1059 | FORM_SCHEMA_FETCHED: "[FORM][LIST] FORM_SCHEMA_FETCHED",
|
1060 | };
|
1061 | var FormsListAction = (function () {
|
1062 | function FormsListAction() {
|
1063 | this.type = FormsListActionTypes.FORMS_LIST;
|
1064 | }
|
1065 | return FormsListAction;
|
1066 | }());
|
1067 | if (false) {
|
1068 |
|
1069 | FormsListAction.prototype.type;
|
1070 | }
|
1071 | var FormsListStartAction = (function () {
|
1072 | function FormsListStartAction() {
|
1073 | this.type = FormsListActionTypes.FORMS_LIST_START;
|
1074 | }
|
1075 | return FormsListStartAction;
|
1076 | }());
|
1077 | if (false) {
|
1078 |
|
1079 | FormsListStartAction.prototype.type;
|
1080 | }
|
1081 | var FormsListSucceedAction = (function () {
|
1082 | function FormsListSucceedAction(payload) {
|
1083 | this.payload = payload;
|
1084 | this.type = FormsListActionTypes.FORMS_LIST_SUCCEED;
|
1085 | }
|
1086 | return FormsListSucceedAction;
|
1087 | }());
|
1088 | if (false) {
|
1089 |
|
1090 | FormsListSucceedAction.prototype.type;
|
1091 |
|
1092 | FormsListSucceedAction.prototype.payload;
|
1093 | }
|
1094 | var FormsListFailedAction = (function () {
|
1095 | function FormsListFailedAction() {
|
1096 | this.type = FormsListActionTypes.FORMS_LIST_FAILED;
|
1097 | }
|
1098 | return FormsListFailedAction;
|
1099 | }());
|
1100 | if (false) {
|
1101 |
|
1102 | FormsListFailedAction.prototype.type;
|
1103 | }
|
1104 | var UpdateFormSchemaAction = (function () {
|
1105 | function UpdateFormSchemaAction(payload) {
|
1106 | this.payload = payload;
|
1107 | this.type = FormsListActionTypes.FORM_SCHEMA_UPDATE;
|
1108 | }
|
1109 | return UpdateFormSchemaAction;
|
1110 | }());
|
1111 | if (false) {
|
1112 |
|
1113 | UpdateFormSchemaAction.prototype.type;
|
1114 |
|
1115 | UpdateFormSchemaAction.prototype.payload;
|
1116 | }
|
1117 | var AddFormSchemaAction = (function () {
|
1118 | function AddFormSchemaAction(payload) {
|
1119 | this.payload = payload;
|
1120 | this.type = FormsListActionTypes.ADD_FORM_SCHEMA;
|
1121 | }
|
1122 | return AddFormSchemaAction;
|
1123 | }());
|
1124 | if (false) {
|
1125 |
|
1126 | AddFormSchemaAction.prototype.type;
|
1127 |
|
1128 | AddFormSchemaAction.prototype.payload;
|
1129 | }
|
1130 | var GetFormSchemaAction = (function () {
|
1131 | function GetFormSchemaAction(payload) {
|
1132 | this.payload = payload;
|
1133 | this.type = FormsListActionTypes.GET_FORM_SCHEMA;
|
1134 | }
|
1135 | return GetFormSchemaAction;
|
1136 | }());
|
1137 | if (false) {
|
1138 |
|
1139 | GetFormSchemaAction.prototype.type;
|
1140 |
|
1141 | GetFormSchemaAction.prototype.payload;
|
1142 | }
|
1143 | var FormSchemaFechedAction = (function () {
|
1144 | function FormSchemaFechedAction(payload) {
|
1145 | this.payload = payload;
|
1146 | this.type = FormsListActionTypes.FORM_SCHEMA_FETCHED;
|
1147 | }
|
1148 | return FormSchemaFechedAction;
|
1149 | }());
|
1150 | if (false) {
|
1151 |
|
1152 | FormSchemaFechedAction.prototype.type;
|
1153 |
|
1154 | FormSchemaFechedAction.prototype.payload;
|
1155 | }
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 | var DateFormInputControlComponent = (function () {
|
1162 | function DateFormInputControlComponent() {
|
1163 | }
|
1164 | DateFormInputControlComponent.decorators = [
|
1165 | { type: Component, args: [{
|
1166 | selector: "ngs-form-control-date",
|
1167 | 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> -->",
|
1168 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
1169 | }] }
|
1170 | ];
|
1171 |
|
1172 | DateFormInputControlComponent.ctorParameters = function () { return []; };
|
1173 | return DateFormInputControlComponent;
|
1174 | }());
|
1175 | if (false) {
|
1176 |
|
1177 | DateFormInputControlComponent.prototype.config;
|
1178 |
|
1179 | DateFormInputControlComponent.prototype.group;
|
1180 | }
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 | var FileFormInputControlComponent = (function () {
|
1187 | function FileFormInputControlComponent() {
|
1188 | }
|
1189 | FileFormInputControlComponent.decorators = [
|
1190 | { type: Component, args: [{
|
1191 | selector: "ngs-form-control-file",
|
1192 | 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> -->",
|
1193 | styles: [":host{display:block}.mat-form-field{width:100%}"]
|
1194 | }] }
|
1195 | ];
|
1196 |
|
1197 | FileFormInputControlComponent.ctorParameters = function () { return []; };
|
1198 | return FileFormInputControlComponent;
|
1199 | }());
|
1200 | if (false) {
|
1201 |
|
1202 | FileFormInputControlComponent.prototype.config;
|
1203 |
|
1204 | FileFormInputControlComponent.prototype.group;
|
1205 | }
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 | var FormCaptchaService = (function () {
|
1212 | function FormCaptchaService(http, store, configurationService) {
|
1213 | this.http = http;
|
1214 | this.store = store;
|
1215 | this.configurationService = configurationService;
|
1216 | }
|
1217 | |
1218 |
|
1219 |
|
1220 | FormCaptchaService.prototype.getCaptcha = |
1221 |
|
1222 |
|
1223 | function () {
|
1224 | var _this = this;
|
1225 | return this.configurationService.config$.pipe(filter(( |
1226 |
|
1227 |
|
1228 |
|
1229 | function (captcha) { return captcha.endpoints.captchaUrl != ""; })), take(1), switchMap(( |
1230 |
|
1231 |
|
1232 |
|
1233 | function (captcha) {
|
1234 | return _this.http.get(captcha.env.server + captcha.endpoints.captchaUrl);
|
1235 | })), map(( |
1236 |
|
1237 |
|
1238 |
|
1239 | function (response) { return response.Result; })));
|
1240 | };
|
1241 | |
1242 |
|
1243 |
|
1244 | FormCaptchaService.prototype.sendCaptcha = |
1245 |
|
1246 |
|
1247 | function () {
|
1248 | var _this = this;
|
1249 | return this.configurationService.config$.pipe(filter(( |
1250 |
|
1251 |
|
1252 |
|
1253 | function (config) { return config.endpoints.getList != ""; })), switchMap(( |
1254 |
|
1255 |
|
1256 |
|
1257 | function (config) { return _this.http.get(config.env.server + config.endpoints.getList); })), map(( |
1258 |
|
1259 |
|
1260 |
|
1261 | function (response) { return response.Result; })));
|
1262 | };
|
1263 | FormCaptchaService.decorators = [
|
1264 | { type: Injectable, args: [{
|
1265 | providedIn: "root"
|
1266 | },] }
|
1267 | ];
|
1268 |
|
1269 | FormCaptchaService.ctorParameters = function () { return [
|
1270 | { type: HttpClient },
|
1271 | { type: Store },
|
1272 | { type: FormConfigurationService }
|
1273 | ]; };
|
1274 | FormCaptchaService.ngInjectableDef = ɵɵdefineInjectable({ factory: function FormCaptchaService_Factory() { return new FormCaptchaService(ɵɵinject(HttpClient), ɵɵinject(Store), ɵɵinject(FormConfigurationService)); }, token: FormCaptchaService, providedIn: "root" });
|
1275 | return FormCaptchaService;
|
1276 | }());
|
1277 | if (false) {
|
1278 | |
1279 |
|
1280 |
|
1281 |
|
1282 | FormCaptchaService.prototype.http;
|
1283 | |
1284 |
|
1285 |
|
1286 |
|
1287 | FormCaptchaService.prototype.store;
|
1288 | |
1289 |
|
1290 |
|
1291 |
|
1292 | FormCaptchaService.prototype.configurationService;
|
1293 | }
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 | var CaptchaModel = (function () {
|
1300 | function CaptchaModel(_a) {
|
1301 | var _b = _a === void 0 ? {} : _a, captchaImg = _b.captchaImg, captchaCode = _b.captchaCode;
|
1302 | this.captchaImg = captchaImg + "?" + Math.random();
|
1303 | this.captchaCode = captchaCode || "";
|
1304 | }
|
1305 | return CaptchaModel;
|
1306 | }());
|
1307 | if (false) {
|
1308 |
|
1309 | CaptchaModel.prototype.captchaImg;
|
1310 |
|
1311 | CaptchaModel.prototype.captchaCode;
|
1312 | }
|
1313 | var UpsertCaptchaApiModel;
|
1314 | (function (UpsertCaptchaApiModel) {
|
1315 | var Request = (function () {
|
1316 | function Request(initValue) {
|
1317 | var _this = this;
|
1318 | if (initValue === void 0) { initValue = {}; }
|
1319 | Object.keys(initValue).forEach(( |
1320 |
|
1321 |
|
1322 |
|
1323 | function (key) { return (_this[key] = initValue[key]); }));
|
1324 | }
|
1325 | |
1326 |
|
1327 |
|
1328 | Request.prototype.getRequestBody = |
1329 |
|
1330 |
|
1331 | function () {
|
1332 | return this.Captcha.captchaCode;
|
1333 | };
|
1334 | return Request;
|
1335 | }());
|
1336 | UpsertCaptchaApiModel.Request = Request;
|
1337 | if (false) {
|
1338 |
|
1339 | Request.prototype.Captcha;
|
1340 | }
|
1341 | var Response = (function () {
|
1342 | function Response() {
|
1343 | }
|
1344 | return Response;
|
1345 | }());
|
1346 | UpsertCaptchaApiModel.Response = Response;
|
1347 | if (false) {
|
1348 |
|
1349 | Response.prototype.Result;
|
1350 | }
|
1351 | })(UpsertCaptchaApiModel || (UpsertCaptchaApiModel = {}));
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 | var FormCaptchaComponent = (function () {
|
1358 | function FormCaptchaComponent(service, store, configurationService) {
|
1359 |
|
1360 |
|
1361 |
|
1362 | this.service = service;
|
1363 | this.store = store;
|
1364 | this.configurationService = configurationService;
|
1365 | this._captcha_generate();
|
1366 | }
|
1367 | |
1368 |
|
1369 |
|
1370 | FormCaptchaComponent.prototype.ngOnInit = |
1371 |
|
1372 |
|
1373 | function () {
|
1374 | var _this = this;
|
1375 | this.store.select(( |
1376 |
|
1377 |
|
1378 |
|
1379 | function (s) { return s.authentication.captcha.captcha; })).subscribe(( |
1380 |
|
1381 |
|
1382 |
|
1383 | function (e) { return _this.refresh(); }));
|
1384 | };
|
1385 | |
1386 |
|
1387 |
|
1388 | FormCaptchaComponent.prototype.refresh = |
1389 |
|
1390 |
|
1391 | function () {
|
1392 | this.captcha.captchaImg = this._captcha_generate() + ("?" + Math.random());
|
1393 | };
|
1394 | |
1395 |
|
1396 |
|
1397 | FormCaptchaComponent.prototype._captcha_generate = |
1398 |
|
1399 |
|
1400 | function () {
|
1401 | var _this = this;
|
1402 | this.configurationService.config$.pipe(map(( |
1403 |
|
1404 |
|
1405 |
|
1406 | function (config) { return config.env.server + config.endpoints.captchaUrl; }))).subscribe(( |
1407 |
|
1408 |
|
1409 |
|
1410 | function (captcha) {
|
1411 | _this.captcha = new CaptchaModel({
|
1412 | captchaImg: captcha
|
1413 | });
|
1414 | }));
|
1415 | };
|
1416 | FormCaptchaComponent.decorators = [
|
1417 | { type: Component, args: [{
|
1418 | selector: "lib-form-captcha",
|
1419 | template: "<div fxLayout=\"row wrap\" fxLayoutAlign=\"start center\">\r\n <img [src]=\"captcha.captchaImg\" />\r\n\r\n <button type=\"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>",
|
1420 | styles: ["img{border:1px solid #e4e4e4}"]
|
1421 | }] }
|
1422 | ];
|
1423 |
|
1424 | FormCaptchaComponent.ctorParameters = function () { return [
|
1425 | { type: FormCaptchaService },
|
1426 | { type: Store },
|
1427 | { type: FormConfigurationService }
|
1428 | ]; };
|
1429 | return FormCaptchaComponent;
|
1430 | }());
|
1431 | if (false) {
|
1432 |
|
1433 | FormCaptchaComponent.prototype.config;
|
1434 |
|
1435 | FormCaptchaComponent.prototype.group;
|
1436 |
|
1437 | FormCaptchaComponent.prototype.captcha;
|
1438 |
|
1439 | FormCaptchaComponent.prototype.captchaSrc;
|
1440 | |
1441 |
|
1442 |
|
1443 |
|
1444 | FormCaptchaComponent.prototype.service;
|
1445 | |
1446 |
|
1447 |
|
1448 |
|
1449 | FormCaptchaComponent.prototype.store;
|
1450 | |
1451 |
|
1452 |
|
1453 |
|
1454 | FormCaptchaComponent.prototype.configurationService;
|
1455 | }
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 | var FormViewComponent = (function () {
|
1467 | function FormViewComponent(service, compiler, resolver, store) {
|
1468 | var _this = this;
|
1469 | this.service = service;
|
1470 | this.compiler = compiler;
|
1471 | this.resolver = resolver;
|
1472 | this.store = store;
|
1473 | this.unsubscribe = new Subject();
|
1474 | this.accept = new EventEmitter();
|
1475 | this.cancel = new EventEmitter();
|
1476 | this.card = false;
|
1477 | this.formGroupCreated = false;
|
1478 | this.schema$ = new BehaviorSubject$1(undefined);
|
1479 | this.schema$.pipe(takeUntil(this.unsubscribe)).subscribe(( |
1480 |
|
1481 |
|
1482 |
|
1483 | function (schema) {
|
1484 | if (!schema)
|
1485 | return;
|
1486 | _this.formGroup = ( (_this.createFrom(schema.form)));
|
1487 | if (!schema.form.name)
|
1488 | return;
|
1489 | _this.formGroupCreated = true;
|
1490 | }));
|
1491 | }
|
1492 | Object.defineProperty(FormViewComponent.prototype, "id", {
|
1493 | set: /**
|
1494 | * @param {?} id
|
1495 | * @return {?}
|
1496 | */
|
1497 | function (id) {
|
1498 | var _this = this;
|
1499 | if (!this.local)
|
1500 | this.store.dispatch(new GetFormSchemaAction(id));
|
1501 | this.service
|
1502 | .selectFormById(id)
|
1503 | .pipe(takeUntil(this.unsubscribe))
|
1504 | .subscribe(( |
1505 |
|
1506 |
|
1507 |
|
1508 | function (schema) { return _this.schema$.next(schema); }));
|
1509 | },
|
1510 | enumerable: true,
|
1511 | configurable: true
|
1512 | });
|
1513 | Object.defineProperty(FormViewComponent.prototype, "schema", {
|
1514 | set: /**
|
1515 | * @param {?} schema
|
1516 | * @return {?}
|
1517 | */
|
1518 | function (schema) {
|
1519 | this.schema$.next(schema);
|
1520 | },
|
1521 | enumerable: true,
|
1522 | configurable: true
|
1523 | });
|
1524 | |
1525 |
|
1526 |
|
1527 | FormViewComponent.prototype.ngOnDestroy = |
1528 |
|
1529 |
|
1530 | function () {
|
1531 | this.unsubscribe.next();
|
1532 | this.unsubscribe.complete();
|
1533 | };
|
1534 | |
1535 |
|
1536 |
|
1537 |
|
1538 | FormViewComponent.prototype.generate = |
1539 |
|
1540 |
|
1541 |
|
1542 | function (schema) {
|
1543 | this.schema$.next(schema);
|
1544 | };
|
1545 | |
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 | FormViewComponent.prototype.createFrom = |
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 | function (data, parentPath) {
|
1556 | var _this = this;
|
1557 | if (parentPath === void 0) { parentPath = ""; }
|
1558 | if (data.type == "control") {
|
1559 |
|
1560 | var formGroupPath = void 0;
|
1561 | if (data.parentType == "array") {
|
1562 |
|
1563 | }
|
1564 | else if (data.parentType == "group") {
|
1565 | formGroupPath = parentPath;
|
1566 | parentPath = parentPath + ".controls." + (( (data))).name;
|
1567 | }
|
1568 |
|
1569 | var validators = [];
|
1570 | if (data.validator.required && data.validator.required.active) {
|
1571 | validators.push(Validators.required);
|
1572 | }
|
1573 | if (data.validator.minlength && data.validator.minlength.active) {
|
1574 | validators.push(Validators.minLength(data.validator.minlength.value));
|
1575 | }
|
1576 | if (data.validator.email && data.validator.email.active) {
|
1577 | validators.push(Validators.email);
|
1578 | }
|
1579 |
|
1580 | var ctr = new FormControl(data.value, validators);
|
1581 | (( (ctr))).schema = data;
|
1582 | (( (ctr))).schema.path = parentPath;
|
1583 | (( (ctr))).schema.formGroupPath = formGroupPath;
|
1584 | return ctr;
|
1585 | }
|
1586 | else if (data.type == "group") {
|
1587 |
|
1588 | var formGroup_1 = new FormGroup({});
|
1589 | if (data.parentType == undefined) {
|
1590 | parentPath = (( (data))).name;
|
1591 | }
|
1592 | else if (data.parentType == "array") {
|
1593 | parentPath = parentPath + ".controls[" + (( (data))).name + "]";
|
1594 | }
|
1595 | else if (data.parentType == "group") {
|
1596 | parentPath = parentPath + ".controls." + (( (data))).name;
|
1597 | }
|
1598 | (( (formGroup_1))).schema = data;
|
1599 | (( (formGroup_1))).schema.path = parentPath;
|
1600 | data.fields.forEach(( |
1601 |
|
1602 |
|
1603 |
|
1604 | function (item) {
|
1605 | item.parentType = "group";
|
1606 | formGroup_1.addControl(item.name, _this.createFrom(item, parentPath));
|
1607 | }));
|
1608 | return formGroup_1;
|
1609 | }
|
1610 | else {
|
1611 |
|
1612 | var formArray_1 = new FormArray([]);
|
1613 | parentPath =
|
1614 | parentPath == "" ? (( (data))).name : parentPath + ".controls." + (( (data))).name;
|
1615 | (( (formArray_1))).schema = data;
|
1616 | (( (formArray_1))).schema.path = parentPath;
|
1617 | data.fields.forEach(( |
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 | function (item, idx) {
|
1623 | item.parentType = "array";
|
1624 | item.name = idx.toString();
|
1625 | formArray_1.controls.push(_this.createFrom(item, parentPath));
|
1626 | }));
|
1627 | return formArray_1;
|
1628 | }
|
1629 | };
|
1630 | |
1631 |
|
1632 |
|
1633 | FormViewComponent.prototype.accepted = |
1634 |
|
1635 |
|
1636 | function () {
|
1637 | this.accept.emit(this.formGroup);
|
1638 | };
|
1639 | |
1640 |
|
1641 |
|
1642 | FormViewComponent.prototype.canceled = |
1643 |
|
1644 |
|
1645 | function () {
|
1646 | this.cancel.emit(this.formGroup);
|
1647 | };
|
1648 | FormViewComponent.decorators = [
|
1649 | { type: Component, args: [{
|
1650 | selector: "ngs-form-view",
|
1651 | 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>",
|
1652 | styles: [""]
|
1653 | }] }
|
1654 | ];
|
1655 |
|
1656 | FormViewComponent.ctorParameters = function () { return [
|
1657 | { type: FormService },
|
1658 | { type: Compiler },
|
1659 | { type: ComponentFactoryResolver },
|
1660 | { type: Store }
|
1661 | ]; };
|
1662 | FormViewComponent.propDecorators = {
|
1663 | accept: [{ type: Output }],
|
1664 | cancel: [{ type: Output }],
|
1665 | local: [{ type: Input }],
|
1666 | card: [{ type: Input }],
|
1667 | id: [{ type: Input }],
|
1668 | schema: [{ type: Input }]
|
1669 | };
|
1670 | return FormViewComponent;
|
1671 | }());
|
1672 | if (false) {
|
1673 |
|
1674 | FormViewComponent.prototype.unsubscribe;
|
1675 |
|
1676 | FormViewComponent.prototype.accept;
|
1677 |
|
1678 | FormViewComponent.prototype.cancel;
|
1679 |
|
1680 | FormViewComponent.prototype.local;
|
1681 |
|
1682 | FormViewComponent.prototype.card;
|
1683 |
|
1684 | FormViewComponent.prototype._id;
|
1685 |
|
1686 | FormViewComponent.prototype.formGroup;
|
1687 |
|
1688 | FormViewComponent.prototype.formGroupCreated;
|
1689 |
|
1690 | FormViewComponent.prototype.schema$;
|
1691 | |
1692 |
|
1693 |
|
1694 |
|
1695 | FormViewComponent.prototype.service;
|
1696 | |
1697 |
|
1698 |
|
1699 |
|
1700 | FormViewComponent.prototype.compiler;
|
1701 | |
1702 |
|
1703 |
|
1704 |
|
1705 | FormViewComponent.prototype.resolver;
|
1706 | |
1707 |
|
1708 |
|
1709 |
|
1710 | FormViewComponent.prototype.store;
|
1711 | }
|
1712 |
|
1713 | var components = {
|
1714 | checkbox: CheckboxComponent,
|
1715 | text: TextComponent,
|
1716 | password: TextComponent,
|
1717 | date: DateFormInputControlComponent,
|
1718 | file: FileFormInputControlComponent,
|
1719 | table: TableComponent,
|
1720 | color: ColorComponent,
|
1721 | email: EmailComponent,
|
1722 | captcha: FormCaptchaComponent,
|
1723 | select: SelectComponent
|
1724 | };
|
1725 | var DynamicFieldDirective = (function () {
|
1726 | function DynamicFieldDirective(resolver, container) {
|
1727 | this.resolver = resolver;
|
1728 | this.container = container;
|
1729 | }
|
1730 | |
1731 |
|
1732 |
|
1733 | DynamicFieldDirective.prototype.ngOnChanges = |
1734 |
|
1735 |
|
1736 | function () {
|
1737 | if (this.component) {
|
1738 | this.component.instance.config = this.config;
|
1739 | this.component.instance.group = this.group;
|
1740 | }
|
1741 | };
|
1742 | |
1743 |
|
1744 |
|
1745 | DynamicFieldDirective.prototype.ngOnInit = |
1746 |
|
1747 |
|
1748 | function () {
|
1749 | if (this.config.inputType == undefined)
|
1750 | return;
|
1751 | if (!components[this.config.inputType]) {
|
1752 |
|
1753 | var supportedTypes = Object.keys(components).join(", ");
|
1754 | throw new Error("Trying to use an unsupported type (" + this.config.inputType + ").\n\t\t Supported types: " + supportedTypes);
|
1755 | }
|
1756 |
|
1757 | var component = this.resolver.resolveComponentFactory(components[this.config.inputType]);
|
1758 | this.component = this.container.createComponent(component);
|
1759 | this.component.instance.config = this.config;
|
1760 | this.component.instance.group = this.group;
|
1761 | };
|
1762 | DynamicFieldDirective.decorators = [
|
1763 | { type: Directive, args: [{
|
1764 | selector: "[dynamicField]"
|
1765 | },] }
|
1766 | ];
|
1767 |
|
1768 | DynamicFieldDirective.ctorParameters = function () { return [
|
1769 | { type: ComponentFactoryResolver },
|
1770 | { type: ViewContainerRef }
|
1771 | ]; };
|
1772 | DynamicFieldDirective.propDecorators = {
|
1773 | config: [{ type: Input }],
|
1774 | group: [{ type: Input }]
|
1775 | };
|
1776 | return DynamicFieldDirective;
|
1777 | }());
|
1778 | if (false) {
|
1779 |
|
1780 | DynamicFieldDirective.prototype.config;
|
1781 |
|
1782 | DynamicFieldDirective.prototype.group;
|
1783 |
|
1784 | DynamicFieldDirective.prototype.component;
|
1785 | |
1786 |
|
1787 |
|
1788 |
|
1789 | DynamicFieldDirective.prototype.resolver;
|
1790 | |
1791 |
|
1792 |
|
1793 |
|
1794 | DynamicFieldDirective.prototype.container;
|
1795 | }
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 | function State() { }
|
1805 | if (false) {
|
1806 |
|
1807 | State.prototype.status;
|
1808 |
|
1809 | State.prototype.data;
|
1810 | }
|
1811 | var ɵ0 = [];
|
1812 |
|
1813 | var initialState = {
|
1814 | status: "pristine",
|
1815 | data: ɵ0
|
1816 | };
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 | function reducer(state, action) {
|
1823 | if (state === void 0) { state = initialState; }
|
1824 | switch (action.type) {
|
1825 | case FormsListActionTypes.FORMS_LIST: {
|
1826 | return __assign({}, state, { status: "dirty" });
|
1827 | }
|
1828 | case FormsListActionTypes.FORMS_LIST_START: {
|
1829 | return __assign({}, state, { status: "pending" });
|
1830 | }
|
1831 | case FormsListActionTypes.FORMS_LIST_SUCCEED: {
|
1832 | return __assign({}, state, { data: action.payload, status: "succeed" });
|
1833 | }
|
1834 | case FormsListActionTypes.FORMS_LIST_FAILED: {
|
1835 | return __assign({}, state, { status: "failed" });
|
1836 | }
|
1837 | case FormsListActionTypes.FORM_SCHEMA_UPDATE: {
|
1838 |
|
1839 | var data = state.data.concat();
|
1840 |
|
1841 | var entityIdx = state.data.findIndex(( |
1842 |
|
1843 |
|
1844 |
|
1845 | function (form) { return form._id == action.payload._id; }));
|
1846 | if (entityIdx > -1) {
|
1847 | data[entityIdx] = Object.assign({}, data[entityIdx], action.payload);
|
1848 | }
|
1849 | else {
|
1850 | data.push(action.payload);
|
1851 | }
|
1852 | return __assign({}, state, { data: data });
|
1853 | }
|
1854 | case FormsListActionTypes.ADD_FORM_SCHEMA: {
|
1855 |
|
1856 | var data = state.data.concat();
|
1857 |
|
1858 | var entityIdx = state.data.findIndex(( |
1859 |
|
1860 |
|
1861 |
|
1862 | function (form) { return form._id == action.payload._id; }));
|
1863 | if (entityIdx > -1) {
|
1864 | data[entityIdx] = Object.assign({}, data[entityIdx], action.payload);
|
1865 | }
|
1866 | else {
|
1867 | data.push(action.payload);
|
1868 | }
|
1869 | return __assign({}, state, { data: data });
|
1870 | }
|
1871 | case FormsListActionTypes.FORM_SCHEMA_FETCHED: {
|
1872 |
|
1873 | var data = state.data.concat();
|
1874 |
|
1875 | var entityIdx = state.data.findIndex(( |
1876 |
|
1877 |
|
1878 |
|
1879 | function (form) { return form._id == action.payload._id; }));
|
1880 | if (entityIdx > -1) {
|
1881 | data[entityIdx] = Object.assign({}, data[entityIdx], action.payload);
|
1882 | }
|
1883 | else {
|
1884 | data.push(action.payload);
|
1885 | }
|
1886 | return __assign({}, state, { data: data });
|
1887 | }
|
1888 | default: {
|
1889 | return state;
|
1890 | }
|
1891 | }
|
1892 | }
|
1893 |
|
1894 | var getStatus = ( |
1895 |
|
1896 |
|
1897 |
|
1898 | function (state) { return state.status; });
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 | function FormState() { }
|
1908 | if (false) {
|
1909 |
|
1910 | FormState.prototype.list;
|
1911 | }
|
1912 |
|
1913 | var FormReducers = {
|
1914 | list: reducer
|
1915 | };
|
1916 |
|
1917 |
|
1918 |
|
1919 | function MainContainerState() { }
|
1920 | if (false) {
|
1921 |
|
1922 | MainContainerState.prototype.form;
|
1923 | }
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 | var FormGroupComponent = (function () {
|
1930 | function FormGroupComponent() {
|
1931 | this.noHeader = false;
|
1932 | this.changes = new EventEmitter();
|
1933 | this.delete = new EventEmitter();
|
1934 | }
|
1935 | |
1936 |
|
1937 |
|
1938 | FormGroupComponent.prototype.changed = |
1939 |
|
1940 |
|
1941 | function () {
|
1942 | this.changes.emit();
|
1943 | };
|
1944 | |
1945 |
|
1946 |
|
1947 |
|
1948 | FormGroupComponent.prototype.addFormGroup = |
1949 |
|
1950 |
|
1951 |
|
1952 | function (root) {
|
1953 |
|
1954 | var group = new FieldConfig("group");
|
1955 | group.fields = [];
|
1956 | root.fields.push(group);
|
1957 | this.schema.id = this.schema.id + 1;
|
1958 | return group;
|
1959 | };
|
1960 | |
1961 |
|
1962 |
|
1963 |
|
1964 | FormGroupComponent.prototype.addFormArray = |
1965 |
|
1966 |
|
1967 |
|
1968 | function (root) {
|
1969 |
|
1970 | var array = new FieldConfig("array");
|
1971 | array.fields = [];
|
1972 | root.fields.push(array);
|
1973 | return array;
|
1974 | };
|
1975 | |
1976 |
|
1977 |
|
1978 |
|
1979 | FormGroupComponent.prototype.addFormControl = |
1980 |
|
1981 |
|
1982 |
|
1983 | function (root) {
|
1984 |
|
1985 | var control = new FieldConfig("control");
|
1986 | root.fields.push(control);
|
1987 | return control;
|
1988 | };
|
1989 | |
1990 |
|
1991 |
|
1992 |
|
1993 | FormGroupComponent.prototype.deleteFormGroup = |
1994 |
|
1995 |
|
1996 |
|
1997 | function (idx) {
|
1998 | this.schema.fields.splice(idx, 1);
|
1999 | };
|
2000 | FormGroupComponent.decorators = [
|
2001 | { type: Component, args: [{
|
2002 | selector: "app-form-group",
|
2003 | 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>"
|
2004 | }] }
|
2005 | ];
|
2006 |
|
2007 | FormGroupComponent.ctorParameters = function () { return []; };
|
2008 | FormGroupComponent.propDecorators = {
|
2009 | schema: [{ type: Input }],
|
2010 | noHeader: [{ type: Input }],
|
2011 | changes: [{ type: Output }],
|
2012 | delete: [{ type: Output }]
|
2013 | };
|
2014 | return FormGroupComponent;
|
2015 | }());
|
2016 | if (false) {
|
2017 |
|
2018 | FormGroupComponent.prototype.schema;
|
2019 |
|
2020 | FormGroupComponent.prototype.noHeader;
|
2021 |
|
2022 | FormGroupComponent.prototype.changes;
|
2023 |
|
2024 | FormGroupComponent.prototype.delete;
|
2025 | }
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 | var FormArrayComponent = (function () {
|
2032 | function FormArrayComponent() {
|
2033 | this.changes = new EventEmitter();
|
2034 | }
|
2035 | |
2036 |
|
2037 |
|
2038 | FormArrayComponent.prototype.changed = |
2039 |
|
2040 |
|
2041 | function () {
|
2042 | this.changes.emit();
|
2043 | };
|
2044 | |
2045 |
|
2046 |
|
2047 |
|
2048 | FormArrayComponent.prototype.addFormGroup = |
2049 |
|
2050 |
|
2051 |
|
2052 | function (root) {
|
2053 |
|
2054 | var group = new FieldConfig("group");
|
2055 | group.fields = [];
|
2056 | root.fields.push(group);
|
2057 | return group;
|
2058 | };
|
2059 | |
2060 |
|
2061 |
|
2062 |
|
2063 | FormArrayComponent.prototype.addFormArray = |
2064 |
|
2065 |
|
2066 |
|
2067 | function (root) {
|
2068 |
|
2069 | var array = new FieldConfig("array");
|
2070 | array.fields = [];
|
2071 | root.fields.push(array);
|
2072 | return array;
|
2073 | };
|
2074 | |
2075 |
|
2076 |
|
2077 |
|
2078 | FormArrayComponent.prototype.addFormControl = |
2079 |
|
2080 |
|
2081 |
|
2082 | function (root) {
|
2083 |
|
2084 | var control = new FieldConfig("control");
|
2085 | root.fields.push(control);
|
2086 | return control;
|
2087 | };
|
2088 | FormArrayComponent.decorators = [
|
2089 | { type: Component, args: [{
|
2090 | selector: "app-form-array",
|
2091 | 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>"
|
2092 | }] }
|
2093 | ];
|
2094 |
|
2095 | FormArrayComponent.ctorParameters = function () { return []; };
|
2096 | FormArrayComponent.propDecorators = {
|
2097 | schema: [{ type: Input }],
|
2098 | changes: [{ type: Output }]
|
2099 | };
|
2100 | return FormArrayComponent;
|
2101 | }());
|
2102 | if (false) {
|
2103 |
|
2104 | FormArrayComponent.prototype.schema;
|
2105 |
|
2106 | FormArrayComponent.prototype.changes;
|
2107 | }
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 | var FormControlComponent = (function () {
|
2114 | function FormControlComponent() {
|
2115 | this.changes = new EventEmitter();
|
2116 | this.delete = new EventEmitter();
|
2117 | this.width = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
2118 | this.options = new FormArray([
|
2119 | new FormGroup({
|
2120 | key: new FormControl(),
|
2121 | value: new FormControl()
|
2122 | })
|
2123 | ]);
|
2124 | this.tableOptions = new FormGroup({
|
2125 | dataEndpoint: new FormControl("")
|
2126 | });
|
2127 | }
|
2128 | |
2129 |
|
2130 |
|
2131 | FormControlComponent.prototype.changed = |
2132 |
|
2133 |
|
2134 | function () {
|
2135 | if ([this.schema.name, this.schema.title, this.schema.inputType].some(( |
2136 |
|
2137 |
|
2138 |
|
2139 | function (item) { return !item; })))
|
2140 | return true;
|
2141 | if (this.schema.inputType == "table") {
|
2142 | this.schema.options = this.tableOptions.value;
|
2143 | }
|
2144 | else if (this.schema.inputType == "select") {
|
2145 | this.schema.options = this.options.value;
|
2146 | }
|
2147 | this.changes.emit();
|
2148 | };
|
2149 | |
2150 |
|
2151 |
|
2152 | FormControlComponent.prototype.addOption = |
2153 |
|
2154 |
|
2155 | function () {
|
2156 | this.options.push(new FormGroup({
|
2157 | key: new FormControl(),
|
2158 | value: new FormControl()
|
2159 | }));
|
2160 | };
|
2161 | |
2162 |
|
2163 |
|
2164 |
|
2165 | FormControlComponent.prototype.removeOption = |
2166 |
|
2167 |
|
2168 |
|
2169 | function (i) {
|
2170 | this.options.controls.splice(i, 1);
|
2171 | };
|
2172 | |
2173 |
|
2174 |
|
2175 | FormControlComponent.prototype.insertOptions = |
2176 |
|
2177 |
|
2178 | function () {
|
2179 | this.schema.options = this.options.value;
|
2180 | };
|
2181 | FormControlComponent.decorators = [
|
2182 | { type: Component, args: [{
|
2183 | selector: "app-form-control",
|
2184 | 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>"
|
2185 | }] }
|
2186 | ];
|
2187 |
|
2188 | FormControlComponent.ctorParameters = function () { return []; };
|
2189 | FormControlComponent.propDecorators = {
|
2190 | schema: [{ type: Input }],
|
2191 | changes: [{ type: Output }],
|
2192 | delete: [{ type: Output }]
|
2193 | };
|
2194 | return FormControlComponent;
|
2195 | }());
|
2196 | if (false) {
|
2197 |
|
2198 | FormControlComponent.prototype.schema;
|
2199 |
|
2200 | FormControlComponent.prototype.changes;
|
2201 |
|
2202 | FormControlComponent.prototype.delete;
|
2203 |
|
2204 | FormControlComponent.prototype.width;
|
2205 |
|
2206 | FormControlComponent.prototype.options;
|
2207 |
|
2208 | FormControlComponent.prototype.tableOptions;
|
2209 | }
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 |
|
2215 |
|
2216 | var EditFormActionTypes = {
|
2217 | EDIT_FORM: "[FORM][EDIT] EDIT_FORM",
|
2218 | EDIT_FORM_START: "[FORM][EDIT] EDIT_FORM_START",
|
2219 | EDIT_FORM_SUCCEED: "[FORM][EDIT] EDIT_FORM_SUCCEED",
|
2220 | EDIT_FORM_FAILED: "[FORM][EDIT] EDIT_FORM_FAILED",
|
2221 | };
|
2222 | var EditFormAction = (function () {
|
2223 | function EditFormAction(payload) {
|
2224 | this.payload = payload;
|
2225 | this.type = EditFormActionTypes.EDIT_FORM;
|
2226 | }
|
2227 | return EditFormAction;
|
2228 | }());
|
2229 | if (false) {
|
2230 |
|
2231 | EditFormAction.prototype.type;
|
2232 |
|
2233 | EditFormAction.prototype.payload;
|
2234 | }
|
2235 | var EditFormStartAction = (function () {
|
2236 | function EditFormStartAction(payload) {
|
2237 | this.payload = payload;
|
2238 | this.type = EditFormActionTypes.EDIT_FORM_START;
|
2239 | }
|
2240 | return EditFormStartAction;
|
2241 | }());
|
2242 | if (false) {
|
2243 |
|
2244 | EditFormStartAction.prototype.type;
|
2245 |
|
2246 | EditFormStartAction.prototype.payload;
|
2247 | }
|
2248 | var EditFormSucceedAction = (function () {
|
2249 | function EditFormSucceedAction(payload) {
|
2250 | this.payload = payload;
|
2251 | this.type = EditFormActionTypes.EDIT_FORM_SUCCEED;
|
2252 | }
|
2253 | return EditFormSucceedAction;
|
2254 | }());
|
2255 | if (false) {
|
2256 |
|
2257 | EditFormSucceedAction.prototype.type;
|
2258 |
|
2259 | EditFormSucceedAction.prototype.payload;
|
2260 | }
|
2261 | var EditFormFailedAction = (function () {
|
2262 | function EditFormFailedAction() {
|
2263 | this.type = EditFormActionTypes.EDIT_FORM_FAILED;
|
2264 | }
|
2265 | return EditFormFailedAction;
|
2266 | }());
|
2267 | if (false) {
|
2268 |
|
2269 | EditFormFailedAction.prototype.type;
|
2270 | }
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 | var AddFormActionTypes = {
|
2278 | ADD_FORM: "[FORM][ADD] ADD_FORM_PROFILE",
|
2279 | ADD_FORM_START: "[FORM][ADD] ADD_FORM_START",
|
2280 | ADD_FORM_SUCCEED: "[FORM][ADD] ADD_FORM_SUCCEED",
|
2281 | ADD_FORM_FAILED: "[FORM][ADD] ADD_FORM_FAILED",
|
2282 | };
|
2283 | var AddFormAction = (function () {
|
2284 | function AddFormAction(payload) {
|
2285 | this.payload = payload;
|
2286 | this.type = AddFormActionTypes.ADD_FORM;
|
2287 | }
|
2288 | return AddFormAction;
|
2289 | }());
|
2290 | if (false) {
|
2291 |
|
2292 | AddFormAction.prototype.type;
|
2293 |
|
2294 | AddFormAction.prototype.payload;
|
2295 | }
|
2296 | var AddFormStartAction = (function () {
|
2297 | function AddFormStartAction(payload) {
|
2298 | this.payload = payload;
|
2299 | this.type = AddFormActionTypes.ADD_FORM_START;
|
2300 | }
|
2301 | return AddFormStartAction;
|
2302 | }());
|
2303 | if (false) {
|
2304 |
|
2305 | AddFormStartAction.prototype.type;
|
2306 |
|
2307 | AddFormStartAction.prototype.payload;
|
2308 | }
|
2309 | var AddFormSucceedAction = (function () {
|
2310 | function AddFormSucceedAction() {
|
2311 | this.type = AddFormActionTypes.ADD_FORM_SUCCEED;
|
2312 | }
|
2313 | return AddFormSucceedAction;
|
2314 | }());
|
2315 | if (false) {
|
2316 |
|
2317 | AddFormSucceedAction.prototype.type;
|
2318 | }
|
2319 | var AddFormFailedAction = (function () {
|
2320 | function AddFormFailedAction() {
|
2321 | this.type = AddFormActionTypes.ADD_FORM_FAILED;
|
2322 | }
|
2323 | return AddFormFailedAction;
|
2324 | }());
|
2325 | if (false) {
|
2326 |
|
2327 | AddFormFailedAction.prototype.type;
|
2328 | }
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 | var AddFormContainerComponent = (function () {
|
2335 | function AddFormContainerComponent(store, service) {
|
2336 | this.store = store;
|
2337 | this.service = service;
|
2338 | }
|
2339 | |
2340 |
|
2341 |
|
2342 | AddFormContainerComponent.prototype.ngOnInit = |
2343 |
|
2344 |
|
2345 | function () {
|
2346 | this.schema = new FormSchemaModel();
|
2347 | this.schema.init();
|
2348 | this.store.dispatch(new AddFormSchemaAction(this.schema));
|
2349 | };
|
2350 | |
2351 |
|
2352 |
|
2353 |
|
2354 | AddFormContainerComponent.prototype.add = |
2355 |
|
2356 |
|
2357 |
|
2358 | function (form) {
|
2359 | this.store.dispatch(new AddFormAction(form));
|
2360 | };
|
2361 | |
2362 |
|
2363 |
|
2364 |
|
2365 | AddFormContainerComponent.prototype.update_schema = |
2366 |
|
2367 |
|
2368 |
|
2369 | function (form) {
|
2370 | this.store.dispatch(new UpdateFormSchemaAction(form));
|
2371 | };
|
2372 | AddFormContainerComponent.decorators = [
|
2373 | { type: Component, args: [{
|
2374 | 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>"
|
2375 | }] }
|
2376 | ];
|
2377 |
|
2378 | AddFormContainerComponent.ctorParameters = function () { return [
|
2379 | { type: Store },
|
2380 | { type: FormService }
|
2381 | ]; };
|
2382 | return AddFormContainerComponent;
|
2383 | }());
|
2384 | if (false) {
|
2385 |
|
2386 | AddFormContainerComponent.prototype.schema;
|
2387 |
|
2388 | AddFormContainerComponent.prototype.store;
|
2389 |
|
2390 | AddFormContainerComponent.prototype.service;
|
2391 | }
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 | var EditFormContainerComponent = (function (_super) {
|
2403 | __extends(EditFormContainerComponent, _super);
|
2404 | function EditFormContainerComponent(service, route, store) {
|
2405 | var _this = _super.call(this, store, service) || this;
|
2406 | _this.service = service;
|
2407 | _this.route = route;
|
2408 | _this.store = store;
|
2409 | _this.formGroup = EditFormApiModel.Request.formGroup;
|
2410 | return _this;
|
2411 | }
|
2412 | |
2413 |
|
2414 |
|
2415 | EditFormContainerComponent.prototype.ngOnInit = |
2416 |
|
2417 |
|
2418 | function () {
|
2419 | var _this = this;
|
2420 | this.route.params
|
2421 | .map(( |
2422 |
|
2423 |
|
2424 |
|
2425 | function (params) { return params["_id"]; }))
|
2426 | .subscribe(( |
2427 |
|
2428 |
|
2429 |
|
2430 | function (id) { return _this.store.dispatch(new GetFormSchemaAction(id)); }));
|
2431 | this.route.params
|
2432 | .map(( |
2433 |
|
2434 |
|
2435 |
|
2436 | function (params) { return params["_id"]; }))
|
2437 | .switchMap(( |
2438 |
|
2439 |
|
2440 |
|
2441 | function (id) { return _this.service.selectFormById(id); }))
|
2442 | .filter(( |
2443 |
|
2444 |
|
2445 |
|
2446 | function (data) { return data != null; }))
|
2447 | .take(1)
|
2448 | .subscribe(( |
2449 |
|
2450 |
|
2451 |
|
2452 | function (formSchema) {
|
2453 | _this.schema = formSchema;
|
2454 | _this.formGroup.patchValue(formSchema);
|
2455 | }));
|
2456 | };
|
2457 | |
2458 |
|
2459 |
|
2460 |
|
2461 | EditFormContainerComponent.prototype.update = |
2462 |
|
2463 |
|
2464 |
|
2465 | function (data) {
|
2466 | this.store.dispatch(new EditFormAction(data));
|
2467 | };
|
2468 | EditFormContainerComponent.decorators = [
|
2469 | { type: Component, args: [{
|
2470 | 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>"
|
2471 | }] }
|
2472 | ];
|
2473 |
|
2474 | EditFormContainerComponent.ctorParameters = function () { return [
|
2475 | { type: FormService },
|
2476 | { type: ActivatedRoute },
|
2477 | { type: Store }
|
2478 | ]; };
|
2479 | return EditFormContainerComponent;
|
2480 | }(AddFormContainerComponent));
|
2481 | if (false) {
|
2482 |
|
2483 | EditFormContainerComponent.prototype.formGroup;
|
2484 |
|
2485 | EditFormContainerComponent.prototype.service;
|
2486 | |
2487 |
|
2488 |
|
2489 |
|
2490 | EditFormContainerComponent.prototype.route;
|
2491 |
|
2492 | EditFormContainerComponent.prototype.store;
|
2493 | }
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 | var AddFormComponent = (function () {
|
2500 | function AddFormComponent() {
|
2501 | this.formGroup = AddFormApiModel.Request.formGroup;
|
2502 | this.submited = new EventEmitter();
|
2503 | this.changes = new EventEmitter();
|
2504 | }
|
2505 | |
2506 |
|
2507 |
|
2508 | AddFormComponent.prototype.emit = |
2509 |
|
2510 |
|
2511 | function () {
|
2512 | this.formGroup.patchValue({ form: this.schema.form });
|
2513 | this.submited.emit(this.formGroup.value);
|
2514 | };
|
2515 | |
2516 |
|
2517 |
|
2518 | AddFormComponent.prototype.changed = |
2519 |
|
2520 |
|
2521 | function () {
|
2522 | this.formGroup.patchValue({ form: this.schema.form });
|
2523 | this.changes.emit(this.formGroup.value);
|
2524 | };
|
2525 | |
2526 |
|
2527 |
|
2528 |
|
2529 | AddFormComponent.prototype.changeOrder = |
2530 |
|
2531 |
|
2532 |
|
2533 | function ($event) { };
|
2534 | |
2535 |
|
2536 |
|
2537 |
|
2538 | AddFormComponent.prototype.addFormGroup = |
2539 |
|
2540 |
|
2541 |
|
2542 | function (root) {
|
2543 |
|
2544 | var group = new FieldConfig("group");
|
2545 | group.fields = [];
|
2546 | root.fields.push(group);
|
2547 | return group;
|
2548 | };
|
2549 | |
2550 |
|
2551 |
|
2552 |
|
2553 | AddFormComponent.prototype.addFormArray = |
2554 |
|
2555 |
|
2556 |
|
2557 | function (root) {
|
2558 |
|
2559 | var array = new FieldConfig("array");
|
2560 | array.fields = [];
|
2561 | root.fields.push(array);
|
2562 | return array;
|
2563 | };
|
2564 | |
2565 |
|
2566 |
|
2567 |
|
2568 | AddFormComponent.prototype.addFormControl = |
2569 |
|
2570 |
|
2571 |
|
2572 | function (root) {
|
2573 |
|
2574 | var control = new FieldConfig("control");
|
2575 | root.fields.push(control);
|
2576 | return control;
|
2577 | };
|
2578 | AddFormComponent.decorators = [
|
2579 | { type: Component, args: [{
|
2580 | selector: "ngs-form-add",
|
2581 | 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>"
|
2582 | }] }
|
2583 | ];
|
2584 | AddFormComponent.propDecorators = {
|
2585 | schema: [{ type: Input }],
|
2586 | formGroup: [{ type: Input }],
|
2587 | submited: [{ type: Output }],
|
2588 | changes: [{ type: Output }]
|
2589 | };
|
2590 | return AddFormComponent;
|
2591 | }());
|
2592 | if (false) {
|
2593 |
|
2594 | AddFormComponent.prototype.schema;
|
2595 |
|
2596 | AddFormComponent.prototype.formGroup;
|
2597 |
|
2598 | AddFormComponent.prototype.submited;
|
2599 |
|
2600 | AddFormComponent.prototype.changes;
|
2601 | }
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 | var EditFormComponent = (function (_super) {
|
2613 | __extends(EditFormComponent, _super);
|
2614 | function EditFormComponent() {
|
2615 | return _super !== null && _super.apply(this, arguments) || this;
|
2616 | }
|
2617 | |
2618 |
|
2619 |
|
2620 | EditFormComponent.prototype.emit = |
2621 |
|
2622 |
|
2623 | function () {
|
2624 | if (!this.formGroup.valid)
|
2625 | return;
|
2626 | return this.submited.emit(this.formGroup.value);
|
2627 | };
|
2628 | EditFormComponent.decorators = [
|
2629 | { type: Component, args: [{
|
2630 | selector: "edit-form",
|
2631 | 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>",
|
2632 | styles: [".form-buttons,.schema-form{padding:25px 10px}"]
|
2633 | }] }
|
2634 | ];
|
2635 | EditFormComponent.propDecorators = {
|
2636 | schema: [{ type: Input }]
|
2637 | };
|
2638 | return EditFormComponent;
|
2639 | }(AddFormComponent));
|
2640 | if (false) {
|
2641 |
|
2642 | EditFormComponent.prototype.schema;
|
2643 | }
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 | var FormListContainerComponent = (function () {
|
2650 | function FormListContainerComponent(store) {
|
2651 | this.store = store;
|
2652 | this.data$ = this.store.select(( |
2653 |
|
2654 |
|
2655 |
|
2656 | function (state) { return state.form.list.data; }));
|
2657 | }
|
2658 | |
2659 |
|
2660 |
|
2661 | FormListContainerComponent.prototype.ngOnInit = |
2662 |
|
2663 |
|
2664 | function () {
|
2665 | this.store.dispatch(new FormsListAction());
|
2666 | };
|
2667 | FormListContainerComponent.decorators = [
|
2668 | { type: Component, args: [{
|
2669 | template: "<form-list\n\t\t\t\t\t[data]=\"data$\">\n\t\t\t\t</form-list>"
|
2670 | }] }
|
2671 | ];
|
2672 |
|
2673 | FormListContainerComponent.ctorParameters = function () { return [
|
2674 | { type: Store }
|
2675 | ]; };
|
2676 | return FormListContainerComponent;
|
2677 | }());
|
2678 | if (false) {
|
2679 |
|
2680 | FormListContainerComponent.prototype.data$;
|
2681 |
|
2682 | FormListContainerComponent.prototype.store;
|
2683 | }
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 | var FormListComponent = (function () {
|
2690 | function FormListComponent() {
|
2691 | }
|
2692 | FormListComponent.decorators = [
|
2693 | { type: Component, args: [{
|
2694 | selector: "form-list",
|
2695 | 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>",
|
2696 | styles: ["button.link{padding:25px 15px;margin:.5%;box-sizing:border-box}button mat-icon{font-size:34px;width:34px;height:34px}"]
|
2697 | }] }
|
2698 | ];
|
2699 | FormListComponent.propDecorators = {
|
2700 | data$: [{ type: Input, args: ["data",] }]
|
2701 | };
|
2702 | return FormListComponent;
|
2703 | }());
|
2704 | if (false) {
|
2705 |
|
2706 | FormListComponent.prototype.data$;
|
2707 | }
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 | var MainContainerComponent = (function () {
|
2714 | function MainContainerComponent(route, store) {
|
2715 | this.route = route;
|
2716 | this.store = store;
|
2717 | }
|
2718 | MainContainerComponent.decorators = [
|
2719 | { type: Component, args: [{
|
2720 | template: "<router-outlet></router-outlet>"
|
2721 | }] }
|
2722 | ];
|
2723 |
|
2724 | MainContainerComponent.ctorParameters = function () { return [
|
2725 | { type: ActivatedRoute },
|
2726 | { type: Store }
|
2727 | ]; };
|
2728 | return MainContainerComponent;
|
2729 | }());
|
2730 | if (false) {
|
2731 | |
2732 |
|
2733 |
|
2734 |
|
2735 | MainContainerComponent.prototype.route;
|
2736 | |
2737 |
|
2738 |
|
2739 |
|
2740 | MainContainerComponent.prototype.store;
|
2741 | }
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 | var AddFormEffects = (function () {
|
2748 | function AddFormEffects(actions$, router, service) {
|
2749 | var _this = this;
|
2750 | this.actions$ = actions$;
|
2751 | this.router = router;
|
2752 | this.service = service;
|
2753 | this.AddForm$ = this.actions$.pipe(ofType(AddFormActionTypes.ADD_FORM), map(( |
2754 |
|
2755 |
|
2756 |
|
2757 | function (action) { return action.payload; })), map(( |
2758 |
|
2759 |
|
2760 |
|
2761 | function (data) { return new AddFormStartAction(data); })));
|
2762 | this.AddFormStart$ = this.actions$.pipe(ofType(AddFormActionTypes.ADD_FORM_START), map(( |
2763 |
|
2764 |
|
2765 |
|
2766 | function (action) { return action.payload; })), switchMap(( |
2767 |
|
2768 |
|
2769 |
|
2770 | function (data) { return _this.service.add(data); })), map(( |
2771 |
|
2772 |
|
2773 |
|
2774 | function (res) { return new AddFormSucceedAction(); })), catchError(( |
2775 |
|
2776 |
|
2777 | function () { return of(new AddFormFailedAction()); })));
|
2778 | }
|
2779 | AddFormEffects.decorators = [
|
2780 | { type: Injectable }
|
2781 | ];
|
2782 |
|
2783 | AddFormEffects.ctorParameters = function () { return [
|
2784 | { type: Actions },
|
2785 | { type: Router },
|
2786 | { type: FormService }
|
2787 | ]; };
|
2788 | __decorate([
|
2789 | Effect(),
|
2790 | __metadata("design:type", Object)
|
2791 | ], AddFormEffects.prototype, "AddForm$", void 0);
|
2792 | __decorate([
|
2793 | Effect(),
|
2794 | __metadata("design:type", Object)
|
2795 | ], AddFormEffects.prototype, "AddFormStart$", void 0);
|
2796 | return AddFormEffects;
|
2797 | }());
|
2798 | if (false) {
|
2799 |
|
2800 | AddFormEffects.prototype.AddForm$;
|
2801 |
|
2802 | AddFormEffects.prototype.AddFormStart$;
|
2803 | |
2804 |
|
2805 |
|
2806 |
|
2807 | AddFormEffects.prototype.actions$;
|
2808 | |
2809 |
|
2810 |
|
2811 |
|
2812 | AddFormEffects.prototype.router;
|
2813 | |
2814 |
|
2815 |
|
2816 |
|
2817 | AddFormEffects.prototype.service;
|
2818 | }
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 | var FormsListEffects = (function () {
|
2835 | function FormsListEffects(actions$, router, service) {
|
2836 | var _this = this;
|
2837 | this.actions$ = actions$;
|
2838 | this.router = router;
|
2839 | this.service = service;
|
2840 | this.EditProfileRequest$ = this.actions$.pipe(ofType(FormsListActionTypes.FORMS_LIST), map(( |
2841 |
|
2842 |
|
2843 |
|
2844 | function (data) { return new FormsListStartAction(); })));
|
2845 | this.GetForm$ = this.actions$.pipe(ofType(FormsListActionTypes.GET_FORM_SCHEMA), map(( |
2846 |
|
2847 |
|
2848 |
|
2849 | function (action) { return action.payload; })), switchMap(( |
2850 |
|
2851 |
|
2852 |
|
2853 | function (id) { return _this.service.get(id); })), map(( |
2854 |
|
2855 |
|
2856 |
|
2857 | function (formSchema) { return new FormSchemaFechedAction(formSchema); })));
|
2858 | this.get_forms_list$ = this.actions$.pipe(ofType(FormsListActionTypes.FORMS_LIST_START), switchMap(( |
2859 |
|
2860 |
|
2861 |
|
2862 | function (data) { return _this.service.getList(); })), map(( |
2863 |
|
2864 |
|
2865 |
|
2866 | function (res) { return new FormsListSucceedAction(res); })), catchError(( |
2867 |
|
2868 |
|
2869 | function () { return of(new FormsListFailedAction()); })));
|
2870 | }
|
2871 | FormsListEffects.decorators = [
|
2872 | { type: Injectable }
|
2873 | ];
|
2874 |
|
2875 | FormsListEffects.ctorParameters = function () { return [
|
2876 | { type: Actions },
|
2877 | { type: Router },
|
2878 | { type: FormService }
|
2879 | ]; };
|
2880 | __decorate([
|
2881 | Effect(),
|
2882 | __metadata("design:type", Object)
|
2883 | ], FormsListEffects.prototype, "EditProfileRequest$", void 0);
|
2884 | __decorate([
|
2885 | Effect(),
|
2886 | __metadata("design:type", Object)
|
2887 | ], FormsListEffects.prototype, "GetForm$", void 0);
|
2888 | __decorate([
|
2889 | Effect(),
|
2890 | __metadata("design:type", Object)
|
2891 | ], FormsListEffects.prototype, "get_forms_list$", void 0);
|
2892 | return FormsListEffects;
|
2893 | }());
|
2894 | if (false) {
|
2895 |
|
2896 | FormsListEffects.prototype.EditProfileRequest$;
|
2897 |
|
2898 | FormsListEffects.prototype.GetForm$;
|
2899 |
|
2900 | FormsListEffects.prototype.get_forms_list$;
|
2901 | |
2902 |
|
2903 |
|
2904 |
|
2905 | FormsListEffects.prototype.actions$;
|
2906 | |
2907 |
|
2908 |
|
2909 |
|
2910 | FormsListEffects.prototype.router;
|
2911 | |
2912 |
|
2913 |
|
2914 |
|
2915 | FormsListEffects.prototype.service;
|
2916 | }
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 | var EditFormEffects = (function () {
|
2928 | function EditFormEffects(actions$, router, service) {
|
2929 | var _this = this;
|
2930 | this.actions$ = actions$;
|
2931 | this.router = router;
|
2932 | this.service = service;
|
2933 | this.EditForm$ = this.actions$.pipe(ofType(EditFormActionTypes.EDIT_FORM), map(( |
2934 |
|
2935 |
|
2936 |
|
2937 | function (action) { return action.payload; })), map(( |
2938 |
|
2939 |
|
2940 |
|
2941 | function (data) { return new EditFormStartAction(data); })));
|
2942 | this.EditFormStart$ = this.actions$.pipe(ofType(EditFormActionTypes.EDIT_FORM_START), map(( |
2943 |
|
2944 |
|
2945 |
|
2946 | function (action) { return action.payload; })), switchMap(( |
2947 |
|
2948 |
|
2949 |
|
2950 | function (data) { return _this.service.update(data); })), map(( |
2951 |
|
2952 |
|
2953 |
|
2954 | function (formSchema) { return new EditFormSucceedAction(formSchema); })), catchError(( |
2955 |
|
2956 |
|
2957 | function () { return of(new EditFormFailedAction()); })));
|
2958 | this.UpdateFormsListStart$ = this.actions$.pipe(ofType(EditFormActionTypes.EDIT_FORM_SUCCEED), map(( |
2959 |
|
2960 |
|
2961 |
|
2962 | function (action) { return action.payload; })), map(( |
2963 |
|
2964 |
|
2965 |
|
2966 | function (formSchema) { return new UpdateFormSchemaAction(formSchema); })));
|
2967 | }
|
2968 | EditFormEffects.decorators = [
|
2969 | { type: Injectable }
|
2970 | ];
|
2971 |
|
2972 | EditFormEffects.ctorParameters = function () { return [
|
2973 | { type: Actions },
|
2974 | { type: Router },
|
2975 | { type: FormService }
|
2976 | ]; };
|
2977 | __decorate([
|
2978 | Effect(),
|
2979 | __metadata("design:type", Object)
|
2980 | ], EditFormEffects.prototype, "EditForm$", void 0);
|
2981 | __decorate([
|
2982 | Effect(),
|
2983 | __metadata("design:type", Object)
|
2984 | ], EditFormEffects.prototype, "EditFormStart$", void 0);
|
2985 | __decorate([
|
2986 | Effect(),
|
2987 | __metadata("design:type", Object)
|
2988 | ], EditFormEffects.prototype, "UpdateFormsListStart$", void 0);
|
2989 | return EditFormEffects;
|
2990 | }());
|
2991 | if (false) {
|
2992 |
|
2993 | EditFormEffects.prototype.EditForm$;
|
2994 |
|
2995 | EditFormEffects.prototype.EditFormStart$;
|
2996 |
|
2997 | EditFormEffects.prototype.UpdateFormsListStart$;
|
2998 | |
2999 |
|
3000 |
|
3001 |
|
3002 | EditFormEffects.prototype.actions$;
|
3003 | |
3004 |
|
3005 |
|
3006 |
|
3007 | EditFormEffects.prototype.router;
|
3008 | |
3009 |
|
3010 |
|
3011 |
|
3012 | EditFormEffects.prototype.service;
|
3013 | }
|
3014 |
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 | var routes = [
|
3021 | {
|
3022 | path: "form",
|
3023 | component: MainContainerComponent,
|
3024 | children: [
|
3025 | {
|
3026 | path: "add",
|
3027 | component: AddFormContainerComponent
|
3028 | },
|
3029 | {
|
3030 | path: "edit/:_id",
|
3031 | component: EditFormContainerComponent
|
3032 | },
|
3033 | {
|
3034 | path: "",
|
3035 | component: FormListContainerComponent
|
3036 | }
|
3037 | ]
|
3038 | }
|
3039 | ];
|
3040 |
|
3041 | var RoutingModule = RouterModule.forChild(routes);
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 | var CaptchaActionTypes = {
|
3049 | GET_CAPTCHA: "[CAPTCHA][GET] GET_CAPTCHA",
|
3050 | GET_CAPTCHA_START: "[CAPTCHA][GET] GET_CAPTCHA_START",
|
3051 | GET_CAPTCHA_SUCCEED: "[CAPTCHA][GET] GET_CAPTCHA_SUCCEED",
|
3052 | GET_CAPTCHA_FAILED: "[CAPTCHA][GET] GET_CAPTCHA_FAILED",
|
3053 | };
|
3054 | var GetCaptchaAction = (function () {
|
3055 | function GetCaptchaAction() {
|
3056 | this.type = CaptchaActionTypes.GET_CAPTCHA;
|
3057 |
|
3058 | }
|
3059 | return GetCaptchaAction;
|
3060 | }());
|
3061 | if (false) {
|
3062 |
|
3063 | GetCaptchaAction.prototype.type;
|
3064 | }
|
3065 | var GetCaptchaStartAction = (function () {
|
3066 | function GetCaptchaStartAction(payload) {
|
3067 | this.payload = payload;
|
3068 | this.type = CaptchaActionTypes.GET_CAPTCHA_START;
|
3069 | }
|
3070 | return GetCaptchaStartAction;
|
3071 | }());
|
3072 | if (false) {
|
3073 |
|
3074 | GetCaptchaStartAction.prototype.type;
|
3075 |
|
3076 | GetCaptchaStartAction.prototype.payload;
|
3077 | }
|
3078 | var GetCaptchaSucceedAction = (function () {
|
3079 | function GetCaptchaSucceedAction() {
|
3080 | this.type = CaptchaActionTypes.GET_CAPTCHA_SUCCEED;
|
3081 | }
|
3082 | return GetCaptchaSucceedAction;
|
3083 | }());
|
3084 | if (false) {
|
3085 |
|
3086 | GetCaptchaSucceedAction.prototype.type;
|
3087 | }
|
3088 | var GetCaptchaFailedAction = (function () {
|
3089 | function GetCaptchaFailedAction() {
|
3090 | this.type = CaptchaActionTypes.GET_CAPTCHA_FAILED;
|
3091 | }
|
3092 | return GetCaptchaFailedAction;
|
3093 | }());
|
3094 | if (false) {
|
3095 |
|
3096 | GetCaptchaFailedAction.prototype.type;
|
3097 | }
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 | var CaptchaEffects = (function () {
|
3104 | function CaptchaEffects(actions$, router, service) {
|
3105 | var _this = this;
|
3106 | this.actions$ = actions$;
|
3107 | this.router = router;
|
3108 | this.service = service;
|
3109 | this.GetCaptcha$ = this.actions$.pipe(ofType(CaptchaActionTypes.GET_CAPTCHA), map(( |
3110 |
|
3111 |
|
3112 |
|
3113 | function (action) { return action.payload; })), map(( |
3114 |
|
3115 |
|
3116 |
|
3117 | function (data) { return new GetCaptchaStartAction(data); })));
|
3118 | this.AddFormStart$ = this.actions$.pipe(ofType(CaptchaActionTypes.GET_CAPTCHA_START), map(( |
3119 |
|
3120 |
|
3121 |
|
3122 | function (action) { return action.payload; })), switchMap(( |
3123 |
|
3124 |
|
3125 |
|
3126 | function (data) { return _this.service.getCaptcha(); })), map(( |
3127 |
|
3128 |
|
3129 |
|
3130 | function (res) { return new GetCaptchaSucceedAction(); })), catchError(( |
3131 |
|
3132 |
|
3133 | function () { return of(new GetCaptchaFailedAction()); })));
|
3134 | }
|
3135 | CaptchaEffects.decorators = [
|
3136 | { type: Injectable }
|
3137 | ];
|
3138 |
|
3139 | CaptchaEffects.ctorParameters = function () { return [
|
3140 | { type: Actions },
|
3141 | { type: Router },
|
3142 | { type: FormCaptchaService }
|
3143 | ]; };
|
3144 | __decorate([
|
3145 | Effect(),
|
3146 | __metadata("design:type", Object)
|
3147 | ], CaptchaEffects.prototype, "GetCaptcha$", void 0);
|
3148 | __decorate([
|
3149 | Effect(),
|
3150 | __metadata("design:type", Object)
|
3151 | ], CaptchaEffects.prototype, "AddFormStart$", void 0);
|
3152 | return CaptchaEffects;
|
3153 | }());
|
3154 | if (false) {
|
3155 |
|
3156 | CaptchaEffects.prototype.GetCaptcha$;
|
3157 |
|
3158 | CaptchaEffects.prototype.AddFormStart$;
|
3159 | |
3160 |
|
3161 |
|
3162 |
|
3163 | CaptchaEffects.prototype.actions$;
|
3164 | |
3165 |
|
3166 |
|
3167 |
|
3168 | CaptchaEffects.prototype.router;
|
3169 | |
3170 |
|
3171 |
|
3172 |
|
3173 | CaptchaEffects.prototype.service;
|
3174 | }
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 |
|
3180 | var NgsFormModule = (function () {
|
3181 | function NgsFormModule() {
|
3182 | }
|
3183 | |
3184 |
|
3185 |
|
3186 |
|
3187 | NgsFormModule.forRoot = |
3188 |
|
3189 |
|
3190 |
|
3191 | function (config) {
|
3192 | return {
|
3193 | ngModule: RootNgsFormModule,
|
3194 | providers: [{ provide: MODULE_CONFIG_TOKEN, useValue: config }, FormConfigurationService]
|
3195 | };
|
3196 | };
|
3197 | NgsFormModule.decorators = [
|
3198 | { type: NgModule, args: [{
|
3199 | imports: [
|
3200 | HttpClientModule,
|
3201 | FormsModule,
|
3202 | RouterModule,
|
3203 | CommonModule,
|
3204 | MatExpansionModule,
|
3205 | MatSnackBarModule,
|
3206 | MatIconModule,
|
3207 | MatDatepickerModule,
|
3208 | MatButtonModule,
|
3209 | MatCardModule,
|
3210 | MatCheckboxModule,
|
3211 | MatTableModule,
|
3212 | MatSelectModule,
|
3213 | MatInputModule,
|
3214 | MatFormFieldModule,
|
3215 | MatTabsModule,
|
3216 | MatDividerModule,
|
3217 | FlexLayoutModule,
|
3218 | MatRadioModule,
|
3219 | MatSlideToggleModule,
|
3220 | ReactiveFormsModule
|
3221 | ],
|
3222 | declarations: [
|
3223 | EditFormContainerComponent,
|
3224 | EditFormComponent,
|
3225 | FormListContainerComponent,
|
3226 | FormListComponent,
|
3227 | AddFormContainerComponent,
|
3228 | MainContainerComponent,
|
3229 | AddFormComponent,
|
3230 | FormGroupComponent,
|
3231 | FormArrayComponent,
|
3232 | FormControlComponent,
|
3233 | FormViewComponent,
|
3234 | DynamicFieldDirective,
|
3235 | SelectComponent,
|
3236 | CheckboxComponent,
|
3237 | EmailComponent,
|
3238 | ColorComponent,
|
3239 | DateFormInputControlComponent,
|
3240 | FileFormInputControlComponent,
|
3241 | TextComponent,
|
3242 | NumberComponent,
|
3243 | TableComponent,
|
3244 | FormCaptchaComponent
|
3245 |
|
3246 | ],
|
3247 | entryComponents: [
|
3248 | SelectComponent,
|
3249 | CheckboxComponent,
|
3250 | EmailComponent,
|
3251 | ColorComponent,
|
3252 | DateFormInputControlComponent,
|
3253 | FileFormInputControlComponent,
|
3254 | TextComponent,
|
3255 | NumberComponent,
|
3256 | TableComponent,
|
3257 | FormCaptchaComponent
|
3258 | ],
|
3259 | exports: [FormViewComponent]
|
3260 |
|
3261 | },] }
|
3262 | ];
|
3263 | return NgsFormModule;
|
3264 | }());
|
3265 | var RootNgsFormModule = (function () {
|
3266 | function RootNgsFormModule() {
|
3267 | (( (window))).___starter = (( (window))).___starter || {};
|
3268 | (( (window))).___starter.form = "8.0.11";
|
3269 | }
|
3270 | RootNgsFormModule.decorators = [
|
3271 | { type: NgModule, args: [{
|
3272 | imports: [
|
3273 | NgsFormModule,
|
3274 | StoreModule.forFeature("form", FormReducers),
|
3275 | EffectsModule.forFeature([AddFormEffects, EditFormEffects, FormsListEffects, CaptchaEffects]),
|
3276 | RoutingModule
|
3277 | ],
|
3278 | exports: [NgsFormModule]
|
3279 | },] }
|
3280 | ];
|
3281 |
|
3282 | RootNgsFormModule.ctorParameters = function () { return []; };
|
3283 | return RootNgsFormModule;
|
3284 | }());
|
3285 |
|
3286 |
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 | export { DynamicFieldDirective, FormService, FormViewComponent, NgsFormModule, RootNgsFormModule, MODULE_CONFIG_TOKEN as ɵa, FormReducers as ɵb, FormCaptchaComponent as ɵba, FormCaptchaService as ɵbb, reducer as ɵbc, AddFormEffects as ɵbd, EditFormEffects as ɵbe, FormsListEffects as ɵbf, CaptchaEffects as ɵbg, RoutingModule as ɵbh, FormConfigurationService as ɵd, EditFormContainerComponent as ɵf, AddFormContainerComponent as ɵg, EditFormComponent as ɵh, AddFormComponent as ɵi, FormListContainerComponent as ɵj, FormListComponent as ɵk, AddFormContainerComponent as ɵl, MainContainerComponent as ɵm, AddFormComponent as ɵn, FormGroupComponent as ɵo, FormArrayComponent as ɵp, FormControlComponent as ɵq, SelectComponent as ɵr, CheckboxComponent as ɵs, EmailComponent as ɵt, ColorComponent as ɵu, DateFormInputControlComponent as ɵv, FileFormInputControlComponent as ɵw, TextComponent as ɵx, NumberComponent as ɵy, TableComponent as ɵz };
|
3297 |
|