fcad-core-dragon 2.0.0-beta.2 → 2.0.0-beta.4
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/.eslintrc.cjs +1 -1
- package/CHANGELOG +9 -0
- package/package.json +26 -12
- package/src/$locales/en.json +37 -87
- package/src/$locales/fr.json +17 -106
- package/src/assets/data/onboardingMessages.json +1 -1
- package/src/components/AppBase.vue +241 -143
- package/src/components/AppBaseButton.vue +2 -6
- package/src/components/AppBaseErrorDisplay.vue +193 -183
- package/src/components/AppBaseFlipCard.vue +1 -0
- package/src/components/AppBaseModule.vue +195 -225
- package/src/components/AppBasePage.vue +519 -64
- package/src/components/AppBasePopover.vue +41 -0
- package/src/components/AppCompAudio.vue +32 -64
- package/src/components/AppCompBranchButtons.vue +52 -71
- package/src/components/AppCompButtonProgress.vue +12 -18
- package/src/components/AppCompCarousel.vue +102 -0
- package/src/components/{AppCompInputCheckBox.vue → AppCompInputCheckBoxNext.vue} +56 -94
- package/src/components/AppCompInputDropdownNext.vue +159 -0
- package/src/components/{AppCompInputRadio.vue → AppCompInputRadioNext.vue} +53 -63
- package/src/components/AppCompInputTextNext.vue +106 -0
- package/src/components/AppCompInputTextTableNext.vue +141 -0
- package/src/components/AppCompInputTextToFillDropdownNext.vue +230 -0
- package/src/components/{AppCompInputTextToFillText.vue → AppCompInputTextToFillNext.vue} +71 -64
- package/src/components/AppCompJauge.vue +16 -9
- package/src/components/AppCompMenu.vue +50 -29
- package/src/components/AppCompMenuItem.vue +52 -15
- package/src/components/AppCompNavigation.vue +225 -211
- package/src/components/AppCompNoteCall.vue +22 -30
- package/src/components/AppCompNoteCredit.vue +45 -20
- package/src/components/AppCompPlayBar.vue +55 -108
- package/src/components/AppCompPlayBarNext.vue +2052 -0
- package/src/components/AppCompPlayBarProgress.vue +10 -1
- package/src/components/AppCompPopUpNext.vue +503 -0
- package/src/components/{AppCompQuiz.vue → AppCompQuizNext.vue} +632 -703
- package/src/components/AppCompQuizRecall.vue +74 -75
- package/src/components/{AppCompSVG.vue → AppCompSVGNext.vue} +111 -99
- package/src/components/AppCompSettingsMenu.vue +11 -8
- package/src/components/AppCompTableOfContent.vue +78 -76
- package/src/components/AppCompTranscript.vue +5 -0
- package/src/components/AppCompVideoPlayer.vue +30 -42
- package/src/components/BaseModule.vue +1 -0
- 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 +99 -90
- package/src/mixins/$mediaMixins.js +13 -21
- package/src/mixins/timerMixin.js +1 -1
- package/src/module/stores/appStore.js +901 -0
- package/src/module/xapi/ADL.js +8 -4
- package/src/plugins/bus.js +7 -2
- package/src/plugins/gsap.js +4 -7
- package/src/plugins/helper.js +33 -13
- package/src/plugins/i18n.js +2 -2
- package/src/plugins/idb.js +44 -29
- package/src/plugins/save.js +1 -1
- package/src/plugins/scorm.js +2 -2
- package/src/plugins/xapi.js +2 -2
- package/src/public/index.html +22 -10
- package/src/router/index.js +13 -10
- package/src/router/routes.js +20 -25
- package/src/shared/generalfuncs.js +33 -18
- package/src/shared/validators.js +116 -6
- package/src/components/AppCompInputDropdown.vue +0 -182
- package/src/components/AppCompInputTextBox.vue +0 -91
- package/src/components/AppCompInputTextTable.vue +0 -158
- package/src/components/AppCompInputTextToFillDropdown.vue +0 -257
- package/src/components/AppCompPopUp.vue +0 -583
- package/src/components/AppCompPopover.vue +0 -27
- package/src/mixins/$pageMixins.js +0 -415
- package/src/mixins/$quizMixins.js +0 -442
- package/src/module/store.js +0 -1014
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
<!-- About this Component--
|
|
2
|
+
* Renders a checkboxe input type for the Quiz component
|
|
3
|
+
* Related Quiz to question: REPONSE_MULTIPLE
|
|
4
|
+
* Receives the a data object defined by user
|
|
5
|
+
* Used by AppCompQuizNext
|
|
6
|
+
-->
|
|
1
7
|
<template>
|
|
2
8
|
<div class="input-box">
|
|
3
9
|
<fieldset>
|
|
@@ -8,11 +14,11 @@
|
|
|
8
14
|
v-html="$t('quizState.answers')"
|
|
9
15
|
/>
|
|
10
16
|
|
|
11
|
-
<template
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
>
|
|
17
|
+
<template
|
|
18
|
+
v-for="choixReponse in inputDataValue"
|
|
19
|
+
:Key="`div_chx_${inputDataId}_${choixReponse.id}`"
|
|
20
|
+
>
|
|
21
|
+
<div class="box-checkbox" role="group">
|
|
16
22
|
<label
|
|
17
23
|
:key="`lbl_chx_${inputDataId}-${choixReponse.id}`"
|
|
18
24
|
:for="`chx_${inputDataId}_${choixReponse.id}`"
|
|
@@ -26,7 +32,7 @@
|
|
|
26
32
|
type="checkbox"
|
|
27
33
|
:value="choixReponse.id"
|
|
28
34
|
:name="`btn-checkbox-${inputDataId}`"
|
|
29
|
-
:disabled="
|
|
35
|
+
:disabled="quizLimitActive"
|
|
30
36
|
class="checkbox-input"
|
|
31
37
|
:aria-labelledby="`span_${inputDataId}_${choixReponse.id}`"
|
|
32
38
|
/>
|
|
@@ -50,15 +56,17 @@
|
|
|
50
56
|
</div>
|
|
51
57
|
</template>
|
|
52
58
|
<script>
|
|
53
|
-
import
|
|
59
|
+
import { useQuiz } from '../composables/useQuiz'
|
|
60
|
+
import { toRefs } from 'vue'
|
|
54
61
|
export default {
|
|
55
|
-
name: '
|
|
56
|
-
|
|
62
|
+
name: 'AppCompInputCheckBoxNext',
|
|
63
|
+
|
|
57
64
|
props: {
|
|
58
|
-
|
|
65
|
+
quizType: {
|
|
59
66
|
type: String,
|
|
60
67
|
default: ''
|
|
61
68
|
},
|
|
69
|
+
|
|
62
70
|
inputDataId: {
|
|
63
71
|
type: String,
|
|
64
72
|
default: ''
|
|
@@ -67,9 +75,9 @@ export default {
|
|
|
67
75
|
type: Array,
|
|
68
76
|
default: () => []
|
|
69
77
|
},
|
|
70
|
-
|
|
71
|
-
type:
|
|
72
|
-
default:
|
|
78
|
+
quizInputType: {
|
|
79
|
+
type: Array,
|
|
80
|
+
default: () => []
|
|
73
81
|
},
|
|
74
82
|
solution: {
|
|
75
83
|
type: Array,
|
|
@@ -83,118 +91,72 @@ export default {
|
|
|
83
91
|
type: Boolean,
|
|
84
92
|
default: false
|
|
85
93
|
},
|
|
86
|
-
|
|
87
|
-
type:
|
|
88
|
-
default:
|
|
89
|
-
}, //use to
|
|
94
|
+
quizLimitActive: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
}, //use to set if quiz should be active or not
|
|
98
|
+
|
|
90
99
|
quizSubmit: {
|
|
91
100
|
type: Boolean,
|
|
92
101
|
default: false
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
} //use to call a submit
|
|
103
|
+
},
|
|
104
|
+
emits: ['input-change'],
|
|
105
|
+
setup(props) {
|
|
106
|
+
const { containsValue, shuffleArray, classInput, messageAccessibility } =
|
|
107
|
+
useQuiz(toRefs(props))
|
|
108
|
+
|
|
109
|
+
return { containsValue, shuffleArray, classInput, messageAccessibility }
|
|
98
110
|
},
|
|
99
111
|
|
|
100
112
|
data() {
|
|
101
113
|
return {
|
|
102
114
|
inputDataValue: [],
|
|
103
|
-
quizInputMultipleValue: [] //not using quizInputMultiple because quizInputMultiple is a prop
|
|
115
|
+
quizInputMultipleValue: [], //not using quizInputMultiple because quizInputMultiple is a prop
|
|
116
|
+
quizSolution: null
|
|
104
117
|
}
|
|
105
118
|
},
|
|
106
119
|
|
|
107
|
-
computed: {},
|
|
108
|
-
|
|
109
120
|
watch: {
|
|
110
121
|
/**
|
|
111
122
|
* @description to pass value to AppCompQuiz
|
|
112
123
|
* @fires input-change to AppCompQuiz.vue
|
|
113
124
|
*/
|
|
114
|
-
quizInputMultipleValue
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
* @description to pass the value from AppCompQuiz
|
|
120
|
-
*/
|
|
121
|
-
quizInputMultiple(newValue) {
|
|
122
|
-
this.quizInputMultipleValue = newValue
|
|
125
|
+
quizInputMultipleValue: {
|
|
126
|
+
deep: true,
|
|
127
|
+
handler(newValue) {
|
|
128
|
+
this.$emit('input-change', newValue)
|
|
129
|
+
}
|
|
123
130
|
}
|
|
124
131
|
},
|
|
125
132
|
|
|
126
133
|
mounted() {
|
|
127
|
-
|
|
128
|
-
this.solution.sort(function (a, b) {
|
|
129
|
-
return a - b
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
this.quizInputMultipleValue = this.quizInputMultiple
|
|
133
|
-
|
|
134
|
-
if (this.shuffleAnswers) {
|
|
135
|
-
this.inputDataValue = this.shuffleArray(this.inputData)
|
|
136
|
-
} else {
|
|
137
|
-
this.inputDataValue = this.inputData
|
|
138
|
-
}
|
|
134
|
+
this.initQuiz()
|
|
139
135
|
},
|
|
140
136
|
|
|
141
137
|
methods: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
isEqual(array1, array2) {
|
|
149
|
-
// if length is not equal
|
|
150
|
-
if (array1.length != array2.length) {
|
|
151
|
-
return false
|
|
152
|
-
} else {
|
|
153
|
-
// comapring each element of array
|
|
154
|
-
for (let i = 0; i < array1.length; i++) {
|
|
155
|
-
if (array1[i] != array2[i]) {
|
|
156
|
-
return false
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return true
|
|
138
|
+
initQuiz() {
|
|
139
|
+
this.quizSolution = this.solution
|
|
140
|
+
if (this.quizSolution !== null) {
|
|
141
|
+
this.quizSolution.sort(function (a, b) {
|
|
142
|
+
return a - b
|
|
143
|
+
})
|
|
160
144
|
}
|
|
161
|
-
|
|
145
|
+
this.quizInputMultipleValue = this.quizInputType
|
|
162
146
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
* @param {Array} array
|
|
166
|
-
* @param value
|
|
167
|
-
* @returns {Boolean}
|
|
168
|
-
*/
|
|
169
|
-
containsValue(array, value) {
|
|
170
|
-
return array.includes(value)
|
|
171
|
-
},
|
|
147
|
+
if (this.shuffleAnswers)
|
|
148
|
+
return (this.inputDataValue = this.shuffleArray(this.inputData))
|
|
172
149
|
|
|
173
|
-
|
|
174
|
-
* @description shuffles an array used to randomized the option order if shuffleAnswers is true
|
|
175
|
-
* @param {Array} array
|
|
176
|
-
* @returns {Array}
|
|
177
|
-
*/
|
|
178
|
-
shuffleArray(array) {
|
|
179
|
-
let newArray = []
|
|
180
|
-
let newArray2 = []
|
|
181
|
-
|
|
182
|
-
for (let i = 0; i < array.length; i++) {
|
|
183
|
-
const element = array[i]
|
|
184
|
-
//todo remove null values
|
|
185
|
-
newArray.push(element)
|
|
186
|
-
}
|
|
187
|
-
while (newArray.length > 0) {
|
|
188
|
-
let pos = Math.floor(newArray.length * Math.random())
|
|
189
|
-
newArray2.push(newArray[pos])
|
|
190
|
-
newArray.splice(pos, 1)
|
|
191
|
-
}
|
|
192
|
-
return newArray2
|
|
150
|
+
this.inputDataValue = this.inputData
|
|
193
151
|
}
|
|
194
152
|
}
|
|
195
153
|
}
|
|
196
154
|
</script>
|
|
197
155
|
<style lang="scss">
|
|
156
|
+
fieldset {
|
|
157
|
+
border: inherit;
|
|
158
|
+
}
|
|
159
|
+
|
|
198
160
|
.custom-control-input:focus ~ .custom-control-label::before {
|
|
199
161
|
border: inherit;
|
|
200
162
|
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<!-- About this Component--
|
|
2
|
+
* Renders a SELECT input to display choices of response for the Quiz component
|
|
3
|
+
* Related Quiz to question: DROPDOWN
|
|
4
|
+
* Receives the a data object defined by user
|
|
5
|
+
* Used by AppCompQuizNext
|
|
6
|
+
* Uses useQuiz composable
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<div class="input-box">
|
|
10
|
+
<div
|
|
11
|
+
v-for="singleDropdown in inputData"
|
|
12
|
+
:key="singleDropdown.id"
|
|
13
|
+
class="dropdown-container"
|
|
14
|
+
:class="`dropdownlist-${singleDropdown.id} ${classInput(singleDropdown.id, quizInputTypeValue)}`"
|
|
15
|
+
>
|
|
16
|
+
<label
|
|
17
|
+
:for="`${inputDataId}_${singleDropdown.id}`"
|
|
18
|
+
v-html="singleDropdown.ennonce"
|
|
19
|
+
></label>
|
|
20
|
+
|
|
21
|
+
<v-select
|
|
22
|
+
:id="inputDataId + '_' + singleDropdown.id"
|
|
23
|
+
v-model="quizInputTypeValue[singleDropdown.id]"
|
|
24
|
+
item-title="text"
|
|
25
|
+
:items="singleDropdown.option"
|
|
26
|
+
:disabled="quizLimitActive"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<script>
|
|
32
|
+
import { useQuiz } from '../composables/useQuiz'
|
|
33
|
+
import { toRefs } from 'vue'
|
|
34
|
+
export default {
|
|
35
|
+
name: 'AppCompInputDropdown',
|
|
36
|
+
|
|
37
|
+
props: {
|
|
38
|
+
quizType: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
inputDataId: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ''
|
|
45
|
+
},
|
|
46
|
+
inputData: {
|
|
47
|
+
type: Array,
|
|
48
|
+
default: () => []
|
|
49
|
+
},
|
|
50
|
+
quizInputType: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => []
|
|
53
|
+
},
|
|
54
|
+
solution: {
|
|
55
|
+
type: Array,
|
|
56
|
+
default: () => []
|
|
57
|
+
},
|
|
58
|
+
showSolution: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
quizLimitActive: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
shuffleAnswers: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
quizSubmit: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
} //use to call a submit
|
|
75
|
+
},
|
|
76
|
+
emits: ['input-change'],
|
|
77
|
+
setup(props) {
|
|
78
|
+
const { containsValue, shuffleArray, classInput, messageAccessibility } =
|
|
79
|
+
useQuiz(toRefs(props))
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
containsValue,
|
|
83
|
+
shuffleArray,
|
|
84
|
+
classInput,
|
|
85
|
+
messageAccessibility
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
data() {
|
|
90
|
+
return {
|
|
91
|
+
quizInputTypeValue: [], //not using quizInputType because quizInputType is a prop
|
|
92
|
+
quizSolution: null
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
computed: {},
|
|
97
|
+
|
|
98
|
+
watch: {
|
|
99
|
+
/**
|
|
100
|
+
* @description to pass value to AppCompQuiz
|
|
101
|
+
* @emits input-change
|
|
102
|
+
*/
|
|
103
|
+
quizInputTypeValue: {
|
|
104
|
+
deep: true,
|
|
105
|
+
handler(newValue) {
|
|
106
|
+
this.$emit('input-change', newValue)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
mounted() {
|
|
112
|
+
this.initQuiz()
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
methods: {
|
|
116
|
+
initQuiz() {
|
|
117
|
+
this.quizSolution = this.solution
|
|
118
|
+
if (this.quizSolution !== null) {
|
|
119
|
+
this.quizSolution.sort(function (a, b) {
|
|
120
|
+
return a - b
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
//to show the defaultAnswer
|
|
124
|
+
const defaultAnswer = {
|
|
125
|
+
value: null,
|
|
126
|
+
disabled: true,
|
|
127
|
+
text: this.$t('message.first_option_dropdown')
|
|
128
|
+
}
|
|
129
|
+
let selectedChoices = []
|
|
130
|
+
for (let i = 0; i < this.inputData.length; i++) {
|
|
131
|
+
let singleDropdown
|
|
132
|
+
if (this.shuffleAnswers) {
|
|
133
|
+
singleDropdown = this.inputData[i]
|
|
134
|
+
singleDropdown.option = this.shuffleArray(singleDropdown.option)
|
|
135
|
+
} else {
|
|
136
|
+
singleDropdown = this.inputData[i]
|
|
137
|
+
}
|
|
138
|
+
if (
|
|
139
|
+
this.inputData[i].option[0].text !==
|
|
140
|
+
this.$t('message.first_option_dropdown')
|
|
141
|
+
) {
|
|
142
|
+
singleDropdown.option.unshift(defaultAnswer)
|
|
143
|
+
}
|
|
144
|
+
selectedChoices.push(null)
|
|
145
|
+
}
|
|
146
|
+
if (this.quizInputType.length == 0) {
|
|
147
|
+
this.quizInputTypeValue = selectedChoices
|
|
148
|
+
} else {
|
|
149
|
+
this.quizInputTypeValue = this.quizInputType
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
155
|
+
<style lang="scss">
|
|
156
|
+
.dropdown-container {
|
|
157
|
+
position: relative;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
<!-- About this Component--
|
|
2
|
+
* Renders a RADIO BUTTON input to display choices of response for the Quiz component
|
|
3
|
+
* Related Quiz to question: REPONSE_UNIQUE
|
|
4
|
+
* Receives the a data object defined by user
|
|
5
|
+
* Used by AppCompQuizNext
|
|
6
|
+
* Uses useQuiz composable
|
|
7
|
+
-->
|
|
8
|
+
|
|
1
9
|
<template>
|
|
2
10
|
<div class="input-box">
|
|
3
11
|
<fieldset>
|
|
@@ -8,11 +16,11 @@
|
|
|
8
16
|
v-html="$t('quizState.answers')"
|
|
9
17
|
/>
|
|
10
18
|
|
|
11
|
-
<template
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
>
|
|
19
|
+
<template
|
|
20
|
+
v-for="choixReponse in quizInputDataValue"
|
|
21
|
+
:Key="`div_chx_${inputDataId}-${choixReponse.id}`"
|
|
22
|
+
>
|
|
23
|
+
<div class="box-radio" role="group">
|
|
16
24
|
<label
|
|
17
25
|
:key="`lbl_chx_${inputDataId}_${choixReponse.id}`"
|
|
18
26
|
:for="`chx_${inputDataId}_${choixReponse.id}`"
|
|
@@ -22,11 +30,11 @@
|
|
|
22
30
|
<input
|
|
23
31
|
:id="`chx_${inputDataId}_${choixReponse.id}`"
|
|
24
32
|
:key="`chx_${inputDataId}_${choixReponse.id}`"
|
|
25
|
-
v-model="
|
|
33
|
+
v-model="inputUniqueValue"
|
|
34
|
+
:disabled="quizLimitActive"
|
|
26
35
|
type="radio"
|
|
27
36
|
:value="choixReponse.id"
|
|
28
37
|
:name="`btn-radios-${inputDataId}`"
|
|
29
|
-
:disabled="quizCompleted"
|
|
30
38
|
class="radio-input"
|
|
31
39
|
:aria-labelledby="`span_${inputDataId}_${choixReponse.id}`"
|
|
32
40
|
/>
|
|
@@ -51,13 +59,13 @@
|
|
|
51
59
|
</div>
|
|
52
60
|
</template>
|
|
53
61
|
<script>
|
|
54
|
-
import
|
|
62
|
+
import { useQuiz } from '../composables/useQuiz'
|
|
63
|
+
import { toRefs } from 'vue'
|
|
55
64
|
export default {
|
|
56
|
-
name: '
|
|
57
|
-
mixins: [$extendsQuiz],
|
|
65
|
+
name: 'AppCompInputRadioNext',
|
|
58
66
|
|
|
59
67
|
props: {
|
|
60
|
-
|
|
68
|
+
quizType: {
|
|
61
69
|
type: String,
|
|
62
70
|
default: ''
|
|
63
71
|
},
|
|
@@ -70,9 +78,9 @@ export default {
|
|
|
70
78
|
type: Array,
|
|
71
79
|
default: () => []
|
|
72
80
|
},
|
|
73
|
-
|
|
74
|
-
type:
|
|
75
|
-
default:
|
|
81
|
+
quizInputType: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: ''
|
|
76
84
|
},
|
|
77
85
|
solution: {
|
|
78
86
|
type: String,
|
|
@@ -86,76 +94,58 @@ export default {
|
|
|
86
94
|
type: Boolean,
|
|
87
95
|
default: false
|
|
88
96
|
},
|
|
89
|
-
|
|
90
|
-
type:
|
|
91
|
-
default:
|
|
92
|
-
}, //use to
|
|
97
|
+
quizLimitActive: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false
|
|
100
|
+
}, //use to set if quiz should be active or not
|
|
101
|
+
|
|
93
102
|
quizSubmit: {
|
|
94
103
|
type: Boolean,
|
|
95
104
|
default: false
|
|
96
|
-
}
|
|
97
|
-
aBy: {
|
|
98
|
-
type: String,
|
|
99
|
-
default: ''
|
|
100
|
-
} // use to pass id of the related question for the choices
|
|
105
|
+
} //use to call a submit
|
|
101
106
|
},
|
|
107
|
+
emits: ['input-change'],
|
|
108
|
+
setup(props) {
|
|
109
|
+
const { shuffleArray, classInput, messageAccessibility } = useQuiz(
|
|
110
|
+
toRefs(props)
|
|
111
|
+
)
|
|
102
112
|
|
|
113
|
+
return { shuffleArray, classInput, messageAccessibility }
|
|
114
|
+
},
|
|
103
115
|
data() {
|
|
104
116
|
return {
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
quizInputDataValue: [],
|
|
118
|
+
inputUniqueValue: null //not using quizInputUnique because quizInputUnique is a prop
|
|
107
119
|
}
|
|
108
120
|
},
|
|
109
121
|
|
|
110
122
|
computed: {},
|
|
111
123
|
|
|
112
124
|
watch: {
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* @description to pass the value from AppCompQuiz
|
|
123
|
-
*/
|
|
124
|
-
quizInputUnique(newValue) {
|
|
125
|
-
this.quizInputUniqueValue = newValue
|
|
125
|
+
// /**
|
|
126
|
+
// * @description to pass value to AppCompQuiz
|
|
127
|
+
// * @fires input-change to AppCompQuiz.vue
|
|
128
|
+
// */
|
|
129
|
+
inputUniqueValue: {
|
|
130
|
+
deep: true,
|
|
131
|
+
handler(newValue) {
|
|
132
|
+
this.$emit('input-change', newValue)
|
|
133
|
+
}
|
|
126
134
|
}
|
|
127
135
|
},
|
|
128
136
|
|
|
129
137
|
mounted() {
|
|
130
|
-
this.
|
|
131
|
-
if (this.shuffleAnswers) {
|
|
132
|
-
this.inputDataValue = this.shuffleArray(this.inputData)
|
|
133
|
-
} else {
|
|
134
|
-
this.inputDataValue = this.inputData
|
|
135
|
-
}
|
|
138
|
+
this.initQuiz()
|
|
136
139
|
},
|
|
137
140
|
|
|
138
141
|
methods: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
let newArray = []
|
|
146
|
-
let newArray2 = []
|
|
147
|
-
|
|
148
|
-
for (let i = 0; i < array.length; i++) {
|
|
149
|
-
const element = array[i]
|
|
150
|
-
//todo remove null values
|
|
151
|
-
newArray.push(element)
|
|
152
|
-
}
|
|
153
|
-
while (newArray.length > 0) {
|
|
154
|
-
let pos = Math.floor(newArray.length * Math.random())
|
|
155
|
-
newArray2.push(newArray[pos])
|
|
156
|
-
newArray.splice(pos, 1)
|
|
142
|
+
initQuiz() {
|
|
143
|
+
this.inputUniqueValue = this.quizInputType
|
|
144
|
+
if (this.shuffleAnswers) {
|
|
145
|
+
this.quizInputDataValue = this.shuffleArray(this.inputData)
|
|
146
|
+
} else {
|
|
147
|
+
this.quizInputDataValue = this.inputData
|
|
157
148
|
}
|
|
158
|
-
return newArray2
|
|
159
149
|
}
|
|
160
150
|
}
|
|
161
151
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<!-- About this Component--
|
|
2
|
+
* Renders a TEXTAREA input to collect input for the Quiz component
|
|
3
|
+
* Related Quiz to question: REPONSE_OUVERTE
|
|
4
|
+
Receives the a data object defined by user
|
|
5
|
+
* Used by AppCompQuizNext
|
|
6
|
+
* Uses useQuiz composable
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<div class="input-box box-reponse-ouverte">
|
|
10
|
+
<v-textarea
|
|
11
|
+
:id="`textArea_${inputDataId}`"
|
|
12
|
+
v-model="quizInputTypeValue"
|
|
13
|
+
:aria-labelledby="`textArea_${inputDataId}`"
|
|
14
|
+
:class="classInput()"
|
|
15
|
+
:placeholder="$t('text.place_holder.for_textarea')"
|
|
16
|
+
focused
|
|
17
|
+
rows="3"
|
|
18
|
+
no-resize
|
|
19
|
+
:aria-describedby="`${inputDataId}-msg-erreur`"
|
|
20
|
+
clearable
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<span :id="`${inputDataId}-msg-erreur`" class="sr-only">
|
|
24
|
+
{{ messageAccessibility() }}
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
import { useQuiz } from '../composables/useQuiz'
|
|
30
|
+
import { toRefs } from 'vue'
|
|
31
|
+
export default {
|
|
32
|
+
name: 'AppCompInputTextNext',
|
|
33
|
+
props: {
|
|
34
|
+
quizType: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
38
|
+
inputDataId: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
inputData: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: () => []
|
|
46
|
+
}, //not used just here to be the same
|
|
47
|
+
|
|
48
|
+
quizInputType: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: ''
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
solution: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ''
|
|
56
|
+
},
|
|
57
|
+
showSolution: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
quizLimitActive: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
}, //use to set if quiz should be active or not
|
|
65
|
+
|
|
66
|
+
quizSubmit: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
} //use to call a submit
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
emits: ['input-change'],
|
|
73
|
+
|
|
74
|
+
setup(props) {
|
|
75
|
+
const { classInput, messageAccessibility } = useQuiz(toRefs(props))
|
|
76
|
+
|
|
77
|
+
return { classInput, messageAccessibility }
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
quizInputTypeValue: '' //not using quizInputType because quizInputType is a prop
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
watch: {
|
|
86
|
+
/**
|
|
87
|
+
* @description to pass value to AppCompQuiz
|
|
88
|
+
* @fires input-change to AppCompQuiz.vue
|
|
89
|
+
*/
|
|
90
|
+
quizInputTypeValue: {
|
|
91
|
+
deep: true,
|
|
92
|
+
handler(newValue) {
|
|
93
|
+
this.$emit('input-change', newValue)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
mounted() {
|
|
99
|
+
this.quizInputTypeValue = this.quizInputType
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
<style>
|
|
104
|
+
.box-reponse-ouverte {
|
|
105
|
+
}
|
|
106
|
+
</style>
|