survery-lib 0.0.3 → 0.0.6

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 (31) hide show
  1. package/esm2022/lib/components/question-boolean-template/question-boolean-template.component.mjs +11 -3
  2. package/esm2022/lib/components/question-check-box-template/question-check-box-template.component.mjs +13 -5
  3. package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +11 -3
  4. package/esm2022/lib/components/question-matrix-template/question-matrix-template.component.mjs +15 -5
  5. package/esm2022/lib/components/question-radio-button-template/question-radio-button-template.component.mjs +11 -3
  6. package/esm2022/lib/components/question-text-template/question-text-template.component.mjs +22 -3
  7. package/esm2022/lib/pipes/filter-question.pipe.mjs +16 -0
  8. package/esm2022/lib/survery-lib.component.mjs +238 -23
  9. package/esm2022/lib/survery-lib.module.mjs +6 -3
  10. package/esm2022/shared/dtos/rule-exp.dto.mjs +1 -1
  11. package/esm2022/shared/enums/Logic-Property.enum.mjs +14 -0
  12. package/esm2022/shared/enums/logic-action.enum.mjs +9 -0
  13. package/esm2022/shared/enums/operator.enum.mjs +6 -0
  14. package/esm2022/shared/form-interfaces/survery-lib.form-interface.mjs +1 -1
  15. package/fesm2022/survery-lib.mjs +358 -42
  16. package/fesm2022/survery-lib.mjs.map +1 -1
  17. package/lib/components/question-boolean-template/question-boolean-template.component.d.ts +3 -1
  18. package/lib/components/question-check-box-template/question-check-box-template.component.d.ts +3 -1
  19. package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +3 -1
  20. package/lib/components/question-matrix-template/question-matrix-template.component.d.ts +3 -1
  21. package/lib/components/question-radio-button-template/question-radio-button-template.component.d.ts +3 -1
  22. package/lib/components/question-text-template/question-text-template.component.d.ts +4 -1
  23. package/lib/pipes/filter-question.pipe.d.ts +9 -0
  24. package/lib/survery-lib.component.d.ts +8 -3
  25. package/lib/survery-lib.module.d.ts +6 -5
  26. package/package.json +1 -1
  27. package/shared/dtos/rule-exp.dto.d.ts +4 -2
  28. package/shared/enums/Logic-Property.enum.d.ts +12 -0
  29. package/shared/enums/logic-action.enum.d.ts +7 -0
  30. package/shared/enums/operator.enum.d.ts +4 -0
  31. package/shared/form-interfaces/survery-lib.form-interface.d.ts +17 -4
@@ -1,6 +1,6 @@
1
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';
2
+ import { Injectable, EventEmitter, Component, Output, Input, Pipe, NgModule } from '@angular/core';
3
+ import { Subject, BehaviorSubject, debounceTime, distinctUntilChanged, of } from 'rxjs';
4
4
  import * as i1 from '@ng-stack/forms';
5
5
  import { NgsFormsModule } from '@ng-stack/forms';
6
6
  import * as i3 from '@angular/common';
@@ -20,6 +20,35 @@ var QuestionTypeEnum;
20
20
  QuestionTypeEnum[QuestionTypeEnum["Matrix"] = 6] = "Matrix";
21
21
  })(QuestionTypeEnum || (QuestionTypeEnum = {}));
22
22
 
