fcad-core-dragon 2.0.1 → 2.0.2-beta.2
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.cjs +81 -81
- package/CHANGELOG +17 -1
- package/bk.scss +117 -117
- package/package.json +1 -1
- package/src/$locales/en.json +18 -4
- package/src/$locales/fr.json +17 -3
- package/src/assets/data/onboardingMessages.json +47 -47
- package/src/components/AppBase.vue +36 -341
- package/src/components/AppBaseErrorDisplay.vue +438 -438
- package/src/components/AppBaseFlipCard.vue +84 -84
- package/src/components/AppBaseModule.vue +16 -21
- package/src/components/AppBasePage.vue +45 -14
- package/src/components/AppBasePopover.vue +41 -41
- package/src/components/AppBaseSkeleton.vue +45 -0
- package/src/components/AppCompAudio.vue +12 -3
- package/src/components/AppCompButtonProgress.vue +13 -2
- package/src/components/AppCompCarousel.vue +12 -4
- package/src/components/AppCompInputCheckBoxNx.vue +324 -0
- package/src/components/AppCompInputDropdownNx.vue +295 -0
- package/src/components/AppCompInputRadioNx.vue +264 -0
- package/src/components/AppCompInputTextNx.vue +148 -0
- package/src/components/AppCompInputTextTableNx.vue +198 -0
- package/src/components/AppCompInputTextToFillDropdownNx.vue +291 -0
- package/src/components/AppCompInputTextToFillNx.vue +277 -0
- package/src/components/AppCompJauge.vue +11 -4
- package/src/components/AppCompMenu.vue +7 -14
- package/src/components/AppCompMenuItem.vue +7 -5
- package/src/components/AppCompNavigation.vue +21 -21
- package/src/components/AppCompNoteCall.vue +1 -0
- package/src/components/AppCompNoteCredit.vue +2 -1
- package/src/components/AppCompPlayBarNext.vue +94 -41
- package/src/components/AppCompPlayBarProgress.vue +82 -82
- package/src/components/AppCompPopUpNext.vue +6 -6
- package/src/components/AppCompQuiz.vue +500 -0
- package/src/components/AppCompQuizRecall.vue +113 -66
- package/src/components/AppCompSettingsMenu.vue +172 -172
- package/src/components/AppCompTableOfContent.vue +39 -10
- package/src/components/AppCompVideoPlayer.vue +1 -1
- package/src/components/AppCompViewDisplay.vue +6 -6
- package/src/composables/useQuiz.js +62 -179
- package/src/directives/nvdaFix.js +53 -0
- package/src/externalComps/ModuleView.vue +22 -22
- package/src/externalComps/SummaryView.vue +91 -91
- package/src/main.js +227 -30
- package/src/mixins/$mediaMixins.js +1 -11
- package/src/module/stores/appStore.js +29 -11
- 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 -315
- 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/utils.js +167 -167
- package/src/module/xapi/verbs.js +294 -294
- package/src/module/xapi/xapiStatement.js +444 -444
- package/src/plugins/bus.js +8 -8
- package/src/plugins/gsap.js +14 -14
- package/src/plugins/i18n.js +44 -44
- package/src/plugins/idb.js +1 -1
- 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 -33
- package/src/shared/generalfuncs.js +134 -0
- package/src/shared/validators.js +308 -234
- package/src/components/AppCompInputCheckBoxNext.vue +0 -205
- package/src/components/AppCompInputDropdownNext.vue +0 -201
- package/src/components/AppCompInputRadioNext.vue +0 -158
- package/src/components/AppCompInputTextNext.vue +0 -124
- package/src/components/AppCompInputTextTableNext.vue +0 -142
- package/src/components/AppCompInputTextToFillDropdownNext.vue +0 -238
- package/src/components/AppCompInputTextToFillNext.vue +0 -171
- package/src/components/AppCompQuizNext.vue +0 -2908
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
<!-- About this Component--
|
|
2
|
-
* Renders a Series of SELECTS inputs to collect input for the Quiz component.
|
|
3
|
-
* Related Quiz to question: TEXTE_TABLEAU
|
|
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 v-for="textInput in quizInputDataValue" :key="textInput.id">
|
|
11
|
-
<label
|
|
12
|
-
:id="`${inputDataId}_${textInput.id}-label`"
|
|
13
|
-
aria-hidden="true"
|
|
14
|
-
v-html="textInput.ennonce"
|
|
15
|
-
></label>
|
|
16
|
-
<div
|
|
17
|
-
class="cnt-input-text"
|
|
18
|
-
:class="classInput(textInput.id, quizInputTypeValue)"
|
|
19
|
-
>
|
|
20
|
-
<v-text-field
|
|
21
|
-
:id="`${inputDataId}_${textInput.id}-champ`"
|
|
22
|
-
v-model="quizInputTypeValue[textInput.id]"
|
|
23
|
-
:placeholder="$t('text.place_holder.for_textarea')"
|
|
24
|
-
:disabled="quizLimitActive"
|
|
25
|
-
no-resize
|
|
26
|
-
:aria-describedby="`${inputDataId}_${textInput.id}-msg-erreur`"
|
|
27
|
-
:aria-labelledby="`${inputDataId}_${textInput.id}-label`"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
<span :id="`${inputDataId}_${textInput.id}-msg-erreur`" class="sr-only">
|
|
31
|
-
{{ messageAccessibility(textInput.id, quizInputTypeValue) }}
|
|
32
|
-
</span>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
<script>
|
|
37
|
-
import { useQuiz } from '../composables/useQuiz'
|
|
38
|
-
import { toRefs } from 'vue'
|
|
39
|
-
export default {
|
|
40
|
-
name: 'AppCompInputTextTableNext',
|
|
41
|
-
|
|
42
|
-
props: {
|
|
43
|
-
quizType: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: ''
|
|
46
|
-
},
|
|
47
|
-
inputDataId: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: ''
|
|
50
|
-
},
|
|
51
|
-
inputData: {
|
|
52
|
-
type: Array,
|
|
53
|
-
default: () => []
|
|
54
|
-
},
|
|
55
|
-
quizInputType: {
|
|
56
|
-
type: Array,
|
|
57
|
-
default: () => []
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
solution: {
|
|
61
|
-
type: Array,
|
|
62
|
-
default: () => []
|
|
63
|
-
},
|
|
64
|
-
showSolution: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: false
|
|
67
|
-
},
|
|
68
|
-
quizLimitActive: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: false
|
|
71
|
-
}, //use to set if quiz should be active or not
|
|
72
|
-
shuffleAnswers: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: false
|
|
75
|
-
},
|
|
76
|
-
quizSubmit: {
|
|
77
|
-
type: Boolean,
|
|
78
|
-
default: false
|
|
79
|
-
} //use to call a submit
|
|
80
|
-
},
|
|
81
|
-
emits: ['input-change'],
|
|
82
|
-
setup(props) {
|
|
83
|
-
const { classInput, containsValue, shuffleArray, messageAccessibility } =
|
|
84
|
-
useQuiz(toRefs(props))
|
|
85
|
-
|
|
86
|
-
return { classInput, containsValue, shuffleArray, messageAccessibility }
|
|
87
|
-
},
|
|
88
|
-
data() {
|
|
89
|
-
return {
|
|
90
|
-
quizInputDataValue: [],
|
|
91
|
-
quizInputTypeValue: [],
|
|
92
|
-
quizSolution: null
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
watch: {
|
|
97
|
-
/**
|
|
98
|
-
* @description to pass value to AppCompQuiz
|
|
99
|
-
* @fires input-change to AppCompQuiz.vue
|
|
100
|
-
*/
|
|
101
|
-
quizInputTypeValue: {
|
|
102
|
-
deep: true,
|
|
103
|
-
handler(newValue) {
|
|
104
|
-
// const val = newValue.length == 0 ? null : newValue
|
|
105
|
-
this.$emit('input-change', newValue)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
mounted() {
|
|
111
|
-
this.initQuiz()
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
methods: {
|
|
115
|
-
initQuiz() {
|
|
116
|
-
this.quizSolution = this.solution
|
|
117
|
-
if (this.quizSolution !== null) {
|
|
118
|
-
this.quizSolution.sort(function (a, b) {
|
|
119
|
-
return a - b
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
//apply previous answers
|
|
124
|
-
if (this.quizInputType && this.quizInputType.length == 0) {
|
|
125
|
-
this.quizInputTypeValue = []
|
|
126
|
-
} else {
|
|
127
|
-
this.quizInputTypeValue = this.quizInputType
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (this.shuffleAnswers)
|
|
131
|
-
return (this.quizInputDataValue = this.shuffleArray(this.inputData))
|
|
132
|
-
|
|
133
|
-
this.quizInputDataValue = this.inputData
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
</script>
|
|
138
|
-
<style lang="scss" scoped>
|
|
139
|
-
.cnt-input-text {
|
|
140
|
-
position: relative;
|
|
141
|
-
}
|
|
142
|
-
</style>
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
<!-- About this Component--
|
|
2
|
-
* Renders a Series of inputs to collect input for the Quiz component.
|
|
3
|
-
* Related Quiz to question: TEXTE_TROUE_SELECT
|
|
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 theInputData"
|
|
12
|
-
:key="singleDropdown.id"
|
|
13
|
-
class="texteatrou"
|
|
14
|
-
>
|
|
15
|
-
<span v-if="!singleDropdown.type" v-html="singleDropdown.content"></span>
|
|
16
|
-
<label
|
|
17
|
-
:for="`${inputDataId}_${singleDropdown.id}-champ`"
|
|
18
|
-
style="display: none"
|
|
19
|
-
>
|
|
20
|
-
{{ $t('text.quiz') }}
|
|
21
|
-
</label>
|
|
22
|
-
<div
|
|
23
|
-
class="cnt-input"
|
|
24
|
-
:class="classInput(singleDropdown.id, quizInputTypeValue)"
|
|
25
|
-
>
|
|
26
|
-
<v-select
|
|
27
|
-
v-if="singleDropdown.type == 'dropdown'"
|
|
28
|
-
:id="`${inputDataId}_${singleDropdown.id}-champ`"
|
|
29
|
-
v-model="quizInputTypeValue[singleDropdown.id]"
|
|
30
|
-
item-title="text"
|
|
31
|
-
class="dropdown"
|
|
32
|
-
:items="singleDropdown.option"
|
|
33
|
-
:item-props="true"
|
|
34
|
-
:disabled="quizLimitActive"
|
|
35
|
-
:aria-describedby="`${inputDataId}_${singleDropdown.id}-msg-erreur`"
|
|
36
|
-
:open-text="$t('message.dropdown_list')"
|
|
37
|
-
close-text=""
|
|
38
|
-
/>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<span
|
|
42
|
-
v-if="showSolution"
|
|
43
|
-
:id="`${inputDataId}_${singleDropdown.id}-msg-erreur`"
|
|
44
|
-
class="sr-only"
|
|
45
|
-
>
|
|
46
|
-
{{ messageAccessibility(singleDropdown.id, quizInputTypeValue) }}
|
|
47
|
-
</span>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
|
-
<script>
|
|
52
|
-
import { useQuiz } from '../composables/useQuiz'
|
|
53
|
-
import { toRefs } from 'vue'
|
|
54
|
-
export default {
|
|
55
|
-
name: 'AppCompInputTextToFillDropdownNext',
|
|
56
|
-
|
|
57
|
-
props: {
|
|
58
|
-
quizType: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: ''
|
|
61
|
-
},
|
|
62
|
-
inputDataId: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: ''
|
|
65
|
-
},
|
|
66
|
-
inputData: {
|
|
67
|
-
type: Array,
|
|
68
|
-
default: () => []
|
|
69
|
-
},
|
|
70
|
-
inputType: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: ''
|
|
73
|
-
},
|
|
74
|
-
textBase: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: ''
|
|
77
|
-
},
|
|
78
|
-
quizInputType: {
|
|
79
|
-
type: Array,
|
|
80
|
-
default: () => []
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
solution: {
|
|
84
|
-
type: Array,
|
|
85
|
-
default: () => []
|
|
86
|
-
},
|
|
87
|
-
showSolution: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
default: false
|
|
90
|
-
},
|
|
91
|
-
quizLimitActive: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: false
|
|
94
|
-
}, //use to set if quiz should be active or not
|
|
95
|
-
shuffleAnswers: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
default: false
|
|
98
|
-
},
|
|
99
|
-
quizSubmit: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false
|
|
102
|
-
} //use to call a submit
|
|
103
|
-
},
|
|
104
|
-
emits: ['input-change'],
|
|
105
|
-
setup(props) {
|
|
106
|
-
const { shuffleArray, classInput, messageAccessibility } = useQuiz(
|
|
107
|
-
toRefs(props)
|
|
108
|
-
)
|
|
109
|
-
return { shuffleArray, classInput, messageAccessibility }
|
|
110
|
-
},
|
|
111
|
-
data() {
|
|
112
|
-
return {
|
|
113
|
-
quizInputTypeValue: [], //not using quizInputType because quizInputType is a prop
|
|
114
|
-
theInputData: [], //to create the list of drop down and text mixed togeter
|
|
115
|
-
quizSolution: null
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
watch: {
|
|
120
|
-
/**
|
|
121
|
-
* @description to pass value to AppCompQuiz
|
|
122
|
-
* @fires input-change to AppCompQuiz.vue
|
|
123
|
-
*/
|
|
124
|
-
quizInputTypeValue: {
|
|
125
|
-
deep: true,
|
|
126
|
-
handler(newValue) {
|
|
127
|
-
this.$emit('input-change', newValue)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
mounted() {
|
|
133
|
-
this.initQuiz()
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
methods: {
|
|
137
|
-
/**
|
|
138
|
-
* @description create the object to genate the text and inputs
|
|
139
|
-
* @param {String} str the text with holes to fill
|
|
140
|
-
*/
|
|
141
|
-
createTextWithInput(str) {
|
|
142
|
-
const regex = /\$%\S*%\$/g // regex pattern to match exp: $%number%$
|
|
143
|
-
let matchAll = str.split(regex)
|
|
144
|
-
let listInput = []
|
|
145
|
-
for (let i = 0; i < this.inputData.length; i++) {
|
|
146
|
-
const element = this.inputData[i]
|
|
147
|
-
listInput.push({ id: 't' + i, content: matchAll[i] })
|
|
148
|
-
listInput.push({
|
|
149
|
-
id: i,
|
|
150
|
-
type: 'dropdown',
|
|
151
|
-
option: Object.values(element)[0]
|
|
152
|
-
})
|
|
153
|
-
}
|
|
154
|
-
let lastItem = matchAll.length - 1
|
|
155
|
-
listInput.push({ id: 't' + lastItem, content: matchAll[lastItem] })
|
|
156
|
-
this.theInputData = listInput
|
|
157
|
-
},
|
|
158
|
-
initQuiz() {
|
|
159
|
-
this.quizSolution = this.solution
|
|
160
|
-
if (this.quizSolution !== null) {
|
|
161
|
-
this.quizSolution.sort(function (a, b) {
|
|
162
|
-
return a - b
|
|
163
|
-
})
|
|
164
|
-
}
|
|
165
|
-
//to show the defaultAnswer
|
|
166
|
-
const defaultAnswer = {
|
|
167
|
-
value: null,
|
|
168
|
-
disabled: true,
|
|
169
|
-
selected: true,
|
|
170
|
-
text: this.$t('message.first_option_dropdown')
|
|
171
|
-
}
|
|
172
|
-
let selectedChoices = []
|
|
173
|
-
|
|
174
|
-
for (let i = 0; i < this.inputData.length; i++) {
|
|
175
|
-
let singleDropdown = {}
|
|
176
|
-
if (this.shuffleAnswers) {
|
|
177
|
-
singleDropdown = this.inputData[i]
|
|
178
|
-
|
|
179
|
-
singleDropdown[Object.keys(this.inputData[i])[0].toString()] =
|
|
180
|
-
this.shuffleArray(Object.values(this.inputData[i])[0])
|
|
181
|
-
} else {
|
|
182
|
-
// this.inputData[i].splice(0, 0, defaultAnswer)
|
|
183
|
-
singleDropdown = this.inputData[i]
|
|
184
|
-
}
|
|
185
|
-
for (
|
|
186
|
-
let index = 0;
|
|
187
|
-
index < Object.values(singleDropdown)[0].length;
|
|
188
|
-
index++
|
|
189
|
-
) {
|
|
190
|
-
const element = Object.values(singleDropdown)[0][index]
|
|
191
|
-
if (
|
|
192
|
-
element.text &&
|
|
193
|
-
element.text == this.$t('message.first_option_dropdown')
|
|
194
|
-
) {
|
|
195
|
-
Object.values(singleDropdown)[0].splice(index, 1)
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
Object.values(singleDropdown)[0].unshift(defaultAnswer)
|
|
200
|
-
|
|
201
|
-
selectedChoices.push(null)
|
|
202
|
-
}
|
|
203
|
-
if (this.quizInputType.length == 0) {
|
|
204
|
-
this.quizInputTypeValue = selectedChoices
|
|
205
|
-
} else {
|
|
206
|
-
this.quizInputTypeValue = this.quizInputType
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
this.createTextWithInput(this.textBase)
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
</script>
|
|
214
|
-
<style lang="scss" scoped>
|
|
215
|
-
select {
|
|
216
|
-
&.custom-select {
|
|
217
|
-
background-image: inherit;
|
|
218
|
-
|
|
219
|
-
&:focus {
|
|
220
|
-
border-color: inherit;
|
|
221
|
-
box-shadow: inherit;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/***** style dev *****/
|
|
227
|
-
.texteatrou {
|
|
228
|
-
display: inline;
|
|
229
|
-
}
|
|
230
|
-
.texteatrou > select {
|
|
231
|
-
display: inline;
|
|
232
|
-
width: auto;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.cnt-input {
|
|
236
|
-
position: relative;
|
|
237
|
-
}
|
|
238
|
-
</style>
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
<!-- About this Component--
|
|
2
|
-
* Renders a Series of inputs to collect input for the Quiz component.
|
|
3
|
-
* Related Quiz to question: TEXTE_TROUE
|
|
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="textInput in theInputData"
|
|
12
|
-
:key="textInput.id"
|
|
13
|
-
class="texteatrou"
|
|
14
|
-
>
|
|
15
|
-
<span v-if="!textInput.type" v-html="textInput.content"></span>
|
|
16
|
-
<label
|
|
17
|
-
:for="`${inputDataId}_${textInput.id}-champ`"
|
|
18
|
-
style="display: none"
|
|
19
|
-
>
|
|
20
|
-
{{ $t('text.quiz') }}
|
|
21
|
-
</label>
|
|
22
|
-
<v-text-field
|
|
23
|
-
v-if="textInput.type == 'inputText'"
|
|
24
|
-
:id="`${inputDataId}_${textInput.id}-champ`"
|
|
25
|
-
v-model="quizInputTypeValue[textInput.id]"
|
|
26
|
-
:placeholder="$t('text.place_holder.for_textarea')"
|
|
27
|
-
:disabled="quizLimitActive"
|
|
28
|
-
no-resize
|
|
29
|
-
:class="classInput(textInput.id, quizInputTypeValue)"
|
|
30
|
-
class="input-textatrou"
|
|
31
|
-
:aria-describedby="`${inputDataId}_${textInput.id}-msg-erreur`"
|
|
32
|
-
:aria-labelledby="`${inputDataId}_${textInput.id}-label`"
|
|
33
|
-
/>
|
|
34
|
-
<span :id="`${inputDataId}_${textInput.id}-msg-erreur`" class="sr-only">
|
|
35
|
-
{{ messageAccessibility(textInput.id, quizInputTypeValue) }}
|
|
36
|
-
</span>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</template>
|
|
40
|
-
<script>
|
|
41
|
-
import { useQuiz } from '../composables/useQuiz'
|
|
42
|
-
import { toRefs } from 'vue'
|
|
43
|
-
export default {
|
|
44
|
-
name: 'AppCompInputTextToFillNext',
|
|
45
|
-
props: {
|
|
46
|
-
quizType: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: ''
|
|
49
|
-
},
|
|
50
|
-
inputDataId: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: ''
|
|
53
|
-
},
|
|
54
|
-
inputData: {
|
|
55
|
-
type: Array,
|
|
56
|
-
default: () => []
|
|
57
|
-
},
|
|
58
|
-
inputType: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: ''
|
|
61
|
-
},
|
|
62
|
-
textBase: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: ''
|
|
65
|
-
},
|
|
66
|
-
quizInputType: {
|
|
67
|
-
type: Array,
|
|
68
|
-
default: () => []
|
|
69
|
-
},
|
|
70
|
-
solution: {
|
|
71
|
-
type: Array,
|
|
72
|
-
default: () => []
|
|
73
|
-
},
|
|
74
|
-
showSolution: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
default: false
|
|
77
|
-
},
|
|
78
|
-
quizLimitActive: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: false
|
|
81
|
-
}, //use to set if quiz should be active or not
|
|
82
|
-
quizSubmit: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false
|
|
85
|
-
} //use to call a submit
|
|
86
|
-
},
|
|
87
|
-
emits: ['input-change'],
|
|
88
|
-
setup(props) {
|
|
89
|
-
const { shuffleArray, classInput, messageAccessibility } = useQuiz(
|
|
90
|
-
toRefs(props)
|
|
91
|
-
)
|
|
92
|
-
return { shuffleArray, classInput, messageAccessibility }
|
|
93
|
-
},
|
|
94
|
-
data() {
|
|
95
|
-
return {
|
|
96
|
-
quizInputTypeValue: [], //not using quizInputType because quizInputType is a prop
|
|
97
|
-
theInputData: [], //to create the list of drop down and text mixed togeter
|
|
98
|
-
quizSolution: null
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
watch: {
|
|
103
|
-
/**
|
|
104
|
-
* @description to pass value to AppCompQuiz
|
|
105
|
-
* @fires input-change to AppCompQuiz.vue
|
|
106
|
-
*/
|
|
107
|
-
quizInputTypeValue: {
|
|
108
|
-
deep: true,
|
|
109
|
-
handler(newValue) {
|
|
110
|
-
this.$emit('input-change', newValue)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
mounted() {
|
|
116
|
-
this.initQuiz()
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
methods: {
|
|
120
|
-
initQuiz() {
|
|
121
|
-
this.quizSolution = this.solution
|
|
122
|
-
if (this.quizSolution !== null) {
|
|
123
|
-
this.quizSolution.sort(function (a, b) {
|
|
124
|
-
return a - b
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
let textChoices = []
|
|
128
|
-
|
|
129
|
-
const regex = /\$%\S*%\$/g // regex pattern to match exp: $%number%$
|
|
130
|
-
let matchAll = this.textBase.split(regex)
|
|
131
|
-
|
|
132
|
-
for (let i = 0; i < matchAll.length - 1; i++) {
|
|
133
|
-
textChoices.push('')
|
|
134
|
-
}
|
|
135
|
-
//apply previous answers
|
|
136
|
-
if (this.quizInputType && this.quizInputType.length == 0) {
|
|
137
|
-
this.quizInputTypeValue = textChoices
|
|
138
|
-
} else {
|
|
139
|
-
this.quizInputTypeValue = this.quizInputType
|
|
140
|
-
}
|
|
141
|
-
this.createTextWithInput(this.textBase)
|
|
142
|
-
},
|
|
143
|
-
/**
|
|
144
|
-
* @description create the object to genate the text and inputs
|
|
145
|
-
* @param {String} str the text with holes to fill
|
|
146
|
-
*/
|
|
147
|
-
createTextWithInput(str) {
|
|
148
|
-
const regex = /\$%\S*%\$/g // regex pattern to match exp: $%number%$
|
|
149
|
-
let matchAll = str.split(regex)
|
|
150
|
-
let listInput = []
|
|
151
|
-
for (let i = 0; i < matchAll.length - 1; i++) {
|
|
152
|
-
listInput.push({ id: 't' + i, content: matchAll[i] })
|
|
153
|
-
listInput.push({ id: i, type: 'inputText' })
|
|
154
|
-
}
|
|
155
|
-
let lastItem = matchAll.length - 1
|
|
156
|
-
listInput.push({ id: 't' + lastItem, content: matchAll[lastItem] })
|
|
157
|
-
this.theInputData = listInput
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
</script>
|
|
162
|
-
<style lang="scss" scoped>
|
|
163
|
-
.texteatrou {
|
|
164
|
-
display: inline;
|
|
165
|
-
position: relative;
|
|
166
|
-
}
|
|
167
|
-
.texteatrou > input {
|
|
168
|
-
display: inline;
|
|
169
|
-
width: auto;
|
|
170
|
-
}
|
|
171
|
-
</style>
|