survery-lib 2.1.33 → 2.1.34
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.
- package/esm2022/lib/components/question-boolean-template/question-boolean-template.component.mjs +5 -1
- package/esm2022/lib/components/question-cascade-template/question-cascade-template.component.mjs +7 -3
- package/esm2022/lib/components/question-check-box-template/question-check-box-template.component.mjs +6 -3
- package/esm2022/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.mjs +4 -1
- package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +4 -1
- package/esm2022/lib/components/question-feedback-template/question-feedback-template.component.mjs +4 -1
- package/esm2022/lib/components/question-institutions-template/question-institutions-template.component.mjs +1 -2
- package/esm2022/lib/components/question-matrix-template/question-matrix-template.component.mjs +4 -1
- package/esm2022/lib/components/question-radio-button-template/question-radio-button-template.component.mjs +4 -1
- package/esm2022/lib/services/survey-lib.service.mjs +1 -8
- package/esm2022/shared/form-interfaces/question-cascade.form-interface.mjs +1 -1
- package/fesm2022/survery-lib.mjs +30 -12
- package/fesm2022/survery-lib.mjs.map +1 -1
- package/lib/services/survey-lib.service.d.ts +0 -1
- package/package.json +1 -1
- package/shared/form-interfaces/question-cascade.form-interface.d.ts +1 -0
package/fesm2022/survery-lib.mjs
CHANGED
|
@@ -186,7 +186,6 @@ class SurveyLibService {
|
|
|
186
186
|
constructor(_Store) {
|
|
187
187
|
this._Store = _Store;
|
|
188
188
|
this.reloadSurveySubject = new Subject();
|
|
189
|
-
this.questionsWithErrors = [];
|
|
190
189
|
}
|
|
191
190
|
setSurveyData(survey) {
|
|
192
191
|
var questionArr = [];
|
|
@@ -254,12 +253,6 @@ class SurveyLibService {
|
|
|
254
253
|
}
|
|
255
254
|
addQuestion(question, pageIndex, questionGroupId) {
|
|
256
255
|
var questionArr = [];
|
|
257
|
-
if (question.surveyAnswers?.length == 0 || question.surveyAnswers == null) {
|
|
258
|
-
debugger;
|
|
259
|
-
this.questionsWithErrors.push(question);
|
|
260
|
-
console.error("Question has no erros", this.questionsWithErrors);
|
|
261
|
-
return questionArr;
|
|
262
|
-
}
|
|
263
256
|
var questionNgrxModel = {
|
|
264
257
|
surveyPageId: pageIndex,
|
|
265
258
|
questionId: question.questionId,
|
|
@@ -867,6 +860,9 @@ class QuestionRadioButtonTemplateComponent {
|
|
|
867
860
|
isSelected: new FormControl(false)
|
|
868
861
|
}));
|
|
869
862
|
});
|
|
863
|
+
if (value.isShow == true) {
|
|
864
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
865
|
+
}
|
|
870
866
|
if (value.isRequired == true) {
|
|
871
867
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
872
868
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -975,6 +971,9 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
975
971
|
isSelected: new FormControl(false)
|
|
976
972
|
}));
|
|
977
973
|
});
|
|
974
|
+
if (value.isShow == true) {
|
|
975
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
976
|
+
}
|
|
978
977
|
if (value.isRequired == true) {
|
|
979
978
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
980
979
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -1065,11 +1064,11 @@ class QuestionCheckBoxTemplateComponent {
|
|
|
1065
1064
|
return element;
|
|
1066
1065
|
}
|
|
1067
1066
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }, { token: i3.Store }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1068
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: { setQuestion: "setQuestion" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':fCtrls.isShow.value != true}\">\r\n <h3 class=\"quastion-title \">\r\n <span [innerHTML]=\"fCtrls.title.value\"></span>\r\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\r\n </h3>\r\n\r\n <div class=\"checkbox-button-quastion\">\r\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\r\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" [disabled]=\"fCtrls.isDisabled.value\"\r\n (change)=\"onChangeAnswer(item ,$event)\" [checked]=\"item.value.isSelected == true? true : null\">\r\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\" [innerHTML]=\"item.value.title\"></label>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1067
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: { setQuestion: "setQuestion" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" \r\n[ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':fCtrls.isShow.value != true}\">\r\n <h3 class=\"quastion-title \">\r\n <span [innerHTML]=\"fCtrls.title.value\"></span>\r\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\r\n </h3>\r\n\r\n <div class=\"checkbox-button-quastion\">\r\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\r\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" [disabled]=\"fCtrls.isDisabled.value\"\r\n (change)=\"onChangeAnswer(item ,$event)\" [checked]=\"item.value.isSelected == true? true : null\">\r\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\" [innerHTML]=\"item.value.title\"></label>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1069
1068
|
}
|
|
1070
1069
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCheckBoxTemplateComponent, decorators: [{
|
|
1071
1070
|
type: Component,
|
|
1072
|
-
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':fCtrls.isShow.value != true}\">\r\n <h3 class=\"quastion-title \">\r\n <span [innerHTML]=\"fCtrls.title.value\"></span>\r\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\r\n </h3>\r\n\r\n <div class=\"checkbox-button-quastion\">\r\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\r\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" [disabled]=\"fCtrls.isDisabled.value\"\r\n (change)=\"onChangeAnswer(item ,$event)\" [checked]=\"item.value.isSelected == true? true : null\">\r\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\" [innerHTML]=\"item.value.title\"></label>\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
1071
|
+
args: [{ selector: 'lib-question-check-box-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" \r\n[ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':fCtrls.isShow.value != true}\">\r\n <h3 class=\"quastion-title \">\r\n <span [innerHTML]=\"fCtrls.title.value\"></span>\r\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\r\n </h3>\r\n\r\n <div class=\"checkbox-button-quastion\">\r\n <div class=\"form-check check-box-form-check\" *ngFor=\"let item of fCtrls.answerArray.controls ;let i = index\">\r\n <input type=\"checkbox\" class=\"form-check-input\" id=\"{{elemId}}__checkbox_{{i}}\" [disabled]=\"fCtrls.isDisabled.value\"\r\n (change)=\"onChangeAnswer(item ,$event)\" [checked]=\"item.value.isSelected == true? true : null\">\r\n <label class=\"form-check-label \" for=\"{{elemId}}__checkbox_{{i}}\" [innerHTML]=\"item.value.title\"></label>\r\n </div>\r\n </div>\r\n</div>\r\n" }]
|
|
1073
1072
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }, { type: i3.Store }]; }, propDecorators: { setQuestion: [{
|
|
1074
1073
|
type: Input
|
|
1075
1074
|
}] } });
|
|
@@ -1093,6 +1092,9 @@ class QuestionDropdownTemplateComponent {
|
|
|
1093
1092
|
isDisabled: value.questionAllInfo.isReadOnly,
|
|
1094
1093
|
isShow: value.questionAllInfo.isVisable
|
|
1095
1094
|
});
|
|
1095
|
+
if (value.isShow == true) {
|
|
1096
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
1097
|
+
}
|
|
1096
1098
|
if (value.isRequired == true) {
|
|
1097
1099
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
1098
1100
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -1197,6 +1199,9 @@ class QuestionMatrixTemplateComponent {
|
|
|
1197
1199
|
questionTitle: new FormControl(x.questionTitle),
|
|
1198
1200
|
answer: new FormControl(null),
|
|
1199
1201
|
});
|
|
1202
|
+
if (value.isShow == true) {
|
|
1203
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
1204
|
+
}
|
|
1200
1205
|
if (value.isRequired == true) {
|
|
1201
1206
|
group.controls.answer.addValidators([Validators.required]);
|
|
1202
1207
|
group.controls.answer.updateValueAndValidity();
|
|
@@ -1315,6 +1320,9 @@ class QuestionBooleanTemplateComponent {
|
|
|
1315
1320
|
isSelected: new FormControl(false)
|
|
1316
1321
|
}));
|
|
1317
1322
|
});
|
|
1323
|
+
if (value.isShow == true) {
|
|
1324
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
1325
|
+
}
|
|
1318
1326
|
if (value.isRequired == true) {
|
|
1319
1327
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
1320
1328
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -1373,6 +1381,7 @@ class QuestionBooleanTemplateComponent {
|
|
|
1373
1381
|
if (oldValue?.isDisabled != newValue?.isDisabled) {
|
|
1374
1382
|
this.fCtrls.isDisabled.setValue(newValue?.isDisabled);
|
|
1375
1383
|
}
|
|
1384
|
+
console.log("newValue?.isShow", newValue?.isShow);
|
|
1376
1385
|
//updated isShow
|
|
1377
1386
|
if (oldValue?.isShow != newValue?.isShow) {
|
|
1378
1387
|
this.fCtrls.isShow.setValue(newValue?.isShow);
|
|
@@ -1424,6 +1433,9 @@ class QuestionDropdownMultiTemplateComponent {
|
|
|
1424
1433
|
isSelected: new FormControl(false)
|
|
1425
1434
|
}));
|
|
1426
1435
|
});
|
|
1436
|
+
if (value.isShow == true) {
|
|
1437
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
1438
|
+
}
|
|
1427
1439
|
if (value.isRequired == true) {
|
|
1428
1440
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
1429
1441
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -1582,6 +1594,9 @@ class QuestionCascadeTemplateComponent {
|
|
|
1582
1594
|
set setQuestion(value) {
|
|
1583
1595
|
if (this.surveyQuestionArr?.length == 0) {
|
|
1584
1596
|
this.setQuestions(value.questionAllInfo);
|
|
1597
|
+
if (value.isShow == true) {
|
|
1598
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
1599
|
+
}
|
|
1585
1600
|
var childQuestion1 = this.pageQuestions$().find(x => x.parentQuestionId == value.questionId);
|
|
1586
1601
|
if (childQuestion1) {
|
|
1587
1602
|
this.setQuestions(childQuestion1.questionAllInfo);
|
|
@@ -1606,6 +1621,7 @@ class QuestionCascadeTemplateComponent {
|
|
|
1606
1621
|
this.surveyKey = null;
|
|
1607
1622
|
this.applicantKey = null;
|
|
1608
1623
|
this.rForm = this._formBuilder.group({
|
|
1624
|
+
isShow: new FormControl(false),
|
|
1609
1625
|
questionArr: this._formBuilder.array([])
|
|
1610
1626
|
});
|
|
1611
1627
|
}
|
|
@@ -1770,11 +1786,11 @@ class QuestionCascadeTemplateComponent {
|
|
|
1770
1786
|
});
|
|
1771
1787
|
}
|
|
1772
1788
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCascadeTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }, { token: ApiService }, { token: i3.Store }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1773
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: { pageId: "pageId", questionGroupId: "questionGroupId", isPre: "isPre", surveyLanguageId: "surveyLanguageId", surveyKey: "surveyKey", applicantKey: "applicantKey", setQuestion: "setQuestion" }, ngImport: i0, template: "<ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n
|
|
1789
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: { pageId: "pageId", questionGroupId: "questionGroupId", isPre: "isPre", surveyLanguageId: "surveyLanguageId", surveyKey: "surveyKey", applicantKey: "applicantKey", setQuestion: "setQuestion" }, ngImport: i0, template: "<div [ngClass]=\"{'d-none':fCtrls.isShow.value != true}\">\r\n <ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n <lib-question-dropdown-template #questionDropdownTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType != questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \" (emitter)=\"onUpdateAnswer($event)\">\r\n </lib-question-dropdown-template>\r\n\r\n <lib-question-text-template #questionTextTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType == questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \"\r\n [isArabicLang]=\"true\"></lib-question-text-template>\r\n\r\n </ng-container>\r\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: ["isArabicLang", "setQuestion", "isDisabled"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "pipe", type: FindQuestionPipe, name: "findQuestion" }] }); }
|
|
1774
1790
|
}
|
|
1775
1791
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCascadeTemplateComponent, decorators: [{
|
|
1776
1792
|
type: Component,
|
|
1777
|
-
args: [{ selector: 'lib-question-cascade-template', template: "<ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n
|
|
1793
|
+
args: [{ selector: 'lib-question-cascade-template', template: "<div [ngClass]=\"{'d-none':fCtrls.isShow.value != true}\">\r\n <ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n <lib-question-dropdown-template #questionDropdownTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType != questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \" (emitter)=\"onUpdateAnswer($event)\">\r\n </lib-question-dropdown-template>\r\n\r\n <lib-question-text-template #questionTextTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType == questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \"\r\n [isArabicLang]=\"true\"></lib-question-text-template>\r\n\r\n </ng-container>\r\n</div>" }]
|
|
1778
1794
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }, { type: ApiService }, { type: i3.Store }]; }, propDecorators: { pageId: [{
|
|
1779
1795
|
type: Input
|
|
1780
1796
|
}], questionGroupId: [{
|
|
@@ -1822,6 +1838,9 @@ class QuestionFeedbackTemplateComponent {
|
|
|
1822
1838
|
this.fCtrls.inputTypeId.setValue(InputTypeEnum.Pagination);
|
|
1823
1839
|
}
|
|
1824
1840
|
}
|
|
1841
|
+
if (value.isShow == true) {
|
|
1842
|
+
this.fCtrls.isShow.setValue(value.isShow);
|
|
1843
|
+
}
|
|
1825
1844
|
if (value.isRequired == true) {
|
|
1826
1845
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
1827
1846
|
this.fCtrls.answer.updateValueAndValidity();
|
|
@@ -1936,7 +1955,6 @@ class QuestionInstitutionsTemplateComponent {
|
|
|
1936
1955
|
isShow: value.isShow
|
|
1937
1956
|
});
|
|
1938
1957
|
value.questionAllInfo.surveySubQuestionLevels.forEach(surveySubQuestionLevel => {
|
|
1939
|
-
console.log(surveySubQuestionLevel);
|
|
1940
1958
|
var question = this.pageQuestions$().find(x => x.questionId == value.questionId);
|
|
1941
1959
|
this.setQuestionFormGroup(surveySubQuestionLevel, question?.isRequired, question?.answerId);
|
|
1942
1960
|
});
|