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