23
+ var LogicPropertyEnum;
24
+ (function (LogicPropertyEnum) {
25
+ LogicPropertyEnum[LogicPropertyEnum["GreaterThan"] = 1] = "GreaterThan";
26
+ LogicPropertyEnum[LogicPropertyEnum["GreaterThanOrEqual"] = 2] = "GreaterThanOrEqual";
27
+ LogicPropertyEnum[LogicPropertyEnum["LessThan"] = 3] = "LessThan";
28
+ LogicPropertyEnum[LogicPropertyEnum["LessThanOrEqual"] = 4] = "LessThanOrEqual";
29
+ LogicPropertyEnum[LogicPropertyEnum["Equal"] = 5] = "Equal";
30
+ LogicPropertyEnum[LogicPropertyEnum["NotEqual"] = 6] = "NotEqual";
31
+ LogicPropertyEnum[LogicPropertyEnum["IsEmpty"] = 9] = "IsEmpty";
32
+ LogicPropertyEnum[LogicPropertyEnum["IsNotEmpty"] = 10] = "IsNotEmpty";
33
+ LogicPropertyEnum[LogicPropertyEnum["AnyOf"] = 11] = "AnyOf";
34
+ LogicPropertyEnum[LogicPropertyEnum["Then"] = 12] = "Then";
35
+ })(LogicPropertyEnum || (LogicPropertyEnum = {}));
36
+
37
+ var OperatorEnum;
38
+ (function (OperatorEnum) {
39
+ OperatorEnum[OperatorEnum["Or"] = 7] = "Or";
40
+ OperatorEnum[OperatorEnum["And"] = 8] = "And";
41
+ })(OperatorEnum || (OperatorEnum = {}));
42
+
43
+ var LogicActionEnum;
44
+ (function (LogicActionEnum) {
45
+ LogicActionEnum[LogicActionEnum["Show"] = 1] = "Show";
46
+ LogicActionEnum[LogicActionEnum["Hide"] = 2] = "Hide";
47
+ LogicActionEnum[LogicActionEnum["Enable"] = 3] = "Enable";
48
+ LogicActionEnum[LogicActionEnum["Disable"] = 4] = "Disable";
49
+ LogicActionEnum[LogicActionEnum["SetAnswer"] = 5] = "SetAnswer";
50
+ })(LogicActionEnum || (LogicActionEnum = {}));
51
+
23
52
  class SurveyLibService {
24
53
  get surveyDataObsrv() {
25
54
  return this.surveyDataSubject.asObservable();
@@ -79,11 +108,17 @@ class QuestionTextTemplateComponent {
79
108
  this.fCtrls.answer.addValidators([Validators.required]);
80
109
  this.fCtrls.answer.updateValueAndValidity();
81
110
  }
111
+ this.isShow = value.isVisable;
112
+ this.toggleEnableAnswer(value.isReadOnly);
113
+ }
114
+ set isDisabled(value) {
115
+ this.toggleEnableAnswer(value);
82
116
  }
83
117
  constructor(_formBuilder, _sharedDataService) {
84
118
  this._formBuilder = _formBuilder;
85
119
  this._sharedDataService = _sharedDataService;
86
120
  this.emitter = new EventEmitter();
121
+ this.isShow = true;
87
122
  this.rForm = this._formBuilder.group({
88
123
  id: [null],
89
124
  name: [null],
@@ -114,18 +149,31 @@ class QuestionTextTemplateComponent {
114
149
  convertToFormControl(element) {
115
150
  return element;
116
151
  }
152
+ toggleEnableAnswer(isReadOnly) {
153
+ if (isReadOnly == true) {
154
+ this.fCtrls.answer.disable();
155
+ }
156
+ else {
157
+ this.fCtrls.answer.enable();
158
+ }
159
+ this.fCtrls.answer.updateValueAndValidity();
160
+ }
117
161
  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 }); }
118
- 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"] }] }); }
162
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: { isShow: "isShow", isTextArea: "isTextArea", setQuestion: "setQuestion", isDisabled: "isDisabled" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [formGroup]=\"rForm\" [attr.id]=\"'question_'+fCtrls.id.value\"\n [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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 [disabled]=\"isDisabled\" *ngIf=\"isTextArea == false else textAreaTemplate\">\n <ng-template #textAreaTemplate>\n <textarea class=\"form-control\" rows=\"5\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n [disabled]=\"isDisabled\" ></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"] }] }); }
119
163
  }
120
164
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionTextTemplateComponent, decorators: [{
121
165
  type: Component,
122
- 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>" }]
166
+ 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 , 'd-none':isShow != true}\">\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 [disabled]=\"isDisabled\" *ngIf=\"isTextArea == false else textAreaTemplate\">\n <ng-template #textAreaTemplate>\n <textarea class=\"form-control\" rows=\"5\" [formControl]=\"convertToFormControl(fCtrls.answer)\"\n [disabled]=\"isDisabled\" ></textarea>\n </ng-template>\n </div>" }]
123
167
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
124
168
  type: Output
169
+ }], isShow: [{
170
+ type: Input
125
171
  }], isTextArea: [{
126
172
  type: Input
127
173
  }], setQuestion: [{
128
174
  type: Input
175
+ }], isDisabled: [{
176
+ type: Input
129
177
  }] } });
130
178
 
