ep-lib-ts 0.1.8 → 0.1.10

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 (90) hide show
  1. package/dist/BgAudio-7556351b.js +5 -0
  2. package/dist/DisplayBox-15403c71.js +5 -0
  3. package/dist/EpAlert-2abc116f.js +5 -0
  4. package/dist/EpAudio-5c9dfb92.js +5 -0
  5. package/dist/EpBadge-234518b2.js +5 -0
  6. package/dist/EpBarChart-ce79ce3d.js +5 -0
  7. package/dist/EpBtn-3512ca60.js +5 -0
  8. package/dist/EpCard-84819b25.js +5 -0
  9. package/dist/EpCheckbox-fe632df9.js +36 -0
  10. package/dist/EpChip-f91aa662.js +5 -0
  11. package/dist/EpDivider-13d648fa.js +5 -0
  12. package/dist/EpEdu-fe8bc9f2.js +5 -0
  13. package/dist/EpFlex-c87197a7.js +5 -0
  14. package/dist/EpHeader-61c8da9f.js +5 -0
  15. package/dist/EpIcon-c85eaee3.js +5 -0
  16. package/dist/EpIframe-06bf6ef4.js +5 -0
  17. package/dist/EpImg-dc60d288.js +5 -0
  18. package/dist/EpInput-e2cd96a6.js +1171 -0
  19. package/dist/EpLineChart-76eb8203.js +5 -0
  20. package/dist/EpLink-ae95b58b.js +5 -0
  21. package/dist/EpModal-9acbf67e.js +5 -0
  22. package/dist/EpNothing-9a8a563a.js +10 -0
  23. package/dist/EpQuestion-e24fa1e7.js +5 -0
  24. package/dist/EpQuote-82683817.js +5 -0
  25. package/dist/EpRadio-6bb393b5.js +5 -0
  26. package/dist/EpReading-725ce633.js +5 -0
  27. package/dist/EpResource-3487f005.js +5 -0
  28. package/dist/EpScope-87682f54.js +5 -0
  29. package/dist/EpSection-826799f7.js +5 -0
  30. package/dist/EpSelect-39d82b2a.js +31 -0
  31. package/dist/EpSoftware-b616d8f4.js +5 -0
  32. package/dist/EpSpinner-b1c988e5.js +5 -0
  33. package/dist/EpSwitch-1eaf9d3f.js +44 -0
  34. package/dist/EpTable-fd10d6c4.js +5 -0
  35. package/dist/EpTerm-6a339de4.js +5 -0
  36. package/dist/EpText-75b4c821.js +5 -0
  37. package/dist/EpTextarea-67f751e9.js +41 -0
  38. package/dist/EpToggle-9755056a.js +44 -0
  39. package/dist/EpVideo-981c8f8d.js +5 -0
  40. package/dist/EpVideoPanopto-928e60df.js +5 -0
  41. package/dist/components/basics/EpSpinner.vue.d.ts +9 -0
  42. package/dist/components/basics/EpText.vue.d.ts +13 -9
  43. package/dist/components/educationals/EpEdu.vue.d.ts +3 -2
  44. package/dist/components/educationals/EpReading.vue.d.ts +5 -4
  45. package/dist/components/educationals/EpResource.vue.d.ts +34 -1
  46. package/dist/components/educationals/EpScope.vue.d.ts +9 -0
  47. package/dist/components/forms/EpCheckbox.vue.d.ts +72 -0
  48. package/dist/components/forms/EpInput.vue.d.ts +98 -0
  49. package/dist/components/forms/EpRadio.vue.d.ts +69 -0
  50. package/dist/components/forms/EpSelect.vue.d.ts +83 -0
  51. package/dist/components/forms/EpSwitch.vue.d.ts +81 -0
  52. package/dist/components/forms/EpTextarea.vue.d.ts +90 -0
  53. package/dist/components/forms/EpToggle.vue.d.ts +81 -0
  54. package/dist/components/interactions/EpQuestion.vue.d.ts +90 -1
  55. package/dist/components/medias/EpAudio.vue.d.ts +3 -8
  56. package/dist/components/medias/EpCarousel.vue.d.ts +2 -2
  57. package/dist/components/medias/EpLink.vue.d.ts +3 -2
  58. package/dist/components/medias/EpSoftware.vue.d.ts +3 -2
  59. package/dist/components/medias/EpVideo.vue.d.ts +3 -2
  60. package/dist/components/medias/EpVideoPanopto.vue.d.ts +3 -2
  61. package/dist/components/signages/EpAlert.vue.d.ts +10 -3
  62. package/dist/components/signages/EpNothing.vue.d.ts +2 -0
  63. package/dist/components/signages/EpQuote.vue.d.ts +9 -9
  64. package/dist/composables/useComponent.d.ts +6 -0
  65. package/dist/ep-lib-ts.js +41 -18489
  66. package/dist/ep-lib-ts.umd.cjs +42 -38
  67. package/dist/index-761c8157.js +18795 -0
  68. package/dist/style.css +1 -1
  69. package/dist/types/Answer.d.ts +15 -0
  70. package/dist/types/MandateLevel.d.ts +5 -0
  71. package/package.json +3 -2
  72. package/src/components/basics/EpCard.vue +1 -1
  73. package/src/components/basics/EpImg.vue +70 -40
  74. package/src/components/basics/EpSpinner.vue +35 -25
  75. package/src/components/basics/EpText.vue +19 -5
  76. package/src/components/educationals/EpEdu.vue +11 -3
  77. package/src/components/educationals/EpReading.vue +10 -7
  78. package/src/components/educationals/EpResource.vue +66 -3
  79. package/src/components/educationals/EpScope.vue +14 -2
  80. package/src/components/forms/EpRadio.vue +2 -1
  81. package/src/components/interactions/EpQuestion.vue +176 -4
  82. package/src/components/medias/EpAudio.vue +2 -2
  83. package/src/components/medias/EpCarousel.vue +10 -10
  84. package/src/components/medias/EpLink.vue +2 -1
  85. package/src/components/medias/EpSoftware.vue +4 -4
  86. package/src/components/medias/EpVideo.vue +7 -3
  87. package/src/components/medias/EpVideoPanopto.vue +2 -1
  88. package/src/components/signages/EpAlert.vue +19 -4
  89. package/src/components/signages/EpNothing.vue +5 -0
  90. package/src/components/signages/EpQuote.vue +23 -19
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .modal-mask{position:fixed;z-index:9998;top:0;left:0;width:100%;height:100%;background-color:#00000080;display:flex;transition:opacity .3s ease}.modal-container{margin:auto;transition:all .3s ease;z-index:9999}.modal-header h3{margin-top:0;color:#42b983}.modal-body{margin:20px 0}.modal-default-button{float:right}.modal-enter-from,.modal-leave-to{opacity:0}.modal-enter-from .modal-container,.modal-leave-to .modal-container{transform:scale(1.1)}.content[data-v-69793e45]{max-height:0;overflow:hidden}.v-enter-active[data-v-ecd9b088],.v-leave-active[data-v-ecd9b088]{transition:opacity .5s ease}.v-enter-from[data-v-ecd9b088],.v-leave-to[data-v-ecd9b088]{opacity:0}.katex[data-v-24ff8b28]{font-size:1.3em}
1
+ .modal-mask{position:fixed;z-index:9998;top:0;left:0;width:100%;height:100%;background-color:#00000080;display:flex;transition:opacity .3s ease}.modal-container{margin:auto;transition:all .3s ease;z-index:9999}.modal-header h3{margin-top:0;color:#42b983}.modal-body{margin:20px 0}.modal-default-button{float:right}.modal-enter-from,.modal-leave-to{opacity:0}.modal-enter-from .modal-container,.modal-leave-to .modal-container{transform:scale(1.1)}.content[data-v-69793e45]{max-height:0;overflow:hidden}.v-enter-active[data-v-7d48941b],.v-leave-active[data-v-7d48941b]{transition:opacity .5s ease}.v-enter-from[data-v-7d48941b],.v-leave-to[data-v-7d48941b]{opacity:0}.katex[data-v-24ff8b28]{font-size:1.3em}
@@ -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 {};
@@ -0,0 +1,5 @@
1
+ export interface MandateLevel {
2
+ color: string;
3
+ title: string;
4
+ value: string;
5
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep-lib-ts",
3
3
  "private": false,
4
- "version": "0.1.8",
4
+ "version": "0.1.10",
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",
@@ -48,7 +48,7 @@ const borderColor = computed(() => {
48
48
 
49
49
  const bgColor = computed(() => {
50
50
  if(props.color && !props.outlined){
51
- return `${useColors('bg', props.color)} text-white`
51
+ return `${useColors('bg', props.color)}`
52
52
  }
53
53
  return `bg-white text-black`
54
54
  })
@@ -1,59 +1,89 @@
1
1
  <script setup lang="ts">
2
- import {toRefs, ref} from 'vue'
3
- import EpModal from '../interactions/EpModal.vue'
4
- import EpIcon from '../basics/EpIcon.vue'
5
- import { mdiArrowExpandAll } from '@mdi/js';
6
-
7
- interface Props{
8
- src:string;
9
- alt?:string;
10
- height?:string | number;
11
- width?:string | number;
12
- thumbnail?:boolean;
13
- caption?:string;
14
- bib?:string;
15
- title?:string,
16
- gallery?:boolean
17
- cols?:string|number //posible type à venir => basis-1/12... basis-11/12 to basis-full
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
- alt:"Image snfas",
22
- cols:"basis-4/12",
23
- thumbnail:false,
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, cols} = toRefs(props)
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
- <div :class="`mx-auto bg-white rounded-md overflow-hidden shadow-md ${cols}`">
35
- <img class="object-cover object-center w-full" :src="src" :alt="alt" @click="showModal = true">
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
- <p class="text-gray-700 mt-4">{{bib}}</p>
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
- </div>
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
- </div>
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
 
@@ -4,44 +4,54 @@ import useColors from '../../composables/useColors';
4
4
  interface Props {
5
5
  color?: string;
6
6
  dots?: boolean;
7
- size?:number
7
+ size?: number
8
+ inline?: boolean
8
9
  }
9
10
 
10
11
  const props = withDefaults(defineProps<Props>(), {
11
12
  color: 'primary',
12
13
  dots: false,
13
- size:46
14
+ size: 46,
15
+ inline:false
14
16
  })
15
17
 
16
18
  const currentColor = computed(() => {
17
19
  return useColors('fill', props.color)
18
20
  })
19
21
 
22
+ const styles = computed(()=>{
23
+ return props.inline?'':'flex flex-row w-full h-screen items-center justify-center'
24
+ })
25
+
20
26
  </script>
21
27
 
22
28
  <template>
23
- <svg v-if="!dots" xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" class="inline" viewBox="0 0 32 32" >
24
- <path :class="currentColor" fill="currentColor"
25
- d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"></path>
26
- <path :class="currentColor" fill="currentColor"
27
- d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z">
28
- <animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate"
29
- values="0 12 12;360 12 12">
30
- </animateTransform>
31
- </path>
32
- </svg>
33
- <svg v-else xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" class="inline" viewBox="0 0 32 32" >
34
- <g>
35
- <circle cx="12" cy="2.5" r="1.5" :class="currentColor" fill="currentColor" opacity=".14" />
36
- <circle cx="16.75" cy="3.77" r="1.5" :class="currentColor" fill="currentColor" opacity=".29" />
37
- <circle cx="20.23" cy="7.25" r="1.5" :class="currentColor" fill="currentColor" opacity=".43" />
38
- <circle cx="21.5" cy="12" r="1.5" :class="currentColor" fill="currentColor" opacity=".57" />
39
- <circle cx="20.23" cy="16.75" r="1.5" :class="currentColor" fill="currentColor" opacity=".71" />
40
- <circle cx="16.75" cy="20.23" r="1.5" :class="currentColor" fill="currentColor" opacity=".86" />
41
- <circle cx="12" cy="21.5" r="1.5" :class="currentColor" fill="currentColor" />
42
- <animateTransform attributeName="transform" calcMode="discrete" dur="0.75s" repeatCount="indefinite" type="rotate"
43
- values="0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12" />
44
- </g>
45
- </svg></template>
29
+ <div :class="styles">
30
+ <svg v-if="!dots" xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" class="inline" viewBox="0 0 32 32">
31
+ <path :class="currentColor" fill="currentColor"
32
+ d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"></path>
33
+ <path :class="currentColor" fill="currentColor"
34
+ d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z">
35
+ <animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate"
36
+ values="0 12 12;360 12 12">
37
+ </animateTransform>
38
+ </path>
39
+ </svg>
40
+ <svg v-else xmlns="http://www.w3.org/2000/svg" :width="size" :height="size" class="inline" viewBox="0 0 32 32">
41
+ <g>
42
+ <circle cx="12" cy="2.5" r="1.5" :class="currentColor" fill="currentColor" opacity=".14" />
43
+ <circle cx="16.75" cy="3.77" r="1.5" :class="currentColor" fill="currentColor" opacity=".29" />
44
+ <circle cx="20.23" cy="7.25" r="1.5" :class="currentColor" fill="currentColor" opacity=".43" />
45
+ <circle cx="21.5" cy="12" r="1.5" :class="currentColor" fill="currentColor" opacity=".57" />
46
+ <circle cx="20.23" cy="16.75" r="1.5" :class="currentColor" fill="currentColor" opacity=".71" />
47
+ <circle cx="16.75" cy="20.23" r="1.5" :class="currentColor" fill="currentColor" opacity=".86" />
48
+ <circle cx="12" cy="21.5" r="1.5" :class="currentColor" fill="currentColor" />
49
+ <animateTransform attributeName="transform" calcMode="discrete" dur="0.75s" repeatCount="indefinite"
50
+ type="rotate"
51
+ values="0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12" />
52
+ </g>
53
+ </svg>
54
+ </div>
55
+ </template>
46
56
 
47
57
 
@@ -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
- //const {content} = toRefs(props)
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="mandateLevel"></EpScope>
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="bg-primary 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"
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
- <div class="p-12 bg-warning-light w-[50%] mx-auto border-2 border-warning">
6
- <p class="text-center text-error font-bold uppercase">In progress</p>
7
- </div>
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="base">{{ title }}</EpChip>
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