survery-lib 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +24 -0
  2. package/assets/style.css +58 -0
  3. package/assets/style.css.map +1 -0
  4. package/esm2022/lib/components/question-boolean-template/question-boolean-template.component.mjs +80 -0
  5. package/esm2022/lib/components/question-check-box-template/question-check-box-template.component.mjs +88 -0
  6. package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +76 -0
  7. package/esm2022/lib/components/question-matrix-template/question-matrix-template.component.mjs +69 -0
  8. package/esm2022/lib/components/question-radio-button-template/question-radio-button-template.component.mjs +80 -0
  9. package/esm2022/lib/components/question-text-template/question-text-template.component.mjs +77 -0
  10. package/esm2022/lib/services/shared-data.service.mjs +23 -0
  11. package/esm2022/lib/services/survey-lib.service.mjs +23 -0
  12. package/esm2022/lib/survery-lib.component.mjs +124 -0
  13. package/esm2022/lib/survery-lib.module.mjs +50 -0
  14. package/esm2022/public-api.mjs +7 -0
  15. package/esm2022/shared/dtos/rule-exp-answer.dto.mjs +2 -0
  16. package/esm2022/shared/dtos/rule-exp.dto.mjs +2 -0
  17. package/esm2022/shared/dtos/rule-result-question.dto.mjs +2 -0
  18. package/esm2022/shared/dtos/survey-answer.dto.mjs +2 -0
  19. package/esm2022/shared/dtos/survey-page.dto.mjs +2 -0
  20. package/esm2022/shared/dtos/survey-question-group.dto.mjs +2 -0
  21. package/esm2022/shared/dtos/survey-question.dto.mjs +2 -0
  22. package/esm2022/shared/dtos/survey-rule.dto.mjs +2 -0
  23. package/esm2022/shared/dtos/survey-sub-question.dto.mjs +2 -0
  24. package/esm2022/shared/dtos/survey.dto.mjs +2 -0
  25. package/esm2022/shared/enums/question-type.enum.mjs +10 -0
  26. package/esm2022/shared/form-interfaces/question-boolean-template.form-interface.mjs +2 -0
  27. package/esm2022/shared/form-interfaces/question-check-box-template.form-interface.mjs +3 -0
  28. package/esm2022/shared/form-interfaces/question-dropdown-template.form-interface.mjs +3 -0
  29. package/esm2022/shared/form-interfaces/question-matrix-template.form-interface.mjs +2 -0
  30. package/esm2022/shared/form-interfaces/question-radio-button-template.form-interface.mjs +3 -0
  31. package/esm2022/shared/form-interfaces/question-text-template.form-interface.mjs +2 -0
  32. package/esm2022/shared/form-interfaces/survery-lib.form-interface.mjs +2 -0
  33. package/esm2022/shared/models/question-answer.model.mjs +3 -0
  34. package/esm2022/survery-lib.mjs +5 -0
  35. package/fesm2022/survery-lib.mjs +638 -0
  36. package/fesm2022/survery-lib.mjs.map +1 -0
  37. package/index.d.ts +5 -0
  38. package/lib/components/question-boolean-template/question-boolean-template.component.d.ts +34 -0
  39. package/lib/components/question-check-box-template/question-check-box-template.component.d.ts +34 -0
  40. package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +31 -0
  41. package/lib/components/question-matrix-template/question-matrix-template.component.d.ts +28 -0
  42. package/lib/components/question-radio-button-template/question-radio-button-template.component.d.ts +34 -0
  43. package/lib/components/question-text-template/question-text-template.component.d.ts +31 -0
  44. package/lib/services/shared-data.service.d.ts +9 -0
  45. package/lib/services/survey-lib.service.d.ts +10 -0
  46. package/lib/survery-lib.component.d.ts +34 -0
  47. package/lib/survery-lib.module.d.ts +19 -0
  48. package/package.json +27 -0
  49. package/public-api.d.ts +3 -0
  50. package/shared/dtos/rule-exp-answer.dto.d.ts +5 -0
  51. package/shared/dtos/rule-exp.dto.d.ts +11 -0
  52. package/shared/dtos/rule-result-question.dto.d.ts +4 -0
  53. package/shared/dtos/survey-answer.dto.d.ts +16 -0
  54. package/shared/dtos/survey-page.dto.d.ts +9 -0
  55. package/shared/dtos/survey-question-group.dto.d.ts +8 -0
  56. package/shared/dtos/survey-question.dto.d.ts +18 -0
  57. package/shared/dtos/survey-rule.dto.d.ts +10 -0
  58. package/shared/dtos/survey-sub-question.dto.d.ts +9 -0
  59. package/shared/dtos/survey.dto.d.ts +16 -0
  60. package/shared/enums/question-type.enum.d.ts +8 -0
  61. package/shared/form-interfaces/question-boolean-template.form-interface.d.ts +9 -0
  62. package/shared/form-interfaces/question-check-box-template.form-interface.d.ts +9 -0
  63. package/shared/form-interfaces/question-dropdown-template.form-interface.d.ts +9 -0
  64. package/shared/form-interfaces/question-matrix-template.form-interface.d.ts +11 -0
  65. package/shared/form-interfaces/question-radio-button-template.form-interface.d.ts +9 -0
  66. package/shared/form-interfaces/question-text-template.form-interface.d.ts +9 -0
  67. package/shared/form-interfaces/survery-lib.form-interface.d.ts +11 -0
  68. package/shared/models/question-answer.model.d.ts +5 -0
