survery-lib 0.0.6 → 0.0.8

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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, EventEmitter, Component, Output, Input, Pipe, NgModule } from '@angular/core';
3
- import { Subject, BehaviorSubject, debounceTime, distinctUntilChanged, of } from 'rxjs';
3
+ import { Subject, of, BehaviorSubject, debounceTime, distinctUntilChanged } 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 LogicActionEnum;
24
+ (function (LogicActionEnum) {
25
+ LogicActionEnum[LogicActionEnum["Show"] = 1] = "Show";
26
+ LogicActionEnum[LogicActionEnum["Hide"] = 2] = "Hide";
27
+ LogicActionEnum[LogicActionEnum["Enable"] = 3] = "Enable";
28
+ LogicActionEnum[LogicActionEnum["Disable"] = 4] = "Disable";
29
+ LogicActionEnum[LogicActionEnum["SetAnswer"] = 5] = "SetAnswer";
30
+ })(LogicActionEnum || (LogicActionEnum = {}));
31
+
32
+ class SurveyLibService {
33
+ get surveyDataObsrv() {
34
+ return this.surveyDataSubject.asObservable();
35
+ }
36
+ constructor() {
37
+ this.surveyDataSubject = new Subject();
38
+ }
39
+ setSurveyData(survey) {
40
+ this.surveyDataSubject.next(survey);
41
+ }
42
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
43
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, providedIn: 'root' }); }
44
+ }
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, decorators: [{
46
+ type: Injectable,
47
+ args: [{
48
+ providedIn: 'root'
49
+ }]
50
+ }], ctorParameters: function () { return []; } });
51
+
23
52
  var LogicPropertyEnum;
24
53
  (function (LogicPropertyEnum) {
25
54
  LogicPropertyEnum[LogicPropertyEnum["GreaterThan"] = 1] = "GreaterThan";
@@ -40,34 +69,153 @@ var OperatorEnum;
40
69
  OperatorEnum[OperatorEnum["And"] = 8] = "And";
41
70
  })(OperatorEnum || (OperatorEnum = {}));