131
179
  class QuestionRadioButtonTemplateComponent {
@@ -148,12 +196,16 @@ class QuestionRadioButtonTemplateComponent {
148
196
  this.fCtrls.answer.addValidators([Validators.required]);
149
197
  this.fCtrls.answer.updateValueAndValidity();
150
198
  }
199
+ this.isShow = value.isVisable;
200
+ this.isDisabled = value.isReadOnly;
151
201
  }
152
202
  constructor(_formBuilder, _sharedDataService) {
153
203
  this._formBuilder = _formBuilder;
154
204
  this._sharedDataService = _sharedDataService;
155
205
  this.elemId = v4();
156
206
  this.emitter = new EventEmitter();
207
+ this.isShow = true;
208
+ this.isDisabled = false;
157
209
  this.rForm = this._formBuilder.group({
158
210
  id: [null],
159
211
  name: [null],
@@ -188,13 +240,17 @@ class QuestionRadioButtonTemplateComponent {
188
240
  return element;
189
241
  }
190
242
  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 }); }
191
- 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"] }] }); }
243
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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)\" [disabled]=\"isDisabled\"\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"] }] }); }
192
244
  }
193
245
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionRadioButtonTemplateComponent, decorators: [{
194
246
  type: Component,
195
- 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" }]
247
+ args: [{ selector: 'lib-question-radio-button-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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)\" [disabled]=\"isDisabled\"\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" }]
196
248
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
197
249
  type: Output
250
+ }], isShow: [{
251
+ type: Input
252
+ }], isDisabled: [{
253
+ type: Input
198
254
  }], setQuestion: [{
199
255
  type: Input
200
256
  }] } });
@@ -219,12 +275,16 @@ class QuestionCheckBoxTemplateComponent {
219
275
  this.fCtrls.answer.addValidators([Validators.required]);
220
276
  this.fCtrls.answer.updateValueAndValidity();
221
277
  }
278
+ this.isShow = value.isVisable;
279
+ this.isDisabled = value.isReadOnly;
222
280
  }
223
281
  constructor(_formBuilder, _sharedDataService) {
224
282
  this._formBuilder = _formBuilder;
225
283
  this._sharedDataService = _sharedDataService;
226
284
  this.elemId = v4();
227
285
  this.emitter = new EventEmitter();
286
+ this.isShow = true;
287
+ this.isDisabled = false;
228
288
  this.rForm = this._formBuilder.group({
229
289
  id: [null],
230
290
  name: [null],
@@ -243,7 +303,7 @@ class QuestionCheckBoxTemplateComponent {
243
303
  });
244
304
  }
245
305
  ngOnInit() {
246
- this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
306
+ this.fCtrls.answer.valueChanges.subscribe(value => {
247
307
  const formValue = this.rForm.value;
248
308
  this.emitter.emit({
249
309
  QuestionId: formValue.id,
@@ -260,20 +320,24 @@ class QuestionCheckBoxTemplateComponent {
260
320
  else {
261
321
  answerArr = answerArr.filter(x => x != item.answerId);
262
322
  }
263
- answerArr = answerArr.length == 0 ? null : answerArr;
323
+ answerArr = answerArr.length == 0 ? [] : answerArr;
264
324
  this.fCtrls.answer.setValue(answerArr);
265
325
  }
266
326
  convertToFormControl(element) {
267
327
  return element;
268
328
  }
269
329
  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 }); }
270
- 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"] }] }); }
330
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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}}\" [disabled]=\"isDisabled\"\n (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"] }] }); }
271
331
  }
272
332
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, decorators: [{
273
333
  type: Component,
274
- 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" }]
334
+ args: [{ selector: 'lib-question-check-box-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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}}\" [disabled]=\"isDisabled\"\n (change)=\"onChangeAnswer(item,$event)\">\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\">{{item.answerTitle}}</label>\n </div>\n </div>\n</div>\n" }]
275
335
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
276
336
  type: Output
337
+ }], isShow: [{
338
+ type: Input
339
+ }], isDisabled: [{
340
+ type: Input
277
341
  }], setQuestion: [{
278
342
  type: Input
279
343
  }] } });
@@ -298,11 +362,15 @@ class QuestionDropdownTemplateComponent {
298
362
  this.fCtrls.answer.addValidators([Validators.required]);
299
363
  this.fCtrls.answer.updateValueAndValidity();
300
364
  }
365
+ this.isShow = value.isVisable;
366
+ this.isDisabled = value.isReadOnly;
301
367
  }
