survery-lib 0.1.11 → 0.1.13
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.map +1 -1
- package/esm2022/lib/components/question-boolean-template/question-boolean-template.component.mjs +99 -0
- package/esm2022/lib/components/question-check-box-template/question-check-box-template.component.mjs +110 -0
- package/esm2022/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.mjs +95 -0
- package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +83 -0
- package/esm2022/lib/components/question-matrix-template/question-matrix-template.component.mjs +101 -0
- package/esm2022/lib/components/question-radio-button-template/question-radio-button-template.component.mjs +99 -0
- package/esm2022/lib/components/question-text-template/question-text-template.component.mjs +99 -0
- package/esm2022/lib/pipes/default-question-answer.pipe.mjs +19 -0
- package/esm2022/lib/pipes/default-question-answers.pipe.mjs +19 -0
- package/esm2022/lib/pipes/filter-question.pipe.mjs +16 -0
- package/esm2022/lib/services/survey-lib.service.mjs +30 -0
- package/esm2022/lib/survery-lib.component.mjs +302 -0
- package/esm2022/lib/survery-lib.module.mjs +63 -0
- package/esm2022/lib/usecases/base/use-case.mjs +2 -0
- package/esm2022/lib/usecases/check-rule-exps.usecase.mjs +154 -0
- package/esm2022/public-api.mjs +8 -0
- package/esm2022/shared/dtos/default-question-answers.dto.mjs +3 -0
- package/esm2022/shared/dtos/rule-exp-answer.dto.mjs +2 -0
- package/esm2022/shared/dtos/rule-exp.dto.mjs +2 -0
- package/esm2022/shared/dtos/rule-result-question.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-answer.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-answers-subject.dto.mjs +3 -0
- package/esm2022/shared/dtos/survey-page.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-question-group.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-question.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-rule.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-sub-question.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey.dto.mjs +2 -0
- package/esm2022/shared/enums/Logic-Property.enum.mjs +14 -0
- package/esm2022/shared/enums/logic-action.enum.mjs +9 -0
- package/esm2022/shared/enums/operator.enum.mjs +6 -0
- package/esm2022/shared/enums/question-type.enum.mjs +11 -0
- package/esm2022/shared/form-interfaces/question-boolean-template.form-interface.mjs +2 -0
- package/esm2022/shared/form-interfaces/question-check-box-template.form-interface.mjs +3 -0
- package/esm2022/shared/form-interfaces/question-dropdown-multi-template.form-interface.mjs +3 -0
- package/esm2022/shared/form-interfaces/question-dropdown-template.form-interface.mjs +3 -0
- package/esm2022/shared/form-interfaces/question-matrix-template.form-interface.mjs +2 -0
- package/esm2022/shared/form-interfaces/question-radio-button-template.form-interface.mjs +3 -0
- package/esm2022/shared/form-interfaces/question-text-template.form-interface.mjs +2 -0
- package/esm2022/shared/form-interfaces/survery-lib.form-interface.mjs +2 -0
- package/esm2022/shared/models/question-answer.model.mjs +3 -0
- package/esm2022/shared/models/survery-question-result.model.mjs +3 -0
- package/esm2022/survery-lib.mjs +5 -0
- package/fesm2022/survery-lib.mjs +1240 -0
- package/fesm2022/survery-lib.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/question-boolean-template/question-boolean-template.component.d.ts +36 -0
- package/lib/components/question-check-box-template/question-check-box-template.component.d.ts +37 -0
- package/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.d.ts +35 -0
- package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +33 -0
- package/lib/components/question-matrix-template/question-matrix-template.component.d.ts +33 -0
- package/lib/components/question-radio-button-template/question-radio-button-template.component.d.ts +36 -0
- package/lib/components/question-text-template/question-text-template.component.d.ts +35 -0
- package/lib/pipes/default-question-answer.pipe.d.ts +8 -0
- package/lib/pipes/default-question-answers.pipe.d.ts +8 -0
- package/lib/pipes/filter-question.pipe.d.ts +9 -0
- package/lib/services/survey-lib.service.d.ts +14 -0
- package/lib/survery-lib.component.d.ts +49 -0
- package/lib/survery-lib.module.d.ts +24 -0
- package/{src/lib/usecases/base/use-case.ts → lib/usecases/base/use-case.d.ts} +7 -9
- package/lib/usecases/check-rule-exps.usecase.d.ts +21 -0
- package/package.json +28 -15
- package/{src/public-api.ts → public-api.d.ts} +1 -5
- package/shared/dtos/default-question-answers.dto.d.ts +9 -0
- package/{src/shared/dtos/rule-exp-answer.dto.ts → shared/dtos/rule-exp-answer.dto.d.ts} +5 -5
- package/{src/shared/dtos/rule-exp.dto.ts → shared/dtos/rule-exp.dto.d.ts} +13 -14
- package/{src/shared/dtos/rule-result-question.dto.ts → shared/dtos/rule-result-question.dto.d.ts} +4 -5
- package/{src/shared/dtos/survey-answer.dto.ts → shared/dtos/survey-answer.dto.d.ts} +16 -16
- package/{src/shared/dtos/survey-answers-subject.dto.ts → shared/dtos/survey-answers-subject.dto.d.ts} +5 -6
- package/{src/shared/dtos/survey-page.dto.ts → shared/dtos/survey-page.dto.d.ts} +9 -10
- package/{src/shared/dtos/survey-question-group.dto.ts → shared/dtos/survey-question-group.dto.d.ts} +8 -9
- package/{src/shared/dtos/survey-question.dto.ts → shared/dtos/survey-question.dto.d.ts} +18 -19
- package/{src/shared/dtos/survey-rule.dto.ts → shared/dtos/survey-rule.dto.d.ts} +10 -11
- package/{src/shared/dtos/survey-sub-question.dto.ts → shared/dtos/survey-sub-question.dto.d.ts} +9 -9
- package/{src/shared/dtos/survey.dto.ts → shared/dtos/survey.dto.d.ts} +16 -17
- package/shared/enums/Logic-Property.enum.d.ts +12 -0
- package/{src/shared/enums/logic-action.enum.ts → shared/enums/logic-action.enum.d.ts} +7 -7
- package/shared/enums/operator.enum.d.ts +4 -0
- package/{src/shared/enums/question-type.enum.ts → shared/enums/question-type.enum.d.ts} +9 -9
- package/shared/form-interfaces/question-boolean-template.form-interface.d.ts +15 -0
- package/shared/form-interfaces/question-check-box-template.form-interface.d.ts +15 -0
- package/shared/form-interfaces/question-dropdown-multi-template.form-interface.d.ts +15 -0
- package/shared/form-interfaces/question-dropdown-template.form-interface.d.ts +9 -0
- package/{src/shared/form-interfaces/question-matrix-template.form-interface.ts → shared/form-interfaces/question-matrix-template.form-interface.d.ts} +11 -13
- package/shared/form-interfaces/question-radio-button-template.form-interface.d.ts +15 -0
- package/shared/form-interfaces/question-text-template.form-interface.d.ts +10 -0
- package/shared/form-interfaces/survery-lib.form-interface.d.ts +24 -0
- package/shared/models/question-answer.model.d.ts +6 -0
- package/shared/models/survery-question-result.model.d.ts +8 -0
- package/ng-package.json +0 -11
- package/scss/style.scss +0 -88
- package/src/lib/components/question-boolean-template/question-boolean-template.component.html +0 -13
- package/src/lib/components/question-boolean-template/question-boolean-template.component.scss +0 -0
- package/src/lib/components/question-boolean-template/question-boolean-template.component.spec.ts +0 -21
- package/src/lib/components/question-boolean-template/question-boolean-template.component.ts +0 -109
- package/src/lib/components/question-check-box-template/question-check-box-template.component.html +0 -13
- package/src/lib/components/question-check-box-template/question-check-box-template.component.scss +0 -0
- package/src/lib/components/question-check-box-template/question-check-box-template.component.spec.ts +0 -21
- package/src/lib/components/question-check-box-template/question-check-box-template.component.ts +0 -124
- package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.html +0 -10
- package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.scss +0 -3
- package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.spec.ts +0 -21
- package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.ts +0 -100
- package/src/lib/components/question-dropdown-template/question-dropdown-template.component.html +0 -10
- package/src/lib/components/question-dropdown-template/question-dropdown-template.component.scss +0 -0
- package/src/lib/components/question-dropdown-template/question-dropdown-template.component.spec.ts +0 -21
- package/src/lib/components/question-dropdown-template/question-dropdown-template.component.ts +0 -87
- package/src/lib/components/question-matrix-template/question-matrix-template.component.html +0 -36
- package/src/lib/components/question-matrix-template/question-matrix-template.component.scss +0 -0
- package/src/lib/components/question-matrix-template/question-matrix-template.component.spec.ts +0 -21
- package/src/lib/components/question-matrix-template/question-matrix-template.component.ts +0 -110
- package/src/lib/components/question-radio-button-template/question-radio-button-template.component.html +0 -13
- package/src/lib/components/question-radio-button-template/question-radio-button-template.component.scss +0 -0
- package/src/lib/components/question-radio-button-template/question-radio-button-template.component.spec.ts +0 -21
- package/src/lib/components/question-radio-button-template/question-radio-button-template.component.ts +0 -111
- package/src/lib/components/question-text-template/question-text-template.component.html +0 -13
- package/src/lib/components/question-text-template/question-text-template.component.scss +0 -0
- package/src/lib/components/question-text-template/question-text-template.component.spec.ts +0 -21
- package/src/lib/components/question-text-template/question-text-template.component.ts +0 -105
- package/src/lib/pipes/default-question-answer.pipe.spec.ts +0 -8
- package/src/lib/pipes/default-question-answer.pipe.ts +0 -18
- package/src/lib/pipes/default-question-answers.pipe.spec.ts +0 -8
- package/src/lib/pipes/default-question-answers.pipe.ts +0 -17
- package/src/lib/pipes/filter-question.pipe.spec.ts +0 -8
- package/src/lib/pipes/filter-question.pipe.ts +0 -14
- package/src/lib/services/survey-lib.service.spec.ts +0 -16
- package/src/lib/services/survey-lib.service.ts +0 -31
- package/src/lib/survery-lib.component.spec.ts +0 -21
- package/src/lib/survery-lib.component.ts +0 -308
- package/src/lib/survery-lib.module.ts +0 -47
- package/src/lib/survey-lib.component.html +0 -67
- package/src/lib/survey-lib.component.scss +0 -4
- package/src/lib/usecases/check-rule-exps.usecase.ts +0 -188
- package/src/shared/dtos/default-question-answers.dto.ts +0 -10
- package/src/shared/enums/logic-property.enum.ts +0 -12
- package/src/shared/enums/operator.enum.ts +0 -4
- package/src/shared/form-interfaces/question-boolean-template.form-interface.ts +0 -17
- package/src/shared/form-interfaces/question-check-box-template.form-interface.ts +0 -18
- package/src/shared/form-interfaces/question-dropdown-multi-template.form-interface.ts +0 -17
- package/src/shared/form-interfaces/question-dropdown-template.form-interface.ts +0 -10
- package/src/shared/form-interfaces/question-radio-button-template.form-interface.ts +0 -17
- package/src/shared/form-interfaces/question-text-template.form-interface.ts +0 -11
- package/src/shared/form-interfaces/survery-lib.form-interface.ts +0 -27
- package/src/shared/models/question-answer.model.ts +0 -6
- package/src/shared/models/survery-question-result.model.ts +0 -8
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { QuestionTypeEnum } from "../enums/question-type.enum";
|
|
2
|
+
export interface SurveryLibFormInterface {
|
|
3
|
+
currentPageIndex: number;
|
|
4
|
+
questionArray: QuestionChildOfSurveryLibFormInterface[];
|
|
5
|
+
ruleQuestionArray: RuleQuestionChildOfSurveryLibFormInterface[];
|
|
6
|
+
}
|
|
7
|
+
export interface QuestionChildOfSurveryLibFormInterface {
|
|
8
|
+
surveyPageIndex: number;
|
|
9
|
+
questionId: any;
|
|
10
|
+
questionType: QuestionTypeEnum;
|
|
11
|
+
isMatrixGroup: boolean;
|
|
12
|
+
answerId: any;
|
|
13
|
+
answerIdArr: any;
|
|
14
|
+
answerText: any;
|
|
15
|
+
isRequired: boolean;
|
|
16
|
+
isValid: boolean;
|
|
17
|
+
isDisabled: boolean;
|
|
18
|
+
isShow: boolean;
|
|
19
|
+
isDisabled_default: boolean;
|
|
20
|
+
isShow_default: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface RuleQuestionChildOfSurveryLibFormInterface {
|
|
23
|
+
questionId: any;
|
|
24
|
+
}
|
package/ng-package.json
DELETED
package/scss/style.scss
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
@import "../../../node_modules/@ng-select/ng-select/scss/default.theme.scss";
|
|
2
|
-
|
|
3
|
-
lib-survery-lib {
|
|
4
|
-
.survay-pagination {
|
|
5
|
-
nav {
|
|
6
|
-
ul.pagination {
|
|
7
|
-
display: flex;
|
|
8
|
-
gap: 8px;
|
|
9
|
-
|
|
10
|
-
li.page-item.next-page-item {
|
|
11
|
-
a {
|
|
12
|
-
&::after {
|
|
13
|
-
content: ' ';
|
|
14
|
-
background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxOCAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgaWQ9IkFycm93IC0gTGVmdCI+CjxwYXRoIGlkPSJGaWxsIDEiIG9wYWNpdHk9IjAuNCIgZD0iTTEyLjc5NzUgNC44MDk1N0wxNi40OTY3IDQuNDgyNDJDMTcuMzI2OSA0LjQ4MjQyIDE4IDUuMTYyMDYgMTggNi4wMDAzMkMxOCA2LjgzODU4IDE3LjMyNjkgNy41MTgyMiAxNi40OTY3IDcuNTE4MjJMMTIuNzk3NSA3LjE5MTA3QzEyLjE0NjMgNy4xOTEwNyAxMS42MTgzIDYuNjU3OTMgMTEuNjE4MyA2LjAwMDMyQzExLjYxODMgNS4zNDE2MSAxMi4xNDYzIDQuODA5NTcgMTIuNzk3NSA0LjgwOTU3WiIgZmlsbD0iIzRDM0Q4RiIvPgo8cGF0aCBpZD0iRmlsbCA0IiBkPSJNMC4zNzUzNCA0Ljg2OTg0QzAuNDMzMTU3IDQuODExNDYgMC42NDkxNTUgNC41NjQ3MSAwLjg1MjA2MSA0LjM1OTgzQzIuMDM1NjggMy4wNzY1NiA1LjEyNjE5IDAuOTc4MTUzIDYuNzQyOSAwLjMzNTk2NUM2Ljk4ODM1IDAuMjMzNTIzIDcuNjA5MDcgMC4wMTU0MjEzIDcuOTQxNzkgMEM4LjI1OTI0IDAgOC41NjI1MSAwLjA3MzgwMjEgOC44NTE2IDAuMjE5MjAzQzkuMjEyNjkgMC40MjI5ODUgOS41MDA2OCAwLjc0NDYzIDkuNjU5OTUgMS4xMjM1NUM5Ljc2MTQxIDEuMzg1NzIgOS45MjA2OCAyLjE3MzMxIDkuOTIwNjggMi4xODc2M0MxMC4wNzg5IDMuMDQ3OTIgMTAuMTY1IDQuNDQ2ODUgMTAuMTY1IDUuOTkzMzlDMTAuMTY1IDcuNDY1MDMgMTAuMDc4OSA4LjgwNjY4IDkuOTQ5MDQgOS42ODEyOUM5LjkzNDg2IDkuNjk2NzEgOS43NzU1OSAxMC42NzM4IDkuNjAyMTQgMTEuMDA4NkM5LjI4NDY5IDExLjYyMTEgOC42NjM5NyAxMiA3Ljk5OTYxIDEySDcuOTQxNzlDNy41MDg3MSAxMS45ODU3IDYuNTk4OSAxMS42MDU3IDYuNTk4OSAxMS41OTI0QzUuMDY4MzcgMTAuOTUwMiAyLjA1MDk2IDguOTUzMTkgMC44Mzc4NzkgNy42MjU4NUMwLjgzNzg3OSA3LjYyNTg1IDAuNDk1MzM4IDcuMjg0MzggMC4zNDY5NzYgNy4wNzE3OEMwLjExNTcwNiA2Ljc2NTU2IDcuMTUyNTZlLTA1IDYuMzg2NjMgNy4xNTI1NmUtMDUgNi4wMDc3MUM3LjE1MjU2ZS0wNSA1LjU4NDczIDAuMTI5ODg4IDUuMTkxNDggMC4zNzUzNCA0Ljg2OTg0WiIgZmlsbD0iIzRDM0Q4RiIvPgo8L2c+Cjwvc3ZnPgo=);
|
|
15
|
-
width: 20px;
|
|
16
|
-
height: 20px;
|
|
17
|
-
display: inline-block;
|
|
18
|
-
background-repeat: no-repeat;
|
|
19
|
-
background-position: center;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
li.page-item.previous-page-item {
|
|
25
|
-
a {
|
|
26
|
-
&::before {
|
|
27
|
-
content: ' ';
|
|
28
|
-
background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxOCAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgaWQ9IkFycm93IC0gTGVmdCI+CjxwYXRoIGlkPSJGaWxsIDEiIG9wYWNpdHk9IjAuNCIgZD0iTTUuMjAyNDggNC44MDk1N0wxLjUwMzI1IDQuNDgyNDJDMC42NzMwODMgNC40ODI0MiAwIDUuMTYyMDYgMCA2LjAwMDMyQzAgNi44Mzg1OCAwLjY3MzA4MyA3LjUxODIyIDEuNTAzMjUgNy41MTgyMkw1LjIwMjQ4IDcuMTkxMDdDNS44NTM3NSA3LjE5MTA3IDYuMzgxNzQgNi42NTc5MyA2LjM4MTc0IDYuMDAwMzJDNi4zODE3NCA1LjM0MTYxIDUuODUzNzUgNC44MDk1NyA1LjIwMjQ4IDQuODA5NTdaIiBmaWxsPSIjNEMzRDhGIi8+CjxwYXRoIGlkPSJGaWxsIDQiIGQ9Ik0xNy42MjQ3IDQuODY5ODRDMTcuNTY2OCA0LjgxMTQ2IDE3LjM1MDggNC41NjQ3MSAxNy4xNDc5IDQuMzU5ODNDMTUuOTY0MyAzLjA3NjU2IDEyLjg3MzggMC45NzgxNTMgMTEuMjU3MSAwLjMzNTk2NUMxMS4wMTE2IDAuMjMzNTIzIDEwLjM5MDkgMC4wMTU0MjEzIDEwLjA1ODIgMEM5Ljc0MDc2IDAgOS40Mzc0OSAwLjA3MzgwMjEgOS4xNDg0IDAuMjE5MjAzQzguNzg3MzEgMC40MjI5ODUgOC40OTkzMiAwLjc0NDYzIDguMzQwMDUgMS4xMjM1NUM4LjIzODU5IDEuMzg1NzIgOC4wNzkzMiAyLjE3MzMxIDguMDc5MzIgMi4xODc2M0M3LjkyMTE0IDMuMDQ3OTIgNy44MzQ5NiA0LjQ0Njg1IDcuODM0OTYgNS45OTMzOUM3LjgzNDk2IDcuNDY1MDMgNy45MjExNCA4LjgwNjY4IDguMDUwOTYgOS42ODEyOUM4LjA2NTE0IDkuNjk2NzEgOC4yMjQ0MSAxMC42NzM4IDguMzk3ODYgMTEuMDA4NkM4LjcxNTMxIDExLjYyMTEgOS4zMzYwMyAxMiAxMC4wMDA0IDEySDEwLjA1ODJDMTAuNDkxMyAxMS45ODU3IDExLjQwMTEgMTEuNjA1NyAxMS40MDExIDExLjU5MjRDMTIuOTMxNiAxMC45NTAyIDE1Ljk0OSA4Ljk1MzE5IDE3LjE2MjEgNy42MjU4NUMxNy4xNjIxIDcuNjI1ODUgMTcuNTA0NyA3LjI4NDM4IDE3LjY1MyA3LjA3MTc4QzE3Ljg4NDMgNi43NjU1NiAxNy45OTk5IDYuMzg2NjMgMTcuOTk5OSA2LjAwNzcxQzE3Ljk5OTkgNS41ODQ3MyAxNy44NzAxIDUuMTkxNDggMTcuNjI0NyA0Ljg2OTg0WiIgZmlsbD0iIzRDM0Q4RiIvPgo8L2c+Cjwvc3ZnPgo=);
|
|
29
|
-
width: 20px;
|
|
30
|
-
height: 20px;
|
|
31
|
-
display: inline-block;
|
|
32
|
-
background-repeat: no-repeat;
|
|
33
|
-
background-position: center;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
li.page-item {
|
|
39
|
-
&.active {
|
|
40
|
-
a {
|
|
41
|
-
border-radius: 8px;
|
|
42
|
-
background: var(--primary-100, #4C3D8F);
|
|
43
|
-
color: #fff;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:hover {
|
|
48
|
-
a {
|
|
49
|
-
border-radius: 8px;
|
|
50
|
-
background: var(--primary-100, #4C3D8F);
|
|
51
|
-
color: #fff;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
a {
|
|
56
|
-
color: var(--dark-100, #363636);
|
|
57
|
-
/* Body/Bold */
|
|
58
|
-
font-size: 16px;
|
|
59
|
-
font-style: normal;
|
|
60
|
-
font-weight: 700;
|
|
61
|
-
line-height: 24px;
|
|
62
|
-
/* 150% */
|
|
63
|
-
display: flex;
|
|
64
|
-
min-width: 50px;
|
|
65
|
-
height: 50px;
|
|
66
|
-
padding: 20px;
|
|
67
|
-
justify-content: center;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: 10px;
|
|
70
|
-
border-radius: 8px;
|
|
71
|
-
background: var(--secondary-20, #F4F5FE);
|
|
72
|
-
border: none;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.survey-page_submitted .invalid-question {
|
|
80
|
-
border: 2px solid red;
|
|
81
|
-
border-radius: 5px;
|
|
82
|
-
border-bottom: 2px solid red !important;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
ng-select{
|
|
86
|
-
font-size: 20px !important;
|
|
87
|
-
}
|
|
88
|
-
}
|
package/src/lib/components/question-boolean-template/question-boolean-template.component.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<div class="quastion" [attr.id]="'question_'+fCtrls.id.value" [ngClass]="{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}">
|
|
2
|
-
<h3 class="quastion-title ">
|
|
3
|
-
{{fCtrls.title.value}}
|
|
4
|
-
</h3>
|
|
5
|
-
<div class="radio-button-quastion">
|
|
6
|
-
<div class="form-check form-check-radio form-check-inline"
|
|
7
|
-
*ngFor="let item of fCtrls.answerArray.controls ;let i = index">
|
|
8
|
-
<input class="form-check-input" type="radio" (change)="onChangeAnswer(item.value)" [disabled]="isDisabled"
|
|
9
|
-
name="{{elemId}}__radio-btn-option" id="{{elemId}}__radio-btn_{{i}}" [checked]="item.value.isSelected == true? true : null">
|
|
10
|
-
<label class="form-check-label" for="{{elemId}}__radio-btn_{{i}}">{{item.value.title}}</label>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
package/src/lib/components/question-boolean-template/question-boolean-template.component.scss
DELETED
|
File without changes
|
package/src/lib/components/question-boolean-template/question-boolean-template.component.spec.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { QuestionBooleanTemplateComponent } from './question-boolean-template.component';
|
|
4
|
-
|
|
5
|
-
describe('QuestionBooleanTemplateComponent', () => {
|
|
6
|
-
let component: QuestionBooleanTemplateComponent;
|
|
7
|
-
let fixture: ComponentFixture<QuestionBooleanTemplateComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [QuestionBooleanTemplateComponent]
|
|
12
|
-
});
|
|
13
|
-
fixture = TestBed.createComponent(QuestionBooleanTemplateComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
-
import { Validators, FormControl } from '@angular/forms';
|
|
3
|
-
import { SurveyQuestionDto } from '../../../shared/dtos/survey-question.dto';
|
|
4
|
-
import { QuestionTypeEnum } from '../../../shared/enums/question-type.enum';
|
|
5
|
-
import { QuestionRadioButtonTemplateFormInterface } from '../../../shared/form-interfaces/question-radio-button-template.form-interface';
|
|
6
|
-
import { QuestionAnswerModel } from '../../../shared/models/question-answer.model';
|
|
7
|
-
import { debounceTime, distinctUntilChanged, filter, map } from 'rxjs';
|
|
8
|
-
import { AnswerChildOfQuestionBooleanTemplateFormInterface, QuestionBooleanTemplateFormInterface } from '../../../shared/form-interfaces/question-boolean-template.form-interface';
|
|
9
|
-
import { FormBuilder, FormGroup } from '@ng-stack/forms';
|
|
10
|
-
import { v4 as guidGenerator } from 'uuid';
|
|
11
|
-
import { SurveyAnswerDto } from '../../../shared/dtos/survey-answer.dto';
|
|
12
|
-
import { DefaultQuestionAnswerDto } from '../../../shared/dtos/default-question-answers.dto';
|
|
13
|
-
import { SurveyLibService } from '../../services/survey-lib.service';
|
|
14
|
-
|
|
15
|
-
@Component({
|
|
16
|
-
selector: 'lib-question-boolean-template',
|
|
17
|
-
templateUrl: './question-boolean-template.component.html',
|
|
18
|
-
styleUrls: ['./question-boolean-template.component.scss']
|
|
19
|
-
})
|
|
20
|
-
export class QuestionBooleanTemplateComponent implements OnInit {
|
|
21
|
-
elemId = guidGenerator() as string;
|
|
22
|
-
surveyQuestion: SurveyQuestionDto;
|
|
23
|
-
rForm: FormGroup<QuestionBooleanTemplateFormInterface>;
|
|
24
|
-
|
|
25
|
-
get fCtrls() {
|
|
26
|
-
return this.rForm.controls;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get questionTypeEnum() {
|
|
30
|
-
return QuestionTypeEnum;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@Output() emitter = new EventEmitter<QuestionAnswerModel>();
|
|
34
|
-
|
|
35
|
-
@Input() isShow: boolean = true;
|
|
36
|
-
@Input() isDisabled: boolean = false;
|
|
37
|
-
|
|
38
|
-
@Input() set setQuestion(value: SurveyQuestionDto) {
|
|
39
|
-
this.surveyQuestion = value;
|
|
40
|
-
this.rForm.patchValue({
|
|
41
|
-
id: value.questionId,
|
|
42
|
-
name: value.questionName,
|
|
43
|
-
title: value.questionTitle,
|
|
44
|
-
typeId: value.questionTypeId,
|
|
45
|
-
description: value.questionDescription
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
value.surveyAnswers.forEach(surveryAnswer => {
|
|
49
|
-
this.fCtrls.answerArray.push(this._formBuilder.group<AnswerChildOfQuestionBooleanTemplateFormInterface>({
|
|
50
|
-
id: [surveryAnswer.answerId],
|
|
51
|
-
title: [surveryAnswer.answerTitle],
|
|
52
|
-
isSelected: [false]
|
|
53
|
-
}))
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
if (value.isRequired == true) {
|
|
57
|
-
this.fCtrls.answer.addValidators([Validators.required]);
|
|
58
|
-
this.fCtrls.answer.updateValueAndValidity();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this.isShow = value.isVisable;
|
|
62
|
-
this.isDisabled = value.isReadOnly;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
constructor(private _formBuilder: FormBuilder , private _surveyLibService:SurveyLibService) {
|
|
66
|
-
this.rForm = this._formBuilder.group<QuestionBooleanTemplateFormInterface>({
|
|
67
|
-
id: [null],
|
|
68
|
-
name: [null],
|
|
69
|
-
title: [null],
|
|
70
|
-
typeId: [null],
|
|
71
|
-
description: [null],
|
|
72
|
-
answer: [null],
|
|
73
|
-
answerArray: this._formBuilder.array<AnswerChildOfQuestionBooleanTemplateFormInterface>([])
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
ngOnInit(): void {
|
|
78
|
-
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
79
|
-
const formValue = this.rForm.value;
|
|
80
|
-
this.emitter.emit({
|
|
81
|
-
QuestionId: formValue.id,
|
|
82
|
-
IsValid: this.fCtrls.answer.valid,
|
|
83
|
-
Answer: value
|
|
84
|
-
})
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
this.fCtrls.answer.setValue(null);
|
|
88
|
-
|
|
89
|
-
this._surveyLibService.surveyAnswersObsrv
|
|
90
|
-
.pipe(map(x=> x.defaultAnswers.filter(x=>x.QuestionId == this.fCtrls.id.value)))
|
|
91
|
-
.pipe(filter(x=>x.length > 0)).pipe(map(x=> x.at(0)))
|
|
92
|
-
.subscribe(answer=>{
|
|
93
|
-
this.fCtrls.answer.setValue(answer.AnswerId);
|
|
94
|
-
|
|
95
|
-
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == answer.AnswerId);
|
|
96
|
-
if(groupIndex > -1){
|
|
97
|
-
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
onChangeAnswer(item: AnswerChildOfQuestionBooleanTemplateFormInterface) {
|
|
103
|
-
this.fCtrls.answer.setValue(item.id);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
convertToFormControl(element: any) {
|
|
107
|
-
return element as FormControl;
|
|
108
|
-
}
|
|
109
|
-
}
|
package/src/lib/components/question-check-box-template/question-check-box-template.component.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<div class="quastion" [attr.id]="'question_'+fCtrls.id.value" [ngClass]="{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}">
|
|
2
|
-
<h3 class="quastion-title ">
|
|
3
|
-
{{fCtrls.title.value}}
|
|
4
|
-
</h3>
|
|
5
|
-
|
|
6
|
-
<div class="checkbox-button-quastion">
|
|
7
|
-
<div class="form-check check-box-form-check" *ngFor="let item of fCtrls.answerArray.controls ;let i = index">
|
|
8
|
-
<input type="checkbox" class="form-check-input" id="{{elemId}}__checkbox_{{i}}" [disabled]="isDisabled"
|
|
9
|
-
(change)="onChangeAnswer(item.value ,$event)" [checked]="item.value.isSelected == true? true : null">
|
|
10
|
-
<label class="form-check-label " for="{{elemId}}__checkbox_{{i}}">{{item.value.title}}</label>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
package/src/lib/components/question-check-box-template/question-check-box-template.component.scss
DELETED
|
File without changes
|
package/src/lib/components/question-check-box-template/question-check-box-template.component.spec.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { QuestionCheckBoxTemplateComponent } from './question-check-box-template.component';
|
|
4
|
-
|
|
5
|
-
describe('QuestionCheckBoxTemplateComponent', () => {
|
|
6
|
-
let component: QuestionCheckBoxTemplateComponent;
|
|
7
|
-
let fixture: ComponentFixture<QuestionCheckBoxTemplateComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [QuestionCheckBoxTemplateComponent]
|
|
12
|
-
});
|
|
13
|
-
fixture = TestBed.createComponent(QuestionCheckBoxTemplateComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
package/src/lib/components/question-check-box-template/question-check-box-template.component.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
-
import { FormControl, Validators } from '@angular/forms';
|
|
3
|
-
import { FormBuilder, FormGroup } from '@ng-stack/forms';
|
|
4
|
-
import { SurveyAnswerDto } from '../../../shared/dtos/survey-answer.dto';
|
|
5
|
-
import { SurveyQuestionDto } from '../../../shared/dtos/survey-question.dto';
|
|
6
|
-
import { QuestionTypeEnum } from '../../../shared/enums/question-type.enum';
|
|
7
|
-
import {
|
|
8
|
-
AnswerChildOfQuestionCheckBoxTemplateFormInterface,
|
|
9
|
-
QuestionCheckBoxTemplateFormInterface
|
|
10
|
-
} from '../../../shared/form-interfaces/question-check-box-template.form-interface';
|
|
11
|
-
import { QuestionRadioButtonTemplateFormInterface } from '../../../shared/form-interfaces/question-radio-button-template.form-interface';
|
|
12
|
-
import { debounceTime, distinctUntilChanged, filter, map } from 'rxjs';
|
|
13
|
-
import { v4 as guidGenerator } from 'uuid';
|
|
14
|
-
import { QuestionAnswerModel } from '../../../shared/models/question-answer.model';
|
|
15
|
-
import { DefaultQuestionAnswerDto } from '../../../shared/dtos/default-question-answers.dto';
|
|
16
|
-
import { AnswerChildOfQuestionBooleanTemplateFormInterface } from '../../../shared/form-interfaces/question-boolean-template.form-interface';
|
|
17
|
-
import { SurveyLibService } from '../../services/survey-lib.service';
|
|
18
|
-
|
|
19
|
-
@Component({
|
|
20
|
-
selector: 'lib-question-check-box-template',
|
|
21
|
-
templateUrl: './question-check-box-template.component.html',
|
|
22
|
-
styleUrls: ['./question-check-box-template.component.scss']
|
|
23
|
-
})
|
|
24
|
-
export class QuestionCheckBoxTemplateComponent implements OnInit {
|
|
25
|
-
elemId = guidGenerator() as string;
|
|
26
|
-
surveyQuestion: SurveyQuestionDto;
|
|
27
|
-
rForm: FormGroup<QuestionCheckBoxTemplateFormInterface>;
|
|
28
|
-
|
|
29
|
-
get fCtrls() {
|
|
30
|
-
return this.rForm.controls;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get questionTypeEnum() {
|
|
34
|
-
return QuestionTypeEnum;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@Output() emitter = new EventEmitter<QuestionAnswerModel>();
|
|
38
|
-
|
|
39
|
-
@Input() isShow: boolean = true;
|
|
40
|
-
@Input() isDisabled: boolean = false;
|
|
41
|
-
@Input() set setQuestion(value: SurveyQuestionDto) {
|
|
42
|
-
this.surveyQuestion = value;
|
|
43
|
-
this.rForm.patchValue({
|
|
44
|
-
id: value.questionId,
|
|
45
|
-
name: value.questionName,
|
|
46
|
-
title: value.questionTitle,
|
|
47
|
-
typeId: value.questionTypeId,
|
|
48
|
-
description: value.questionDescription
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
value.surveyAnswers.forEach(surveryAnswer => {
|
|
52
|
-
this.fCtrls.answerArray.push(this._formBuilder.group<AnswerChildOfQuestionCheckBoxTemplateFormInterface>({
|
|
53
|
-
id: [surveryAnswer.answerId],
|
|
54
|
-
title: [surveryAnswer.answerTitle],
|
|
55
|
-
isSelected: [false]
|
|
56
|
-
}))
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
if (value.isRequired == true) {
|
|
60
|
-
this.fCtrls.answer.addValidators([Validators.required]);
|
|
61
|
-
this.fCtrls.answer.updateValueAndValidity();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this.isShow = value.isVisable;
|
|
65
|
-
this.isDisabled = value.isReadOnly;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
constructor(private _formBuilder: FormBuilder, private _surveyLibService: SurveyLibService) {
|
|
69
|
-
this.rForm = this._formBuilder.group<QuestionCheckBoxTemplateFormInterface>({
|
|
70
|
-
id: [null],
|
|
71
|
-
name: [null],
|
|
72
|
-
title: [null],
|
|
73
|
-
typeId: [null],
|
|
74
|
-
description: [null],
|
|
75
|
-
answer: [null],
|
|
76
|
-
answerArray: this._formBuilder.array<AnswerChildOfQuestionCheckBoxTemplateFormInterface>([])
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
ngOnInit(): void {
|
|
81
|
-
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
82
|
-
const formValue = this.rForm.value;
|
|
83
|
-
this.emitter.emit({
|
|
84
|
-
QuestionId: formValue.id,
|
|
85
|
-
IsValid: this.fCtrls.answer.valid,
|
|
86
|
-
Answer: value
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
this.fCtrls.answer.setValue(null);
|
|
91
|
-
|
|
92
|
-
this._surveyLibService.surveyAnswersObsrv
|
|
93
|
-
.pipe(map(x => x.defaultAnswers.filter(x => x.QuestionId == this.fCtrls.id.value)))
|
|
94
|
-
.pipe(filter(x => x.length > 0)).pipe(map(x => x.at(0)))
|
|
95
|
-
.subscribe(answer => {
|
|
96
|
-
const distinctArray = answer.AnswerIdArr.filter((n, i) => answer.AnswerIdArr.indexOf(n) === i);
|
|
97
|
-
this.fCtrls.answer.setValue(distinctArray);
|
|
98
|
-
|
|
99
|
-
answer.AnswerIdArr.forEach(answerId => {
|
|
100
|
-
const groupIndex = this.fCtrls.answerArray.value.findIndex(x => x.id == answerId);
|
|
101
|
-
if (groupIndex > -1) {
|
|
102
|
-
this.fCtrls.answerArray.at(groupIndex).controls.isSelected.setValue(true);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
onChangeAnswer(item: AnswerChildOfQuestionBooleanTemplateFormInterface, event: Event) {
|
|
109
|
-
var answerArr: number[] = this.fCtrls.answer.value || [];
|
|
110
|
-
|
|
111
|
-
if ((event.target as any).checked == true) {
|
|
112
|
-
answerArr.push(item.id);
|
|
113
|
-
} else {
|
|
114
|
-
answerArr = answerArr.filter(x => x != item.id);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
answerArr = answerArr.length == 0 ? [] : answerArr;
|
|
118
|
-
this.fCtrls.answer.setValue(answerArr);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
convertToFormControl(element: any) {
|
|
122
|
-
return element as FormControl;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<div class="quastion" [attr.id]="'question_'+fCtrls.id.value" [ngClass]="{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}">
|
|
2
|
-
<h3 class="quastion-title ">
|
|
3
|
-
{{fCtrls.title.value}}
|
|
4
|
-
</h3>
|
|
5
|
-
<div class="text-quastion">
|
|
6
|
-
<ng-select [items]="this.fCtrls.answerArray.value" bindValue="id" bindLabel="title" class="form-control"
|
|
7
|
-
[formControl]="convertToFormControl(fCtrls.answer)" [disabled]="isDisabled" [multiple]="true">
|
|
8
|
-
</ng-select>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { QuestionDropdownMultiTemplateComponent } from './question-dropdown-multi-template.component';
|
|
4
|
-
|
|
5
|
-
describe('QuestionDropdownMultiTemplateComponent', () => {
|
|
6
|
-
let component: QuestionDropdownMultiTemplateComponent;
|
|
7
|
-
let fixture: ComponentFixture<QuestionDropdownMultiTemplateComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [QuestionDropdownMultiTemplateComponent]
|
|
12
|
-
});
|
|
13
|
-
fixture = TestBed.createComponent(QuestionDropdownMultiTemplateComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
-
import { FormControl } from '@angular/forms';
|
|
3
|
-
import { FormGroup, Validators , FormBuilder} from '@ng-stack/forms';
|
|
4
|
-
import { QuestionCheckBoxTemplateFormInterface } from '../../../shared/form-interfaces/question-check-box-template.form-interface';
|
|
5
|
-
import { debounceTime, distinctUntilChanged, filter, map } from 'rxjs';
|
|
6
|
-
import { SurveyQuestionDto } from '../../../shared/dtos/survey-question.dto';
|
|
7
|
-
import { QuestionTypeEnum } from '../../../shared/enums/question-type.enum';
|
|
8
|
-
import { QuestionAnswerModel } from '../../../shared/models/question-answer.model';
|
|
9
|
-
import { v4 as guidGenerator } from 'uuid';
|
|
10
|
-
import { AnswerChildOfQuestionDropDownMultiTemplateFormInterface, QuestionDropDownMultiTemplateFormInterface } from '../../../shared/form-interfaces/question-dropdown-multi-template.form-interface';
|
|
11
|
-
import { SurveyLibService } from '../../services/survey-lib.service';
|
|
12
|
-
import { AnswerChildOfQuestionBooleanTemplateFormInterface } from '../../../shared/form-interfaces/question-boolean-template.form-interface';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'lib-question-dropdown-multi-template',
|
|
16
|
-
templateUrl: './question-dropdown-multi-template.component.html',
|
|
17
|
-
styleUrls: ['./question-dropdown-multi-template.component.scss']
|
|
18
|
-
})
|
|
19
|
-
export class QuestionDropdownMultiTemplateComponent {
|
|
20
|
-
|
|
21
|
-
elemId = guidGenerator() as string;
|
|
22
|
-
surveyQuestion: SurveyQuestionDto;
|
|
23
|
-
rForm: FormGroup<QuestionDropDownMultiTemplateFormInterface>;
|
|
24
|
-
|
|
25
|
-
get fCtrls() {
|
|
26
|
-
return this.rForm.controls;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get questionTypeEnum() {
|
|
30
|
-
return QuestionTypeEnum;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@Output() emitter = new EventEmitter<QuestionAnswerModel>();
|
|
34
|
-
|
|
35
|
-
@Input() isShow: boolean = true;
|
|
36
|
-
@Input() isDisabled: boolean = false;
|
|
37
|
-
@Input() set setQuestion(value: SurveyQuestionDto) {
|
|
38
|
-
this.surveyQuestion = value;
|
|
39
|
-
this.rForm.patchValue({
|
|
40
|
-
id: value.questionId,
|
|
41
|
-
name: value.questionName,
|
|
42
|
-
title: value.questionTitle,
|
|
43
|
-
typeId: value.questionTypeId,
|
|
44
|
-
description: value.questionDescription
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
value.surveyAnswers.forEach(surveryAnswer => {
|
|
48
|
-
this.fCtrls.answerArray.push(this._formBuilder.group<AnswerChildOfQuestionDropDownMultiTemplateFormInterface>({
|
|
49
|
-
id: [surveryAnswer.answerId],
|
|
50
|
-
title: [surveryAnswer.answerTitle],
|
|
51
|
-
isSelected: [false]
|
|
52
|
-
}))
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
if (value.isRequired == true) {
|
|
56
|
-
this.fCtrls.answer.addValidators([Validators.required]);
|
|
57
|
-
this.fCtrls.answer.updateValueAndValidity();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this.isShow = value.isVisable;
|
|
61
|
-
this.isDisabled = value.isReadOnly;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
constructor(private _formBuilder: FormBuilder, private _surveyLibService: SurveyLibService) {
|
|
65
|
-
this.rForm = this._formBuilder.group<QuestionDropDownMultiTemplateFormInterface>({
|
|
66
|
-
id: [null],
|
|
67
|
-
name: [null],
|
|
68
|
-
title: [null],
|
|
69
|
-
typeId: [null],
|
|
70
|
-
description: [null],
|
|
71
|
-
answer: [null],
|
|
72
|
-
answerArray: this._formBuilder.array<AnswerChildOfQuestionDropDownMultiTemplateFormInterface>([])
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
ngOnInit(): void {
|
|
77
|
-
this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
|
|
78
|
-
const formValue = this.rForm.value;
|
|
79
|
-
this.emitter.emit({
|
|
80
|
-
QuestionId: formValue.id,
|
|
81
|
-
IsValid: this.fCtrls.answer.valid,
|
|
82
|
-
Answer: value
|
|
83
|
-
})
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
this.fCtrls.answer.setValue(null);
|
|
87
|
-
|
|
88
|
-
this._surveyLibService.surveyAnswersObsrv
|
|
89
|
-
.pipe(map(x => x.defaultAnswers.filter(x => x.QuestionId == this.fCtrls.id.value)))
|
|
90
|
-
.pipe(filter(x => x.length > 0)).pipe(map(x => x.at(0)))
|
|
91
|
-
.subscribe(answer => {
|
|
92
|
-
const distinctArray = answer.AnswerIdArr.filter((n, i) => answer.AnswerIdArr.indexOf(n) === i);
|
|
93
|
-
this.fCtrls.answer.setValue(distinctArray);
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
convertToFormControl(element: any) {
|
|
98
|
-
return element as FormControl;
|
|
99
|
-
}
|
|
100
|
-
}
|
package/src/lib/components/question-dropdown-template/question-dropdown-template.component.html
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<div class="quastion" [attr.id]="'question_'+fCtrls.id.value" [ngClass]="{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}">
|
|
2
|
-
<h3 class="quastion-title ">
|
|
3
|
-
{{fCtrls.title.value}}
|
|
4
|
-
</h3>
|
|
5
|
-
<div class="text-quastion">
|
|
6
|
-
<select class="form-control" [formControl]="convertToFormControl(fCtrls.answer)" [disabled]="isDisabled">
|
|
7
|
-
<option *ngFor="let item of surveyQuestion?.surveyAnswers" [value]="item.answerId">{{item.answerTitle}}</option>
|
|
8
|
-
</select>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
package/src/lib/components/question-dropdown-template/question-dropdown-template.component.scss
DELETED
|
File without changes
|
package/src/lib/components/question-dropdown-template/question-dropdown-template.component.spec.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { QuestionDropdownTemplateComponent } from './question-dropdown-template.component';
|
|
4
|
-
|
|
5
|
-
describe('QuestionDropdownTemplateComponent', () => {
|
|
6
|
-
let component: QuestionDropdownTemplateComponent;
|
|
7
|
-
let fixture: ComponentFixture<QuestionDropdownTemplateComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [QuestionDropdownTemplateComponent]
|
|
12
|
-
});
|
|
13
|
-
fixture = TestBed.createComponent(QuestionDropdownTemplateComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|