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.
Files changed (72) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/CHANGELOG +9 -0
  3. package/package.json +26 -12
  4. package/src/$locales/en.json +37 -87
  5. package/src/$locales/fr.json +17 -106
  6. package/src/assets/data/onboardingMessages.json +1 -1
  7. package/src/components/AppBase.vue +241 -143
  8. package/src/components/AppBaseButton.vue +2 -6
  9. package/src/components/AppBaseErrorDisplay.vue +193 -183
  10. package/src/components/AppBaseFlipCard.vue +1 -0
  11. package/src/components/AppBaseModule.vue +195 -225
  12. package/src/components/AppBasePage.vue +519 -64
  13. package/src/components/AppBasePopover.vue +41 -0
  14. package/src/components/AppCompAudio.vue +32 -64
  15. package/src/components/AppCompBranchButtons.vue +52 -71
  16. package/src/components/AppCompButtonProgress.vue +12 -18
  17. package/src/components/AppCompCarousel.vue +102 -0
  18. package/src/components/{AppCompInputCheckBox.vue → AppCompInputCheckBoxNext.vue} +56 -94
  19. package/src/components/AppCompInputDropdownNext.vue +159 -0
  20. package/src/components/{AppCompInputRadio.vue → AppCompInputRadioNext.vue} +53 -63
  21. package/src/components/AppCompInputTextNext.vue +106 -0
  22. package/src/components/AppCompInputTextTableNext.vue +141 -0
  23. package/src/components/AppCompInputTextToFillDropdownNext.vue +230 -0
  24. package/src/components/{AppCompInputTextToFillText.vue → AppCompInputTextToFillNext.vue} +71 -64
  25. package/src/components/AppCompJauge.vue +16 -9
  26. package/src/components/AppCompMenu.vue +50 -29
  27. package/src/components/AppCompMenuItem.vue +52 -15
  28. package/src/components/AppCompNavigation.vue +225 -211
  29. package/src/components/AppCompNoteCall.vue +22 -30
  30. package/src/components/AppCompNoteCredit.vue +45 -20
  31. package/src/components/AppCompPlayBar.vue +55 -108
  32. package/src/components/AppCompPlayBarNext.vue +2052 -0
  33. package/src/components/AppCompPlayBarProgress.vue +10 -1
  34. package/src/components/AppCompPopUpNext.vue +503 -0
  35. package/src/components/{AppCompQuiz.vue → AppCompQuizNext.vue} +632 -703
  36. package/src/components/AppCompQuizRecall.vue +74 -75
  37. package/src/components/{AppCompSVG.vue → AppCompSVGNext.vue} +111 -99
  38. package/src/components/AppCompSettingsMenu.vue +11 -8
  39. package/src/components/AppCompTableOfContent.vue +78 -76
  40. package/src/components/AppCompTranscript.vue +5 -0
  41. package/src/components/AppCompVideoPlayer.vue +30 -42
  42. package/src/components/BaseModule.vue +1 -0
  43. package/src/composables/useQuiz.js +206 -0
  44. package/src/externalComps/ModuleView.vue +22 -0
  45. package/src/externalComps/SummaryView.vue +91 -0
  46. package/src/main.js +99 -90
  47. package/src/mixins/$mediaMixins.js +13 -21
  48. package/src/mixins/timerMixin.js +1 -1
  49. package/src/module/stores/appStore.js +901 -0
  50. package/src/module/xapi/ADL.js +8 -4
  51. package/src/plugins/bus.js +7 -2
  52. package/src/plugins/gsap.js +4 -7
  53. package/src/plugins/helper.js +33 -13
  54. package/src/plugins/i18n.js +2 -2
  55. package/src/plugins/idb.js +44 -29
  56. package/src/plugins/save.js +1 -1
  57. package/src/plugins/scorm.js +2 -2
  58. package/src/plugins/xapi.js +2 -2
  59. package/src/public/index.html +22 -10
  60. package/src/router/index.js +13 -10
  61. package/src/router/routes.js +20 -25
  62. package/src/shared/generalfuncs.js +33 -18
  63. package/src/shared/validators.js +116 -6
  64. package/src/components/AppCompInputDropdown.vue +0 -182
  65. package/src/components/AppCompInputTextBox.vue +0 -91
  66. package/src/components/AppCompInputTextTable.vue +0 -158
  67. package/src/components/AppCompInputTextToFillDropdown.vue +0 -257
  68. package/src/components/AppCompPopUp.vue +0 -583
  69. package/src/components/AppCompPopover.vue +0 -27
  70. package/src/mixins/$pageMixins.js +0 -415
  71. package/src/mixins/$quizMixins.js +0 -442
  72. package/src/module/store.js +0 -1014