302
368
  constructor(_formBuilder, _sharedDataService) {
303
369
  this._formBuilder = _formBuilder;
304
370
  this._sharedDataService = _sharedDataService;
305
371
  this.emitter = new EventEmitter();
372
+ this.isShow = true;
373
+ this.isDisabled = false;
306
374
  this.rForm = this._formBuilder.group({
307
375
  id: [null],
308
376
  name: [null],
@@ -334,13 +402,17 @@ class QuestionDropdownTemplateComponent {
334
402
  return element;
335
403
  }
336
404
  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 }); }
337
- 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"] }] }); }
405
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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)\" [disabled]=\"isDisabled\">\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"] }] }); }
338
406
  }
339
407
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, decorators: [{
340
408
  type: Component,
341
- 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" }]
409
+ args: [{ selector: 'lib-question-dropdown-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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)\" [disabled]=\"isDisabled\">\n <option *ngFor=\"let item of surveyQuestion?.surveyAnswers\" [value]=\"item.answerId\">{{item.answerTitle}}</option>\n </select>\n </div>\n</div>\n" }]
342
410
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
343
411
  type: Output
412
+ }], isShow: [{
413
+ type: Input
414
+ }], isDisabled: [{
415
+ type: Input
344
416
  }], setQuestion: [{
345
417
  type: Input
346
418
  }] } });
@@ -370,11 +442,15 @@ class QuestionMatrixTemplateComponent {
370
442
  }
371
443
  this.fCtrls.subQuestionArray.push(group);
372
444
  });
445
+ this.isShow = value.isVisable;
446
+ this.isDisabled = value.isReadOnly;
373
447
  }
374
448
  constructor(_formBuilder) {
375
449
  this._formBuilder = _formBuilder;
376
450
  this.elemId = v4();
377
451
  this.emitter = new EventEmitter();
452
+ this.isShow = true;
453
+ this.isDisabled = false;
378
454
  this.rForm = this._formBuilder.group({
379
455
  id: [null],
380
456
  typeId: [null],
@@ -385,9 +461,11 @@ class QuestionMatrixTemplateComponent {
385
461
  const index = this.fCtrls.subQuestionArray.value.findIndex(x => x.subQuestionId == question.subQuestionId);
386
462
  this.fCtrls.subQuestionArray.controls[index].controls.answer.setValue(answer.answerId);
387
463
  var model = this.fCtrls.subQuestionArray.value.map(x => {
388
- return { QuestionId: x.subQuestionId,
464
+ return {
465
+ QuestionId: x.subQuestionId,
389
466
  Answer: x.answer,
390
- IsValid: this.fCtrls.subQuestionArray.controls[index].controls.answer.valid };
467
+ IsValid: this.fCtrls.subQuestionArray.controls[index].controls.answer.valid
468
+ };
391
469
  });
392
470
  this.emitter.emit(model);
393
471
  }
@@ -395,13 +473,17 @@ class QuestionMatrixTemplateComponent {
395
473
  return element;
396
474
  }
397
475
  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 }); }
398
- 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"] }] }); }
476
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" style=\" border-collapse: collapse;\"\n[ngClass]=\"{'d-none':isShow != true}\">\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"] }] }); }
399
477
  }
400
478
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionMatrixTemplateComponent, decorators: [{
401
479
  type: Component,
402
- 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>" }]
480
+ args: [{ selector: 'lib-question-matrix-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" style=\" border-collapse: collapse;\"\n[ngClass]=\"{'d-none':isShow != true}\">\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>" }]
403
481
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { emitter: [{
404
482
  type: Output
483
+ }], isShow: [{
484
+ type: Input
485
+ }], isDisabled: [{
486
+ type: Input
405
487
  }], setQuestion: [{
406
488
  type: Input
407
489
  }] } });
@@ -426,12 +508,16 @@ class QuestionBooleanTemplateComponent {
426
508
  this.fCtrls.answer.addValidators([Validators.required]);
427
509
  this.fCtrls.answer.updateValueAndValidity();
428
510
  }
511
+ this.isShow = value.isVisable;
512
+ this.isDisabled = value.isReadOnly;
429
513
  }
430
514
  constructor(_formBuilder, _sharedDataService) {
431
515
  this._formBuilder = _formBuilder;
432
516
  this._sharedDataService = _sharedDataService;
433
517
  this.elemId = v4();
434
518
  this.emitter = new EventEmitter();
519
+ this.isShow = true;
520
+ this.isDisabled = false;
435
521
  this.rForm = this._formBuilder.group({
436
522
  id: [null],
437
523
  name: [null],
@@ -466,17 +552,35 @@ class QuestionBooleanTemplateComponent {
466
552
  return element;
467
553
  }
468
554
  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 }); }
469
- 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"] }] }); }
555
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: { isShow: "isShow", isDisabled: "isDisabled", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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)\" [disabled]=\"isDisabled\"\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"] }] }); }
470
556
  }
