fcad-core-dragon 2.1.1 → 2.2.0-beta.1
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 +7 -7
- package/.gitlab-ci.yml +106 -0
- package/.prettierrc +11 -11
- package/.vscode/extensions.json +8 -8
- package/.vscode/settings.json +16 -16
- package/CHANGELOG +529 -520
- package/README.md +57 -57
- package/artifacts/playwright-report/index.html +85 -0
- package/documentation/.vitepress/config.js +114 -114
- package/documentation/api-examples.md +49 -49
- package/documentation/composants/app-base-button.md +58 -58
- package/documentation/composants/app-base-error-display.md +59 -59
- package/documentation/composants/app-base-popover.md +68 -68
- package/documentation/composants/app-comp-audio.md +75 -75
- package/documentation/composants/app-comp-branch-buttons.md +111 -111
- package/documentation/composants/app-comp-button-progress.md +53 -53
- package/documentation/composants/app-comp-carousel.md +53 -53
- package/documentation/composants/app-comp-container.md +53 -53
- package/documentation/composants/app-comp-input-checkbox-next.md +42 -42
- package/documentation/composants/app-comp-input-dropdown-next.md +34 -34
- package/documentation/composants/app-comp-input-radio-next.md +39 -39
- package/documentation/composants/app-comp-input-text-next.md +35 -35
- package/documentation/composants/app-comp-input-text-table-next.md +34 -34
- package/documentation/composants/app-comp-input-text-to-fill-dropdown-next.md +53 -53
- package/documentation/composants/app-comp-input-text-to-fill-next.md +31 -31
- package/documentation/composants/app-comp-jauge.md +31 -31
- package/documentation/composants/app-comp-menu-item.md +55 -55
- package/documentation/composants/app-comp-menu.md +29 -29
- package/documentation/composants/app-comp-navigation.md +41 -41
- package/documentation/composants/app-comp-note-call.md +53 -53
- package/documentation/composants/app-comp-note-credit.md +53 -53
- package/documentation/composants/app-comp-play-bar-next.md +53 -53
- package/documentation/composants/app-comp-pop-up-next.md +93 -93
- package/documentation/composants/app-comp-quiz-next.md +235 -235
- package/documentation/composants/app-comp-quiz-recall.md +53 -53
- package/documentation/composants/app-comp-svg-next.md +53 -53
- package/documentation/composants/app-comp-table-of-content.md +50 -50
- package/documentation/composants/app-comp-video-player.md +82 -82
- package/documentation/composants.md +46 -46
- package/documentation/composants_critiques/ModelPageComposant.md +53 -53
- package/documentation/composants_critiques/app-base-module.md +43 -43
- package/documentation/composants_critiques/app-base-page.md +48 -48
- package/documentation/composants_critiques/app-base.md +311 -311
- package/documentation/composants_critiques/main.md +15 -15
- package/documentation/demarrage.md +50 -50
- package/documentation/deploiement.md +57 -57
- package/documentation/index.md +33 -33
- package/documentation/markdown-examples.md +85 -85
- package/documentation/public/vite.svg +14 -14
- package/documentation/public/vuejs.svg +1 -1
- package/documentation/public/vuetify.svg +5 -5
- package/eslint.config.js +60 -60
- package/package.json +69 -59
- package/playwright/index.html +12 -0
- package/playwright/index.js +21 -0
- package/playwright-ct.config.js +95 -0
- package/src/$locales/en.json +157 -157
- package/src/$locales/fr.json +120 -120
- package/src/assets/data/onboardingMessages.json +47 -47
- package/src/components/AppBase.vue +1171 -1169
- package/src/components/AppBaseButton.vue +90 -95
- package/src/components/AppBaseErrorDisplay.vue +438 -438
- package/src/components/AppBaseFlipCard.vue +84 -84
- package/src/components/AppBaseModule.vue +1639 -1634
- package/src/components/AppBasePage.vue +862 -866
- package/src/components/AppBasePopover.vue +41 -41
- package/src/components/AppBaseSkeleton.vue +66 -66
- package/src/components/AppCompAudio.vue +261 -256
- package/src/components/AppCompBranchButtons.vue +508 -508
- package/src/components/AppCompButtonProgress.vue +137 -132
- package/src/components/AppCompCarousel.vue +342 -336
- package/src/components/AppCompContainer.vue +29 -29
- package/src/components/AppCompInputCheckBoxNx.vue +326 -323
- package/src/components/AppCompInputDropdownNx.vue +302 -299
- package/src/components/AppCompInputRadioNx.vue +288 -284
- package/src/components/AppCompInputTextNx.vue +154 -153
- package/src/components/AppCompInputTextTableNx.vue +205 -202
- package/src/components/AppCompInputTextToFillDropdownNx.vue +341 -340
- package/src/components/AppCompInputTextToFillNx.vue +293 -313
- package/src/components/AppCompJauge.vue +81 -81
- package/src/components/AppCompMenu.vue +6 -1
- package/src/components/AppCompMenuItem.vue +246 -240
- package/src/components/AppCompNavigation.vue +977 -972
- package/src/components/AppCompNoteCall.vue +167 -161
- package/src/components/AppCompNoteCredit.vue +496 -491
- package/src/components/AppCompPlayBarNext.vue +2288 -2288
- package/src/components/AppCompPopUpNext.vue +508 -504
- package/src/components/AppCompQuizNext.vue +515 -510
- package/src/components/AppCompQuizRecall.vue +365 -350
- package/src/components/AppCompSVGNext.vue +346 -346
- package/src/components/AppCompSettingsMenu.vue +177 -172
- package/src/components/AppCompTableOfContent.vue +433 -427
- package/src/components/AppCompVideoPlayer.vue +378 -377
- package/src/components/AppCompViewDisplay.vue +6 -6
- package/src/components/BaseModule.vue +55 -55
- package/src/composables/useIdleDetector.js +56 -56
- package/src/composables/useQuiz.js +89 -89
- package/src/composables/useTimer.js +172 -172
- package/src/directives/nvdaFix.js +53 -53
- package/src/externalComps/ModuleView.vue +22 -22
- package/src/externalComps/SummaryView.vue +91 -91
- package/src/main.js +506 -476
- package/src/module/stores/appStore.js +960 -947
- package/src/module/xapi/ADL.js +520 -520
- 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/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 +1895 -1895
- package/src/module/xapi/xapiStatement.js +444 -444
- package/src/plugins/analytics.js +34 -34
- package/src/plugins/bus.js +12 -8
- package/src/plugins/gsap.js +17 -17
- package/src/plugins/helper.js +355 -358
- package/src/plugins/i18n.js +29 -26
- package/src/plugins/idb.js +227 -227
- 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/router/index.js +57 -57
- package/src/router/routes.js +312 -312
- package/src/shared/generalfuncs.js +344 -344
- package/src/shared/validators.js +1018 -1018
- package/tests/component/AppBaseButton.spec.js +53 -0
- package/tests/component/pinia.spec.js +24 -0
- package/{src/components/tests__ → tests/unit}/AppBaseButton.spec.js +53 -53
- package/tests/unit/AppCompAudio.spec.js +134 -0
- package/tests/unit/AppCompCarousel.spec.js +54 -0
- package/tests/unit/AppCompInputCheckBoxNx.spec.js +59 -0
- package/tests/unit/AppCompInputDropdownNx.spec.js +51 -0
- package/tests/unit/AppCompInputRadioNx.spec.js +59 -0
- package/tests/unit/AppCompInputTextNx.spec.js +44 -0
- package/tests/unit/AppCompInputTextTableNx.spec.js +77 -0
- package/tests/unit/AppCompInputTextToFillDropdownNx.spec.js +60 -0
- package/tests/unit/AppCompInputTextToFillNx.spec.js +45 -0
- package/tests/unit/AppCompNoteCredit.spec.js +58 -0
- package/tests/unit/AppCompQuizNext.spec.js +112 -0
- package/tests/unit/AppCompVideoPlayer.spec.js +169 -0
- package/tests/unit/useQuiz.spec.js +72 -0
- package/{src/components/tests__ → tests/unit}/useTimer.spec.js +91 -91
- package/vitest.config.js +42 -19
- package/vitest.setup.js +96 -0
- package/src/components/AppBaseButton.test.js +0 -21
|
@@ -1,336 +1,342 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@ Description: This component is used to display a carousel.
|
|
3
|
-
@ What it does: Create an html element including an array of slides. These slides are objects including required property (imgSrc) and optional properties (imgAlt, Title, Hypertext).
|
|
4
|
-
-->
|
|
5
|
-
|
|
6
|
-
<template v-if="slides">
|
|
7
|
-
<section id="carousel" :aria-label="$t('text.carousel')">
|
|
8
|
-
<app-base-error-display
|
|
9
|
-
v-if="errorsSlider.length"
|
|
10
|
-
:error-group="'component'"
|
|
11
|
-
:error-title="'ERREUR: CRÉATION CAROUSEL'"
|
|
12
|
-
:errors-list="errorsSlider"
|
|
13
|
-
></app-base-error-display>
|
|
14
|
-
<template v-else>
|
|
15
|
-
<div class="carousel-inner">
|
|
16
|
-
<div id="mycarousel-slides" class="carousel-slides" aria-live="polite">
|
|
17
|
-
<div
|
|
18
|
-
v-for="(slide, index) in slides"
|
|
19
|
-
:key="index"
|
|
20
|
-
class="carousel-slide"
|
|
21
|
-
:class="{
|
|
22
|
-
current: currentSlide == index + 1,
|
|
23
|
-
prev: currentSlide >= index + 2,
|
|
24
|
-
next: currentSlide <= index
|
|
25
|
-
}"
|
|
26
|
-
role="group"
|
|
27
|
-
:aria-hidden="!(currentSlide == index + 1)"
|
|
28
|
-
>
|
|
29
|
-
<span class="sr-only">
|
|
30
|
-
{{
|
|
31
|
-
$t('text.slide') +
|
|
32
|
-
' ' +
|
|
33
|
-
(index + 1) +
|
|
34
|
-
' ' +
|
|
35
|
-
$t('text.of') +
|
|
36
|
-
' ' +
|
|
37
|
-
slideLength
|
|
38
|
-
}}
|
|
39
|
-
</span>
|
|
40
|
-
<div
|
|
41
|
-
class="carousel-image"
|
|
42
|
-
:class="{ 'full-width': !(slide.title || slide.hypertext) }"
|
|
43
|
-
>
|
|
44
|
-
<img
|
|
45
|
-
:src="slide.imgSrc"
|
|
46
|
-
:alt="slide.imgAlt"
|
|
47
|
-
:aria-hidden="
|
|
48
|
-
slide.imgAlt == ' ' || !slide.imgAlt ? true : false
|
|
49
|
-
"
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
<div v-if="slide.title || slide.hypertext" class="carousel-text">
|
|
53
|
-
<p v-if="slide.title" class="carousel-slide-title">
|
|
54
|
-
{{ slide.title }}
|
|
55
|
-
</p>
|
|
56
|
-
<div v-html="slide.hypertext"></div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<div class="carousel-controls">
|
|
62
|
-
<app-base-button
|
|
63
|
-
id="carousel-btn-prev"
|
|
64
|
-
class="carousel-btn"
|
|
65
|
-
:aria-label="$t('button.carousel_prev')"
|
|
66
|
-
aria-controls="mycarousel-slides"
|
|
67
|
-
:title="$t('button.carousel_prev')"
|
|
68
|
-
:aria-disabled="disablePrev"
|
|
69
|
-
:is-disabled="disablePrev"
|
|
70
|
-
:disabled="disablePrev"
|
|
71
|
-
@click="prevSlide()"
|
|
72
|
-
>
|
|
73
|
-
<svg aria-hidden="true" focusable="false">
|
|
74
|
-
<use href="#fleche-gauche-icon"></use>
|
|
75
|
-
</svg>
|
|
76
|
-
</app-base-button>
|
|
77
|
-
<app-base-button
|
|
78
|
-
id="carousel-btn-next"
|
|
79
|
-
class="carousel-btn"
|
|
80
|
-
:aria-label="$t('button.carousel_next')"
|
|
81
|
-
aria-controls="mycarousel-slides"
|
|
82
|
-
:title="$t('button.carousel_next')"
|
|
83
|
-
:aria-disabled="disableNext"
|
|
84
|
-
:is-disabled="disableNext"
|
|
85
|
-
:disabled="disableNext"
|
|
86
|
-
@click="nextSlide()"
|
|
87
|
-
>
|
|
88
|
-
<svg aria-hidden="true" focusable="false">
|
|
89
|
-
<use href="#fleche-droite-icon"></use>
|
|
90
|
-
</svg>
|
|
91
|
-
</app-base-button>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
</template>
|
|
95
|
-
<div class="carousel-index">
|
|
96
|
-
<p aria-hidden="true">{{ sliderPagination }}</p>
|
|
97
|
-
</div>
|
|
98
|
-
</section>
|
|
99
|
-
</template>
|
|
100
|
-
|
|
101
|
-
<script>
|
|
102
|
-
import AppBaseErrorDisplay from './AppBaseErrorDisplay.vue'
|
|
103
|
-
import { mapState } from 'pinia'
|
|
104
|
-
import { useAppStore } from '../module/stores/appStore'
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return this.
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
return this.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
width: 100
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.carousel-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
1
|
+
<!--
|
|
2
|
+
@ Description: This component is used to display a carousel.
|
|
3
|
+
@ What it does: Create an html element including an array of slides. These slides are objects including required property (imgSrc) and optional properties (imgAlt, Title, Hypertext).
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
<template v-if="slides">
|
|
7
|
+
<section id="carousel" :aria-label="$t('text.carousel')">
|
|
8
|
+
<app-base-error-display
|
|
9
|
+
v-if="errorsSlider.length"
|
|
10
|
+
:error-group="'component'"
|
|
11
|
+
:error-title="'ERREUR: CRÉATION CAROUSEL'"
|
|
12
|
+
:errors-list="errorsSlider"
|
|
13
|
+
></app-base-error-display>
|
|
14
|
+
<template v-else>
|
|
15
|
+
<div class="carousel-inner">
|
|
16
|
+
<div id="mycarousel-slides" class="carousel-slides" aria-live="polite">
|
|
17
|
+
<div
|
|
18
|
+
v-for="(slide, index) in slides"
|
|
19
|
+
:key="index"
|
|
20
|
+
class="carousel-slide"
|
|
21
|
+
:class="{
|
|
22
|
+
current: currentSlide == index + 1,
|
|
23
|
+
prev: currentSlide >= index + 2,
|
|
24
|
+
next: currentSlide <= index
|
|
25
|
+
}"
|
|
26
|
+
role="group"
|
|
27
|
+
:aria-hidden="!(currentSlide == index + 1)"
|
|
28
|
+
>
|
|
29
|
+
<span class="sr-only">
|
|
30
|
+
{{
|
|
31
|
+
$t('text.slide') +
|
|
32
|
+
' ' +
|
|
33
|
+
(index + 1) +
|
|
34
|
+
' ' +
|
|
35
|
+
$t('text.of') +
|
|
36
|
+
' ' +
|
|
37
|
+
slideLength
|
|
38
|
+
}}
|
|
39
|
+
</span>
|
|
40
|
+
<div
|
|
41
|
+
class="carousel-image"
|
|
42
|
+
:class="{ 'full-width': !(slide.title || slide.hypertext) }"
|
|
43
|
+
>
|
|
44
|
+
<img
|
|
45
|
+
:src="slide.imgSrc"
|
|
46
|
+
:alt="slide.imgAlt"
|
|
47
|
+
:aria-hidden="
|
|
48
|
+
slide.imgAlt == ' ' || !slide.imgAlt ? true : false
|
|
49
|
+
"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
<div v-if="slide.title || slide.hypertext" class="carousel-text">
|
|
53
|
+
<p v-if="slide.title" class="carousel-slide-title">
|
|
54
|
+
{{ slide.title }}
|
|
55
|
+
</p>
|
|
56
|
+
<div v-html="slide.hypertext"></div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="carousel-controls">
|
|
62
|
+
<app-base-button
|
|
63
|
+
id="carousel-btn-prev"
|
|
64
|
+
class="carousel-btn"
|
|
65
|
+
:aria-label="$t('button.carousel_prev')"
|
|
66
|
+
aria-controls="mycarousel-slides"
|
|
67
|
+
:title="$t('button.carousel_prev')"
|
|
68
|
+
:aria-disabled="disablePrev"
|
|
69
|
+
:is-disabled="disablePrev"
|
|
70
|
+
:disabled="disablePrev"
|
|
71
|
+
@click="prevSlide()"
|
|
72
|
+
>
|
|
73
|
+
<svg aria-hidden="true" focusable="false">
|
|
74
|
+
<use href="#fleche-gauche-icon"></use>
|
|
75
|
+
</svg>
|
|
76
|
+
</app-base-button>
|
|
77
|
+
<app-base-button
|
|
78
|
+
id="carousel-btn-next"
|
|
79
|
+
class="carousel-btn"
|
|
80
|
+
:aria-label="$t('button.carousel_next')"
|
|
81
|
+
aria-controls="mycarousel-slides"
|
|
82
|
+
:title="$t('button.carousel_next')"
|
|
83
|
+
:aria-disabled="disableNext"
|
|
84
|
+
:is-disabled="disableNext"
|
|
85
|
+
:disabled="disableNext"
|
|
86
|
+
@click="nextSlide()"
|
|
87
|
+
>
|
|
88
|
+
<svg aria-hidden="true" focusable="false">
|
|
89
|
+
<use href="#fleche-droite-icon"></use>
|
|
90
|
+
</svg>
|
|
91
|
+
</app-base-button>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
<div class="carousel-index">
|
|
96
|
+
<p aria-hidden="true">{{ sliderPagination }}</p>
|
|
97
|
+
</div>
|
|
98
|
+
</section>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script>
|
|
102
|
+
import AppBaseErrorDisplay from './AppBaseErrorDisplay.vue'
|
|
103
|
+
import { mapState } from 'pinia'
|
|
104
|
+
import { useAppStore } from '../module/stores/appStore'
|
|
105
|
+
import { useI18n } from 'vue-i18n'
|
|
106
|
+
|
|
107
|
+
export default {
|
|
108
|
+
name: 'AppCompSlider',
|
|
109
|
+
components: { AppBaseErrorDisplay },
|
|
110
|
+
props: {
|
|
111
|
+
slides: { type: Array, required: true }, //Array of slides {imgSrc, imgAlt, title, hypertext}
|
|
112
|
+
name: { type: String, default: 'Sooo cool' }
|
|
113
|
+
},
|
|
114
|
+
setup() {
|
|
115
|
+
const { t } = useI18n()
|
|
116
|
+
return { t }
|
|
117
|
+
},
|
|
118
|
+
data() {
|
|
119
|
+
return {
|
|
120
|
+
currentSlide: null, //Slide management
|
|
121
|
+
requiredProperties: ['imgSrc'], //For slides validation
|
|
122
|
+
optionalProperties: ['title', 'imgAlt', 'hypertext'], //For slides validation
|
|
123
|
+
errorsSlider: []
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
computed: {
|
|
127
|
+
...mapState(useAppStore, ['getAppConfigs']),
|
|
128
|
+
disablePrev() {
|
|
129
|
+
return !(this.currentSlide > 1)
|
|
130
|
+
},
|
|
131
|
+
disableNext() {
|
|
132
|
+
return !(this.currentSlide < this.slideLength)
|
|
133
|
+
},
|
|
134
|
+
slideLength() {
|
|
135
|
+
return this.slides ? this.slides.length : 0
|
|
136
|
+
},
|
|
137
|
+
sliderPagination() {
|
|
138
|
+
return this.getAppConfigs.lang.toLowerCase() == 'en'
|
|
139
|
+
? `${this.currentSlide}/${this.slideLength}`
|
|
140
|
+
: `${this.currentSlide} / ${this.slideLength}`
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
created() {
|
|
144
|
+
this.currentSlide = this.slides && this.slides.length ? 1 : 0
|
|
145
|
+
},
|
|
146
|
+
mounted() {
|
|
147
|
+
this.validateCarousel()
|
|
148
|
+
},
|
|
149
|
+
methods: {
|
|
150
|
+
prevSlide() {
|
|
151
|
+
if (this.currentSlide > 1) {
|
|
152
|
+
this.currentSlide--
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
nextSlide() {
|
|
156
|
+
if (this.currentSlide < this.slideLength) {
|
|
157
|
+
this.currentSlide++
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
validateCarousel() {
|
|
161
|
+
//Validating slides
|
|
162
|
+
|
|
163
|
+
if (Array.isArray(this.slides) && this.slideLength > 0) {
|
|
164
|
+
//Validate properties for all the slides
|
|
165
|
+
for (const slide of this.slides) {
|
|
166
|
+
this.validateProperties(
|
|
167
|
+
this.requiredProperties,
|
|
168
|
+
this.optionalProperties,
|
|
169
|
+
slide
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
let msg = `Le corrousel doit avoit au moins un element.`
|
|
174
|
+
this.errorsSlider.push(msg)
|
|
175
|
+
console.warn(
|
|
176
|
+
`%c WARNING!>>> AppCompSlider : slides must be an array of at least one item`,
|
|
177
|
+
'background: orange; color: white; display: block; margin:5px;'
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
//Validate the properties of a specific object (currentObject)
|
|
182
|
+
validateProperties(requiredProperties, optionalProperties, currentObject) {
|
|
183
|
+
let allProperties = requiredProperties.concat(optionalProperties)
|
|
184
|
+
let currentProperties = Object.keys(currentObject)
|
|
185
|
+
let wrongProperties = this.checkerWrong(allProperties, currentProperties)
|
|
186
|
+
let missingRequired = this.checkerMissing(
|
|
187
|
+
requiredProperties,
|
|
188
|
+
currentProperties
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
//Validate if all properties in currentObject are valid
|
|
192
|
+
if (wrongProperties.length > 0) {
|
|
193
|
+
console.warn(
|
|
194
|
+
`%c WARNING!>>> AppCompSlider : slides ${wrongProperties} invalid. Required properties: ${requiredProperties} . Optional properties: ${optionalProperties}`,
|
|
195
|
+
'background: orange; color: white; display: block; margin:5px;'
|
|
196
|
+
)
|
|
197
|
+
let msg = `Attribut(s) invalide(s): <i>${wrongProperties}</i> . Consultez la console pour plus de details.`
|
|
198
|
+
this.errorsSlider.push(msg)
|
|
199
|
+
}
|
|
200
|
+
//Validate if all required properties are present in currentObject
|
|
201
|
+
if (missingRequired.length > 0) {
|
|
202
|
+
console.warn(
|
|
203
|
+
`%c WARNING!>>> AppCompQuizSlider : slides missing required ${missingRequired} property. Required properties: ${requiredProperties} . Optional properties: ${optionalProperties}`,
|
|
204
|
+
'background: orange; color: white; display: block; margin:5px;'
|
|
205
|
+
)
|
|
206
|
+
let msg = `Une/certaines propriété(s) sont manquante(s). Consultez la console pour plus de details.`
|
|
207
|
+
this.errorsSlider.push(msg)
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
//Get all the invalids properties from the object
|
|
211
|
+
/*Add element from target array that are NOT in arr to the wrongArray*/
|
|
212
|
+
checkerWrong(arr, target) {
|
|
213
|
+
let wrongArray = []
|
|
214
|
+
target.every((v) => {
|
|
215
|
+
if (arr.includes(v)) {
|
|
216
|
+
return true
|
|
217
|
+
} else {
|
|
218
|
+
wrongArray.push(v)
|
|
219
|
+
return true
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
return wrongArray
|
|
223
|
+
},
|
|
224
|
+
//Get all the required properties that are missing from the object
|
|
225
|
+
/*Add element from the arr that are NOT in target arr to the missingArray*/
|
|
226
|
+
checkerMissing(arr, target) {
|
|
227
|
+
let missingArray = []
|
|
228
|
+
arr.every((v) => {
|
|
229
|
+
if (target.includes(v)) {
|
|
230
|
+
return true
|
|
231
|
+
} else {
|
|
232
|
+
missingArray.push(v)
|
|
233
|
+
return true
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
return missingArray
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
<style lang="scss">
|
|
242
|
+
#carousel {
|
|
243
|
+
width: max(100%, 350px);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.carousel-inner {
|
|
247
|
+
position: relative;
|
|
248
|
+
height: 100%;
|
|
249
|
+
width: 100%;
|
|
250
|
+
display: flex;
|
|
251
|
+
justify-content: center;
|
|
252
|
+
overflow: initial;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.carousel-slides {
|
|
256
|
+
position: relative;
|
|
257
|
+
height: 100%;
|
|
258
|
+
width: calc(
|
|
259
|
+
100% - 136px
|
|
260
|
+
); //add 68px each side of the carousel for the buttons
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-direction: row;
|
|
263
|
+
overflow: hidden;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.carousel-slide {
|
|
267
|
+
min-width: 100%;
|
|
268
|
+
width: 100%;
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-direction: row;
|
|
271
|
+
opacity: 0.5;
|
|
272
|
+
transition: all 0.6s ease-out;
|
|
273
|
+
position: relative;
|
|
274
|
+
@media screen and (max-width: 1000px) {
|
|
275
|
+
flex-direction: column;
|
|
276
|
+
}
|
|
277
|
+
&.current {
|
|
278
|
+
opacity: 1;
|
|
279
|
+
}
|
|
280
|
+
&.prev {
|
|
281
|
+
margin-left: -100%;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.carousel-image {
|
|
286
|
+
width: 60%;
|
|
287
|
+
height: 100%;
|
|
288
|
+
display: flex;
|
|
289
|
+
justify-content: center;
|
|
290
|
+
&.full-width {
|
|
291
|
+
width: 100%;
|
|
292
|
+
}
|
|
293
|
+
@media screen and (max-width: 1000px) {
|
|
294
|
+
width: 100%;
|
|
295
|
+
max-height: 250px;
|
|
296
|
+
}
|
|
297
|
+
img {
|
|
298
|
+
max-width: 100%;
|
|
299
|
+
width: 100%;
|
|
300
|
+
min-height: 300px;
|
|
301
|
+
object-fit: contain;
|
|
302
|
+
@media screen and (max-width: 1000px) {
|
|
303
|
+
min-height: 250px;
|
|
304
|
+
max-height: 250px;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.carousel-text {
|
|
310
|
+
width: 40%;
|
|
311
|
+
height: 100%;
|
|
312
|
+
padding: 48px 24px 32px 24px;
|
|
313
|
+
|
|
314
|
+
@media screen and (max-width: 1000px) {
|
|
315
|
+
width: 100%;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.carousel-index {
|
|
320
|
+
margin-top: 20px;
|
|
321
|
+
display: flex;
|
|
322
|
+
justify-content: center;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.carousel-controls {
|
|
326
|
+
position: absolute;
|
|
327
|
+
width: 75%;
|
|
328
|
+
top: calc(50% - 25px); //Center buttons
|
|
329
|
+
|
|
330
|
+
@media screen and (min-width: 510px) {
|
|
331
|
+
width: 100%;
|
|
332
|
+
}
|
|
333
|
+
& {
|
|
334
|
+
display: flex;
|
|
335
|
+
flex-direction: row;
|
|
336
|
+
justify-content: space-between;
|
|
337
|
+
z-index: 3;
|
|
338
|
+
user-select: none;
|
|
339
|
+
min-width: 300px;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
</style>
|