survery-lib 0.1.19 → 0.1.21
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/assets/style.css +11 -0
- package/assets/style.css.map +1 -1
- package/esm2022/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.mjs +3 -3
- package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +3 -3
- package/esm2022/lib/services/survey-lib.service.mjs +9 -1
- package/esm2022/lib/survery-lib.component.mjs +44 -21
- package/esm2022/shared/dtos/survey-language.dto.mjs +3 -0
- package/esm2022/shared/enums/survey-section.enum.mjs +6 -0
- package/esm2022/shared/form-interfaces/survery-lib.form-interface.mjs +1 -1
- package/fesm2022/survery-lib.mjs +51 -18
- package/fesm2022/survery-lib.mjs.map +1 -1
- package/lib/services/survey-lib.service.d.ts +4 -0
- package/lib/survery-lib.component.d.ts +11 -4
- package/package.json +1 -1
- package/shared/dtos/survey-language.dto.d.ts +7 -0
- package/shared/enums/survey-section.enum.d.ts +4 -0
- package/shared/form-interfaces/survery-lib.form-interface.d.ts +1 -0
package/fesm2022/survery-lib.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, Pipe, EventEmitter, Component, Output, Input, NgModule } from '@angular/core';
|
|
3
3
|
import { v4 } from 'uuid';
|
|
4
|
+
import * as i4 from '@angular/forms';
|
|
5
|
+
import { Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
4
6
|
import { Subject, of, debounceTime, map, filter } from 'rxjs';
|
|
5
7
|
import * as i1 from '@ng-stack/forms';
|
|
6
8
|
import { Validators as Validators$1, NgsFormsModule } from '@ng-stack/forms';
|
|
7
9
|
import * as i3 from '@angular/common';
|
|
8
10
|
import { CommonModule } from '@angular/common';
|
|
9
|
-
import * as i4 from '@angular/forms';
|
|
10
|
-
import { Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
11
11
|
import * as i5 from '@ng-select/ng-select';
|
|
12
12
|
import { NgSelectModule } from '@ng-select/ng-select';
|
|
13
13
|
import { HttpClientModule } from '@angular/common/http';
|
|
@@ -32,6 +32,12 @@ var LogicActionEnum;
|
|
|
32
32
|
LogicActionEnum[LogicActionEnum["SetAnswer"] = 5] = "SetAnswer";
|
|
33
33
|
})(LogicActionEnum || (LogicActionEnum = {}));
|
|
34
34
|
|
|
35
|
+
var SurveySectionEnum;
|
|
36
|
+
(function (SurveySectionEnum) {
|
|
37
|
+
SurveySectionEnum[SurveySectionEnum["SelectionLanguage"] = 1] = "SelectionLanguage";
|
|
38
|
+
SurveySectionEnum[SurveySectionEnum["Questions"] = 2] = "Questions";
|
|
39
|
+
})(SurveySectionEnum || (SurveySectionEnum = {}));
|
|
40
|
+
|
|
35
41
|
class SurveyLibService {
|
|
36
42
|
get surveyDataObsrv() {
|
|
37
43
|
return this.surveyDataSubject.asObservable();
|
|
@@ -39,9 +45,13 @@ class SurveyLibService {
|
|
|
39
45
|
get surveyAnswersObsrv() {
|
|
40
46
|
return this.surveyAnswersSubject.asObservable();
|
|
41
47
|
}
|
|
48
|
+
get surveyLanguagesObsrv() {
|
|
49
|
+
return this.surveyLanguagesSubject.asObservable();
|
|
50
|
+
}
|
|
42
51
|
constructor() {
|
|
43
52
|
this.surveyDataSubject = new Subject();
|
|
44
53
|
this.surveyAnswersSubject = new Subject();
|
|
54
|
+
this.surveyLanguagesSubject = new Subject();
|
|
45
55
|
}
|
|
46
56
|
setSurveyData(survey) {
|
|
47
57
|
this.surveyDataSubject.next(survey);
|
|
@@ -49,6 +59,10 @@ class SurveyLibService {
|
|
|
49
59
|
setsurveyAnswers(model) {
|
|
50
60
|
this.surveyAnswersSubject.next(model);
|
|
51
61
|
}
|
|
62
|
+
setSurveyLanguages(arr) {
|
|
63
|
+
console.log('setSurveyLanguages', arr);
|
|
64
|
+
this.surveyLanguagesSubject.next(arr);
|
|
65
|
+
}
|
|
52
66
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
53
67
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, providedIn: 'root' }); }
|
|
54
68
|
}
|
|
@@ -625,11 +639,11 @@ class QuestionDropdownTemplateComponent {
|
|
|
625
639
|
return element;
|
|
626
640
|
}
|
|
627
641
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
628
|
-
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 <ng-select [items]=\"surveyQuestion?.surveyAnswers\" bindValue=\"answerId\" bindLabel=\"answerTitle\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"false\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }] }); }
|
|
642
|
+
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 text-quastion__dropdown\">\n <ng-select [items]=\"surveyQuestion?.surveyAnswers\" bindValue=\"answerId\" bindLabel=\"answerTitle\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"false\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }] }); }
|
|
629
643
|
}
|
|
630
644
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, decorators: [{
|
|
631
645
|
type: Component,
|
|
632
|
-
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 <ng-select [items]=\"surveyQuestion?.surveyAnswers\" bindValue=\"answerId\" bindLabel=\"answerTitle\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"false\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"] }]
|
|
646
|
+
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 text-quastion__dropdown\">\n <ng-select [items]=\"surveyQuestion?.surveyAnswers\" bindValue=\"answerId\" bindLabel=\"answerTitle\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"false\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"] }]
|
|
633
647
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
634
648
|
type: Output
|
|
635
649
|
}], isShow: [{
|
|
@@ -890,11 +904,11 @@ class QuestionDropdownMultiTemplateComponent {
|
|
|
890
904
|
return element;
|
|
891
905
|
}
|
|
892
906
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownMultiTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
893
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownMultiTemplateComponent, selector: "lib-question-dropdown-multi-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 <ng-select [items]=\"this.fCtrls.answerArray.value\" bindValue=\"id\" bindLabel=\"title\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"true\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }] }); }
|
|
907
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownMultiTemplateComponent, selector: "lib-question-dropdown-multi-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 text-quastion__dropdown\">\n <ng-select [items]=\"this.fCtrls.answerArray.value\" bindValue=\"id\" bindLabel=\"title\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"true\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }] }); }
|
|
894
908
|
}
|
|
895
909
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownMultiTemplateComponent, decorators: [{
|
|
896
910
|
type: Component,
|
|
897
|
-
args: [{ selector: 'lib-question-dropdown-multi-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 <ng-select [items]=\"this.fCtrls.answerArray.value\" bindValue=\"id\" bindLabel=\"title\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"true\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"] }]
|
|
911
|
+
args: [{ selector: 'lib-question-dropdown-multi-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 text-quastion__dropdown\">\n <ng-select [items]=\"this.fCtrls.answerArray.value\" bindValue=\"id\" bindLabel=\"title\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"true\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"] }]
|
|
898
912
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
899
913
|
type: Output
|
|
900
914
|
}], isShow: [{
|
|
@@ -920,14 +934,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
920
934
|
}] });
|
|
921
935
|
|
|
922
936
|
class SurveryLibComponent {
|
|
937
|
+
;
|
|
923
938
|
get fCtrls() {
|
|
924
939
|
return this.rForm.controls;
|
|
925
940
|
}
|
|
926
941
|
get questionTypeEnum() {
|
|
927
942
|
return QuestionTypeEnum;
|
|
928
943
|
}
|
|
944
|
+
get surveySectionEnum() {
|
|
945
|
+
return SurveySectionEnum;
|
|
946
|
+
}
|
|
929
947
|
get isFirstPage() {
|
|
930
|
-
return this.
|
|
948
|
+
return this.selectedSection == SurveySectionEnum.SelectionLanguage;
|
|
931
949
|
}
|
|
932
950
|
get isLastPage() {
|
|
933
951
|
return this.showedSurveyPages.findIndex(x => x == this.fCtrls.currentPageIndex.value) == (this.showedSurveyPages.length - 1);
|
|
@@ -966,13 +984,22 @@ class SurveryLibComponent {
|
|
|
966
984
|
this._formBuilder = _formBuilder;
|
|
967
985
|
this._checkRuleExpsUsecase = _checkRuleExpsUsecase;
|
|
968
986
|
this.reloadDefaultAnswerId = v4();
|
|
987
|
+
this.surveyLangugeArr = [];
|
|
988
|
+
this.selectedSection = SurveySectionEnum.SelectionLanguage;
|
|
969
989
|
this.surveyResultEmit = new EventEmitter();
|
|
990
|
+
this.selectLanguageEmit = new EventEmitter();
|
|
970
991
|
this.rForm = this._formBuilder.group({
|
|
971
992
|
currentPageIndex: [0],
|
|
993
|
+
selectedLanguageId: [null, [Validators.required]],
|
|
972
994
|
questionArray: this._formBuilder.array([]),
|
|
973
995
|
ruleQuestionArray: this._formBuilder.array([])
|
|
974
996
|
});
|
|
975
997
|
}
|
|
998
|
+
ngAfterViewInit() {
|
|
999
|
+
this._surveyLibService.surveyLanguagesObsrv.subscribe(value => {
|
|
1000
|
+
this.surveyLangugeArr = value;
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
976
1003
|
ngOnInit() {
|
|
977
1004
|
this._surveyLibService.surveyDataObsrv.subscribe(survey => {
|
|
978
1005
|
this.fCtrls.questionArray.clear();
|
|
@@ -993,6 +1020,15 @@ class SurveryLibComponent {
|
|
|
993
1020
|
});
|
|
994
1021
|
}
|
|
995
1022
|
onPaggingNext() {
|
|
1023
|
+
if (this.selectedSection == SurveySectionEnum.SelectionLanguage) {
|
|
1024
|
+
if (this.fCtrls.selectedLanguageId.valid == false) {
|
|
1025
|
+
$(`#survey-page_pre`).addClass('survey-page_submitted');
|
|
1026
|
+
}
|
|
1027
|
+
else {
|
|
1028
|
+
this.selectedSection = SurveySectionEnum.Questions;
|
|
1029
|
+
}
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
996
1032
|
var isHaveInvalidRecords = this.haveInValidateQuestions();
|
|
997
1033
|
if (isHaveInvalidRecords == false) {
|
|
998
1034
|
const nextPageIndex = this.getNextShowedPage();
|
|
@@ -1014,20 +1050,15 @@ class SurveryLibComponent {
|
|
|
1014
1050
|
}
|
|
1015
1051
|
}
|
|
1016
1052
|
}
|
|
1017
|
-
onPaggingChange(index) {
|
|
1018
|
-
const formValue = this.rForm.value;
|
|
1019
|
-
if (index < formValue.currentPageIndex) {
|
|
1020
|
-
this.fCtrls.currentPageIndex.setValue(index);
|
|
1021
|
-
}
|
|
1022
|
-
else if (index == (formValue.currentPageIndex + 1)) {
|
|
1023
|
-
this.onPaggingNext();
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
1053
|
onPaggingBack() {
|
|
1027
1054
|
const prevPageIndex = this.getPrevShowedPage();
|
|
1028
1055
|
if (prevPageIndex != null) {
|
|
1029
1056
|
this.fCtrls.currentPageIndex.setValue(prevPageIndex);
|
|
1030
1057
|
}
|
|
1058
|
+
else {
|
|
1059
|
+
this.selectedSection = SurveySectionEnum.SelectionLanguage;
|
|
1060
|
+
this.fCtrls.currentPageIndex.setValue(0);
|
|
1061
|
+
}
|
|
1031
1062
|
}
|
|
1032
1063
|
onUpdateAnswers(model) {
|
|
1033
1064
|
model.forEach(elem => {
|
|
@@ -1192,13 +1223,15 @@ class SurveryLibComponent {
|
|
|
1192
1223
|
return null;
|
|
1193
1224
|
}
|
|
1194
1225
|
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 }); }
|
|
1195
|
-
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\" *ngIf=\"surveyData != null\">\r\n
|
|
1226
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", outputs: { surveyResultEmit: "surveyResultEmit", selectLanguageEmit: "selectLanguageEmit" }, ngImport: i0, template: "<div class=\"survay-card\">\r\n <div id=\"survey-page_pre\" *ngIf=\"selectedSection == surveySectionEnum.SelectionLanguage\">\r\n <div class=\"quastion\" [ngClass]=\"{'invalid-question': fCtrls.selectedLanguageId.invalid}\">\r\n <h3 class=\"quastion-title \"> \u0644\u063A\u0647 \u0627\u0644\u0627\u0633\u062A\u0628\u064A\u0627\u0646 </h3>\r\n <div class=\"text-quastion text-quastion__dropdown\">\r\n <ng-select [items]=\"surveyLangugeArr\" bindValue=\"id\" bindLabel=\"name\" class=\"form-control\"\r\n [formControl]=\"fCtrls.selectedLanguageId\" [multiple]=\"false\">\r\n </ng-select>\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"selectedSection == surveySectionEnum.Questions && surveyData != null\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\"\r\n [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 #questionBooleanTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionTextTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionDropdownTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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-dropdown-multi-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDownMulti\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionMatrixTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 fw-bold\">\r\n <span>{{curruntShowedSurveyPages}}</span>\r\n <span class=\"ms-2 me-2\">of</span>\r\n <span>{{showedSurveyPages?.length}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}.quastion{padding:10px}.quastion .quastion-title{color:var(--dark-100, #363636);text-align:right;font-family:Almarai;font-size:18px;font-style:normal;font-weight:700;line-height:20.6px}\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: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { 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: "component", type: QuestionDropdownMultiTemplateComponent, selector: "lib-question-dropdown-multi-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
|
|
1196
1227
|
}
|
|
1197
1228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
|
|
1198
1229
|
type: Component,
|
|
1199
|
-
args: [{ selector: 'lib-survery-lib', template: "<div class=\"survay-card\" *ngIf=\"surveyData != null\">\r\n
|
|
1230
|
+
args: [{ selector: 'lib-survery-lib', template: "<div class=\"survay-card\">\r\n <div id=\"survey-page_pre\" *ngIf=\"selectedSection == surveySectionEnum.SelectionLanguage\">\r\n <div class=\"quastion\" [ngClass]=\"{'invalid-question': fCtrls.selectedLanguageId.invalid}\">\r\n <h3 class=\"quastion-title \"> \u0644\u063A\u0647 \u0627\u0644\u0627\u0633\u062A\u0628\u064A\u0627\u0646 </h3>\r\n <div class=\"text-quastion text-quastion__dropdown\">\r\n <ng-select [items]=\"surveyLangugeArr\" bindValue=\"id\" bindLabel=\"name\" class=\"form-control\"\r\n [formControl]=\"fCtrls.selectedLanguageId\" [multiple]=\"false\">\r\n </ng-select>\r\n </div>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"selectedSection == surveySectionEnum.Questions && surveyData != null\">\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\"\r\n [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 #questionBooleanTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionTextTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionDropdownTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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-dropdown-multi-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDownMulti\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 #questionMatrixTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *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 fw-bold\">\r\n <span>{{curruntShowedSurveyPages}}</span>\r\n <span class=\"ms-2 me-2\">of</span>\r\n <span>{{showedSurveyPages?.length}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}.quastion{padding:10px}.quastion .quastion-title{color:var(--dark-100, #363636);text-align:right;font-family:Almarai;font-size:18px;font-style:normal;font-weight:700;line-height:20.6px}\n"] }]
|
|
1200
1231
|
}], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { surveyResultEmit: [{
|
|
1201
1232
|
type: Output
|
|
1233
|
+
}], selectLanguageEmit: [{
|
|
1234
|
+
type: Output
|
|
1202
1235
|
}] } });
|
|
1203
1236
|
|
|
1204
1237
|
class DefaultQuestionAnswerPipe {
|