471
557
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionBooleanTemplateComponent, decorators: [{
472
558
  type: Component,
473
- 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" }]
559
+ args: [{ selector: 'lib-question-boolean-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\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)\" [disabled]=\"isDisabled\"\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" }]
474
560
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { emitter: [{
475
561
  type: Output
562
+ }], isShow: [{
563
+ type: Input
564
+ }], isDisabled: [{
565
+ type: Input
476
566
  }], setQuestion: [{
477
567
  type: Input
478
568
  }] } });
479
569
 
570
+ class FilterQuestionPipe {
571
+ transform(value, questionArr) {
572
+ return questionArr.find(x => x.questionId == value.questionId);
573
+ }
574
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: FilterQuestionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
575
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: FilterQuestionPipe, name: "filterQuestion" }); }
576
+ }
577
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: FilterQuestionPipe, decorators: [{
578
+ type: Pipe,
579
+ args: [{
580
+ name: 'filterQuestion'
581
+ }]
582
+ }] });
583
+
480
584
  class SurveryLibComponent {
481
585
  get fCtrls() {
482
586
  return this.rForm.controls;
@@ -494,7 +598,8 @@ class SurveryLibComponent {
494
598
  this.surveyResultEmit = new EventEmitter();
495
599
  this.rForm = this._formBuilder.group({
496
600
  currentPageIndex: [0],
497
- questionArray: this._formBuilder.array([])
601
+ questionArray: this._formBuilder.array([]),
602
+ ruleQuestionArray: this._formBuilder.array([])
498
603
  });
499
604
  }
500
605
  ngOnInit() {
@@ -509,11 +614,20 @@ class SurveryLibComponent {
509
614
  });
510
615
  }
511
616
  onPaggingNext() {
512
- var currentPageIndex = this.fCtrls.currentPageIndex.value;
513
617
  var isHaveInvalidRecords = this.haveInValidateQuestions();
514
- if (isHaveInvalidRecords == false && currentPageIndex < (this.surveyData.surveyPages.length - 1)) {
515
- currentPageIndex = Number(currentPageIndex) + 1;
516
- this.fCtrls.currentPageIndex.setValue(currentPageIndex);
618
+ if (isHaveInvalidRecords == false) {
619
+ var currentPageIndex = this.fCtrls.currentPageIndex.value;
620
+ if (currentPageIndex < (this.surveyData.surveyPages.length - 1)) {
621
+ currentPageIndex = Number(currentPageIndex) + 1;
622
+ this.fCtrls.currentPageIndex.setValue(currentPageIndex);
623
+ return of(null);
624
+ }
625
+ else {
626
+ return of(this.fCtrls.questionArray.value);
627
+ }
628
+ }
629
+ else {
630
+ return of(null);
517
631
  }
518
632
  }
519
633
  onPaggingBack() {
@@ -530,16 +644,19 @@ class SurveryLibComponent {
530
644
  }
531
645
  onUpdateAnswer(model) {
532
646
  const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == model.QuestionId);
533
- this.fCtrls.questionArray.controls[index].patchValue({
534
- isValid: model.IsValid,
535
- answer: model.Answer
536
- });
537
- }
538
- onSubmit() {
539
- var currentPageIndex = this.fCtrls.currentPageIndex.value;
540
- var isHaveInvalidRecords = this.haveInValidateQuestions();
541
- if (isHaveInvalidRecords == false && currentPageIndex == (this.surveyData.surveyPages.length - 1)) {
542
- this.surveyResultEmit.emit(this.fCtrls.questionArray.value);
647
+ var questionGroup = this.fCtrls.questionArray.controls[index];
648
+ questionGroup.controls.isValid.setValue(model.IsValid);
649
+ if (questionGroup.value.questionType == this.questionTypeEnum.TextInput) {
650
+ questionGroup.controls.answerText.setValue(model.Answer);
651
+ }
652
+ else if (questionGroup.value.questionType == this.questionTypeEnum.CheckBox) {
653
+ questionGroup.controls.answerIdArr.setValue(model.Answer);
654
+ }
655
+ else {
656
+ questionGroup.controls.answerId.setValue(model.Answer);
657
+ }
658
+ if (this.fCtrls.ruleQuestionArray.value.findIndex(x => x.questionId == model.QuestionId) > -1) {
659
+ this.checkRules();
543
660
  }
544
661
  }
545
662
  loadQuestions(survey) {
@@ -550,40 +667,237 @@ class SurveryLibComponent {
550
667
  this.fCtrls.questionArray.push(this._formBuilder.group({
551
668
  surveyPageIndex: pageIndex,
552
669
  questionId: [question.questionId],
553
- answer: [null],
670
+ questionType: [question.questionTypeId],
671
+ isMatrixGroup: [false],
672
+ answerId: [null],
673
+ answerIdArr: [null],
674
+ answerText: [null],
554
675
  isRequired: [question.isRequired],
555
- isValid: [null]
676
+ isValid: [null],
677
+ isDisabled: [question.isReadOnly],
678
+ isShow: [question.isVisable],
679
+ isDisabled_default: [question.isReadOnly],
680
+ isShow_default: [question.isVisable]
556
681
  }));
557
682
  }
558
683
  else {
684
+ this.fCtrls.questionArray.push(this._formBuilder.group({
685
+ surveyPageIndex: pageIndex,
686
+ questionId: [question.questionId],
687
+ questionType: [question.questionTypeId],
688
+ isMatrixGroup: [true],
689
+ answerId: [null],
690
+ answerIdArr: [null],
691
+ answerText: [null],
692
+ isRequired: [question.isRequired],
693
+ isValid: [null],
694
+ isDisabled: [question.isReadOnly],
695
+ isShow: [question.isVisable],
696
+ isDisabled_default: [question.isReadOnly],
697
+ isShow_default: [question.isVisable],
698
+ }));
559
699
  question.surveySubQuestions.forEach(subQuestion => {
560
700
  this.fCtrls.questionArray.push(this._formBuilder.group({
561
701
  surveyPageIndex: pageIndex,
562
702
  questionId: [subQuestion.questionId],
563
- answer: [null],
703
+ questionType: [subQuestion.questionTypeId],
704
+ isMatrixGroup: [false],
705
+ answerId: [null],
706
+ answerIdArr: [null],
707
+ answerText: [null],
564
708
  isRequired: [question.isRequired],
565
- isValid: [null]
709
+ isValid: [null],
710
+ isDisabled: [subQuestion.isReadOnly],
711
+ isShow: [subQuestion.isVisable],
712
+ isDisabled_default: [subQuestion.isReadOnly],
713
+ isShow_default: [subQuestion.isVisable]
566
714
  }));
567
715
  });
568
716
  }
569
717
  });
570
718
  });