42
71
 
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
-
52
- class SurveyLibService {
53
- get surveyDataObsrv() {
54
- return this.surveyDataSubject.asObservable();
55
- }
72
+ class CheckRuleExpsUsecase {
56
73
  constructor() {
57
- this.surveyDataSubject = new Subject();
58
74
  }
59
- setSurveyData(survey) {
60
- this.surveyDataSubject.next(survey);
75
+ execute(params) {
76
+ var useCaseResult = {
77
+ exprestionResultArr: []
78
+ };
79
+ params.ruleExps.forEach(ruleExp => {
80
+ const index = params.questions.findIndex(x => x.questionId == ruleExp.questionId);
81
+ var questionGroupValue = params.questions.at(index);
82
+ var result;
83
+ if (questionGroupValue.questionType == QuestionTypeEnum.TextInput) {
84
+ result = this.checkRuleExpForAnswerText(ruleExp, questionGroupValue.answerText);
85
+ }
86
+ else if (questionGroupValue.questionType == QuestionTypeEnum.CheckBox) {
87
+ result = this.checkRuleExpForAnswerIdArr(ruleExp, questionGroupValue.answerIdArr);
88
+ }
89
+ else {
90
+ result = this.checkRuleExpForAnswerId(ruleExp, questionGroupValue.answerId);
91
+ }
92
+ var answers = ruleExp.ruleExpAnswers.map(x => x.answerId + '-' + x.answerTitle);
93
+ console.log(`Question ${questionGroupValue.questionId} type ${QuestionTypeEnum[questionGroupValue.questionType]} --- ${result == true ? 'passed' : 'not passed'} ---`, ` answers (${answers.join(' , ')}) logic (${LogicPropertyEnum[ruleExp.logicPropertyId]}) operator (${OperatorEnum[ruleExp.opporator]})`);
94
+ useCaseResult.exprestionResultArr.push(result);
95
+ });
96
+ return of(useCaseResult);
61
97
  }
62
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
63
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, providedIn: 'root' }); }
98
+ checkRuleExpForAnswerId(ruleExp, answerId) {
99
+ var ruleExpResultArr = [];
100
+ if (ruleExp.logicPropertyId == LogicPropertyEnum.GreaterThan) {
101
+ ruleExp.ruleExpAnswers.forEach(answer => {
102
+ var result = answerId > answer.answerId;
103
+ ruleExpResultArr.push(result);
104
+ });
105
+ }
106
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.GreaterThanOrEqual) {
107
+ ruleExp.ruleExpAnswers.forEach(answer => {
108
+ var result = answerId >= answer.answerId;
109
+ ruleExpResultArr.push(result);
110
+ });
111
+ }
112
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.LessThan) {
113
+ ruleExp.ruleExpAnswers.forEach(answer => {
114
+ var result = answerId < answer.answerId;
115
+ ruleExpResultArr.push(result);
116
+ });
117
+ }
118
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.LessThanOrEqual) {
119
+ ruleExp.ruleExpAnswers.forEach(answer => {
120
+ var result = answerId <= answer.answerId;
121
+ ruleExpResultArr.push(result);
122
+ });
123
+ }
124
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.Equal) {
125
+ ruleExp.ruleExpAnswers.forEach(answer => {
126
+ var result = answerId == answer.answerId;
127
+ ruleExpResultArr.push(result);
128
+ });
129
+ }
130
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.NotEqual) {
131
+ ruleExp.ruleExpAnswers.forEach(answer => {
132
+ var result = answerId != answer.answerId;
133
+ ruleExpResultArr.push(result);
134
+ });
135
+ }
136
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.IsEmpty) {
137
+ var result = answerId == null;
138
+ ruleExpResultArr.push(result);
139
+ }
140
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.IsNotEmpty) {
141
+ var result = answerId != null;
142
+ ruleExpResultArr.push(result);
143
+ }
144
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.AnyOf) {
145
+ var answerIdArr = ruleExp.ruleExpAnswers.map(x => x.answerId);
146
+ var result = answerIdArr.findIndex(x => x == answerId) > -1;
147
+ ruleExpResultArr.push(result);
148
+ }
149
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.Then) {
150
+ var answerIdArr = ruleExp.ruleExpAnswers.map(x => x.answerId);
151
+ var result = answerIdArr.findIndex(x => x == answerId) == -1;
152
+ ruleExpResultArr.push(result);
153
+ }
154
+ if (ruleExpResultArr.length == 0) {
155
+ return false;
156
+ }
157
+ else if (ruleExp.ruleExpAnswers.length == 1) {
158
+ return ruleExpResultArr.filter(x => x == true).length > 0;
159
+ }
160
+ else if (ruleExp.opporator == OperatorEnum.Or) {
161
+ return ruleExpResultArr.filter(x => x == true).length > 0;
162
+ }
163
+ else {
164
+ return ruleExpResultArr.filter(x => x == false).length == 0;
165
+ }
166
+ }
167
+ checkRuleExpForAnswerIdArr(ruleExp, answerIdArr) {
168
+ var ruleExpResultArr = [];
169
+ answerIdArr?.forEach(answer => {
170
+ var isResult = this.checkRuleExpForAnswerId(ruleExp, answer);
171
+ ruleExpResultArr.push(isResult);
172
+ });
173
+ if (ruleExpResultArr.length == 0) {
174
+ return false;
175
+ }
176
+ else if (ruleExp.ruleExpAnswers.length == 1) {
177
+ return ruleExpResultArr.filter(x => x == true).length > 0;
178
+ }
179
+ else if (ruleExp.opporator == OperatorEnum.Or) {
180
+ return ruleExpResultArr.filter(x => x == true).length > 0;
181
+ }
182
+ else {
183
+ return ruleExpResultArr.filter(x => x == false).length == 0;
184
+ }
185
+ }
186
+ checkRuleExpForAnswerText(ruleExp, answer) {
187
+ var ruleExpResultArr = [];
188
+ if (ruleExp.logicPropertyId == LogicPropertyEnum.IsEmpty) {
189
+ var result = answer == null || answer == '';
190
+ ruleExpResultArr.push(result);
191
+ }
192
+ else if (ruleExp.logicPropertyId == LogicPropertyEnum.IsNotEmpty) {
193
+ var result = answer != null && answer != '';
194
+ ruleExpResultArr.push(result);
195
+ }
196
+ if (ruleExp.ruleExpAnswers.length == 1) {
197
+ return ruleExpResultArr.filter(x => x == true).length > 0;
198
+ }
199
+ else if (ruleExp.opporator == OperatorEnum.Or) {
200
+ return ruleExpResultArr.filter(x => x == true).length > 0;
201
+ }
202
+ else {
203
+ return ruleExpResultArr.filter(x => x == false).length == 0;
204
+ }
205
+ }
206
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: CheckRuleExpsUsecase, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
207
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: CheckRuleExpsUsecase, providedIn: 'root' }); }
64
208
  }
65
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, decorators: [{
209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: CheckRuleExpsUsecase, decorators: [{
66
210
  type: Injectable,
67
211
  args: [{
68
212
  providedIn: 'root'
69
213
  }]
70
214
  }], ctorParameters: function () { return []; } });
