fcad-core-dragon 2.0.0-beta.1 → 2.0.0-beta.3
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/.editorconfig +33 -33
- package/.eslintignore +29 -29
- package/{.eslintrc.js → .eslintrc.cjs} +81 -86
- package/CHANGELOG +364 -364
- package/README.md +71 -71
- package/bk.scss +117 -0
- package/package.json +61 -63
- package/src/$locales/en.json +143 -179
- package/src/$locales/fr.json +105 -181
- package/src/assets/data/onboardingMessages.json +47 -47
- package/src/components/AppBase.vue +1054 -614
- package/src/components/AppBaseButton.vue +87 -63
- package/src/components/AppBaseErrorDisplay.vue +438 -420
- package/src/components/AppBaseFlipCard.vue +84 -83
- package/src/components/AppBaseModule.vue +1673 -1842
- package/src/components/AppBasePage.vue +779 -312
- package/src/components/AppBasePopover.vue +41 -0
- package/src/components/AppCompAudio.vue +234 -0
- package/src/components/AppCompBranchButtons.vue +552 -582
- package/src/components/AppCompButtonProgress.vue +126 -147
- package/src/components/AppCompCarousel.vue +298 -192
- package/src/components/AppCompInputCheckBoxNext.vue +195 -0
- package/src/components/AppCompInputDropdownNext.vue +159 -0
- package/src/components/AppCompInputRadioNext.vue +152 -0
- package/src/components/{AppCompInputTextBox.vue → AppCompInputTextNext.vue} +106 -91
- package/src/components/AppCompInputTextTableNext.vue +141 -0
- package/src/components/AppCompInputTextToFillDropdownNext.vue +230 -0
- package/src/components/{AppCompInputTextToFillText.vue → AppCompInputTextToFillNext.vue} +171 -164
- package/src/components/AppCompJauge.vue +74 -55
- package/src/components/AppCompMenu.vue +413 -209
- package/src/components/AppCompMenuItem.vue +228 -174
- package/src/components/AppCompNavigation.vue +960 -949
- package/src/components/AppCompNoteCall.vue +133 -126
- package/src/components/AppCompNoteCredit.vue +292 -164
- package/src/components/AppCompPlayBar.vue +1218 -1319
- package/src/components/AppCompPlayBarNext.vue +2052 -0
- package/src/components/AppCompPlayBarProgress.vue +82 -0
- package/src/components/AppCompPopUpNext.vue +503 -0
- package/src/components/{AppCompQuiz.vue → AppCompQuizNext.vue} +2904 -2989
- package/src/components/AppCompQuizRecall.vue +276 -250
- package/src/components/AppCompSVGNext.vue +347 -0
- package/src/components/AppCompSettingsMenu.vue +172 -171
- package/src/components/AppCompTableOfContent.vue +387 -264
- package/src/components/AppCompTranscript.vue +24 -19
- package/src/components/AppCompVideoPlayer.vue +368 -336
- package/src/components/AppCompViewDisplay.vue +6 -6
- package/src/components/BaseModule.vue +72 -67
- package/src/composables/useQuiz.js +206 -0
- package/src/externalComps/ModuleView.vue +22 -0
- package/src/externalComps/SummaryView.vue +91 -0
- package/src/main.js +272 -227
- package/src/mixins/$mediaMixins.js +819 -0
- package/src/mixins/timerMixin.js +155 -156
- package/src/module/stores/appStore.js +893 -0
- package/src/module/xapi/ADL.js +376 -339
- package/src/module/xapi/Crypto/Hasher.js +241 -241
- package/src/module/xapi/Crypto/WordArray.js +278 -278
- package/src/module/xapi/Crypto/algorithms/BufferedBlockAlgorithm.js +103 -103
- package/src/module/xapi/Crypto/algorithms/C_algo.js +315 -319
- package/src/module/xapi/Crypto/algorithms/HMAC.js +9 -9
- package/src/module/xapi/Crypto/algorithms/SHA1.js +9 -9
- package/src/module/xapi/Crypto/encoders/Base.js +105 -105
- package/src/module/xapi/Crypto/encoders/Base64.js +99 -99
- package/src/module/xapi/Crypto/encoders/Hex.js +61 -61
- package/src/module/xapi/Crypto/encoders/Latin1.js +61 -61
- package/src/module/xapi/Crypto/encoders/Utf8.js +45 -45
- package/src/module/xapi/Crypto/index.js +53 -53
- package/src/module/xapi/Statement/activity.js +47 -47
- package/src/module/xapi/Statement/agent.js +55 -55
- package/src/module/xapi/Statement/group.js +26 -26
- package/src/module/xapi/Statement/index.js +259 -259
- package/src/module/xapi/Statement/statement.js +253 -253
- package/src/module/xapi/Statement/statementRef.js +23 -23
- package/src/module/xapi/Statement/substatement.js +22 -22
- package/src/module/xapi/Statement/verb.js +36 -36
- package/src/module/xapi/activitytypes.js +17 -17
- package/src/module/xapi/launch.js +157 -157
- package/src/module/xapi/utils.js +167 -167
- package/src/module/xapi/verbs.js +294 -294
- package/src/module/xapi/wrapper.js +1963 -1890
- package/src/module/xapi/xapiStatement.js +444 -444
- package/src/plugins/bus.js +8 -3
- package/src/plugins/gsap.js +14 -17
- package/src/plugins/helper.js +308 -295
- package/src/plugins/i18n.js +44 -31
- package/src/plugins/idb.js +219 -212
- package/src/plugins/save.js +37 -37
- package/src/plugins/scorm.js +287 -287
- package/src/plugins/xapi.js +11 -11
- package/src/public/index.html +33 -21
- package/src/router/index.js +43 -41
- package/src/router/routes.js +312 -337
- package/src/shared/generalfuncs.js +210 -188
- package/src/shared/validators.js +1069 -249
- package/vite.config.js +27 -0
- package/.prettierrc.js +0 -5
- package/babel.config.js +0 -3
- package/src/components/AppBaseDragChoice.vue +0 -91
- package/src/components/AppBaseDropZone.vue +0 -112
- package/src/components/AppCompBif.vue +0 -120
- package/src/components/AppCompDragAndDrop.vue +0 -339
- package/src/components/AppCompInputAssociation.vue +0 -332
- package/src/components/AppCompInputCheckBox.vue +0 -227
- package/src/components/AppCompInputDropdown.vue +0 -184
- package/src/components/AppCompInputRadio.vue +0 -169
- package/src/components/AppCompInputTextTable.vue +0 -155
- package/src/components/AppCompInputTextToFillDropdown.vue +0 -255
- package/src/components/AppCompMediaPlayer.vue +0 -397
- package/src/components/AppCompPopUp.vue +0 -522
- package/src/components/AppCompPopover.vue +0 -27
- package/src/components/AppCompSVG.vue +0 -309
- package/src/mixins/$pageMixins.js +0 -459
- package/src/mixins/$quizMixins.js +0 -456
- package/src/module/store.js +0 -895
- package/src/plugins/timeManager.js +0 -77
- package/src/routes_bckp.js +0 -313
- package/src/routes_static.js +0 -344
- package/vue.config.js +0 -83
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="input-box">
|
|
3
|
-
<div style="display:flex">
|
|
4
|
-
<div
|
|
5
|
-
v-for="singleAssociationZone in inputData.zone_depots"
|
|
6
|
-
:key="singleAssociationZone.id"
|
|
7
|
-
:class="
|
|
8
|
-
`associationlist-${singleAssociationZone.id} ` +
|
|
9
|
-
classInput(singleAssociationZone.id)
|
|
10
|
-
"
|
|
11
|
-
>
|
|
12
|
-
<label
|
|
13
|
-
:for="`${inputDataId}_${singleAssociationZone.id}`"
|
|
14
|
-
v-html="singleAssociationZone.contenu.alt"
|
|
15
|
-
></label>
|
|
16
|
-
<div
|
|
17
|
-
:class="
|
|
18
|
-
quizClickedZone == singleAssociationZone.id
|
|
19
|
-
? 'quizZoneActive'
|
|
20
|
-
: 'quizZone'
|
|
21
|
-
"
|
|
22
|
-
@click="activateChoice(singleAssociationZone.id)"
|
|
23
|
-
>
|
|
24
|
-
<!--zone is img-->
|
|
25
|
-
<div
|
|
26
|
-
v-if="singleAssociationZone.contenu.type == 'img'"
|
|
27
|
-
class="quizZoneIsImg"
|
|
28
|
-
>
|
|
29
|
-
<img
|
|
30
|
-
:src="singleAssociationZone.contenu.affichage"
|
|
31
|
-
:alt="singleAssociationZone.contenu.alt"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
<!--zone is text-->
|
|
35
|
-
<div
|
|
36
|
-
v-if="singleAssociationZone.contenu.type == 'str'"
|
|
37
|
-
class="quizZoneIsText"
|
|
38
|
-
>
|
|
39
|
-
<p v-html="singleAssociationZone.contenu.affichage"></p>
|
|
40
|
-
</div>
|
|
41
|
-
<!--selected item-->
|
|
42
|
-
<!---selected is img--->
|
|
43
|
-
<div
|
|
44
|
-
v-if="
|
|
45
|
-
quizAssociation[singleAssociationZone.id] &&
|
|
46
|
-
quizAssociation[singleAssociationZone.id] !== '' &&
|
|
47
|
-
inputData.choix_deplaceable[
|
|
48
|
-
quizAssociation[singleAssociationZone.id]
|
|
49
|
-
].contenu.type == 'img'
|
|
50
|
-
"
|
|
51
|
-
class="quizZoneWithImg"
|
|
52
|
-
>
|
|
53
|
-
<img
|
|
54
|
-
:src="
|
|
55
|
-
inputData.choix_deplaceable[
|
|
56
|
-
quizAssociation[singleAssociationZone.id]
|
|
57
|
-
].contenu.affichage
|
|
58
|
-
"
|
|
59
|
-
:alt="
|
|
60
|
-
inputData.choix_deplaceable[
|
|
61
|
-
quizAssociation[singleAssociationZone.id]
|
|
62
|
-
].contenu.alt
|
|
63
|
-
"
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
<!---selected is text--->
|
|
67
|
-
<div
|
|
68
|
-
v-if="
|
|
69
|
-
quizAssociation[singleAssociationZone.id] &&
|
|
70
|
-
quizAssociation[singleAssociationZone.id] !== '' &&
|
|
71
|
-
inputData.choix_deplaceable[
|
|
72
|
-
quizAssociation[singleAssociationZone.id]
|
|
73
|
-
].contenu.type == 'str'
|
|
74
|
-
"
|
|
75
|
-
class="quizZoneWithText"
|
|
76
|
-
>
|
|
77
|
-
<p
|
|
78
|
-
v-html="
|
|
79
|
-
inputData.choix_deplaceable[
|
|
80
|
-
quizAssociation[singleAssociationZone.id]
|
|
81
|
-
].contenu.affichage
|
|
82
|
-
"
|
|
83
|
-
></p>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
<!--choices-->
|
|
89
|
-
<div
|
|
90
|
-
style="display:flex"
|
|
91
|
-
:class="quizClickedZone ? 'parentQuizChoicesActive' : 'parentQuizChoices'"
|
|
92
|
-
>
|
|
93
|
-
<div
|
|
94
|
-
v-for="singleAssociationChoice in inputData.choix_deplaceable"
|
|
95
|
-
:key="singleAssociationChoice.id"
|
|
96
|
-
:class="`associationlist-${singleAssociationChoice.id}`"
|
|
97
|
-
>
|
|
98
|
-
<label
|
|
99
|
-
:for="`${inputDataId}_${singleAssociationChoice.id}`"
|
|
100
|
-
v-html="singleAssociationChoice.contenu.alt"
|
|
101
|
-
></label>
|
|
102
|
-
<div
|
|
103
|
-
class="quizAssociationChoice"
|
|
104
|
-
@click="assignValueToZone(singleAssociationChoice.id)"
|
|
105
|
-
>
|
|
106
|
-
<!---is img--->
|
|
107
|
-
<div
|
|
108
|
-
v-if="singleAssociationChoice.contenu.type == 'img'"
|
|
109
|
-
class="quizChoiceWithImg"
|
|
110
|
-
>
|
|
111
|
-
<img
|
|
112
|
-
:src="singleAssociationChoice.contenu.affichage"
|
|
113
|
-
:alt="singleAssociationChoice.contenu.alt"
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
<!---is text--->
|
|
117
|
-
<div
|
|
118
|
-
v-if="singleAssociationChoice.contenu.type == 'str'"
|
|
119
|
-
class="quizChoiceWithText"
|
|
120
|
-
>
|
|
121
|
-
<p v-html="singleAssociationChoice.contenu.affichage"></p>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
</template>
|
|
128
|
-
<script>
|
|
129
|
-
import $extendsQuiz from '../mixins/$quizMixins'
|
|
130
|
-
export default {
|
|
131
|
-
mixins: [$extendsQuiz],
|
|
132
|
-
|
|
133
|
-
props: {
|
|
134
|
-
inputType: {
|
|
135
|
-
type: String,
|
|
136
|
-
default: ''
|
|
137
|
-
},
|
|
138
|
-
inputDataId: {
|
|
139
|
-
type: String,
|
|
140
|
-
default: ''
|
|
141
|
-
},
|
|
142
|
-
inputData: {
|
|
143
|
-
type: Object,
|
|
144
|
-
default: () => {}
|
|
145
|
-
},
|
|
146
|
-
quizCompleted: {
|
|
147
|
-
type: Boolean,
|
|
148
|
-
default: false
|
|
149
|
-
},
|
|
150
|
-
solution: {
|
|
151
|
-
type: Object,
|
|
152
|
-
default: () => []
|
|
153
|
-
},
|
|
154
|
-
showSolution: {
|
|
155
|
-
type: Boolean,
|
|
156
|
-
default: false
|
|
157
|
-
},
|
|
158
|
-
shuffleAnswers: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
default: false
|
|
161
|
-
},
|
|
162
|
-
quizAssociation: {
|
|
163
|
-
type: Object,
|
|
164
|
-
default: () => {}
|
|
165
|
-
}, //use to pass the value of the input
|
|
166
|
-
quizSubmit: {
|
|
167
|
-
type: Boolean,
|
|
168
|
-
default: false
|
|
169
|
-
} //use to call a submit
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
data() {
|
|
173
|
-
return {
|
|
174
|
-
quizClickedZone: '', //for the id of the last clicked zone to assign the choice
|
|
175
|
-
quizAssociationValue: [] //not using quizAssociation because quizAssociation is a prop
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
computed: {
|
|
180
|
-
/**
|
|
181
|
-
* @description
|
|
182
|
-
*
|
|
183
|
-
quizZoneContent(zoneId) {
|
|
184
|
-
//check if zone is filled
|
|
185
|
-
if (zoneId == false) {
|
|
186
|
-
// check if zone has image
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
return zoneId
|
|
190
|
-
}*/
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
watch: {
|
|
194
|
-
/**
|
|
195
|
-
* @description to pass value to AppCompQuiz
|
|
196
|
-
* @fires input-change to AppCompQuiz.vue
|
|
197
|
-
*/
|
|
198
|
-
quizAssociationValue(newValue) {
|
|
199
|
-
this.$emit('input-change', newValue)
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* @description to pass the value from AppCompQuiz
|
|
204
|
-
*/
|
|
205
|
-
quizAssociation(newValue) {
|
|
206
|
-
this.quizAssociationValue = newValue
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
mounted() {
|
|
211
|
-
let associatedChoices = []
|
|
212
|
-
for (let i = 0; i < this.inputData.length; i++) {
|
|
213
|
-
let singleAssociation
|
|
214
|
-
if (this.shuffleAnswers) {
|
|
215
|
-
singleAssociation = this.inputData[i]
|
|
216
|
-
//@todo shuffle
|
|
217
|
-
singleAssociation.option = this.shuffleArray(singleAssociation.option)
|
|
218
|
-
} else {
|
|
219
|
-
singleAssociation = this.inputData[i]
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (this.quizAssociation.length == 0) {
|
|
223
|
-
this.quizAssociationValue = associatedChoices
|
|
224
|
-
} else {
|
|
225
|
-
this.quizAssociationValue = this.quizAssociation
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
methods: {
|
|
230
|
-
/**
|
|
231
|
-
* @description check if a values exists in a array
|
|
232
|
-
* @param {Array} array
|
|
233
|
-
* @param value
|
|
234
|
-
* @returns {Boolean}
|
|
235
|
-
*/
|
|
236
|
-
containsValue(array, value) {
|
|
237
|
-
return array.includes(value)
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* @description shuffles an array used to randomized the option order if shuffleAnswers is true
|
|
242
|
-
* @param {Array} array
|
|
243
|
-
* @returns {Array}
|
|
244
|
-
* @todo redo shuffle
|
|
245
|
-
*/
|
|
246
|
-
shuffleArray(array) {
|
|
247
|
-
let newArray = []
|
|
248
|
-
let newArray2 = []
|
|
249
|
-
|
|
250
|
-
for (let i = 0; i < array.length; i++) {
|
|
251
|
-
const element = array[i]
|
|
252
|
-
//todo remove null values
|
|
253
|
-
newArray.push(element)
|
|
254
|
-
}
|
|
255
|
-
while (newArray.length > 0) {
|
|
256
|
-
let pos = Math.floor(newArray.length * Math.random())
|
|
257
|
-
newArray2.push(newArray[pos])
|
|
258
|
-
newArray.splice(pos, 1)
|
|
259
|
-
}
|
|
260
|
-
return newArray2
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* @description activates choices to assign to that zone
|
|
265
|
-
* @param {String} zoneId
|
|
266
|
-
*/
|
|
267
|
-
activateChoice(zoneId) {
|
|
268
|
-
if (this.quizClickedZone == zoneId) {
|
|
269
|
-
this.quizClickedZone = ''
|
|
270
|
-
} else {
|
|
271
|
-
this.quizClickedZone = zoneId
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* @description remove current uses of value and assign value to quiz
|
|
277
|
-
* @param {String} choiceId
|
|
278
|
-
*/
|
|
279
|
-
assignValueToZone(choiceId) {
|
|
280
|
-
if (this.quizClickedZone !== '' && choiceId !== '') {
|
|
281
|
-
//remove current uses of value
|
|
282
|
-
for (const singleKey in this.quizAssociationValue) {
|
|
283
|
-
if (
|
|
284
|
-
Object.hasOwnProperty.call(this.quizAssociationValue, singleKey)
|
|
285
|
-
) {
|
|
286
|
-
const element = this.quizAssociationValue[singleKey]
|
|
287
|
-
if (element == choiceId) {
|
|
288
|
-
this.$set(this.quizAssociationValue, singleKey, '')
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/*
|
|
293
|
-
let listKeys = Object.keys(this.quizAssociationValue)
|
|
294
|
-
for (let index = 0; index < listKeys.length; index++) {
|
|
295
|
-
if (this.quizAssociationValue[listKeys[index]] == choiceId) {
|
|
296
|
-
this.$set(this.quizAssociationValue, listKeys[index], '')
|
|
297
|
-
}
|
|
298
|
-
}*/
|
|
299
|
-
//assing value
|
|
300
|
-
this.$set(this.quizAssociationValue, this.quizClickedZone, choiceId)
|
|
301
|
-
//deactivate choices
|
|
302
|
-
this.quizClickedZone = ''
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
</script>
|
|
308
|
-
<style scoped>
|
|
309
|
-
.quizZone,
|
|
310
|
-
.quizZoneActive {
|
|
311
|
-
height: 300px;
|
|
312
|
-
width: 300px;
|
|
313
|
-
border: solid 1px;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.quizZone {
|
|
317
|
-
border-color: black;
|
|
318
|
-
}
|
|
319
|
-
.quizZoneActive {
|
|
320
|
-
border-color: red;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.parentQuizChoicesActive {
|
|
324
|
-
background: yellow;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.quizAssociationChoice {
|
|
328
|
-
height: 300px;
|
|
329
|
-
width: 300px;
|
|
330
|
-
border: solid black 1px;
|
|
331
|
-
}
|
|
332
|
-
</style>
|
|
@@ -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>
|