571
719
  });
720
+ survey.surveyRules.forEach(rule => {
721
+ rule.ruleExps.forEach(ruleExp => {
722
+ this.fCtrls.ruleQuestionArray.push(this._formBuilder.group({
723
+ questionId: ruleExp.questionId
724
+ }));
725
+ });
726
+ });
572
727
  }
573
728
  haveInValidateQuestions() {
574
729
  const currentPageIndex = this.fCtrls.currentPageIndex.value;
575
- var invalidRecords = this.rForm.value.questionArray.filter(x => x.surveyPageIndex == currentPageIndex && x.isValid != true);
730
+ var invalidRecords = this.rForm.value.questionArray.filter(x => x.surveyPageIndex == currentPageIndex && x.isValid != true && x.isMatrixGroup != true);
576
731
  if (invalidRecords.length > 0) {
577
732
  $(`#survey-page_${currentPageIndex}`).addClass('survey-page_submitted');
578
733
  }
579
734
  return invalidRecords.length > 0;
580
735
  }
736
+ checkRules() {
737
+ this.surveyData.surveyRules.forEach(rule => {
738
+ var exprestionResultArr = [];
739
+ rule.ruleExps.forEach(ruleExp => {
740
+ const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == ruleExp.questionId);
741
+ var questionGroup = this.fCtrls.questionArray.at(index);
742
+ var result;
743
+ if (questionGroup.value.questionType == this.questionTypeEnum.TextInput) {
744
+ result = this.checkRuleExpForAnswerText(ruleExp, questionGroup.value.answerText);
745
+ }
746
+ else if (questionGroup.value.questionType == this.questionTypeEnum.CheckBox) {
747
+ result = this.checkRuleExpForAnswerIdArr(ruleExp, questionGroup.value.answerIdArr);
748
+ }
749
+ else {
750
+ result = this.checkRuleExpForAnswerId(ruleExp, questionGroup.value.answerId);
751
+ }
752
+ exprestionResultArr.push(result);
753
+ });
754
+ var isPassed = exprestionResultArr.filter(x => x == false).length == 0;
755
+ if (isPassed) {
756
+ rule.ruleResultQuestions.forEach(resultQuestion => {
757
+ const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == resultQuestion.questionId);
758
+ var questionGroup = this.fCtrls.questionArray.at(index);
759
+ if (rule.logicActionId == LogicActionEnum.Show) {
760
+ questionGroup.controls.isShow.setValue(true);
761
+ }
762
+ else if (rule.logicActionId == LogicActionEnum.Hide) {
763
+ questionGroup.controls.isShow.setValue(false);
764
+ }
765
+ else if (rule.logicActionId == LogicActionEnum.Enable) {
766
+ questionGroup.controls.isDisabled.setValue(false);
767
+ }
768
+ else if (rule.logicActionId == LogicActionEnum.Disable) {
769
+ questionGroup.controls.isDisabled.setValue(true);
770
+ }
771
+ else if (rule.logicActionId == LogicActionEnum.SetAnswer) {
772
+ }
773
+ });
774
+ }
775
+ else {
776
+ rule.ruleResultQuestions.forEach(resultQuestion => {
777
+ const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == resultQuestion.questionId);
778
+ var questionGroup = this.fCtrls.questionArray.at(index);
779
+ questionGroup.patchValue({
780
+ isShow: questionGroup.value.isShow_default,
781
+ isDisabled: questionGroup.value.isDisabled_default
782
+ });
783
+ });
784
+ }
785
+ });
786
+ }
787
+ checkRuleExpForAnswerId(ruleExp, answerId) {
788
+ var ruleExpResultArr = [];
789
+ if (ruleExp.logicPropertyId == LogicPropertyEnum.GreaterThan) {
790
+ ruleExp.ruleExpAnswers.forEach(answer => {
791
+ var result = answerId > answer.answerId;
792
+ ruleExpResultArr.push(result);
793
+ });
794
+ }
795
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.GreaterThanOrEqual) {
796
+ ruleExp.ruleExpAnswers.forEach(answer => {
797
+ var result = answerId >= answer.answerId;
798
+ ruleExpResultArr.push(result);
799
+ });
800
+ }
801
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.LessThan) {
802
+ ruleExp.ruleExpAnswers.forEach(answer => {
803
+ var result = answerId < answer.answerId;
804
+ ruleExpResultArr.push(result);
805
+ });
806
+ }
807
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.LessThanOrEqual) {
808
+ ruleExp.ruleExpAnswers.forEach(answer => {
809
+ var result = answerId <= answer.answerId;
810
+ ruleExpResultArr.push(result);
811
+ });
812
+ }
813
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.Equal) {
814
+ ruleExp.ruleExpAnswers.forEach(answer => {
815
+ var result = answerId == answer.answerId;
816
+ ruleExpResultArr.push(result);
817
+ });
818
+ }
819
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.NotEqual) {
820
+ ruleExp.ruleExpAnswers.forEach(answer => {
821
+ var result = answerId != answer.answerId;
822
+ ruleExpResultArr.push(result);
823
+ });
824
+ }
825
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.IsEmpty) {
826
+ var result = answerId == null;
827
+ ruleExpResultArr.push(result);
828
+ }
829
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.IsNotEmpty) {
830
+ var result = answerId != null;
831
+ ruleExpResultArr.push(result);
832
+ }
833
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.AnyOf) {
834
+ var answerIdArr = ruleExp.ruleExpAnswers.map(x => x.answerId);
835
+ var result = answerIdArr.findIndex(x => x == answerId) > -1;
836
+ ruleExpResultArr.push(result);
837
+ }
838
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.Then) {
839
+ var answerIdArr = ruleExp.ruleExpAnswers.map(x => x.answerId);
840
+ var result = answerIdArr.findIndex(x => x == answerId) == -1;
841
+ ruleExpResultArr.push(result);
842
+ }
843
+ if (ruleExpResultArr.length == 0) {
844
+ return false;
845
+ }
846
+ else if (ruleExp.ruleExpAnswers.length == 1) {
847
+ return ruleExpResultArr.filter(x => x == true).length > 0;
848
+ }
849
+ else if (ruleExp.opporator == OperatorEnum.Or) {
850
+ return ruleExpResultArr.filter(x => x == true).length > 0;
851
+ }
852
+ else {
853
+ return ruleExpResultArr.filter(x => x == false).length == 0;
854
+ }
855
+ }
856
+ checkRuleExpForAnswerIdArr(ruleExp, answerIdArr) {
857
+ var ruleExpResultArr = [];
858
+ answerIdArr?.forEach(answer => {
859
+ var isResult = this.checkRuleExpForAnswerId(ruleExp, answer);
860
+ ruleExpResultArr.push(isResult);
861
+ });
862
+ if (ruleExpResultArr.length == 0) {
863
+ return false;
864
+ }
865
+ else if (ruleExp.ruleExpAnswers.length == 1) {
866
+ return ruleExpResultArr.filter(x => x == true).length > 0;
867
+ }
868
+ else if (ruleExp.opporator == OperatorEnum.Or) {
869
+ return ruleExpResultArr.filter(x => x == true).length > 0;
870
+ }
871
+ else {
872
+ return ruleExpResultArr.filter(x => x == false).length == 0;
873
+ }
874
+ }
875
+ checkRuleExpForAnswerText(ruleExp, answer) {
876
+ var ruleExpResultArr = [];
877
+ if (ruleExp.logicPropertyId == LogicPropertyEnum.IsEmpty) {
878
+ var result = answer == null || answer == '';
879
+ ruleExpResultArr.push(result);
880
+ }
881
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.IsNotEmpty) {
882
+ var result = answer != null && answer != '';
883
+ ruleExpResultArr.push(result);
884
+ }
885
+ if (ruleExp.ruleExpAnswers.length == 1) {
886
+ return ruleExpResultArr.filter(x => x == true).length > 0;
887
+ }
888
+ else if (ruleExp.opporator == OperatorEnum.Or) {
889
+ return ruleExpResultArr.filter(x => x == true).length > 0;
890
+ }
891
+ else {
892
+ return ruleExpResultArr.filter(x => x == false).length == 0;
893
+ }
894
+ }
581
895
  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 }); }
