fcad-core-dragon 2.0.0-beta.1 → 2.0.0-beta.10

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 (163) hide show
  1. package/.editorconfig +6 -31
  2. package/.prettierrc +11 -0
  3. package/.vscode/extensions.json +8 -0
  4. package/.vscode/settings.json +16 -0
  5. package/CHANGELOG +153 -0
  6. package/README.md +28 -43
  7. package/documentation/.vitepress/config.js +114 -0
  8. package/documentation/api-examples.md +49 -0
  9. package/documentation/composants/app-base-button.md +58 -0
  10. package/documentation/composants/app-base-error-display.md +59 -0
  11. package/documentation/composants/app-base-popover.md +68 -0
  12. package/documentation/composants/app-comp-audio.md +75 -0
  13. package/documentation/composants/app-comp-branch-buttons.md +111 -0
  14. package/documentation/composants/app-comp-button-progress.md +53 -0
  15. package/documentation/composants/app-comp-carousel.md +53 -0
  16. package/documentation/composants/app-comp-container.md +53 -0
  17. package/documentation/composants/app-comp-input-checkbox-next.md +42 -0
  18. package/documentation/composants/app-comp-input-dropdown-next.md +34 -0
  19. package/documentation/composants/app-comp-input-radio-next.md +39 -0
  20. package/documentation/composants/app-comp-input-text-next.md +35 -0
  21. package/documentation/composants/app-comp-input-text-table-next.md +34 -0
  22. package/documentation/composants/app-comp-input-text-to-fill-dropdown-next.md +53 -0
  23. package/documentation/composants/app-comp-input-text-to-fill-next.md +31 -0
  24. package/documentation/composants/app-comp-jauge.md +31 -0
  25. package/documentation/composants/app-comp-menu-item.md +55 -0
  26. package/documentation/composants/app-comp-menu.md +29 -0
  27. package/documentation/composants/app-comp-navigation.md +41 -0
  28. package/documentation/composants/app-comp-note-call.md +53 -0
  29. package/documentation/composants/app-comp-note-credit.md +53 -0
  30. package/documentation/composants/app-comp-play-bar-next.md +53 -0
  31. package/documentation/composants/app-comp-pop-up-next.md +93 -0
  32. package/documentation/composants/app-comp-quiz-next.md +235 -0
  33. package/documentation/composants/app-comp-quiz-recall.md +53 -0
  34. package/documentation/composants/app-comp-svg-next.md +53 -0
  35. package/documentation/composants/app-comp-table-of-content.md +50 -0
  36. package/documentation/composants/app-comp-video-player.md +82 -0
  37. package/documentation/composants.md +46 -0
  38. package/documentation/composants_critiques/ModelPageComposant.md +53 -0
  39. package/documentation/composants_critiques/app-base-module.md +43 -0
  40. package/documentation/composants_critiques/app-base-page.md +48 -0
  41. package/documentation/composants_critiques/app-base.md +311 -0
  42. package/documentation/composants_critiques/main.md +15 -0
  43. package/documentation/demarrage.md +50 -0
  44. package/documentation/deploiement.md +58 -0
  45. package/documentation/index.md +33 -0
  46. package/documentation/markdown-examples.md +85 -0
  47. package/documentation/public/npm_version.png +0 -0
  48. package/documentation/public/vite.svg +15 -0
  49. package/documentation/public/vuejs.svg +2 -0
  50. package/documentation/public/vuetify.svg +6 -0
  51. package/eslint.config.js +60 -0
  52. package/package.json +43 -47
  53. package/src/$locales/en.json +86 -108
  54. package/src/$locales/fr.json +66 -127
  55. package/src/assets/data/onboardingMessages.json +1 -1
  56. package/src/components/AppBase.vue +960 -405
  57. package/src/components/AppBaseButton.test.js +21 -0
  58. package/src/components/AppBaseButton.vue +42 -10
  59. package/src/components/AppBaseErrorDisplay.vue +207 -189
  60. package/src/components/AppBaseFlipCard.vue +1 -0
  61. package/src/components/AppBaseModule.vue +769 -977
  62. package/src/components/AppBasePage.vue +635 -81
  63. package/src/components/AppBasePopover.vue +41 -0
  64. package/src/components/AppBaseSkeleton.vue +66 -0
  65. package/src/components/AppCompAudio.vue +256 -0
  66. package/src/components/AppCompBranchButtons.vue +79 -153
  67. package/src/components/AppCompButtonProgress.vue +21 -36
  68. package/src/components/AppCompCarousel.vue +231 -87
  69. package/src/components/{AppCompTranscript.vue → AppCompContainer.vue} +12 -2
  70. package/src/components/AppCompInputCheckBoxNx.vue +323 -0
  71. package/src/components/AppCompInputDropdownNx.vue +299 -0
  72. package/src/components/AppCompInputRadioNx.vue +284 -0
  73. package/src/components/AppCompInputTextNx.vue +153 -0
  74. package/src/components/AppCompInputTextTableNx.vue +202 -0
  75. package/src/components/AppCompInputTextToFillDropdownNx.vue +340 -0
  76. package/src/components/AppCompInputTextToFillNx.vue +313 -0
  77. package/src/components/AppCompJauge.vue +36 -10
  78. package/src/components/AppCompMenu.vue +246 -32
  79. package/src/components/AppCompMenuItem.vue +87 -21
  80. package/src/components/AppCompNavigation.vue +470 -447
  81. package/src/components/AppCompNoteCall.vue +93 -58
  82. package/src/components/AppCompNoteCredit.vue +423 -96
  83. package/src/components/AppCompPlayBarNext.vue +2288 -0
  84. package/src/components/AppCompPopUpNext.vue +504 -0
  85. package/src/components/AppCompQuizNext.vue +510 -0
  86. package/src/components/AppCompQuizRecall.vue +199 -99
  87. package/src/components/AppCompSVGNext.vue +346 -0
  88. package/src/components/AppCompSettingsMenu.vue +17 -16
  89. package/src/components/AppCompTableOfContent.vue +262 -99
  90. package/src/components/AppCompVideoPlayer.vue +183 -142
  91. package/src/components/BaseModule.vue +8 -20
  92. package/src/components/tests__/AppBaseButton.spec.js +53 -0
  93. package/src/components/tests__/useTimer.spec.js +91 -0
  94. package/src/composables/useIdleDetector.js +56 -0
  95. package/src/composables/useQuiz.js +89 -0
  96. package/src/composables/useTimer.js +172 -0
  97. package/src/directives/nvdaFix.js +53 -0
  98. package/src/externalComps/ModuleView.vue +22 -0
  99. package/src/externalComps/SummaryView.vue +91 -0
  100. package/src/main.js +397 -148
  101. package/src/module/stores/appStore.js +947 -0
  102. package/src/module/xapi/ADL.js +241 -60
  103. package/src/module/xapi/Crypto/Hasher.js +8 -8
  104. package/src/module/xapi/Crypto/WordArray.js +6 -6
  105. package/src/module/xapi/Crypto/algorithms/BufferedBlockAlgorithm.js +4 -4
  106. package/src/module/xapi/Crypto/algorithms/C_algo.js +14 -18
  107. package/src/module/xapi/Crypto/algorithms/HMAC.js +1 -1
  108. package/src/module/xapi/Crypto/algorithms/SHA1.js +1 -1
  109. package/src/module/xapi/Crypto/encoders/Base.js +7 -7
  110. package/src/module/xapi/Crypto/encoders/Base64.js +3 -3
  111. package/src/module/xapi/Crypto/encoders/Hex.js +2 -2
  112. package/src/module/xapi/Crypto/encoders/Latin1.js +3 -3
  113. package/src/module/xapi/Crypto/encoders/Utf8.js +3 -3
  114. package/src/module/xapi/Statement/index.js +3 -3
  115. package/src/module/xapi/launch.js +10 -10
  116. package/src/module/xapi/utils.js +17 -17
  117. package/src/module/xapi/wrapper.js +219 -214
  118. package/src/module/xapi/xapiStatement.js +29 -29
  119. package/src/plugins/analytics.js +34 -0
  120. package/src/plugins/bus.js +7 -2
  121. package/src/plugins/gsap.js +5 -7
  122. package/src/plugins/helper.js +97 -34
  123. package/src/plugins/i18n.js +13 -18
  124. package/src/plugins/idb.js +45 -30
  125. package/src/plugins/save.js +1 -1
  126. package/src/plugins/scorm.js +15 -15
  127. package/src/plugins/xapi.js +2 -2
  128. package/src/public/index.html +22 -10
  129. package/src/router/index.js +29 -13
  130. package/src/router/routes.js +29 -54
  131. package/src/shared/generalfuncs.js +186 -30
  132. package/src/shared/validators.js +809 -40
  133. package/vitest.config.js +19 -0
  134. package/.eslintignore +0 -29
  135. package/.eslintrc.js +0 -86
  136. package/.prettierrc.js +0 -5
  137. package/babel.config.js +0 -3
  138. package/src/components/AppBaseDragChoice.vue +0 -91
  139. package/src/components/AppBaseDropZone.vue +0 -112
  140. package/src/components/AppCompBif.vue +0 -120
  141. package/src/components/AppCompDragAndDrop.vue +0 -339
  142. package/src/components/AppCompInputAssociation.vue +0 -332
  143. package/src/components/AppCompInputCheckBox.vue +0 -227
  144. package/src/components/AppCompInputDropdown.vue +0 -184
  145. package/src/components/AppCompInputRadio.vue +0 -169
  146. package/src/components/AppCompInputTextBox.vue +0 -91
  147. package/src/components/AppCompInputTextTable.vue +0 -155
  148. package/src/components/AppCompInputTextToFillDropdown.vue +0 -255
  149. package/src/components/AppCompInputTextToFillText.vue +0 -164
  150. package/src/components/AppCompMediaPlayer.vue +0 -397
  151. package/src/components/AppCompPlayBar.vue +0 -1319
  152. package/src/components/AppCompPopUp.vue +0 -522
  153. package/src/components/AppCompPopover.vue +0 -27
  154. package/src/components/AppCompQuiz.vue +0 -2989
  155. package/src/components/AppCompSVG.vue +0 -309
  156. package/src/mixins/$pageMixins.js +0 -459
  157. package/src/mixins/$quizMixins.js +0 -456
  158. package/src/mixins/timerMixin.js +0 -156
  159. package/src/module/store.js +0 -895
  160. package/src/plugins/timeManager.js +0 -77
  161. package/src/routes_bckp.js +0 -313
  162. package/src/routes_static.js +0 -344
  163. package/vue.config.js +0 -83