@@ -0,0 +1,638 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, Output, Input, NgModule } from '@angular/core';
3
+ import { Subject, BehaviorSubject, debounceTime, distinctUntilChanged } from 'rxjs';
4
+ import * as i1 from '@ng-stack/forms';
5
+ import { NgsFormsModule } from '@ng-stack/forms';
6
+ import * as i3 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+ import * as i4 from '@angular/forms';
9
+ import { Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
10
+ import { QuestionTypeEnum as QuestionTypeEnum$1 } from 'projects/survery-lib/src/shared/enums/question-type.enum';
11
+ import { v4 } from 'uuid';
12
+ import { HttpClientModule } from '@angular/common/http';
13
+
14
+ var QuestionTypeEnum;
15
+ (function (QuestionTypeEnum) {
16
+ QuestionTypeEnum[QuestionTypeEnum["RadioButton"] = 1] = "RadioButton";
17
+ QuestionTypeEnum[QuestionTypeEnum["CheckBox"] = 2] = "CheckBox";
18
+ QuestionTypeEnum[QuestionTypeEnum["DropDown"] = 3] = "DropDown";
19
+ QuestionTypeEnum[QuestionTypeEnum["Boolean"] = 4] = "Boolean";
20
+ QuestionTypeEnum[QuestionTypeEnum["TextInput"] = 5] = "TextInput";
21
+ QuestionTypeEnum[QuestionTypeEnum["Matrix"] = 6] = "Matrix";
22
+ })(QuestionTypeEnum || (QuestionTypeEnum = {}));
23
+
24
+ class SurveyLibService {
25
+ get surveyDataObsrv() {
26
+ return this.surveyDataSubject.asObservable();
27
+ }
28
+ constructor() {
29
+ this.surveyDataSubject = new Subject();
30
+ }
31
+ setSurveyData(survey) {
32
+ this.surveyDataSubject.next(survey);
33
+ }
34
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
35
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, providedIn: 'root' }); }
36
+ }
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, decorators: [{
38
+ type: Injectable,
39
+ args: [{
40
+ providedIn: 'root'
41
+ }]
42
+ }], ctorParameters: function () { return []; } });
43
+
44
+ class SharedDataService {
45
+ get submitIdObsrv() {
46
+ return this.submitIdSubject.asObservable();
47
+ }
48
+ constructor() {
49
+ this.submitIdSubject = new BehaviorSubject(null);
50
+ }
51
+ setSubmitId(submitId) {
52
+ this.submitIdSubject.next(submitId);
53
+ }
54
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SharedDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
55
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SharedDataService, providedIn: 'root' }); }
56
+ }
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SharedDataService, decorators: [{
58
+ type: Injectable,
59
+ args: [{
60
+ providedIn: 'root'
61
+ }]
62
+ }], ctorParameters: function () { return []; } });
63
+
64
+ class QuestionTextTemplateComponent {
65
+ get fCtrls() {
66
+ return this.rForm.controls;
67
+ }
68
+ get questionTypeEnum() {
69
+ return QuestionTypeEnum$1;
70
+ }
71
+ set setQuestion(value) {
72
+ this.rForm.patchValue({
73
+ id: value.questionId,
74
+ name: value.questionName,
75
+ title: value.questionTitle,
76
+ typeId: value.questionTypeId,
77
+ description: value.questionDescription
78
+ });
79
+ if (value.isRequired == true) {
80
+ this.fCtrls.answer.addValidators([Validators.required]);
81
+ this.fCtrls.answer.updateValueAndValidity();
82
+ }
83
+ }
84
+ constructor(_formBuilder, _sharedDataService) {
85
+ this._formBuilder = _formBuilder;
86
+ this._sharedDataService = _sharedDataService;
87
+ this.emitter = new EventEmitter();
88
+ this.rForm = this._formBuilder.group({
89
+ id: [null],
90
+ name: [null],
91
+ title: [null],
92
+ typeId: [null],
93
+ description: [null],
94
+ answer: [null]
95
+ });
96
+ this._sharedDataService.submitIdObsrv.pipe(debounceTime(500), distinctUntilChanged()).subscribe(() => {
97
+ const formValue = this.rForm.value;
98
+ this.emitter.emit({
99
+ QuestionId: formValue.id,
100
+ IsValid: this.fCtrls.answer.valid,
101
+ Answer: formValue.answer
102
+ });
103
+ });
104
+ }
105
+ ngOnInit() {
106
+ this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
107
+ const formValue = this.rForm.value;
108
+ this.emitter.emit({
109
+ QuestionId: formValue.id,
110
+ IsValid: this.fCtrls.answer.valid,
111
+ Answer: value
112
+ });
113
+ });
114
+ }
115
+ convertToFormControl(element) {
116
+ return element;
117
+ }
118
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionTextTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SharedDataService }], target: i0.ɵɵFactoryTarget.Component }); }
119
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: { isTextArea: "isTextArea", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [formGroup]=\"rForm\" [attr.id]=\"'question_'+fCtrls.id.value\"\n [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <input class=\"form-control\" type=\"text\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n *ngIf=\"isTextArea == false else textAreaTemplate\">\n <ng-template #textAreaTemplate>\n <textarea class=\"form-control\" rows=\"5\" [formControl]=\"convertToFormControl(fCtrls.answer)\"></textarea>\n </ng-template>\n </div>", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
120
+ }
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionTextTemplateComponent, decorators: [{
122
+ type: Component,
123
+ args: [{ selector: 'lib-question-text-template', template: "<div class=\"quastion\" [formGroup]=\"rForm\" [attr.id]=\"'question_'+fCtrls.id.value\"\n [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <input class=\"form-control\" type=\"text\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n *ngIf=\"isTextArea == false else textAreaTemplate\">\n <ng-template #textAreaTemplate>\n <textarea class=\"form-control\" rows=\"5\" [formControl]=\"convertToFormControl(fCtrls.answer)\"></textarea>\n </ng-template>\n </div>" }]
124
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
125
+ type: Output
126
+ }], isTextArea: [{
127
+ type: Input
128
+ }], setQuestion: [{
129
+ type: Input
130
+ }] } });
131
+
132
+ class QuestionRadioButtonTemplateComponent {
133
+ get fCtrls() {
134
+ return this.rForm.controls;
135
+ }
136
+ get questionTypeEnum() {
137
+ return QuestionTypeEnum$1;
138
+ }
139
+ set setQuestion(value) {
140
+ this.surveyQuestion = value;
141
+ this.rForm.patchValue({
142
+ id: value.questionId,
143
+ name: value.questionName,
144
+ title: value.questionTitle,
145
+ typeId: value.questionTypeId,
146
+ description: value.questionDescription
147
+ });
148
+ if (value.isRequired == true) {
149
+ this.fCtrls.answer.addValidators([Validators.required]);
150
+ this.fCtrls.answer.updateValueAndValidity();
151
+ }
152
+ }
153
+ constructor(_formBuilder, _sharedDataService) {
154
+ this._formBuilder = _formBuilder;
155
+ this._sharedDataService = _sharedDataService;
156
+ this.elemId = v4();
157
+ this.emitter = new EventEmitter();
158
+ this.rForm = this._formBuilder.group({
159
+ id: [null],
160
+ name: [null],
161
+ title: [null],
162
+ typeId: [null],
163
+ description: [null],
164
+ answer: [null]
165
+ });
166
+ this._sharedDataService.submitIdObsrv.pipe(debounceTime(500), distinctUntilChanged()).subscribe(() => {
167
+ const formValue = this.rForm.value;
168
+ this.emitter.emit({
169
+ QuestionId: formValue.id,
170
+ IsValid: this.fCtrls.answer.valid,
171
+ Answer: formValue.answer
172
+ });
173
+ });
174
+ }
175
+ ngOnInit() {
176
+ this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
177
+ const formValue = this.rForm.value;
178
+ this.emitter.emit({
179
+ QuestionId: formValue.id,
180
+ IsValid: this.fCtrls.answer.valid,
181
+ Answer: value
182
+ });
183
+ });
184
+ }
185
+ onChangeAnswer(item) {
186
+ this.fCtrls.answer.setValue(item.answerId);
187
+ }
188
+ convertToFormControl(element) {
189
+ return element;
190
+ }
191
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionRadioButtonTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SharedDataService }], target: i0.ɵɵFactoryTarget.Component }); }
192
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: { setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of surveyQuestion?.surveyAnswers;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item)\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" value=\"{{item.answerId}}\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.answerTitle}}</label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
193
+ }
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionRadioButtonTemplateComponent, decorators: [{
195
+ type: Component,
196
+ args: [{ selector: 'lib-question-radio-button-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of surveyQuestion?.surveyAnswers;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item)\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" value=\"{{item.answerId}}\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.answerTitle}}</label>\n </div>\n </div>\n</div>\n" }]
197
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
198
+ type: Output
199
+ }], setQuestion: [{
200
+ type: Input
201
+ }] } });
202
+
203
+ class QuestionCheckBoxTemplateComponent {
204
+ get fCtrls() {
205
+ return this.rForm.controls;
206
+ }
207
+ get questionTypeEnum() {
208
+ return QuestionTypeEnum$1;
209
+ }
210
+ set setQuestion(value) {
211
+ this.surveyQuestion = value;
212
+ this.rForm.patchValue({
213
+ id: value.questionId,
214
+ name: value.questionName,
215
+ title: value.questionTitle,
216
+ typeId: value.questionTypeId,
217
+ description: value.questionDescription
218
+ });
219
+ if (value.isRequired == true) {
220
+ this.fCtrls.answer.addValidators([Validators.required]);
221
+ this.fCtrls.answer.updateValueAndValidity();
222
+ }
223
+ }
224
+ constructor(_formBuilder, _sharedDataService) {
225
+ this._formBuilder = _formBuilder;
226
+ this._sharedDataService = _sharedDataService;
227
+ this.elemId = v4();
228
+ this.emitter = new EventEmitter();
229
+ this.rForm = this._formBuilder.group({
230
+ id: [null],
231
+ name: [null],
232
+ title: [null],
233
+ typeId: [null],
234
+ description: [null],
235
+ answer: [null]
236
+ });
237
+ this._sharedDataService.submitIdObsrv.pipe(debounceTime(500), distinctUntilChanged()).subscribe(() => {
238
+ const formValue = this.rForm.value;
239
+ this.emitter.emit({
240
+ QuestionId: formValue.id,
241
+ IsValid: this.fCtrls.answer.valid,
242
+ Answer: formValue.answer
243
+ });
244
+ });
245
+ }
246
+ ngOnInit() {
247
+ this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
248
+ const formValue = this.rForm.value;
249
+ this.emitter.emit({
250
+ QuestionId: formValue.id,
251
+ IsValid: this.fCtrls.answer.valid,
252
+ Answer: value
253
+ });
254
+ });
255
+ }
256
+ onChangeAnswer(item, event) {
257
+ var answerArr = this.fCtrls.answer.value || [];
258
+ if (event.target.checked == true) {
259
+ answerArr.push(item.answerId);
260
+ }
261
+ else {
262
+ answerArr = answerArr.filter(x => x != item.answerId);
263
+ }
264
+ answerArr = answerArr.length == 0 ? null : answerArr;
265
+ this.fCtrls.answer.setValue(answerArr);
266
+ }
267
+ convertToFormControl(element) {
268
+ return element;
269
+ }
270
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SharedDataService }], target: i0.ɵɵFactoryTarget.Component }); }
271
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: { setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n\n <div class=\"checkbox-button-quastion\">\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of surveyQuestion?.surveyAnswers;let i = index\">\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" (change)=\"onChangeAnswer(item,$event)\">\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\">{{item.answerTitle}}</label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
272
+ }
273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, decorators: [{
274
+ type: Component,
275
+ args: [{ selector: 'lib-question-check-box-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n\n <div class=\"checkbox-button-quastion\">\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of surveyQuestion?.surveyAnswers;let i = index\">\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" (change)=\"onChangeAnswer(item,$event)\">\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\">{{item.answerTitle}}</label>\n </div>\n </div>\n</div>\n" }]
276
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
277
+ type: Output
278
+ }], setQuestion: [{
279
+ type: Input
280
+ }] } });
281
+
282
+ class QuestionDropdownTemplateComponent {
283
+ get fCtrls() {
284
+ return this.rForm.controls;
285
+ }
286
+ get questionTypeEnum() {
287
+ return QuestionTypeEnum$1;
288
+ }
289
+ set setQuestion(value) {
290
+ this.surveyQuestion = value;
291
+ this.rForm.patchValue({
292
+ id: value.questionId,
293
+ name: value.questionName,
294
+ title: value.questionTitle,
295
+ typeId: value.questionTypeId,
296
+ description: value.questionDescription
297
+ });
298
+ if (value.isRequired == true) {
299
+ this.fCtrls.answer.addValidators([Validators.required]);
300
+ this.fCtrls.answer.updateValueAndValidity();
301
+ }
302
+ }
303
+ constructor(_formBuilder, _sharedDataService) {
304
+ this._formBuilder = _formBuilder;
305
+ this._sharedDataService = _sharedDataService;
306
+ this.emitter = new EventEmitter();
307
+ this.rForm = this._formBuilder.group({
308
+ id: [null],
309
+ name: [null],
310
+ title: [null],
311
+ typeId: [null],
312
+ description: [null],
313
+ answer: [null]
314
+ });
315
+ this._sharedDataService.submitIdObsrv.pipe(debounceTime(500), distinctUntilChanged()).subscribe(() => {
316
+ const formValue = this.rForm.value;
317
+ this.emitter.emit({
318
+ QuestionId: formValue.id,
319
+ IsValid: this.fCtrls.answer.valid,
320
+ Answer: formValue.answer
321
+ });
322
+ });
323
+ }
324
+ ngOnInit() {
325
+ this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
326
+ const formValue = this.rForm.value;
327
+ this.emitter.emit({
328
+ QuestionId: formValue.id,
329
+ IsValid: this.fCtrls.answer.valid,
330
+ Answer: value
331
+ });
332
+ });
333
+ }
334
+ convertToFormControl(element) {
335
+ return element;
336
+ }
337
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SharedDataService }], target: i0.ɵɵFactoryTarget.Component }); }
338
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: { setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <select class=\"form-control\" [formControl]=\"convertToFormControl(fCtrls.answer)\">\n <option *ngFor=\"let item of surveyQuestion?.surveyAnswers\" [value]=\"item.answerId\">{{item.answerTitle}}</option>\n </select>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
339
+ }
340
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, decorators: [{
341
+ type: Component,
342
+ args: [{ selector: 'lib-question-dropdown-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"text-quastion\">\n <select class=\"form-control\" [formControl]=\"convertToFormControl(fCtrls.answer)\">\n <option *ngFor=\"let item of surveyQuestion?.surveyAnswers\" [value]=\"item.answerId\">{{item.answerTitle}}</option>\n </select>\n </div>\n</div>\n" }]
343
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
344
+ type: Output
345
+ }], setQuestion: [{
346
+ type: Input
347
+ }] } });
348
+
349
+ class QuestionMatrixTemplateComponent {
350
+ get fCtrls() {
351
+ return this.rForm.controls;
352
+ }
353
+ get questionTypeEnum() {
354
+ return QuestionTypeEnum$1;
355
+ }
356
+ set setQuestion(value) {
357
+ this.surveyQuestion = value;
358
+ this.rForm.patchValue({
359
+ id: value.questionId,
360
+ typeId: value.questionTypeId
361
+ });
362
+ value.surveySubQuestions.forEach(x => {
363
+ var group = this._formBuilder.group({
364
+ subQuestionId: [x.questionId],
365
+ questionTitle: [x.questionTitle],
366
+ answer: [null]
367
+ });
368
+ if (value.isRequired == true) {
369
+ group.controls.answer.addValidators([Validators.required]);
370
+ group.controls.answer.updateValueAndValidity();
371
+ }
372
+ this.fCtrls.subQuestionArray.push(group);
373
+ });
374
+ }
375
+ constructor(_formBuilder) {
376
+ this._formBuilder = _formBuilder;
377
+ this.elemId = v4();
378
+ this.emitter = new EventEmitter();
379
+ this.rForm = this._formBuilder.group({
380
+ id: [null],
381
+ typeId: [null],
382
+ subQuestionArray: this._formBuilder.array([])
383
+ });
384
+ }
385
+ onChangeAnswer(question, answer) {
386
+ const index = this.fCtrls.subQuestionArray.value.findIndex(x => x.subQuestionId == question.subQuestionId);
387
+ this.fCtrls.subQuestionArray.controls[index].controls.answer.setValue(answer.answerId);
388
+ var model = this.fCtrls.subQuestionArray.value.map(x => {
389
+ return { QuestionId: x.subQuestionId,
390
+ Answer: x.answer,
391
+ IsValid: this.fCtrls.subQuestionArray.controls[index].controls.answer.valid };
392
+ });
393
+ this.emitter.emit(model);
394
+ }
395
+ convertToFormControl(element) {
396
+ return element;
397
+ }
398
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionMatrixTemplateComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
399
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: { setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" style=\" border-collapse: collapse;\">\n <h3 class=\"quastion-title \">\n {{surveyQuestion?.questionTitle}}\n </h3>\n <div class=\"matrix-question\" [formGroup]=\"rForm\">\n <div class=\"matrix-table\" formArrayName=\"subQuestionArray\">\n <div class=\"matrix-head-row\">\n <div class=\"matrix-col\">\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answers of surveyQuestion?.surveyAnswers\">\n {{answers.answerTitle}}\n </div>\n </div>\n\n <div class=\"matrix-row\"\n *ngFor=\"let questionGroup of fCtrls.subQuestionArray.controls ;let subQuestionIndex = index\"\n [ngClass]=\"{'invalid-question': questionGroup.controls.answer.invalid}\">\n <div class=\"matrix-col matrix-sub-quastion\">\n {{questionGroup.value.questionTitle}}\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answer of surveyQuestion?.surveyAnswers;let answerIndex = index\">\n <div class=\"form-check form-check-radio form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" name=\"{{elemId}}__radio-btn-option_{{subQuestionIndex}}\"\n id=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\" (change)=\"onChangeAnswer(questionGroup.value ,answer)\"\n value=\"{{answer.answerId}}\">\n <label class=\"form-check-label d-md-inline d-lg-none\"\n for=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\"> {{answer.answerTitle}}</label>\n </div>\n </div>\n </div>\n\n </div>\n\n </div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] }); }
400
+ }
401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionMatrixTemplateComponent, decorators: [{
402
+ type: Component,
403
+ args: [{ selector: 'lib-question-matrix-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" style=\" border-collapse: collapse;\">\n <h3 class=\"quastion-title \">\n {{surveyQuestion?.questionTitle}}\n </h3>\n <div class=\"matrix-question\" [formGroup]=\"rForm\">\n <div class=\"matrix-table\" formArrayName=\"subQuestionArray\">\n <div class=\"matrix-head-row\">\n <div class=\"matrix-col\">\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answers of surveyQuestion?.surveyAnswers\">\n {{answers.answerTitle}}\n </div>\n </div>\n\n <div class=\"matrix-row\"\n *ngFor=\"let questionGroup of fCtrls.subQuestionArray.controls ;let subQuestionIndex = index\"\n [ngClass]=\"{'invalid-question': questionGroup.controls.answer.invalid}\">\n <div class=\"matrix-col matrix-sub-quastion\">\n {{questionGroup.value.questionTitle}}\n </div>\n <div class=\"matrix-col\" *ngFor=\"let answer of surveyQuestion?.surveyAnswers;let answerIndex = index\">\n <div class=\"form-check form-check-radio form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" name=\"{{elemId}}__radio-btn-option_{{subQuestionIndex}}\"\n id=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\" (change)=\"onChangeAnswer(questionGroup.value ,answer)\"\n value=\"{{answer.answerId}}\">\n <label class=\"form-check-label d-md-inline d-lg-none\"\n for=\"{{elemId}}__radio-btn_{{subQuestionIndex}}_{{answerIndex}}\"> {{answer.answerTitle}}</label>\n </div>\n </div>\n </div>\n\n </div>\n\n </div>\n</div>" }]
404
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
405
+ type: Output
406
+ }], setQuestion: [{
407
+ type: Input
408
+ }] } });
409
+
410
+ class QuestionBooleanTemplateComponent {
411
+ get fCtrls() {
412
+ return this.rForm.controls;
413
+ }
414
+ get questionTypeEnum() {
415
+ return QuestionTypeEnum$1;
416
+ }
417
+ set setQuestion(value) {
418
+ this.surveyQuestion = value;
419
+ this.rForm.patchValue({
420
+ id: value.questionId,
421
+ name: value.questionName,
422
+ title: value.questionTitle,
423
+ typeId: value.questionTypeId,
424
+ description: value.questionDescription
425
+ });
426
+ if (value.isRequired == true) {
427
+ this.fCtrls.answer.addValidators([Validators.required]);
428
+ this.fCtrls.answer.updateValueAndValidity();
429
+ }
430
+ }
431
+ constructor(_formBuilder, _sharedDataService) {
432
+ this._formBuilder = _formBuilder;
433
+ this._sharedDataService = _sharedDataService;
434
+ this.elemId = v4();
435
+ this.emitter = new EventEmitter();
436
+ this.rForm = this._formBuilder.group({
437
+ id: [null],
438
+ name: [null],
439
+ title: [null],
440
+ typeId: [null],
441
+ description: [null],
442
+ answer: [null]
443
+ });
444
+ this._sharedDataService.submitIdObsrv.pipe(debounceTime(500), distinctUntilChanged()).subscribe(() => {
445
+ const formValue = this.rForm.value;
446
+ this.emitter.emit({
447
+ QuestionId: formValue.id,
448
+ IsValid: this.fCtrls.answer.valid,
449
+ Answer: formValue.answer
450
+ });
451
+ });
452
+ }
453
+ ngOnInit() {
454
+ this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
455
+ const formValue = this.rForm.value;
456
+ this.emitter.emit({
457
+ QuestionId: formValue.id,
458
+ IsValid: this.fCtrls.answer.valid,
459
+ Answer: value
460
+ });
461
+ });
462
+ }
463
+ onChangeAnswer(answer) {
464
+ this.fCtrls.answer.setValue(answer);
465
+ }
466
+ convertToFormControl(element) {
467
+ return element;
468
+ }
469
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionBooleanTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SharedDataService }], target: i0.ɵɵFactoryTarget.Component }); }
470
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: { setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of surveyQuestion?.surveyAnswers;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item)\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" value=\"{{item.answerId}}\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.answerTitle}}</label>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
471
+ }
472
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionBooleanTemplateComponent, decorators: [{
473
+ type: Component,
474
+ args: [{ selector: 'lib-question-boolean-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n </h3>\n <div class=\"radio-button-quastion\">\n <div class=\"form-check form-check-radio form-check-inline\" \n *ngFor=\"let item of surveyQuestion?.surveyAnswers;let i = index\">\n <input class=\"form-check-input\" type=\"radio\" (change)=\"onChangeAnswer(item)\"\n name=\"{{elemId}}__radio-btn-option\" id=\"{{elemId}}__radio-btn_{{i}}\" value=\"{{item.answerId}}\">\n <label class=\"form-check-label\" for=\"{{elemId}}__radio-btn_{{i}}\">{{item.answerTitle}}</label>\n </div>\n </div>\n</div>\n" }]
475
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
476
+ type: Output
477
+ }], setQuestion: [{
478
+ type: Input
479
+ }] } });
480
+
481
+ class SurveryLibComponent {
482
+ get fCtrls() {
483
+ return this.rForm.controls;
484
+ }
485
+ get questionTypeEnum() {
486
+ return QuestionTypeEnum;
487
+ }
488
+ get isLastPage() {
489
+ return this.fCtrls.currentPageIndex.value == (this.surveyData?.surveyPages.length - 1);
490
+ }
491
+ constructor(_surveyLibService, _formBuilder, _sharedDataService) {
492
+ this._surveyLibService = _surveyLibService;
493
+ this._formBuilder = _formBuilder;
494
+ this._sharedDataService = _sharedDataService;
495
+ this.surveyResultEmit = new EventEmitter();
496
+ this.rForm = this._formBuilder.group({
497
+ currentPageIndex: [0],
498
+ questionArray: this._formBuilder.array([])
499
+ });
500
+ }
501
+ ngOnInit() {
502
+ this._surveyLibService.surveyDataObsrv.subscribe(survey => {
503
+ this.surveyData = survey;
504
+ if (survey != null) {
505
+ this.loadQuestions(survey);
506
+ }
507
+ else {
508
+ this.fCtrls.questionArray.clear();
509
+ }
510
+ });
511
+ }
512
+ onPaggingNext() {
513
+ var currentPageIndex = this.fCtrls.currentPageIndex.value;
514
+ var isHaveInvalidRecords = this.haveInValidateQuestions();
515
+ if (isHaveInvalidRecords == false && currentPageIndex < (this.surveyData.surveyPages.length - 1)) {
516
+ currentPageIndex = Number(currentPageIndex) + 1;
517
+ this.fCtrls.currentPageIndex.setValue(currentPageIndex);
518
+ }
519
+ }
520
+ onPaggingBack() {
521
+ var currentPageIndex = this.fCtrls.currentPageIndex.value;
522
+ if (currentPageIndex > 0) {
523
+ currentPageIndex = Number(currentPageIndex) - 1;
524
+ this.fCtrls.currentPageIndex.setValue(currentPageIndex);
525
+ }
526
+ }
527
+ onUpdateAnswers(model) {
528
+ model.forEach(elem => {
529
+ this.onUpdateAnswer(elem);
530
+ });
531
+ }
532
+ onUpdateAnswer(model) {
533
+ const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == model.QuestionId);
534
+ this.fCtrls.questionArray.controls[index].patchValue({
535
+ isValid: model.IsValid,
536
+ answer: model.Answer
537
+ });
538
+ }
539
+ onSubmit() {
540
+ var currentPageIndex = this.fCtrls.currentPageIndex.value;
541
+ var isHaveInvalidRecords = this.haveInValidateQuestions();
542
+ if (isHaveInvalidRecords == false && currentPageIndex == (this.surveyData.surveyPages.length - 1)) {
543
+ this.surveyResultEmit.emit(this.fCtrls.questionArray.value);
544
+ }
545
+ }
546
+ loadQuestions(survey) {
547
+ survey.surveyPages.forEach((page, pageIndex) => {
548
+ page.surveyQuestionGroups.forEach(group => {
549
+ group.surveyQuestions.forEach(question => {
550
+ if (question.questionTypeId != 6) {
551
+ this.fCtrls.questionArray.push(this._formBuilder.group({
552
+ surveyPageIndex: pageIndex,
553
+ questionId: [question.questionId],
554
+ answer: [null],
555
+ isRequired: [question.isRequired],
556
+ isValid: [null]
557
+ }));
558
+ }
559
+ else {
560
+ question.surveySubQuestions.forEach(subQuestion => {
561
+ this.fCtrls.questionArray.push(this._formBuilder.group({
562
+ surveyPageIndex: pageIndex,
563
+ questionId: [subQuestion.questionId],
564
+ answer: [null],
565
+ isRequired: [question.isRequired],
566
+ isValid: [null]
567
+ }));
568
+ });
569
+ }
570
+ });
571
+ });
572
+ });
573
+ }
574
+ haveInValidateQuestions() {
575
+ const currentPageIndex = this.fCtrls.currentPageIndex.value;
576
+ var invalidRecords = this.rForm.value.questionArray.filter(x => x.surveyPageIndex == currentPageIndex && x.isValid != true);
577
+ if (invalidRecords.length > 0) {
578
+ $(`#survey-page_${currentPageIndex}`).addClass('survey-page_submitted');
579
+ }
580
+ return invalidRecords.length > 0;
581
+ }
582
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, deps: [{ token: SurveyLibService }, { token: i1.FormBuilder }, { token: SharedDataService }], target: i0.ɵɵFactoryTarget.Component }); }
583
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", outputs: { surveyResultEmit: "surveyResultEmit" }, ngImport: i0, template: "<div class=\"survay-card\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\" [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"></lib-question-boolean-template>\r\n <lib-question-text-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isTextArea]=\"question.isAdvanceTextArea\"></lib-question-text-template>\r\n <lib-question-radio-button-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"></lib-question-radio-button-template>\r\n <lib-question-dropdown-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n <lib-question-check-box-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"></lib-question-check-box-template>\r\n <lib-question-matrix-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswers($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"></lib-question-matrix-template>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"survay-card-footr\" *ngIf=\"surveyData != null\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination\">\r\n <nav aria-label=\"Page navigation example\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item previous-page-item \">\r\n <a class=\"page-link\" href=\"javascript:void(0)\" (click)=\"onPaggingBack()\"\r\n [ngClass]=\"{'disable__btn':fCtrls.currentPageIndex.value == 0}\">\u0627\u0644\u0633\u0627\u0628\u0642</a>\r\n </li>\r\n <li class=\"page-item active\" *ngFor=\"let item of surveyData?.surveyPages;let i = index\"\r\n [ngClass]=\"{'active': i == fCtrls.currentPageIndex.value}\">\r\n <a class=\"page-link\" href=\"javascript:void(0)\">{{i + 1}}</a>\r\n </li>\r\n <li class=\"page-item next-page-item\">\r\n <a class=\"page-link\" href=\"javascript:void(0)\" (click)=\"onPaggingNext()\"\r\n [ngClass]=\"{'disable__btn':fCtrls.currentPageIndex.value == (surveyData.surveyPages.length - 1)}\">\u0627\u0644\u062A\u0627\u0644\u064A</a>\r\n </li>\r\n </ul>\r\n </nav>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: ["isTextArea", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: ["setQuestion"], outputs: ["emitter"] }] }); }
584
+ }
585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
586
+ type: Component,
587
+ args: [{ selector: 'lib-survery-lib', template: "<div class=\"survay-card\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\" [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"></lib-question-boolean-template>\r\n <lib-question-text-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isTextArea]=\"question.isAdvanceTextArea\"></lib-question-text-template>\r\n <lib-question-radio-button-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"></lib-question-radio-button-template>\r\n <lib-question-dropdown-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n <lib-question-check-box-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"></lib-question-check-box-template>\r\n <lib-question-matrix-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswers($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"></lib-question-matrix-template>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"survay-card-footr\" *ngIf=\"surveyData != null\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination\">\r\n <nav aria-label=\"Page navigation example\">\r\n <ul class=\"pagination\">\r\n <li class=\"page-item previous-page-item \">\r\n <a class=\"page-link\" href=\"javascript:void(0)\" (click)=\"onPaggingBack()\"\r\n [ngClass]=\"{'disable__btn':fCtrls.currentPageIndex.value == 0}\">\u0627\u0644\u0633\u0627\u0628\u0642</a>\r\n </li>\r\n <li class=\"page-item active\" *ngFor=\"let item of surveyData?.surveyPages;let i = index\"\r\n [ngClass]=\"{'active': i == fCtrls.currentPageIndex.value}\">\r\n <a class=\"page-link\" href=\"javascript:void(0)\">{{i + 1}}</a>\r\n </li>\r\n <li class=\"page-item next-page-item\">\r\n <a class=\"page-link\" href=\"javascript:void(0)\" (click)=\"onPaggingNext()\"\r\n [ngClass]=\"{'disable__btn':fCtrls.currentPageIndex.value == (surveyData.surveyPages.length - 1)}\">\u0627\u0644\u062A\u0627\u0644\u064A</a>\r\n </li>\r\n </ul>\r\n </nav>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}\n"] }]
588
+ }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { surveyResultEmit: [{
589
+ type: Output
590
+ }] } });
591
+
592
+ class SurveryLibModule {
593
+ static forRoot() {
594
+ return {
595
+ ngModule: SurveryLibModule
596
+ };
597
+ }
598
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
599
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, declarations: [SurveryLibComponent,
600
+ QuestionTextTemplateComponent,
601
+ QuestionRadioButtonTemplateComponent,
602
+ QuestionCheckBoxTemplateComponent,
603
+ QuestionDropdownTemplateComponent,
604
+ QuestionMatrixTemplateComponent,
605
+ QuestionBooleanTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule], exports: [SurveryLibComponent] }); }
606
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule] }); }
607
+ }
608
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, decorators: [{
609
+ type: NgModule,
610
+ args: [{
611
+ declarations: [
612
+ SurveryLibComponent,
613
+ QuestionTextTemplateComponent,
614
+ QuestionRadioButtonTemplateComponent,
615
+ QuestionCheckBoxTemplateComponent,
616
+ QuestionDropdownTemplateComponent,
617
+ QuestionMatrixTemplateComponent,
618
+ QuestionBooleanTemplateComponent
619
+ ],
620
+ imports: [
621
+ CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule
622
+ ],
623
+ exports: [
624
+ SurveryLibComponent
625
+ ]
626
+ }]
627
+ }] });
628
+
629
+ /*
630
+ * Public API Surface of survery-lib
631
+ */
632
+
633
+ /**
634
+ * Generated bundle index. Do not edit.
635
+ */
636
+
637
+ export { SurveryLibComponent, SurveryLibModule, SurveyLibService };
638
+ //# sourceMappingURL=survery-lib.mjs.map