@@ -1,442 +0,0 @@
1
- const $extendsQuiz = {
2
- watch: {
3
- /**
4
- * @description used to call a validation
5
- */
6
- quizSubmit(newValue) {
7
- if (newValue == true) {
8
- this.validateAnswers()
9
- }
10
- }
11
- },
12
-
13
- methods: {
14
- /**
15
- * @param {String} inputId
16
- * @returns {Array} the class
17
- */
18
- classInput(inputId) {
19
- let theClass = []
20
-
21
- switch (this.inputType) {
22
- case 'choix_unique':
23
- if (inputId == this.quizInputUnique) {
24
- theClass.push('reponseSelectionner')
25
- }
26
- break
27
-
28
- case 'choix_mult':
29
- if (this.containsValue(this.quizInputMultiple, inputId)) {
30
- theClass.push('reponseSelectionner')
31
- }
32
- }
33
-
34
- if (this.showSolution) {
35
- if (this.solution !== null) {
36
- switch (this.inputType) {
37
- case 'choix_unique':
38
- if (inputId == this.solution) {
39
- theClass.push('correct_answer')
40
- } else {
41
- theClass.push('wrong_answer')
42
- }
43
- break
44
-
45
- case 'choix_mult':
46
- if (this.containsValue(this.solution, inputId)) {
47
- theClass.push('correct_answer')
48
- } else {
49
- theClass.push('wrong_answer')
50
- }
51
- break
52
-
53
- case 'dropdown':
54
- if (this.solution[inputId] == this.quizSelectedValue[inputId]) {
55
- theClass.push('correct_answer')
56
- } else {
57
- theClass.push('wrong_answer')
58
- }
59
- break
60
-
61
- case 'texte_troue_select':
62
- if (typeof this.quizSelectedValue[inputId] !== 'undefined') {
63
- if (
64
- Object.values(this.solution[inputId])[0] ==
65
- this.quizSelectedValue[inputId]
66
- ) {
67
- theClass.push('correct_answer')
68
- } else {
69
- theClass.push('wrong_answer')
70
- }
71
- }
72
- break
73
-
74
- case 'reponse_ouverte':
75
- if (this.solution == this.quizTextArea) {
76
- theClass.push('correct_answer')
77
- } else {
78
- theClass.push('wrong_answer')
79
- }
80
- break
81
- case 'texte_tableau':
82
- if (
83
- this.containsValue(
84
- this.solution[inputId].reponse_value,
85
- this.quizTextTableValue[inputId]
86
- )
87
- ) {
88
- theClass.push('correct_answer')
89
- } else {
90
- theClass.push('wrong_answer')
91
- }
92
- break
93
- case 'texte_troue':
94
- if (typeof this.quizTextTableValue[inputId] !== 'undefined') {
95
- if (
96
- this.containsValue(
97
- Object.values(this.solution[inputId])[0],
98
- this.quizTextTableValue[inputId]
99
- )
100
- ) {
101
- theClass.push('correct_answer')
102
- } else {
103
- theClass.push('wrong_answer')
104
- }
105
- }
106
- break
107
- case 'association':
108
- if (
109
- this.solution[inputId] == this.quizAssociationValue[inputId]
110
- ) {
111
- theClass.push('correct_answer')
112
- } else {
113
- theClass.push('wrong_answer')
114
- }
115
- break
116
- case 'dragdrop':
117
- if (
118
- this.solution &&
119
- this.solution[inputId] &&
120
- this.quizDragDropValue &&
121
- this.quizDragDropValue[inputId]
122
- ) {
123
- //remove sort if order is important
124
- const solution = [...this.solution[inputId]].sort(
125
- function (a, b) {
126
- return a - b
127
- }
128
- )
129
- const values = [...this.quizDragDropValue[inputId]].sort(
130
- function (a, b) {
131
- return a - b
132
- }
133
- )
134
- if (this.isEqual(solution, values)) {
135
- theClass.push('correct_answer')
136
- } else {
137
- theClass.push('wrong_answer')
138
- }
139
- }
140
- }
141
- }
142
- }
143
- return theClass
144
- },
145
- messageAccessibility(inputId) {
146
- let mess = ''
147
- if (this.showSolution) {
148
- if (this.solution !== null) {
149
- switch (this.inputType) {
150
- case 'choix_unique':
151
- if (inputId == this.solution) {
152
- mess = `${this.$t('quizState.goodAnswer')}`
153
- } else {
154
- mess = `${this.$t('quizState.badAnswer')}`
155
- }
156
- break
157
-
158
- case 'choix_mult':
159
- if (this.containsValue(this.solution, inputId)) {
160
- mess = `${this.$t('quizState.goodAnswer')}`
161
- } else {
162
- mess = `${this.$t('quizState.badAnswer')}`
163
- }
164
- break
165
-
166
- case 'dropdown':
167
- if (this.solution[inputId] == this.quizSelectedValue[inputId]) {
168
- mess = `${this.$t('quizState.goodAnswer')}`
169
- } else {
170
- mess = `${this.$t('quizState.badAnswer')}`
171
- }
172
- break
173
-
174
- case 'texte_troue_select':
175
- if (typeof this.quizSelectedValue[inputId] !== 'undefined') {
176
- if (
177
- Object.values(this.solution[inputId])[0] ==
178
- this.quizSelectedValue[inputId]
179
- ) {
180
- mess = `${this.$t('quizState.goodAnswer')}`
181
- } else {
182
- mess = `${this.$t('quizState.badAnswer')}`
183
- }
184
- }
185
- break
186
-
187
- case 'reponse_ouverte':
188
- if (this.solution == this.quizTextArea) {
189
- mess = `${this.$t('quizState.goodAnswer')}`
190
- } else {
191
- mess = `${this.$t('quizState.badAnswer')}`
192
- }
193
- break
194
- case 'texte_tableau':
195
- if (
196
- this.containsValue(
197
- this.solution[inputId].reponse_value,
198
- this.quizTextTableValue[inputId]
199
- )
200
- ) {
201
- mess = `${this.$t('quizState.goodAnswer')}`
202
- } else {
203
- mess = `${this.$t('quizState.badAnswer')}`
204
- }
205
- break
206
- case 'texte_troue':
207
- if (typeof this.quizTextTableValue[inputId] !== 'undefined') {
208
- if (
209
- this.containsValue(
210
- Object.values(this.solution[inputId])[0],
211
- this.quizTextTableValue[inputId]
212
- )
213
- ) {
214
- mess = `${this.$t('quizState.goodAnswer')}`
215
- } else {
216
- mess = `${this.$t('quizState.badAnswer')}`
217
- }
218
- }
219
- break
220
- case 'association':
221
- if (
222
- this.solution[inputId] == this.quizAssociationValue[inputId]
223
- ) {
224
- mess = `${this.$t('quizState.goodAnswer')}`
225
- } else {
226
- mess = `${this.$t('quizState.badAnswer')}`
227
- }
228
- break
229
- case 'dragdrop':
230
- if (
231
- this.solution &&
232
- this.solution[inputId] &&
233
- this.quizDragDropValue &&
234
- this.quizDragDropValue[inputId]
235
- ) {
236
- //remove sort if order is important
237
- const solution = [...this.solution[inputId]].sort(
238
- function (a, b) {
239
- return a - b
240
- }
241
- )
242
- const values = [...this.quizDragDropValue[inputId]].sort(
243
- function (a, b) {
244
- return a - b
245
- }
246
- )
247
- if (this.isEqual(solution, values)) {
248
- mess = `${this.$t('quizState.goodAnswer')}`
249
- } else {
250
- mess = `${this.$t('quizState.badAnswer')}`
251
- }
252
- }
253
- }
254
- }
255
- }
256
- return mess
257
- },
258
- /**
259
- * @description check if this question is correct
260
- * @fires quiz-submit to AppCompQuiz.vue
261
- */
262
- validateAnswers() {
263
- let theAnswer = {}
264
-
265
- switch (this.inputType) {
266
- case 'choix_unique': {
267
- let listInput = this.quizInputUnique
268
- if (listInput) {
269
- theAnswer = {
270
- [this.inputDataId]: listInput
271
- }
272
- } else {
273
- //did not answered
274
- theAnswer = null
275
- }
276
- break
277
- }
278
-
279
- case 'choix_mult': {
280
- let listInputCheck = this.quizInputMultiple
281
- if (listInputCheck.length > 0) {
282
- theAnswer = {
283
- [this.inputDataId]: listInputCheck
284
- }
285
- } else {
286
- //did not answered
287
- theAnswer = null
288
- }
289
-
290
- break
291
- }
292
-
293
- case 'dropdown': {
294
- let listQuizSelected = this.quizSelected
295
-
296
- if (
297
- listQuizSelected.length == this.inputData.length &&
298
- !this.containsValue(listQuizSelected, null)
299
- ) {
300
- let listQuizSelectedConvert = []
301
- for (let index = 0; index < this.inputData.length; index++) {
302
- const element = this.inputData[index]
303
- listQuizSelectedConvert.push({
304
- question_id: element.id,
305
- reponse_id: listQuizSelected[index]
306
- })
307
- }
308
- theAnswer = {
309
- [this.inputDataId]: listQuizSelectedConvert
310
- }
311
- } else {
312
- //did not answered
313
- theAnswer = null
314
- }
315
- break
316
- }
317
-
318
- case 'texte_troue_select': {
319
- const regex = /\$%\S*%\$/g // regex pattern to match exp: $%number%$
320
- let matchAll = this.textBase.split(regex)
321
- let listQuizSelectedText = this.quizSelected
322
- if (
323
- listQuizSelectedText.length == matchAll.length - 1 &&
324
- !this.containsValue(listQuizSelectedText, null)
325
- ) {
326
- let listQuizSelectedTextConvert = []
327
- for (let index = 0; index < listQuizSelectedText.length; index++) {
328
- listQuizSelectedTextConvert.push({
329
- question_id: index,
330
- reponse_id: listQuizSelectedText[index]
331
- })
332
- }
333
- theAnswer = {
334
- [this.inputDataId]: listQuizSelectedTextConvert
335
- }
336
- } else {
337
- //did not answered
338
- theAnswer = null
339
- }
340
- break
341
- }
342
-
343
- case 'reponse_ouverte': {
344
- let listInputText = this.quizTextArea
345
- if (listInputText.length > 0) {
346
- theAnswer = {
347
- [this.inputDataId]: listInputText
348
- }
349
- } else {
350
- //did not answered
351
- theAnswer = null
352
- }
353
- break
354
- }
355
- case 'texte_tableau': {
356
- let listInputTextTable = this.quizTextTable
357
- if (
358
- listInputTextTable.length == this.inputData.length &&
359
- !this.containsValue(listInputTextTable, null) &&
360
- !this.containsValue(listInputTextTable, '')
361
- ) {
362
- let listInputTextTableConvert = []
363
- for (let index = 0; index < this.inputData.length; index++) {
364
- const element = this.inputData[index]
365
- listInputTextTableConvert.push({
366
- question_id: element.id,
367
- reponse: listInputTextTable[index]
368
- })
369
- }
370
- theAnswer = {
371
- [this.inputDataId]: listInputTextTableConvert
372
- }
373
- } else {
374
- //did not answered
375
- theAnswer = null
376
- }
377
- break
378
- }
379
-
380
- case 'texte_troue': {
381
- const regex = /\$%\S*%\$/g // regex pattern to match exp: $%number%$
382
- let matchAll = this.textBase.split(regex)
383
- let listInputTextFill = this.quizTextTable
384
- if (
385
- listInputTextFill.length == matchAll.length - 1 &&
386
- !this.containsValue(listInputTextFill, null) &&
387
- !this.containsValue(listInputTextFill, '')
388
- ) {
389
- let listInputTextFillConvert = []
390
- for (let index = 0; index < listInputTextFill.length; index++) {
391
- listInputTextFillConvert.push({
392
- question_id: index,
393
- reponse: listInputTextFill[index]
394
- })
395
- }
396
- theAnswer = {
397
- [this.inputDataId]: listInputTextFillConvert
398
- }
399
- } else {
400
- //did not answered
401
- theAnswer = null
402
- }
403
- break
404
- }
405
-
406
- case 'association': {
407
- let listInputAssociation = this.quizAssociation
408
- if (
409
- Object.values(listInputAssociation).length ==
410
- Object.values(this.solution).length &&
411
- !this.containsValue(Object.values(listInputAssociation), '')
412
- ) {
413
- theAnswer = {
414
- [this.inputDataId]: listInputAssociation
415
- }
416
- } else {
417
- //did not answered
418
- theAnswer = null
419
- }
420
- break
421
- }
422
-
423
- case 'dragdrop': {
424
- let listInputDragDrop = this.quizDragDrop
425
- if (
426
- Object.keys(listInputDragDrop).length ==
427
- Object.keys(this.solution).length
428
- ) {
429
- theAnswer = {
430
- [this.inputDataId]: this.quizDragDrop
431
- }
432
- } else {
433
- //did not answered
434
- theAnswer = null
435
- }
436
- }
437
- }
438
- this.$emit('quiz-submit', theAnswer)
439
- }
440
- }
441
- }
442
- export default $extendsQuiz