@@ -1,227 +0,0 @@
1
- <template>
2
- <div class="input-box">
3
- <fieldset>
4
- <legend
5
- :id="`lgd_${inputDataId}`"
6
- class="sr-only"
7
- tabindex="-1"
8
- v-html="getQuizQuestion()"
9
- />
10
-
11
- <template v-for="choixReponse in inputDataValue">
12
- <div
13
- :Key="`div_chx_${inputDataId}_${choixReponse.id}`"
14
- class="box-checkbox"
15
- >
16
- <label
17
- :key="`lbl_chx_${inputDataId}-${choixReponse.id}`"
18
- :for="`chx_${inputDataId}_${choixReponse.id}`"
19
- :class="classInput(choixReponse.id)"
20
- class="checkbox-label"
21
- >
22
- <input
23
- :id="`chx_${inputDataId}_${choixReponse.id}`"
24
- :key="`chx_${inputDataId}_${inputDataId}-${choixReponse.id}`"
25
- v-model="quizInputMultipleValue"
26
- type="checkbox"
27
- :value="choixReponse.id"
28
- :name="`btn-checkbox-${inputDataId}`"
29
- :disabled="quizCompleted"
30
- class="checkbox-input"
31
- />
32
- <span class="checkbox-contenu" v-html="choixReponse.value"></span>
33
- <span
34
- :id="`${inputDataId}_${choixReponse.id}-msg-erreur`"
35
- :key="`msg_chx_${inputDataId}_${choixReponse.id}`"
36
- class="sr-only"
37
- >
38
- {{ messageAccessibility(choixReponse.id) }}
39
- </span>
40
- </label>
41
- </div>
42
- </template>
43
- </fieldset>
44
- </div>
45
- </template>
46
- <script>
47
- import $extendsQuiz from '../mixins/$quizMixins'
48
- export default {
49
- name: 'AppCompInputCheckBox',
50
- mixins: [$extendsQuiz],
51
- props: {
52
- inputType: {
53
- type: String,
54
- default: ''
55
- },
56
- inputDataId: {
57
- type: String,
58
- default: ''
59
- },
60
- inputData: {
61
- type: Array,
62
- default: () => []
63
- },
64
- quizCompleted: {
65
- type: Boolean,
66
- default: false
67
- },
68
- solution: {
69
- type: Array,
70
- default: () => []
71
- },
72
- showSolution: {
73
- type: Boolean,
74
- default: false
75
- },
76
- shuffleAnswers: {
77
- type: Boolean,
78
- default: false
79
- },
80
- quizInputMultiple: {
81
- type: Array,
82
- default: () => []
83
- }, //use to pass the value of the input
84
- quizSubmit: {
85
- type: Boolean,
86
- default: false
87
- }, //use to call a submit
88
- aBy: {
89
- type: String,
90
- default: ''
91
- } // use to pass id of the related question for the choices
92
- },
93
-
94
- data() {
95
- return {
96
- inputDataValue: [],
97
- quizInputMultipleValue: [] //not using quizInputMultiple because quizInputMultiple is a prop
98
- }
99
- },
100
-
101
- computed: {},
102
-
103
- watch: {
104
- /**
105
- * @description to pass value to AppCompQuiz
106
- * @fires input-change to AppCompQuiz.vue
107
- */
108
- quizInputMultipleValue(newValue) {
109
- this.$emit('input-change', newValue)
110
- },
111
-
112
- /**
113
- * @description to pass the value from AppCompQuiz
114
- */
115
- quizInputMultiple(newValue) {
116
- this.quizInputMultipleValue = newValue
117
- }
118
- },
119
-
120
- mounted() {
121
- if (this.solution !== null) {
122
- this.solution.sort(function(a, b) {
123
- return a - b
124
- })
125
- }
126
- this.quizInputMultipleValue = this.quizInputMultiple
127
-
128
- if (this.shuffleAnswers) {
129
- this.inputDataValue = this.shuffleArray(this.inputData)
130
- } else {
131
- this.inputDataValue = this.inputData
132
- }
133
- },
134
-
135
- methods: {
136
- /**
137
- * @description compares 2 array
138
- * @param {Array} array1
139
- * @param {Array} array2
140
- * @returns {Boolean}
141
- */
142
- isEqual(array1, array2) {
143
- // if length is not equal
144
- if (array1.length != array2.length) {
145
- return false
146
- } else {
147
- // comapring each element of array
148
- for (let i = 0; i < array1.length; i++) {
149
- if (array1[i] != array2[i]) {
150
- return false
151
- }
152
- }
153
- return true
154
- }
155
- },
156
-
157
- /**
158
- * @description check if a values exists in a array
159
- * @param {Array} array
160
- * @param value
161
- * @returns {Boolean}
162
- */
163
- containsValue(array, value) {
164
- return array.includes(value)
165
- },
166
-
167
- /**
168
- * @description shuffles an array used to randomized the option order if shuffleAnswers is true
169
- * @param {Array} array
170
- * @returns {Array}
171
- */
172
- shuffleArray(array) {
173
- let newArray = []
174
- let newArray2 = []
175
-
176
- for (let i = 0; i < array.length; i++) {
177
- const element = array[i]
178
- //todo remove null values
179
- newArray.push(element)
180
- }
181
- while (newArray.length > 0) {
182
- let pos = Math.floor(newArray.length * Math.random())
183
- newArray2.push(newArray[pos])
184
- newArray.splice(pos, 1)
185
- }
186
- return newArray2
187
- }
188
- }
189
- }
190
- </script>
191
- <style lang="scss">
192
- .custom-control-input:focus ~ .custom-control-label::before {
193
- border: inherit;
194
- }
195
-
196
- .custom-control-input:focus ~ .custom-control-label::before {
197
- box-shadow: inherit;
198
- -webkit-box-shadow: inherit;
199
- }
200
-
201
- .custom-checkbox {
202
- width: 100%;
203
- height: 100%;
204
- padding-left: 0;
205
-
206
- input {
207
- width: 100%;
208
- height: 100%;
209
- }
210
-
211
- label {
212
- width: 100%;
213
- height: 100%;
214
-
215
- &:after,
216
- &:before {
217
- border: inherit;
218
- top: 0px;
219
- left: 0px;
220
- height: 0;
221
- width: 0;
222
- background-color: inherit;
223
- border: inherit;
224
- }
225
- }
226
- }
227
- </style>
@@ -1,184 +0,0 @@
1
- <template>
2
- <div class="input-box">
3
- <div
4
- v-for="singleDropdown in inputData"
5
- :key="singleDropdown.id"
6
- :class="
7
- `dropdownlist-${singleDropdown.id} ${classInput(singleDropdown.id)}`
8
- "
9
- >
10
- <label
11
- :for="`${inputDataId}_${singleDropdown.id}`"
12
- v-html="singleDropdown.ennonce"
13
- ></label>
14
- <b-form-select
15
- :id="inputDataId + '_' + singleDropdown.id"
16
- v-model="quizSelectedValue[singleDropdown.id]"
17
- :options="singleDropdown.option"
18
- :disabled="quizCompleted"
19
- ></b-form-select>
20
- </div>
21
- </div>
22
- </template>
23
- <script>
24
- import $extendsQuiz from '../mixins/$quizMixins'
25
- export default {
26
- name: 'AppCompInputDropdown',
27
- mixins: [$extendsQuiz],
28
-
29
- props: {
30
- inputType: {
31
- type: String,
32
- default: ''
33
- },
34
- inputDataId: {
35
- type: String,
36
- default: ''
37
- },
38
- inputData: {
39
- type: Array,
40
- default: () => []
41
- },
42
- quizCompleted: {
43
- type: Boolean,
44
- default: false
45
- },
46
- solution: {
47
- type: Array,
48
- default: () => []
49
- },
50
- showSolution: {
51
- type: Boolean,
52
- default: false
53
- },
54
- shuffleAnswers: {
55
- type: Boolean,
56
- default: false
57
- },
58
- quizSelected: {
59
- type: Array,
60
- default: () => []
61
- }, //use to pass the value of the input
62
- quizSubmit: {
63
- type: Boolean,
64
- default: false
65
- } //use to call a submit
66
- },
67
-
68
- data() {
69
- return {
70
- quizSelectedValue: [] //not using quizSelected because quizSelected is a prop
71
- }
72
- },
73
-
74
- computed: {},
75
-
76
- watch: {
77
- /**
78
- * @description to pass value to AppCompQuiz
79
- * @emits input-change
80
- */
81
- quizSelectedValue(newValue) {
82
- this.$emit('input-change', newValue)
83
- },
84
-
85
- /**
86
- * @description to pass the value from AppCompQuiz
87
- */
88
- quizSelected(newValue) {
89
- this.quizSelectedValue = newValue
90
- }
91
- },
92
-
93
- mounted() {
94
- if (this.solution !== null)
95
- this.solution.sort(function(a, b) {
96
- return a.question_id - b.question_id
97
- })
98
- //to show the defaultAnswer
99
- const defaultAnswer = {
100
- value: null,
101
- disabled: true,
102
- text: this.$t('message.first_option_dropdown')
103
- }
104
- let selectedChoices = []
105
- for (let i = 0; i < this.inputData.length; i++) {
106
- let singleDropdown
107
- if (this.shuffleAnswers) {
108
- singleDropdown = this.inputData[i]
109
- singleDropdown.option = this.shuffleArray(singleDropdown.option)
110
- } else {
111
- singleDropdown = this.inputData[i]
112
- }
113
- if (
114
- this.inputData[i].option[0].text !==
115
- this.$t('message.first_option_dropdown')
116
- ) {
117
- singleDropdown.option.unshift(defaultAnswer)
118
- }
119
- selectedChoices.push(null)
120
- }
121
- if (this.quizSelected.length == 0) {
122
- this.quizSelectedValue = selectedChoices
123
- } else {
124
- this.quizSelectedValue = this.quizSelected
125
- }
126
- },
127
-
128
- methods: {
129
- /**
130
- * @description used by the dropdown quiz
131
- * @param {Array} answers what the user has answered
132
- * @param {Array} solution the correct choices
133
- * @returns {Boolean}
134
- * @todo Add a catching for error if the 2 question_id dont match
135
- */
136
- compareSelectedAnswers(answers, solution) {
137
- for (let index = 0; index < answers.length; index++) {
138
- const elementAnswers = answers[index]
139
- const elementSolution = solution[index]
140
- if (elementAnswers.question_id == elementSolution.question_id) {
141
- if (elementAnswers.reponse_id !== elementSolution.reponse_id) {
142
- return false
143
- }
144
- } else {
145
- return //if it return nothing there is a bug since this means the 2 question_id dont match
146
- }
147
- }
148
- return true
149
- },
150
-
151
- /**
152
- * @description check if a values exists in a array
153
- * @param {Array} array
154
- * @param value
155
- * @returns {Boolean}
156
- */
157
- containsValue(array, value) {
158
- return array.includes(value)
159
- },
160
-
161
- /**
162
- * @description shuffles an array used to randomized the option order if shuffleAnswers is true
163
- * @param {Array} array
164
- * @returns {Array}
165
- */
166
- shuffleArray(array) {
167
- let newArray = []
168
- let newArray2 = []
169
-
170
- for (let i = 0; i < array.length; i++) {
171
- const element = array[i]
172
- //todo remove null values
173
- newArray.push(element)
174
- }
175
- while (newArray.length > 0) {
176
- let pos = Math.floor(newArray.length * Math.random())
177
- newArray2.push(newArray[pos])
178
- newArray.splice(pos, 1)
179
- }
180
- return newArray2
181
- }
182
- }
183
- }
184
- </script>
@@ -1,169 +0,0 @@
1
- <template>
2
- <div class="input-box">
3
- <fieldset>
4
- <legend
5
- :id="`lgd_${inputDataId}`"
6
- class="sr-only"
7
- tabindex="-1"
8
- v-html="getQuizQuestion()"
9
- />
10
-
11
- <template v-for="choixReponse in inputDataValue">
12
- <div
13
- :Key="`div_chx_${inputDataId}-${choixReponse.id}`"
14
- class="box-radio"
15
- >
16
- <label
17
- :key="`lbl_chx_${inputDataId}_${choixReponse.id}`"
18
- :for="`chx_${inputDataId}_${choixReponse.id}`"
19
- :class="classInput(choixReponse.id)"
20
- class="radio-label"
21
- >
22
- <input
23
- :id="`chx_${inputDataId}_${choixReponse.id}`"
24
- :key="`chx_${inputDataId}_${choixReponse.id}`"
25
- v-model="quizInputUniqueValue"
26
- type="radio"
27
- :value="choixReponse.id"
28
- :name="`btn-radios-${inputDataId}`"
29
- :disabled="quizCompleted"
30
- class="radio-input"
31
- />
32
-
33
- <span class="radio-contenu" v-html="choixReponse.value" />
34
- <span
35
- :id="`${inputDataId}_${choixReponse.id}-msg-erreur`"
36
- :key="`msg_chx_${inputDataId}_${choixReponse.id}`"
37
- class="sr-only"
38
- >
39
- {{ messageAccessibility(choixReponse.id) }}
40
- </span>
41
- </label>
42
- </div>
43
- </template>
44
- </fieldset>
45
- </div>
46
- </template>
47
- <script>
48
- import $extendsQuiz from '../mixins/$quizMixins'
49
- export default {
50
- name: 'AppCompInputRadio',
51
- mixins: [$extendsQuiz],
52
-
53
- props: {
54
- inputType: {
55
- type: String,
56
- default: ''
57
- },
58
- inputDataId: {
59
- type: String,
60
- default: ''
61
- },
62
-
63
- inputData: {
64
- type: Array,
65
- default: () => []
66
- },
67
- quizCompleted: {
68
- type: Boolean,
69
- default: false
70
- },
71
- solution: {
72
- type: String,
73
- default: ''
74
- }, //may be null
75
- showSolution: {
76
- type: Boolean,
77
- default: false
78
- },
79
- shuffleAnswers: {
80
- type: Boolean,
81
- default: false
82
- },
83
- quizInputUnique: {
84
- type: String,
85
- default: ''
86
- }, //use to pass the value of the input
87
- quizSubmit: {
88
- type: Boolean,
89
- default: false
90
- }, //use to call a submit
91
- aBy: {
92
- type: String,
93
- default: ''
94
- } // use to pass id of the related question for the choices
95
- },
96
-
97
- data() {
98
- return {
99
- inputDataValue: [],
100
- quizInputUniqueValue: null //not using quizInputUnique because quizInputUnique is a prop
101
- }
102
- },
103
-
104
- computed: {},
105
-
106
- watch: {
107
- /**
108
- * @description to pass value to AppCompQuiz
109
- * @fires input-change to AppCompQuiz.vue
110
- */
111
- quizInputUniqueValue(newValue) {
112
- this.$emit('input-change', newValue)
113
- },
114
-
115
- /**
116
- * @description to pass the value from AppCompQuiz
117
- */
118
- quizInputUnique(newValue) {
119
- this.quizInputUniqueValue = newValue
120
- }
121
- },
122
-
123
- mounted() {
124
- this.quizInputUniqueValue = this.quizInputUnique
125
- if (this.shuffleAnswers) {
126
- this.inputDataValue = this.shuffleArray(this.inputData)
127
- } else {
128
- this.inputDataValue = this.inputData
129
- }
130
- },
131
-
132
- methods: {
133
- /**
134
- * @description shuffles an array used to randomized the option order if shuffleAnswers is true
135
- * @param {Array} array
136
- * @returns {Array}
137
- */
138
- shuffleArray(array) {
139
- let newArray = []
140
- let newArray2 = []
141
-
142
- for (let i = 0; i < array.length; i++) {
143
- const element = array[i]
144
- //todo remove null values
145
- newArray.push(element)
146
- }
147
- while (newArray.length > 0) {
148
- let pos = Math.floor(newArray.length * Math.random())
149
- newArray2.push(newArray[pos])
150
- newArray.splice(pos, 1)
151
- }
152
- return newArray2
153
- },
154
-
155
- /**
156
- * @description - Method to get the question
157
- */
158
- getQuizQuestion() {
159
- const el = document.querySelector(`#${this.aBy}`)
160
- if (!el || !el.innerHTML) return
161
- const labelFor =
162
- this.$i18n.locale === 'fr'
163
- ? 'Choix de reponse pour la'
164
- : 'Answers available for the'
165
- return `${labelFor} ${el.innerText}`
166
- }
167
- }
168
- }
169
- </script>
@@ -1,91 +0,0 @@
1
- <template>
2
- <div class="input-box">
3
- <b-form-textarea
4
- :id="`textArea_${inputDataId}`"
5
- v-model="quizTextAreaValue"
6
- :aria-labelledby="`textArea_${inputDataId}`"
7
- :class="classInput()"
8
- :placeholder="$t('text.place_holder.for_textarea')"
9
- :disabled="quizCompleted"
10
- rows="3"
11
- no-resize
12
- :aria-describedby="`${inputDataId}-msg-erreur`"
13
- ></b-form-textarea>
14
- <span :id="`${inputDataId}-msg-erreur`" class="sr-only">
15
- {{ messageAccessibility() }}
16
- </span>
17
- </div>
18
- </template>
19
- <script>
20
- import $extendsQuiz from '../mixins/$quizMixins'
21
- export default {
22
- name: 'AppCompInputTextBox',
23
- mixins: [$extendsQuiz],
24
-
25
- props: {
26
- inputType: {
27
- type: String,
28
- default: ''
29
- },
30
- inputDataId: {
31
- type: String,
32
- default: ''
33
- },
34
- inputData: {
35
- type: Array,
36
- default: () => []
37
- }, //not used just here to be the same
38
- quizCompleted: {
39
- type: Boolean,
40
- default: false
41
- },
42
- solution: {
43
- type: String,
44
- default: ''
45
- },
46
- showSolution: {
47
- type: Boolean,
48
- default: false
49
- },
50
- quizTextArea: {
51
- type: String,
52
- default: ''
53
- }, //use to pass the value of the input
54
- quizSubmit: {
55
- type: Boolean,
56
- default: false
57
- } //use to call a submit
58
- },
59
-
60
- data() {
61
- return {
62
- quizTextAreaValue: '' //not using quizTextArea because quizTextArea is a prop
63
- }
64
- },
65
-
66
- computed: {},
67
-
68
- watch: {
69
- /**
70
- * @description to pass value to AppCompQuiz
71
- * @fires input-change to AppCompQuiz.vue
72
- */
73
- quizTextAreaValue(newValue) {
74
- this.$emit('input-change', newValue)
75
- },
76
-
77
- /**
78
- * @description to pass the value from AppCompQuiz
79
- */
80
- quizTextArea(newValue) {
81
- this.quizTextAreaValue = newValue
82
- }
83
- },
84
-
85
- mounted() {
86
- this.quizTextAreaValue = this.quizTextArea
87
- },
88
-
89
- methods: {}
90
- }
91
- </script>