ep-lib-ts 0.1.8 → 0.1.9
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/dist/BgAudio-ca141b0f.js +5 -0
- package/dist/DisplayBox-38b3a1bd.js +5 -0
- package/dist/EpAlert-d5dcf3f1.js +5 -0
- package/dist/EpAudio-09920ab1.js +5 -0
- package/dist/EpBadge-d7da4b82.js +5 -0
- package/dist/EpBarChart-aa2d3bd3.js +5 -0
- package/dist/EpBtn-584a5fcb.js +5 -0
- package/dist/EpCard-522528d2.js +5 -0
- package/dist/EpCheckbox-fe632df9.js +36 -0
- package/dist/EpChip-524340fe.js +5 -0
- package/dist/EpDivider-88c6be66.js +5 -0
- package/dist/EpEdu-bfd8a980.js +5 -0
- package/dist/EpFlex-560567d3.js +5 -0
- package/dist/EpHeader-48f9a232.js +5 -0
- package/dist/EpIcon-2ba52cd4.js +5 -0
- package/dist/EpIframe-6c4453bb.js +5 -0
- package/dist/EpImg-99724654.js +5 -0
- package/dist/EpInput-f7992e3f.js +1171 -0
- package/dist/EpLineChart-655565a3.js +5 -0
- package/dist/EpLink-ab36acb1.js +5 -0
- package/dist/EpModal-d2df0421.js +5 -0
- package/dist/EpNothing-08f5601f.js +10 -0
- package/dist/EpQuestion-f9baa3e7.js +5 -0
- package/dist/EpQuote-8be6e8eb.js +5 -0
- package/dist/EpRadio-4f83a512.js +5 -0
- package/dist/EpReading-4b8eb5bf.js +5 -0
- package/dist/EpResource-42e0f1e3.js +5 -0
- package/dist/EpScope-609f5fbe.js +5 -0
- package/dist/EpSection-eaf62d9e.js +5 -0
- package/dist/EpSelect-ed79294a.js +31 -0
- package/dist/EpSoftware-0ca2b2d9.js +5 -0
- package/dist/EpSpinner-b50b86fd.js +5 -0
- package/dist/EpSwitch-1eaf9d3f.js +44 -0
- package/dist/EpTable-4eaf84c7.js +5 -0
- package/dist/EpTerm-dfd79f23.js +5 -0
- package/dist/EpText-deac2bec.js +5 -0
- package/dist/EpTextarea-67f751e9.js +41 -0
- package/dist/EpToggle-9755056a.js +44 -0
- package/dist/EpVideo-1d585085.js +5 -0
- package/dist/EpVideoPanopto-cb5441d9.js +5 -0
- package/dist/components/basics/EpText.vue.d.ts +13 -9
- package/dist/components/educationals/EpEdu.vue.d.ts +3 -2
- package/dist/components/educationals/EpReading.vue.d.ts +5 -4
- package/dist/components/educationals/EpResource.vue.d.ts +34 -1
- package/dist/components/educationals/EpScope.vue.d.ts +9 -0
- package/dist/components/forms/EpCheckbox.vue.d.ts +72 -0
- package/dist/components/forms/EpInput.vue.d.ts +98 -0
- package/dist/components/forms/EpRadio.vue.d.ts +69 -0
- package/dist/components/forms/EpSelect.vue.d.ts +83 -0
- package/dist/components/forms/EpSwitch.vue.d.ts +81 -0
- package/dist/components/forms/EpTextarea.vue.d.ts +90 -0
- package/dist/components/forms/EpToggle.vue.d.ts +81 -0
- package/dist/components/interactions/EpQuestion.vue.d.ts +90 -1
- package/dist/components/medias/EpAudio.vue.d.ts +3 -8
- package/dist/components/medias/EpLink.vue.d.ts +3 -2
- package/dist/components/medias/EpSoftware.vue.d.ts +3 -2
- package/dist/components/medias/EpVideo.vue.d.ts +3 -2
- package/dist/components/medias/EpVideoPanopto.vue.d.ts +3 -2
- package/dist/components/signages/EpAlert.vue.d.ts +10 -3
- package/dist/components/signages/EpNothing.vue.d.ts +2 -0
- package/dist/components/signages/EpQuote.vue.d.ts +9 -9
- package/dist/composables/useComponent.d.ts +6 -0
- package/dist/ep-lib-ts.js +41 -18489
- package/dist/ep-lib-ts.umd.cjs +42 -38
- package/dist/index-41c8e591.js +18790 -0
- package/dist/types/Answer.d.ts +15 -0
- package/dist/types/MandateLevel.d.ts +5 -0
- package/package.json +3 -2
- package/src/components/basics/EpCard.vue +1 -1
- package/src/components/basics/EpImg.vue +70 -40
- package/src/components/basics/EpText.vue +19 -5
- package/src/components/educationals/EpEdu.vue +11 -3
- package/src/components/educationals/EpReading.vue +10 -7
- package/src/components/educationals/EpResource.vue +66 -3
- package/src/components/educationals/EpScope.vue +14 -2
- package/src/components/forms/EpRadio.vue +2 -1
- package/src/components/interactions/EpQuestion.vue +176 -4
- package/src/components/medias/EpAudio.vue +2 -2
- package/src/components/medias/EpLink.vue +2 -1
- package/src/components/medias/EpSoftware.vue +4 -4
- package/src/components/medias/EpVideo.vue +7 -3
- package/src/components/medias/EpVideoPanopto.vue +2 -1
- package/src/components/signages/EpAlert.vue +19 -4
- package/src/components/signages/EpNothing.vue +5 -0
- package/src/components/signages/EpQuote.vue +23 -19
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TypeAlert } from './Alert';
|
|
2
|
+
interface ContentComponent {
|
|
3
|
+
type?: string;
|
|
4
|
+
data: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface Answer {
|
|
9
|
+
text: string;
|
|
10
|
+
feedback: string;
|
|
11
|
+
type: TypeAlert;
|
|
12
|
+
uid?: string;
|
|
13
|
+
component?: ContentComponent | null;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ep-lib-ts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.9",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src/components/"
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"postcss-cli": "^10.1.0",
|
|
35
35
|
"vee-validate": "^4.8.6",
|
|
36
36
|
"vue-router": "^4.1.6",
|
|
37
|
-
"vue3-apexcharts": "^1.4.4"
|
|
37
|
+
"vue3-apexcharts": "^1.4.4",
|
|
38
|
+
"vue": "^3.2.45"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@tailwindcss/forms": "^0.5.3",
|
|
@@ -1,59 +1,89 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
import { toRefs, ref, computed } from 'vue'
|
|
3
|
+
import EpModal from '../interactions/EpModal.vue'
|
|
4
|
+
import EpIcon from '../basics/EpIcon.vue'
|
|
5
|
+
import { mdiArrowExpandAll } from '@mdi/js';
|
|
6
|
+
import { useRenderText } from "../../composables/useRenderText";
|
|
7
|
+
const Cols = [
|
|
8
|
+
'basis-6/12',
|
|
9
|
+
'basis-1/12',
|
|
10
|
+
'basis-2/12',
|
|
11
|
+
'basis-3/12',
|
|
12
|
+
'basis-4/12',
|
|
13
|
+
'basis-5/12',
|
|
14
|
+
'basis-6/12',
|
|
15
|
+
'basis-7/12',
|
|
16
|
+
'basis-8/12',
|
|
17
|
+
'basis-9/12',
|
|
18
|
+
'basis-10/12',
|
|
19
|
+
'basis-11/12',
|
|
20
|
+
'basis-12/12',
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
interface Props {
|
|
24
|
+
src: string;
|
|
25
|
+
alt?: string;
|
|
26
|
+
height?: string | number;
|
|
27
|
+
width?: string | number;
|
|
28
|
+
thumbnail?: boolean;
|
|
29
|
+
caption?: string;
|
|
30
|
+
bib?: string;
|
|
31
|
+
title?: string,
|
|
32
|
+
gallery?: boolean
|
|
33
|
+
cols?: string | number //posible type à venir => basis-1/12... basis-11/12 to basis-full
|
|
18
34
|
}
|
|
19
35
|
|
|
20
|
-
const props = withDefaults(defineProps<Props>(),{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
37
|
+
alt: "Image snfas",
|
|
38
|
+
cols: "basis-6/12",
|
|
39
|
+
thumbnail: false,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const renderCols = computed(() => {
|
|
43
|
+
return Cols[+props.cols]
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const renderBib = computed(()=>{
|
|
47
|
+
if(props.bib){
|
|
48
|
+
return useRenderText(props.bib)
|
|
49
|
+
}
|
|
50
|
+
return ""
|
|
24
51
|
})
|
|
25
52
|
|
|
26
53
|
const showModal = ref<boolean>(false)
|
|
27
54
|
|
|
28
|
-
const {src, alt, title, caption, thumbnail, bib
|
|
55
|
+
const { src, alt, title, caption, thumbnail, bib } = toRefs(props)
|
|
29
56
|
|
|
30
57
|
</script>
|
|
31
58
|
|
|
32
59
|
<template>
|
|
33
60
|
<div v-if="!thumbnail" class="flex">
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<div class="px-4 py-2">
|
|
37
|
-
<h2 class="text-2xl font-bold">{{title}}</h2>
|
|
38
|
-
<p class="text-gray-500 text-sm">{{caption}}</p>
|
|
39
|
-
<
|
|
61
|
+
<div :class="`mx-auto bg-white rounded-md overflow-hidden shadow-md ${renderCols}`">
|
|
62
|
+
<img class="object-cover object-center w-full" :src="src" :alt="alt" @click="showModal = true">
|
|
63
|
+
<div class="px-4 py-2" v-if="title || caption || bib">
|
|
64
|
+
<h2 class="text-2xl font-bold">{{ title }}</h2>
|
|
65
|
+
<p class="text-gray-500 text-sm mt-4">{{ caption }}</p>
|
|
66
|
+
<div class="text-gray-700 mt-4" v-html="renderBib"></div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div v-if="thumbnail" class="relative group inline-block m-2">
|
|
71
|
+
<img class="w-36 h-36 object-cover object-center group-hover:opacity-30 " :src="src" :alt="alt">
|
|
72
|
+
<div
|
|
73
|
+
class="absolute top-0 left-0 w-36 h-36 bg-black opacity-0 transition-opacity duration-300 group-hover:opacity-30 cursor-pointer"
|
|
74
|
+
@click="showModal = true">
|
|
75
|
+
<div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-white text-center">
|
|
76
|
+
<EpIcon :icon-path="mdiArrowExpandAll"></EpIcon>
|
|
40
77
|
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
<div v-if="thumbnail" class="relative group inline-block m-2">
|
|
44
|
-
<img class="w-36 h-36 object-cover object-center group-hover:opacity-50 " :src="src" :alt="alt" >
|
|
45
|
-
<div class="absolute top-0 left-0 w-36 h-36 bg-black opacity-0 transition-opacity duration-300 group-hover:opacity-50 cursor-pointer" @click="showModal = true">
|
|
46
|
-
<div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-white text-center">
|
|
47
|
-
<EpIcon :icon-path="mdiArrowExpandAll"></EpIcon>
|
|
48
|
-
</div>
|
|
49
78
|
</div>
|
|
50
|
-
|
|
79
|
+
</div>
|
|
51
80
|
<EpModal v-model="showModal">
|
|
52
81
|
<img class="object-cover object-center h-5/6 w-5/6 mx-auto" :src="src" :alt="alt">
|
|
53
|
-
<div class="px-4 py-2">
|
|
54
|
-
<h2 class="text-2xl font-bold">{{title}}</h2>
|
|
55
|
-
<p class="text-gray-500 text-sm">{{caption}}</p>
|
|
56
|
-
|
|
82
|
+
<div class="px-4 py-2" v-if="thumbnail">
|
|
83
|
+
<h2 class="text-2xl font-bold">{{ title }}</h2>
|
|
84
|
+
<p class="text-gray-500 text-sm mt-4">{{ caption }}</p>
|
|
85
|
+
<div class="text-gray-700 mt-4" v-html="renderBib"></div>
|
|
86
|
+
</div>
|
|
57
87
|
</EpModal>
|
|
58
88
|
</template>
|
|
59
89
|
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, defineComponent } from 'vue';
|
|
2
|
+
import { computed, defineComponent, toRefs } from 'vue';
|
|
3
3
|
import { isHtml } from '../../composables/isHtml';
|
|
4
4
|
import {useMarkdown} from '../../composables/useMarkdown'
|
|
5
5
|
import EpTerm from '../medias/EpTerm.vue'
|
|
6
|
+
import EpAccordeon from '../interactions/EpAccordeon.vue';
|
|
7
|
+
|
|
6
8
|
interface Props {
|
|
7
9
|
glossary?:any[];
|
|
8
10
|
content:string;
|
|
9
|
-
title?:string;
|
|
11
|
+
title?:string|null;
|
|
10
12
|
compact?:boolean;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
const props = withDefaults(defineProps<Props>(),{
|
|
15
|
+
const props = withDefaults(defineProps<Props>(),{
|
|
16
|
+
compact:false
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const renderTitle = computed(()=>{
|
|
20
|
+
if(!props.title){
|
|
21
|
+
return "En savoir plus"
|
|
22
|
+
}
|
|
23
|
+
return props.title
|
|
24
|
+
})
|
|
14
25
|
|
|
15
26
|
const renderText = computed(()=>{
|
|
16
27
|
if(!isHtml(props.content)){
|
|
@@ -75,11 +86,14 @@ const customRenderStringComponents = defineComponent({
|
|
|
75
86
|
template:renderText.value
|
|
76
87
|
})
|
|
77
88
|
|
|
78
|
-
|
|
89
|
+
const {compact} = toRefs(props)
|
|
79
90
|
|
|
80
91
|
</script>
|
|
81
92
|
|
|
82
93
|
<template>
|
|
83
|
-
<component :is="customRenderStringComponents"></component>
|
|
94
|
+
<component v-if="!compact" :is="customRenderStringComponents"></component>
|
|
95
|
+
<EpAccordeon outlined :title="renderTitle" v-else>
|
|
96
|
+
<component :is="customRenderStringComponents"></component>
|
|
97
|
+
</EpAccordeon>
|
|
84
98
|
<!-- <component v-else :is="renderText"></component> -->
|
|
85
99
|
</template>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { toRefs, computed, useSlots } from "vue";
|
|
3
3
|
//types with capital letter, object styles in lowercase
|
|
4
4
|
import { MediaVariants, mediaVariants } from "../../types/Medias";
|
|
5
|
+
import { MandateLevel } from "../../types/MandateLevel";
|
|
5
6
|
import EpIcon from "../basics/EpIcon.vue";
|
|
6
7
|
import EpDivider from "../basics/EpDivider.vue";
|
|
7
8
|
import EpChip from "../basics/EpChip.vue";
|
|
@@ -13,7 +14,7 @@ interface Props {
|
|
|
13
14
|
title?: string | null;
|
|
14
15
|
subtitle?: string | null;
|
|
15
16
|
icon?: string;
|
|
16
|
-
mandateLevel?:string|null;
|
|
17
|
+
mandateLevel?:string | MandateLevel | null;
|
|
17
18
|
synchrone?: boolean;
|
|
18
19
|
type?: MediaVariants;
|
|
19
20
|
intentions?: string;
|
|
@@ -56,11 +57,18 @@ const bottomBarStyle = computed(() => {
|
|
|
56
57
|
|
|
57
58
|
const containerStyle = computed(()=>{
|
|
58
59
|
if(hasActions.value || hasIntentions.value || props.title){
|
|
59
|
-
return `rounded-lg overflow-hidden ${props.flat?'':'shadow-md'} flex flex-col justify-between`
|
|
60
|
+
return `rounded-lg overflow-hidden ${props.flat?'':'shadow-md'} flex flex-col justify-between h-full`
|
|
60
61
|
}
|
|
61
62
|
return `flex flex-col justify-between`
|
|
62
63
|
})
|
|
63
64
|
|
|
65
|
+
const renderMandateLevel = computed(()=>{
|
|
66
|
+
if(typeof props.mandateLevel === "object"){
|
|
67
|
+
return props.mandateLevel?.title
|
|
68
|
+
}
|
|
69
|
+
return props.mandateLevel
|
|
70
|
+
})
|
|
71
|
+
|
|
64
72
|
// type, taxonomyLevel, courseCode, courseTitle, title, subtitle, height, src, color, synchrone
|
|
65
73
|
|
|
66
74
|
const { title, hideIcon } = toRefs(props);
|
|
@@ -71,7 +79,7 @@ const { title, hideIcon } = toRefs(props);
|
|
|
71
79
|
<div :class="`${topBarStyle}`" v-if="title || mandateLevel">
|
|
72
80
|
<!-- <EpIcon :size="24" :icon-path="mdiBookOpenVariant"></EpIcon> -->
|
|
73
81
|
<h3><EpIcon v-if="!hideIcon" :iconPath="renderIcon" size="24"></EpIcon> <span class="font-bold align-middle">{{ title }}</span></h3>
|
|
74
|
-
<EpScope v-if="mandateLevel" :title="
|
|
82
|
+
<EpScope v-if="mandateLevel" :title="renderMandateLevel"></EpScope>
|
|
75
83
|
</div>
|
|
76
84
|
<div class="px-5">
|
|
77
85
|
<div class="py-2" v-if="hasIntentions">
|
|
@@ -5,6 +5,7 @@ import EpBtn from "../basics/EpBtn.vue";
|
|
|
5
5
|
import DisplayBox from "../tools/DisplayBox.vue";
|
|
6
6
|
import EpEdu from "./EpEdu.vue";
|
|
7
7
|
import { MediaVariants } from "../../types/Medias";
|
|
8
|
+
import { MandateLevel } from '../../types/MandateLevel';
|
|
8
9
|
import { useRenderText } from "../../composables/useRenderText";
|
|
9
10
|
import { mdiBookmarkBox } from "@mdi/js";
|
|
10
11
|
import { mdiBookOpenVariant } from "@mdi/js";
|
|
@@ -19,8 +20,8 @@ interface Props {
|
|
|
19
20
|
title: string | null;
|
|
20
21
|
container?: string; /// is publication complete
|
|
21
22
|
editor?: string;
|
|
22
|
-
pages?: string;
|
|
23
|
-
mandateLevel?: string;
|
|
23
|
+
pages?: string|string[];
|
|
24
|
+
mandateLevel?: string | MandateLevel | null;
|
|
24
25
|
intentions?: string;
|
|
25
26
|
compact?: boolean;
|
|
26
27
|
more?: boolean;
|
|
@@ -50,9 +51,10 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
const old_image = "https://live.staticflickr.com/4868/45940268562_c5f7fdd06b_q.jpg";
|
|
54
|
+
const bad_image = "https://farm5.staticflickr.com/4868/45940268562_9452f09a61_o.png"
|
|
53
55
|
|
|
54
56
|
const hasCover = computed(() => {
|
|
55
|
-
if (props.cover === old_image || props.cover.trim().length === 0) {
|
|
57
|
+
if (props.cover === old_image || props.cover.trim().length === 0 || props.cover === bad_image) {
|
|
56
58
|
return false;
|
|
57
59
|
}
|
|
58
60
|
return true;
|
|
@@ -77,7 +79,8 @@ const {
|
|
|
77
79
|
editor,
|
|
78
80
|
pages,
|
|
79
81
|
type,
|
|
80
|
-
mandateLevel
|
|
82
|
+
mandateLevel,
|
|
83
|
+
url
|
|
81
84
|
} = toRefs(props);
|
|
82
85
|
</script>
|
|
83
86
|
|
|
@@ -86,7 +89,7 @@ const {
|
|
|
86
89
|
<template v-if="!hideCover">
|
|
87
90
|
<div
|
|
88
91
|
v-if="hasCover"
|
|
89
|
-
class="
|
|
92
|
+
class="h-96 w-full rounded-t-lg md:h-auto md:w-56 md:rounded-none md:rounded-l-lg flex justify-center items-center text-gray-300"
|
|
90
93
|
>
|
|
91
94
|
<img :src="cover" :alt="`image de la lecture ${title}`" />
|
|
92
95
|
</div>
|
|
@@ -133,7 +136,7 @@ const {
|
|
|
133
136
|
</div>
|
|
134
137
|
</template>
|
|
135
138
|
<template #actions>
|
|
136
|
-
<EpBtn :color="type=='base'?'text-gray-700':'text-white'" :type="type">LIRE</EpBtn>
|
|
139
|
+
<EpBtn :color="type=='base'?'text-gray-700':'text-white'" :type="type" :href="url" v-if="url">LIRE</EpBtn>
|
|
137
140
|
</template>
|
|
138
141
|
</EpEdu>
|
|
139
142
|
</div>
|
|
@@ -223,7 +226,7 @@ const {
|
|
|
223
226
|
</div>
|
|
224
227
|
|
|
225
228
|
<div class="border-l p-5">
|
|
226
|
-
<EpBtn text>
|
|
229
|
+
<EpBtn text :href="url" v-if="url">
|
|
227
230
|
<EpIcon :size="20" :icon-path="mdiOpenInNew"></EpIcon> Lire
|
|
228
231
|
</EpBtn>
|
|
229
232
|
</div>
|
|
@@ -1,8 +1,71 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { defineAsyncComponent, computed, toRefs } from 'vue';
|
|
3
|
+
import { MandateLevel } from '../../types/MandateLevel';
|
|
4
|
+
import { useComponent } from '../../composables/useComponent';
|
|
5
|
+
import { MediaVariants } from "../../types/Medias";
|
|
6
|
+
interface Props {
|
|
7
|
+
pages?:string;
|
|
8
|
+
resource:any;
|
|
9
|
+
mandateLevel?: string | MandateLevel | null;
|
|
10
|
+
type?:MediaVariants
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
14
|
+
type:'base'
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const resourceInfo = computed(()=>{
|
|
18
|
+
if(!props.resource.hasOwnProperty('content')){
|
|
19
|
+
return "EpNothing"
|
|
20
|
+
}
|
|
21
|
+
//console.log(props.resource)
|
|
22
|
+
const typeRess = Object.keys(props.resource.content)[0]
|
|
23
|
+
const ress = Object.assign({}, props.resource.content[typeRess])
|
|
24
|
+
ress.pages = props.pages
|
|
25
|
+
ress.type = typeRess
|
|
26
|
+
if(typeRess === "clip"){
|
|
27
|
+
ress.src = ress.url
|
|
28
|
+
}
|
|
29
|
+
if(typeRess === "website"){
|
|
30
|
+
ress.href = ress.url
|
|
31
|
+
ress.label = ress.title
|
|
32
|
+
ress.title = null
|
|
33
|
+
}
|
|
34
|
+
if(typeRess === "book" && props.pages){
|
|
35
|
+
ress.intentions = props.pages
|
|
36
|
+
ress.pages = null
|
|
37
|
+
}
|
|
38
|
+
if(ress.version_link){
|
|
39
|
+
ress.url = ress.version_link.url
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return ress
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
//get Component asyncComponent
|
|
47
|
+
const getCompontent = (name:string|undefined)=> {
|
|
48
|
+
const componentToLoad = useComponent(name)
|
|
49
|
+
//console.log(componentToLoad)
|
|
50
|
+
if(componentToLoad.name === "EpNothing"){
|
|
51
|
+
return defineAsyncComponent(()=>import('../signages/EpNothing.vue'))
|
|
52
|
+
}
|
|
53
|
+
if(componentToLoad.name === "EpReading"){
|
|
54
|
+
return defineAsyncComponent(()=>import(`./EpReading.vue`))
|
|
55
|
+
}
|
|
56
|
+
return defineAsyncComponent(()=>import(`../${componentToLoad.path}/${componentToLoad.name}.vue`))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const {mandateLevel, type, pages} = toRefs(props)
|
|
60
|
+
|
|
2
61
|
</script>
|
|
3
62
|
|
|
4
63
|
<template>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
64
|
+
<component
|
|
65
|
+
:is="getCompontent(resourceInfo.type)"
|
|
66
|
+
v-bind="{ ...resourceInfo }"
|
|
67
|
+
:mandateLevel="mandateLevel"
|
|
68
|
+
:intentions="pages"
|
|
69
|
+
:type="type"
|
|
70
|
+
></component>
|
|
8
71
|
</template>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { toRefs } from "vue";
|
|
2
|
+
import { ref, toRefs, computed } from "vue";
|
|
3
3
|
//types with capital letter, object styles in lowercase
|
|
4
4
|
import EpChip from "../basics/EpChip.vue";
|
|
5
|
+
import { ChipBgVariant } from "../../types/Chip";
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
title?: string;
|
|
9
|
+
type?:string;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -12,7 +14,17 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
12
14
|
type: "base",
|
|
13
15
|
});
|
|
14
16
|
|
|
17
|
+
let renderMandate = ref<ChipBgVariant>('base')
|
|
15
18
|
|
|
19
|
+
const typeMandate = computed(()=>{
|
|
20
|
+
if(props.title.trim() === "Essentiel"){
|
|
21
|
+
return renderMandate.value = 'warning'
|
|
22
|
+
}
|
|
23
|
+
if(props.title.trim() === "Enrichissement"){
|
|
24
|
+
return renderMandate.value = 'info'
|
|
25
|
+
}
|
|
26
|
+
return renderMandate.value
|
|
27
|
+
})
|
|
16
28
|
|
|
17
29
|
//controls
|
|
18
30
|
//const controls = useMediaControls(video, {src:props.src})
|
|
@@ -21,5 +33,5 @@ const { title } = toRefs(props);
|
|
|
21
33
|
</script>
|
|
22
34
|
|
|
23
35
|
<template>
|
|
24
|
-
<EpChip size="small" type="
|
|
36
|
+
<EpChip size="small" :type="typeMandate">{{ title.trim() }}</EpChip>
|
|
25
37
|
</template>
|
|
@@ -54,6 +54,7 @@ const onChange = (event:Event) => {
|
|
|
54
54
|
<span>
|
|
55
55
|
|
|
56
56
|
<input
|
|
57
|
+
class="cursor-pointer"
|
|
57
58
|
type="radio"
|
|
58
59
|
:id="labelFor"
|
|
59
60
|
:name="labelFor"
|
|
@@ -64,7 +65,7 @@ const onChange = (event:Event) => {
|
|
|
64
65
|
:checked="isChecked"
|
|
65
66
|
@change="onChange"
|
|
66
67
|
/>
|
|
67
|
-
<label :for="labelFor" class="disabled:opacity-40">{{
|
|
68
|
+
<label :for="labelFor" class="disabled:opacity-40 cursor-pointer">{{
|
|
68
69
|
label
|
|
69
70
|
}}</label>
|
|
70
71
|
|
|
@@ -1,8 +1,180 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { watch, ref, toRefs, computed, defineAsyncComponent} from "vue";
|
|
3
|
+
import EpEdu from "../educationals/EpEdu.vue";
|
|
4
|
+
//types with capital letter, object styles in lowercase
|
|
5
|
+
import { MediaVariants } from "../../types/Medias";
|
|
6
|
+
import { Answer } from "../../types/Answer";
|
|
7
|
+
import { useRenderText } from "../../composables/useRenderText";
|
|
8
|
+
import { useComponent } from "../../composables/useComponent"
|
|
9
|
+
import { mdiHelpCircle } from "@mdi/js";
|
|
10
|
+
import EpImg from "../basics/EpImg.vue";
|
|
11
|
+
import EpRadio from "../forms/EpRadio.vue";
|
|
12
|
+
import EpBtn from "../basics/EpBtn.vue";
|
|
13
|
+
import EpAlert from "../signages/EpAlert.vue";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
title?: string;
|
|
19
|
+
intentions?: string;
|
|
20
|
+
hideIcon?: boolean;
|
|
21
|
+
type?: MediaVariants;
|
|
22
|
+
mandateLevel?: string | null;
|
|
23
|
+
question: string;
|
|
24
|
+
answers: Answer[];
|
|
25
|
+
shuffle?: boolean;
|
|
26
|
+
before?: boolean;
|
|
27
|
+
numeration?: boolean;
|
|
28
|
+
src?: string | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
32
|
+
type: "base",
|
|
33
|
+
hideIcon: false,
|
|
34
|
+
shuffle: true,
|
|
35
|
+
before: false,
|
|
36
|
+
numeration: false,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const renderText = computed(() => {
|
|
40
|
+
if (!props.intentions) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return useRenderText(props.intentions);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//shuffle and list
|
|
47
|
+
const shuffleAnswers = computed(() => {
|
|
48
|
+
const array = props.answers;
|
|
49
|
+
if (props.shuffle) {
|
|
50
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
51
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
52
|
+
const temp = array[i];
|
|
53
|
+
array[i] = array[j];
|
|
54
|
+
array[j] = temp;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return array;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const alphabet = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"];
|
|
61
|
+
const typeList = (index:number) => {
|
|
62
|
+
if (props.numeration) {
|
|
63
|
+
return alphabet[index];
|
|
64
|
+
}
|
|
65
|
+
return index + 1;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
///user answer
|
|
69
|
+
const userAnswer = ref("");
|
|
70
|
+
const answered = ref(false);
|
|
71
|
+
const valid = ref(true);
|
|
72
|
+
const response = ref<Answer>({type:'warning', text:'no found', component:null, feedback:""})
|
|
73
|
+
const checkAnswer = () => {
|
|
74
|
+
if (userAnswer.value === "") {
|
|
75
|
+
valid.value = false;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const valuesAnswer = props.answers.find(x => x.uid === userAnswer.value)
|
|
79
|
+
if(!valuesAnswer){
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
response.value = valuesAnswer!
|
|
83
|
+
answered.value = true;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const reset = () => {
|
|
87
|
+
answered.value = false;
|
|
88
|
+
userAnswer.value = ""
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
watch(userAnswer, (val) => {
|
|
92
|
+
if (val !== "") {
|
|
93
|
+
valid.value = true;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
//get Component asyncComponent
|
|
98
|
+
const getCompontent = (name:string|undefined)=> {
|
|
99
|
+
const componentToLoad = useComponent(name)
|
|
100
|
+
//console.log(componentToLoad)
|
|
101
|
+
if(componentToLoad.name === "EpNothing"){
|
|
102
|
+
return defineAsyncComponent(()=>import('../signages/EpNothing.vue'))
|
|
103
|
+
}
|
|
104
|
+
return defineAsyncComponent(()=>import(`../${componentToLoad.path}/${componentToLoad.name}.vue`))
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//returned values from props
|
|
108
|
+
const { title, intentions, hideIcon, question, src } = toRefs(props);
|
|
109
|
+
|
|
2
110
|
</script>
|
|
3
111
|
|
|
4
112
|
<template>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
113
|
+
<EpEdu
|
|
114
|
+
:title="title"
|
|
115
|
+
:type="type"
|
|
116
|
+
:hideIcon="hideIcon"
|
|
117
|
+
:icon="mdiHelpCircle"
|
|
118
|
+
:mandateLevel="mandateLevel"
|
|
119
|
+
>
|
|
120
|
+
<template #intentions v-if="renderText">
|
|
121
|
+
<div v-html="renderText"></div>
|
|
122
|
+
</template>
|
|
123
|
+
<template #content>
|
|
124
|
+
<div class="mt-5">
|
|
125
|
+
<EpImg
|
|
126
|
+
v-if="src && before"
|
|
127
|
+
:src="src"
|
|
128
|
+
:alt="`Image soutien à la question`"
|
|
129
|
+
cols="5"
|
|
130
|
+
/>
|
|
131
|
+
<div v-html="useRenderText(question)" class="my-6"></div>
|
|
132
|
+
<EpImg
|
|
133
|
+
v-if="src && !before"
|
|
134
|
+
:src="src"
|
|
135
|
+
:alt="`Image soutien à la question`"
|
|
136
|
+
cols="5"
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<div class="mb-6">
|
|
140
|
+
<ol>
|
|
141
|
+
<li v-for="(answer, i) in answers" class="mb-2" :key="answer.uid">
|
|
142
|
+
<EpRadio
|
|
143
|
+
:label="`${typeList(i)}. ${answer.text}`"
|
|
144
|
+
v-model="userAnswer"
|
|
145
|
+
:value="answer.uid"
|
|
146
|
+
:disabled="answered"
|
|
147
|
+
></EpRadio>
|
|
148
|
+
</li>
|
|
149
|
+
</ol>
|
|
150
|
+
<EpAlert type="error" outlined noIcon v-if="!valid">
|
|
151
|
+
Veuillez choisir une réponse
|
|
152
|
+
</EpAlert>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div v-if="answered">
|
|
156
|
+
<EpAlert :type="response.type" outlined>
|
|
157
|
+
<div v-html="useRenderText(response.feedback)"></div>
|
|
158
|
+
</EpAlert>
|
|
159
|
+
|
|
160
|
+
<div v-if="response.component">
|
|
161
|
+
<component :is="getCompontent(response.component.type)" v-bind="{ ...response.component.data }"></component>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<EpBtn
|
|
166
|
+
:type="type"
|
|
167
|
+
@click="checkAnswer"
|
|
168
|
+
:disabled="answered"
|
|
169
|
+
outlined
|
|
170
|
+
extraClass="mr-2"
|
|
171
|
+
>Valider</EpBtn
|
|
172
|
+
>
|
|
173
|
+
<EpBtn :type="type" v-if="answered" @click="reset" outlined>Réessayer</EpBtn>
|
|
174
|
+
</div>
|
|
175
|
+
</template>
|
|
176
|
+
<!-- <template #actions>
|
|
177
|
+
<EpBtn :color="type=='base'?'text-gray-700':'text-white'" :type="type">[Repair btn style... to change]</EpBtn>
|
|
178
|
+
</template> -->
|
|
179
|
+
</EpEdu>
|
|
180
|
+
</template>
|