215
+ class CheckRulesUsecaseModel {
216
+ }
217
+ class CheckRulesUsecaseResult {
218
+ }
71
219
 
72
220
  class SharedDataService {
73
221
  get submitIdObsrv() {
@@ -591,10 +739,10 @@ class SurveryLibComponent {
591
739
  get isLastPage() {
592
740
  return this.fCtrls.currentPageIndex.value == (this.surveyData?.surveyPages.length - 1);
593
741
  }
594
- constructor(_surveyLibService, _formBuilder, _sharedDataService) {
742
+ constructor(_surveyLibService, _formBuilder, _checkRuleExpsUsecase) {
595
743
  this._surveyLibService = _surveyLibService;
596
744
  this._formBuilder = _formBuilder;
597
- this._sharedDataService = _sharedDataService;
745
+ this._checkRuleExpsUsecase = _checkRuleExpsUsecase;
598
746
  this.surveyResultEmit = new EventEmitter();
599
747
  this.rForm = this._formBuilder.group({
600
748
  currentPageIndex: [0],
@@ -623,7 +771,8 @@ class SurveryLibComponent {
623
771
  return of(null);
624
772
  }
625
773
  else {
626
- return of(this.fCtrls.questionArray.value);
774
+ var questionArr = this.fCtrls.questionArray.value.filter(x => x.isMatrixGroup != true);
775
+ return of(questionArr);
627
776
  }
628
777
  }
629
778
  else {
@@ -727,7 +876,7 @@ class SurveryLibComponent {
727
876
  }
728
877
  haveInValidateQuestions() {
729
878
  const currentPageIndex = this.fCtrls.currentPageIndex.value;
730
- var invalidRecords = this.rForm.value.questionArray.filter(x => x.surveyPageIndex == currentPageIndex && x.isValid != true && x.isMatrixGroup != true);
879
+ var invalidRecords = this.fCtrls.questionArray.value.filter(x => x.surveyPageIndex == currentPageIndex && x.isValid != true && x.isDisabled == false && x.isMatrixGroup != true);
731
880
  if (invalidRecords.length > 0) {
732
881
  $(`#survey-page_${currentPageIndex}`).addClass('survey-page_submitted');
733
882
  }
@@ -735,170 +884,51 @@ class SurveryLibComponent {
735
884
  }
736
885
  checkRules() {
737
886
  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);
887
+ this._checkRuleExpsUsecase.execute({
888
+ ruleExps: rule.ruleExps,
889
+ questions: this.fCtrls.questionArray.value
890
+ }).subscribe(result => {
891
+ var isPassed = result.exprestionResultArr.filter(x => x == false).length == 0;
892
+ if (isPassed) {
893
+ rule.ruleResultQuestions.forEach(resultQuestion => {
894
+ const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == resultQuestion.questionId);
895
+ var questionGroup = this.fCtrls.questionArray.at(index);
896
+ if (rule.logicActionId == LogicActionEnum.Show) {
897
+ questionGroup.controls.isShow.setValue(true);
898
+ }
899
+ else if (rule.logicActionId == LogicActionEnum.Hide) {
900
+ questionGroup.controls.isShow.setValue(false);
901
+ }
902
+ else if (rule.logicActionId == LogicActionEnum.Enable) {
903
+ questionGroup.controls.isDisabled.setValue(false);
904
+ }
905
+ else if (rule.logicActionId == LogicActionEnum.Disable) {
906
+ questionGroup.controls.isDisabled.setValue(true);
907
+ }
908
+ else if (rule.logicActionId == LogicActionEnum.SetAnswer) {
909
+ }
910
+ });
748
911
  }
749
912
  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
913
+ rule.ruleResultQuestions.forEach(resultQuestion => {
914
+ const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == resultQuestion.questionId);
915
+ var questionGroup = this.fCtrls.questionArray.at(index);
916
+ questionGroup.patchValue({
917
+ isShow: questionGroup.value.isShow_default,
918
+ isDisabled: questionGroup.value.isDisabled_default
919
+ });
782
920
  });
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);
921
+ }
823
922
  });
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
923
  });
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
924
  }
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 }); }
925
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, deps: [{ token: SurveyLibService }, { token: i1.FormBuilder }, { token: CheckRuleExpsUsecase }], target: i0.ɵɵFactoryTarget.Component }); }
896
926
  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" }] }); }
897
927
  }
898
928
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
899
929
  type: Component,
900
930
  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"] }]
901
- }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: SharedDataService }]; }, propDecorators: { surveyResultEmit: [{
931
+ }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { surveyResultEmit: [{
902
932
  type: Output
903
933
  }] } });
904
934