582
- 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"] }] }); }
896
+ 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\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-boolean-template>\r\n\r\n <lib-question-text-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"\r\n [isTextArea]=\"question.isAdvanceTextArea\"></lib-question-text-template>\r\n\r\n <lib-question-radio-button-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-dropdown-template>\r\n\r\n <lib-question-check-box-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswers($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></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: ["isShow", "isTextArea", "setQuestion", "isDisabled"], outputs: ["emitter"] }, { kind: "component", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
583
897
  }
584
898
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
585
899
  type: Component,
586
- 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"] }]
900
+ 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\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-boolean-template>\r\n\r\n <lib-question-text-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"\r\n [isTextArea]=\"question.isAdvanceTextArea\"></lib-question-text-template>\r\n\r\n <lib-question-radio-button-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-dropdown-template>\r\n\r\n <lib-question-check-box-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswers($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></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"] }]
587
901
  }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { surveyResultEmit: [{
588
902
  type: Output
589
903
  }] } });
@@ -601,7 +915,8 @@ class SurveryLibModule {
601
915
  QuestionCheckBoxTemplateComponent,
602
916
  QuestionDropdownTemplateComponent,
603
917
  QuestionMatrixTemplateComponent,
604
- QuestionBooleanTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule], exports: [SurveryLibComponent] }); }
918
+ QuestionBooleanTemplateComponent,
919
+ FilterQuestionPipe], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule], exports: [SurveryLibComponent] }); }
605
920
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule] }); }
606
921
  }
607
922
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, decorators: [{
@@ -614,7 +929,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
614
929
  QuestionCheckBoxTemplateComponent,
615
930
  QuestionDropdownTemplateComponent,
616
931
  QuestionMatrixTemplateComponent,
617
- QuestionBooleanTemplateComponent
932
+ QuestionBooleanTemplateComponent,
933
+ FilterQuestionPipe
618
934
  ],
619
935
  imports: [
620
936
  CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule