survery-lib 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +52 -52
  2. package/assets/style.css +383 -58
  3. package/assets/style.css.map +1 -1
  4. package/ng-package.json +11 -0
  5. package/package.json +15 -27
  6. package/scss/style.scss +88 -0
  7. package/src/lib/components/question-boolean-template/question-boolean-template.component.html +13 -0
  8. package/src/lib/components/question-boolean-template/question-boolean-template.component.scss +0 -0
  9. package/src/lib/components/question-boolean-template/question-boolean-template.component.spec.ts +21 -0
  10. package/src/lib/components/question-boolean-template/question-boolean-template.component.ts +109 -0
  11. package/src/lib/components/question-check-box-template/question-check-box-template.component.html +13 -0
  12. package/src/lib/components/question-check-box-template/question-check-box-template.component.scss +0 -0
  13. package/src/lib/components/question-check-box-template/question-check-box-template.component.spec.ts +21 -0
  14. package/src/lib/components/question-check-box-template/question-check-box-template.component.ts +124 -0
  15. package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.html +10 -0
  16. package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.scss +3 -0
  17. package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.spec.ts +21 -0
  18. package/src/lib/components/question-dropdown-multi-template/question-dropdown-multi-template.component.ts +100 -0
  19. package/src/lib/components/question-dropdown-template/question-dropdown-template.component.html +10 -0
  20. package/src/lib/components/question-dropdown-template/question-dropdown-template.component.scss +0 -0
  21. package/src/lib/components/question-dropdown-template/question-dropdown-template.component.spec.ts +21 -0
  22. package/src/lib/components/question-dropdown-template/question-dropdown-template.component.ts +87 -0
  23. package/src/lib/components/question-matrix-template/question-matrix-template.component.html +36 -0
  24. package/src/lib/components/question-matrix-template/question-matrix-template.component.scss +0 -0
  25. package/src/lib/components/question-matrix-template/question-matrix-template.component.spec.ts +21 -0
  26. package/src/lib/components/question-matrix-template/question-matrix-template.component.ts +110 -0
  27. package/src/lib/components/question-radio-button-template/question-radio-button-template.component.html +13 -0
  28. package/src/lib/components/question-radio-button-template/question-radio-button-template.component.scss +0 -0
  29. package/src/lib/components/question-radio-button-template/question-radio-button-template.component.spec.ts +21 -0
  30. package/src/lib/components/question-radio-button-template/question-radio-button-template.component.ts +111 -0
  31. package/src/lib/components/question-text-template/question-text-template.component.html +13 -0
  32. package/src/lib/components/question-text-template/question-text-template.component.scss +0 -0
  33. package/src/lib/components/question-text-template/question-text-template.component.spec.ts +21 -0
  34. package/src/lib/components/question-text-template/question-text-template.component.ts +105 -0
  35. package/src/lib/pipes/default-question-answer.pipe.spec.ts +8 -0
  36. package/src/lib/pipes/default-question-answer.pipe.ts +18 -0
  37. package/src/lib/pipes/default-question-answers.pipe.spec.ts +8 -0
  38. package/src/lib/pipes/default-question-answers.pipe.ts +17 -0
  39. package/src/lib/pipes/filter-question.pipe.spec.ts +8 -0
  40. package/src/lib/pipes/filter-question.pipe.ts +14 -0
  41. package/src/lib/services/survey-lib.service.spec.ts +16 -0
  42. package/src/lib/services/survey-lib.service.ts +31 -0
  43. package/src/lib/survery-lib.component.spec.ts +21 -0
  44. package/src/lib/survery-lib.component.ts +308 -0
  45. package/src/lib/survery-lib.module.ts +47 -0
  46. package/src/lib/survey-lib.component.html +67 -0
  47. package/src/lib/survey-lib.component.scss +4 -0
  48. package/{lib/usecases/base/use-case.d.ts → src/lib/usecases/base/use-case.ts} +9 -7
  49. package/src/lib/usecases/check-rule-exps.usecase.ts +188 -0
  50. package/{public-api.d.ts → src/public-api.ts} +5 -1
  51. package/src/shared/dtos/default-question-answers.dto.ts +10 -0
  52. package/{shared/dtos/rule-exp-answer.dto.d.ts → src/shared/dtos/rule-exp-answer.dto.ts} +5 -5
  53. package/{shared/dtos/rule-exp.dto.d.ts → src/shared/dtos/rule-exp.dto.ts} +14 -13
  54. package/{shared/dtos/rule-result-question.dto.d.ts → src/shared/dtos/rule-result-question.dto.ts} +5 -4
  55. package/{shared/dtos/survey-answer.dto.d.ts → src/shared/dtos/survey-answer.dto.ts} +16 -16
  56. package/{shared/dtos/survey-answers-subject.dto.d.ts → src/shared/dtos/survey-answers-subject.dto.ts} +6 -5
  57. package/{shared/dtos/survey-page.dto.d.ts → src/shared/dtos/survey-page.dto.ts} +10 -9
  58. package/{shared/dtos/survey-question-group.dto.d.ts → src/shared/dtos/survey-question-group.dto.ts} +9 -8
  59. package/{shared/dtos/survey-question.dto.d.ts → src/shared/dtos/survey-question.dto.ts} +19 -18
  60. package/{shared/dtos/survey-rule.dto.d.ts → src/shared/dtos/survey-rule.dto.ts} +11 -10
  61. package/{shared/dtos/survey-sub-question.dto.d.ts → src/shared/dtos/survey-sub-question.dto.ts} +9 -9
  62. package/{shared/dtos/survey.dto.d.ts → src/shared/dtos/survey.dto.ts} +17 -16
  63. package/{shared/enums/logic-action.enum.d.ts → src/shared/enums/logic-action.enum.ts} +7 -7
  64. package/src/shared/enums/logic-property.enum.ts +12 -0
  65. package/src/shared/enums/operator.enum.ts +4 -0
  66. package/{shared/enums/question-type.enum.d.ts → src/shared/enums/question-type.enum.ts} +9 -8
  67. package/src/shared/form-interfaces/question-boolean-template.form-interface.ts +17 -0
  68. package/src/shared/form-interfaces/question-check-box-template.form-interface.ts +18 -0
  69. package/src/shared/form-interfaces/question-dropdown-multi-template.form-interface.ts +17 -0
  70. package/src/shared/form-interfaces/question-dropdown-template.form-interface.ts +10 -0
  71. package/{shared/form-interfaces/question-matrix-template.form-interface.d.ts → src/shared/form-interfaces/question-matrix-template.form-interface.ts} +13 -11
  72. package/src/shared/form-interfaces/question-radio-button-template.form-interface.ts +17 -0
  73. package/src/shared/form-interfaces/question-text-template.form-interface.ts +11 -0
  74. package/src/shared/form-interfaces/survery-lib.form-interface.ts +27 -0
  75. package/src/shared/models/question-answer.model.ts +6 -0
  76. package/src/shared/models/survery-question-result.model.ts +8 -0
  77. package/tsconfig.lib.json +14 -0
  78. package/tsconfig.lib.prod.json +10 -0
  79. package/tsconfig.spec.json +14 -0
  80. package/esm2022/lib/components/question-boolean-template/question-boolean-template.component.mjs +0 -99
  81. package/esm2022/lib/components/question-check-box-template/question-check-box-template.component.mjs +0 -110
  82. package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +0 -83
  83. package/esm2022/lib/components/question-matrix-template/question-matrix-template.component.mjs +0 -101
  84. package/esm2022/lib/components/question-radio-button-template/question-radio-button-template.component.mjs +0 -99
  85. package/esm2022/lib/components/question-text-template/question-text-template.component.mjs +0 -99
  86. package/esm2022/lib/pipes/default-question-answer.pipe.mjs +0 -19
  87. package/esm2022/lib/pipes/default-question-answers.pipe.mjs +0 -19
  88. package/esm2022/lib/pipes/filter-question.pipe.mjs +0 -16
  89. package/esm2022/lib/services/survey-lib.service.mjs +0 -30
  90. package/esm2022/lib/survery-lib.component.mjs +0 -270
  91. package/esm2022/lib/survery-lib.module.mjs +0 -59
  92. package/esm2022/lib/usecases/base/use-case.mjs +0 -2
  93. package/esm2022/lib/usecases/check-rule-exps.usecase.mjs +0 -154
  94. package/esm2022/public-api.mjs +0 -8
  95. package/esm2022/shared/dtos/default-question-answers.dto.mjs +0 -3
  96. package/esm2022/shared/dtos/rule-exp-answer.dto.mjs +0 -2
  97. package/esm2022/shared/dtos/rule-exp.dto.mjs +0 -2
  98. package/esm2022/shared/dtos/rule-result-question.dto.mjs +0 -2
  99. package/esm2022/shared/dtos/survey-answer.dto.mjs +0 -2
  100. package/esm2022/shared/dtos/survey-answers-subject.dto.mjs +0 -3
  101. package/esm2022/shared/dtos/survey-page.dto.mjs +0 -2
  102. package/esm2022/shared/dtos/survey-question-group.dto.mjs +0 -2
  103. package/esm2022/shared/dtos/survey-question.dto.mjs +0 -2
  104. package/esm2022/shared/dtos/survey-rule.dto.mjs +0 -2
  105. package/esm2022/shared/dtos/survey-sub-question.dto.mjs +0 -2
  106. package/esm2022/shared/dtos/survey.dto.mjs +0 -2
  107. package/esm2022/shared/enums/Logic-Property.enum.mjs +0 -14
  108. package/esm2022/shared/enums/logic-action.enum.mjs +0 -9
  109. package/esm2022/shared/enums/operator.enum.mjs +0 -6
  110. package/esm2022/shared/enums/question-type.enum.mjs +0 -10
  111. package/esm2022/shared/form-interfaces/question-boolean-template.form-interface.mjs +0 -2
  112. package/esm2022/shared/form-interfaces/question-check-box-template.form-interface.mjs +0 -3
  113. package/esm2022/shared/form-interfaces/question-dropdown-template.form-interface.mjs +0 -3
  114. package/esm2022/shared/form-interfaces/question-matrix-template.form-interface.mjs +0 -2
  115. package/esm2022/shared/form-interfaces/question-radio-button-template.form-interface.mjs +0 -3
  116. package/esm2022/shared/form-interfaces/question-text-template.form-interface.mjs +0 -2
  117. package/esm2022/shared/form-interfaces/survery-lib.form-interface.mjs +0 -2
  118. package/esm2022/shared/models/question-answer.model.mjs +0 -3
  119. package/esm2022/shared/models/survery-question-result.model.mjs +0 -3
  120. package/esm2022/survery-lib.mjs +0 -5
  121. package/fesm2022/survery-lib.mjs +0 -1120
  122. package/fesm2022/survery-lib.mjs.map +0 -1
  123. package/index.d.ts +0 -5
  124. package/lib/components/question-boolean-template/question-boolean-template.component.d.ts +0 -36
  125. package/lib/components/question-check-box-template/question-check-box-template.component.d.ts +0 -37
  126. package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +0 -33
  127. package/lib/components/question-matrix-template/question-matrix-template.component.d.ts +0 -33
  128. package/lib/components/question-radio-button-template/question-radio-button-template.component.d.ts +0 -36
  129. package/lib/components/question-text-template/question-text-template.component.d.ts +0 -35
  130. package/lib/pipes/default-question-answer.pipe.d.ts +0 -8
  131. package/lib/pipes/default-question-answers.pipe.d.ts +0 -8
  132. package/lib/pipes/filter-question.pipe.d.ts +0 -9
  133. package/lib/services/survey-lib.service.d.ts +0 -14
  134. package/lib/survery-lib.component.d.ts +0 -45
  135. package/lib/survery-lib.module.d.ts +0 -22
  136. package/lib/usecases/check-rule-exps.usecase.d.ts +0 -21
  137. package/shared/dtos/default-question-answers.dto.d.ts +0 -9
  138. package/shared/enums/Logic-Property.enum.d.ts +0 -12
  139. package/shared/enums/operator.enum.d.ts +0 -4
  140. package/shared/form-interfaces/question-boolean-template.form-interface.d.ts +0 -15
  141. package/shared/form-interfaces/question-check-box-template.form-interface.d.ts +0 -15
  142. package/shared/form-interfaces/question-dropdown-template.form-interface.d.ts +0 -9
  143. package/shared/form-interfaces/question-radio-button-template.form-interface.d.ts +0 -15
  144. package/shared/form-interfaces/question-text-template.form-interface.d.ts +0 -10
  145. package/shared/form-interfaces/survery-lib.form-interface.d.ts +0 -24
  146. package/shared/models/question-answer.model.d.ts +0 -6
  147. package/shared/models/survery-question-result.model.d.ts +0 -8
@@ -0,0 +1,88 @@
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
+ }
@@ -0,0 +1,13 @@
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>
@@ -0,0 +1,21 @@
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
+ });
@@ -0,0 +1,109 @@
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
+ }
@@ -0,0 +1,13 @@
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>
@@ -0,0 +1,21 @@
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
+ });
@@ -0,0 +1,124 @@
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
+ }
@@ -0,0 +1,10 @@
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>
@@ -0,0 +1,3 @@
1
+ .text-quastion .form-control {
2
+ padding: 10px;
3
+ }
@@ -0,0 +1,21 @@
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
+ });
@@ -0,0 +1,100 @@
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
+ }
@@ -0,0 +1,10 @@
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>
@@ -0,0 +1,21 @@
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
+ });
@@ -0,0 +1,87 @@
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 { SurveyQuestionDto } from '../../../shared/dtos/survey-question.dto';
5
+ import { QuestionTypeEnum } from '../../../shared/enums/question-type.enum';
6
+ import { QuestionDropdownTemplateFormInterface } from '../../../shared/form-interfaces/question-dropdown-template.form-interface';
7
+ import { QuestionRadioButtonTemplateFormInterface } from '../../../shared/form-interfaces/question-radio-button-template.form-interface';
8
+ import { debounceTime, distinctUntilChanged, filter, map } from 'rxjs';
9
+ import { QuestionAnswerModel } from '../../../shared/models/question-answer.model';
10
+ import { DefaultQuestionAnswerDto } from '../../../shared/dtos/default-question-answers.dto';
11
+ import { SurveyLibService } from '../../services/survey-lib.service';
12
+
13
+ @Component({
14
+ selector: 'lib-question-dropdown-template',
15
+ templateUrl: './question-dropdown-template.component.html',
16
+ styleUrls: ['./question-dropdown-template.component.scss']
17
+ })
18
+ export class QuestionDropdownTemplateComponent implements OnInit {
19
+ surveyQuestion: SurveyQuestionDto;
20
+ rForm: FormGroup<QuestionDropdownTemplateFormInterface>;
21
+
22
+ get fCtrls() {
23
+ return this.rForm.controls;
24
+ }
25
+
26
+ get questionTypeEnum() {
27
+ return QuestionTypeEnum;
28
+ }
29
+
30
+ @Output() emitter = new EventEmitter<QuestionAnswerModel>();
31
+
32
+ @Input() isShow: boolean = true;
33
+ @Input() isDisabled: boolean = false;
34
+ @Input() set setQuestion(value: SurveyQuestionDto) {
35
+ this.surveyQuestion = value;
36
+ this.rForm.patchValue({
37
+ id: value.questionId,
38
+ name: value.questionName,
39
+ title: value.questionTitle,
40
+ typeId: value.questionTypeId,
41
+ description: value.questionDescription
42
+ });
43
+
44
+ if (value.isRequired == true) {
45
+ this.fCtrls.answer.addValidators([Validators.required]);
46
+ this.fCtrls.answer.updateValueAndValidity();
47
+ }
48
+
49
+ this.isShow = value.isVisable;
50
+ this.isDisabled = value.isReadOnly;
51
+ }
52
+
53
+ constructor(private _formBuilder: FormBuilder ,private _surveyLibService :SurveyLibService) {
54
+ this.rForm = this._formBuilder.group<QuestionDropdownTemplateFormInterface>({
55
+ id: [null],
56
+ name: [null],
57
+ title: [null],
58
+ typeId: [null],
59
+ description: [null],
60
+ answer: [null]
61
+ });
62
+ }
63
+
64
+ ngOnInit(): void {
65
+ this.fCtrls.answer.valueChanges.pipe().pipe(debounceTime(200)).subscribe(value => {
66
+ const formValue = this.rForm.value;
67
+ this.emitter.emit({
68
+ QuestionId: formValue.id,
69
+ IsValid: this.fCtrls.answer.valid,
70
+ Answer: value
71
+ })
72
+ });
73
+
74
+ this.fCtrls.answer.setValue(null);
75
+
76
+ this._surveyLibService.surveyAnswersObsrv
77
+ .pipe(map(x=> x.defaultAnswers.filter(x=>x.QuestionId == this.fCtrls.id.value)))
78
+ .pipe(filter(x=>x.length > 0)).pipe(map(x=> x.at(0)))
79
+ .subscribe(answer=>{
80
+ this.fCtrls.answer.setValue(answer.AnswerId);
81
+ })
82
+ }
83
+
84
+ convertToFormControl(element: any) {
85
+ return element as FormControl;
86
+ }
87
+ }