ep-lib-ts 0.1.20 → 0.1.22
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-a0b0c0bc.js +5 -0
- package/dist/DisplayBox-ce954ea5.js +5 -0
- package/dist/EpAlert-48c0b8d3.js +5 -0
- package/dist/EpAudio-c87fb54c.js +5 -0
- package/dist/EpBadge-e36e0311.js +5 -0
- package/dist/EpBarChart-0b3c41dd.js +5 -0
- package/dist/EpBtn-458aa2af.js +5 -0
- package/dist/EpCard-e6513098.js +5 -0
- package/dist/{EpChip-fd468489.js → EpChip-dcbf1b88.js} +1 -1
- package/dist/EpContentSlider-e023011d.js +5 -0
- package/dist/EpDivider-8f16114c.js +5 -0
- package/dist/EpEdu-8ec843b8.js +5 -0
- package/dist/EpFlex-5e778228.js +5 -0
- package/dist/EpHeader-91a011f9.js +5 -0
- package/dist/{EpIcon-9dd2b039.js → EpIcon-12cecce8.js} +1 -1
- package/dist/EpIframe-e82e430f.js +5 -0
- package/dist/EpImg-4a75e8d5.js +5 -0
- package/dist/{EpInput-556ab6fe.js → EpInput-b7318ba9.js} +1 -1
- package/dist/EpLineChart-44564e39.js +5 -0
- package/dist/EpLink-478701c6.js +5 -0
- package/dist/EpLinkVersion-8b5f4b36.js +5 -0
- package/dist/EpModal-a072bd3b.js +5 -0
- package/dist/{EpNothing-77b5a694.js → EpNothing-08a45d04.js} +1 -1
- package/dist/EpPieChart-f81c7c2d.js +5 -0
- package/dist/EpQuestion-1a8d99db.js +5 -0
- package/dist/EpQuote-df81eab9.js +5 -0
- package/dist/EpRadio-f4da17ca.js +5 -0
- package/dist/EpReading-0a248b77.js +5 -0
- package/dist/EpResource-c57348ff.js +5 -0
- package/dist/EpScope-55da81c6.js +5 -0
- package/dist/EpSection-d2980e78.js +5 -0
- package/dist/{EpSelect-1ffc465c.js → EpSelect-1b4f97c8.js} +1 -1
- package/dist/EpSoftware-7094663e.js +5 -0
- package/dist/EpSpinner-71532758.js +5 -0
- package/dist/EpSvg-7ce64a46.js +5 -0
- package/dist/EpTable-23ce766f.js +5 -0
- package/dist/EpTerm-917b4f88.js +5 -0
- package/dist/EpText-7e50857c.js +5 -0
- package/dist/EpTimeLine-927c2b65.js +5 -0
- package/dist/EpVideo-b1ad37d2.js +5 -0
- package/dist/EpVideoPanopto-14d794e2.js +5 -0
- package/dist/ep-lib-ts.js +1 -1
- package/dist/ep-lib-ts.umd.cjs +31 -31
- package/dist/{index-5bd6e63c.js → index-66861332.js} +3546 -3538
- package/package.json +1 -1
- package/src/components/basics/EpText.vue +93 -105
- package/dist/BgAudio-d9308f99.js +0 -5
- package/dist/DisplayBox-f17b28bc.js +0 -5
- package/dist/EpAlert-c5ccf377.js +0 -5
- package/dist/EpAudio-ee4175aa.js +0 -5
- package/dist/EpBadge-6fc0f5fc.js +0 -5
- package/dist/EpBarChart-d1bdc878.js +0 -5
- package/dist/EpBtn-010839a7.js +0 -5
- package/dist/EpCard-d67b77b2.js +0 -5
- package/dist/EpContentSlider-b1f27a7d.js +0 -5
- package/dist/EpDivider-ea7f1d1a.js +0 -5
- package/dist/EpEdu-74aed121.js +0 -5
- package/dist/EpFlex-232d7513.js +0 -5
- package/dist/EpHeader-1f6cca20.js +0 -5
- package/dist/EpIframe-a4082deb.js +0 -5
- package/dist/EpImg-7f4c35bd.js +0 -5
- package/dist/EpLineChart-822ceecf.js +0 -5
- package/dist/EpLink-c2a1a872.js +0 -5
- package/dist/EpLinkVersion-2bac33d5.js +0 -5
- package/dist/EpModal-1b4d1ff9.js +0 -5
- package/dist/EpPieChart-ad8576ca.js +0 -5
- package/dist/EpQuestion-94aa29de.js +0 -5
- package/dist/EpQuote-adfe2a2b.js +0 -5
- package/dist/EpRadio-53f60b1a.js +0 -5
- package/dist/EpReading-747f0ce9.js +0 -5
- package/dist/EpResource-c6662e5a.js +0 -5
- package/dist/EpScope-494ffdec.js +0 -5
- package/dist/EpSection-bdad41e4.js +0 -5
- package/dist/EpSoftware-2730a943.js +0 -5
- package/dist/EpSpinner-da2475b0.js +0 -5
- package/dist/EpSvg-a2ebcc93.js +0 -5
- package/dist/EpTable-0555285d.js +0 -5
- package/dist/EpTerm-87ed74e7.js +0 -5
- package/dist/EpText-7c29711c.js +0 -5
- package/dist/EpTimeLine-c85d470a.js +0 -5
- package/dist/EpVideo-fe865980.js +0 -5
- package/dist/EpVideoPanopto-f31cdb1e.js +0 -5
- package/dist/TextBloc-d81840e6.js +0 -13
- package/dist/components/tools/TextBloc.vue.d.ts +0 -9
- package/src/components/tools/TextBloc.vue +0 -10
package/package.json
CHANGED
|
@@ -1,121 +1,109 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed,
|
|
3
|
-
import { isHtml } from
|
|
4
|
-
import {useMarkdown} from
|
|
5
|
-
import EpAccordeon from
|
|
6
|
-
|
|
2
|
+
import { computed, toRefs, h, defineAsyncComponent } from "vue";
|
|
3
|
+
import { isHtml } from "../../composables/isHtml";
|
|
4
|
+
import { useMarkdown } from "../../composables/useMarkdown";
|
|
5
|
+
import EpAccordeon from "../interactions/EpAccordeon.vue";
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
interface Props {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
glossary?: any[];
|
|
10
|
+
content: string;
|
|
11
|
+
title?: string | null;
|
|
12
|
+
compact?: boolean;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
const props = withDefaults(defineProps<Props>(),{
|
|
17
|
-
compact:false,
|
|
18
|
-
})
|
|
15
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
16
|
+
compact: false,
|
|
17
|
+
});
|
|
19
18
|
|
|
20
|
-
const renderTitle = computed(()=>{
|
|
21
|
-
if(!props.title){
|
|
22
|
-
return "En savoir plus"
|
|
19
|
+
const renderTitle = computed(() => {
|
|
20
|
+
if (!props.title) {
|
|
21
|
+
return "En savoir plus";
|
|
23
22
|
}
|
|
24
|
-
return props.title
|
|
25
|
-
})
|
|
23
|
+
return props.title;
|
|
24
|
+
});
|
|
26
25
|
|
|
27
|
-
const renderText = computed(()=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
const term = _glossary.find(word => word.id === id)
|
|
58
|
-
//if was found
|
|
59
|
-
if(term){
|
|
60
|
-
///add the new values to the array
|
|
61
|
-
const word = item.outerHTML
|
|
62
|
-
//check if the term has relations
|
|
63
|
-
const foundedRelations = _glossary.filter((x) =>
|
|
64
|
-
x.relation.some((item:string) => {
|
|
65
|
-
return item == id;
|
|
66
|
-
})
|
|
67
|
-
);
|
|
68
|
-
//get relations id and term
|
|
69
|
-
const idsRelation = foundedRelations.map((x) => x.id);
|
|
70
|
-
const termsRelation = foundedRelations.map((x) => x.term);
|
|
71
|
-
const variation = term.variation
|
|
72
|
-
const hasImge = term.src ? term.src : ''
|
|
73
|
-
//const replaceWord = `<EpBtn :pts-data="{term:'${term.term}', definition:'${term.definition}', renderword:'${render_word}', graminfo:'${term.graminfo}', domain:'${term.domain}',variation:'${variation}', relations_names:'${termsRelation}', relations_ids:'${idsRelation}'}"></EpBtn>`
|
|
74
|
-
const replaceWord = ` <EpTerm term="${term.term}" word="${render_word}" variations="${variation}" graminfo="${term.graminfo}" src='${hasImge}' domain="${term.domain}" relations="${termsRelation}" idrelation="${idsRelation}"> ${term.definition} </EpTerm> `
|
|
75
|
-
//replace output string
|
|
76
|
-
newStr = newStr.replace(word, replaceWord)
|
|
77
|
-
}
|
|
78
|
-
})
|
|
26
|
+
const renderText = computed(() => {
|
|
27
|
+
if (!props.content) {
|
|
28
|
+
return `<div>no data</div>`;
|
|
29
|
+
}
|
|
30
|
+
if (!isHtml(props.content)) {
|
|
31
|
+
return useMarkdown(props.content);
|
|
32
|
+
}
|
|
33
|
+
//return props.content
|
|
34
|
+
//create a div
|
|
35
|
+
const div = document.createElement("DIV");
|
|
36
|
+
///add the html input to the div
|
|
37
|
+
div.innerHTML = props.content.trim();
|
|
38
|
+
///get strign of html
|
|
39
|
+
let newStr = div.outerHTML;
|
|
40
|
+
//find all span.ep_glossary_item to know the glossary terms in the text
|
|
41
|
+
const glossaryTerms = div.querySelectorAll(".ep_glossary_item");
|
|
42
|
+
// console.log(glossaryTerms)
|
|
43
|
+
//if find glossary terms
|
|
44
|
+
if (glossaryTerms.length > 0) {
|
|
45
|
+
///check every term and replace it
|
|
46
|
+
glossaryTerms.forEach((item) => {
|
|
47
|
+
//get id
|
|
48
|
+
const id = item.getAttribute("data-id");
|
|
49
|
+
//get content text
|
|
50
|
+
const render_word = item.innerHTML;
|
|
51
|
+
//find in the glossary their equivalent
|
|
52
|
+
let _glossary = [];
|
|
53
|
+
if (props.glossary) {
|
|
54
|
+
_glossary = props.glossary;
|
|
79
55
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
56
|
+
const term = _glossary.find((word) => word.id === id);
|
|
57
|
+
//if was found
|
|
58
|
+
if (term) {
|
|
59
|
+
///add the new values to the array
|
|
60
|
+
const word = item.outerHTML;
|
|
61
|
+
//check if the term has relations
|
|
62
|
+
const foundedRelations = _glossary.filter((x) =>
|
|
63
|
+
x.relation.some((item: string) => {
|
|
64
|
+
return item == id;
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
//get relations id and term
|
|
68
|
+
const idsRelation = foundedRelations.map((x) => x.id);
|
|
69
|
+
const termsRelation = foundedRelations.map((x) => x.term);
|
|
70
|
+
const variation = term.variation;
|
|
71
|
+
const hasImge = term.src ? term.src : "";
|
|
72
|
+
//const replaceWord = `<EpBtn :pts-data="{term:'${term.term}', definition:'${term.definition}', renderword:'${render_word}', graminfo:'${term.graminfo}', domain:'${term.domain}',variation:'${variation}', relations_names:'${termsRelation}', relations_ids:'${idsRelation}'}"></EpBtn>`
|
|
73
|
+
const replaceWord = ` <EpTerm term="${term.term}" word="${render_word}" variations="${variation}" graminfo="${term.graminfo}" src='${hasImge}' domain="${term.domain}" relations="${termsRelation}" idrelation="${idsRelation}"> ${term.definition} </EpTerm> `;
|
|
74
|
+
//replace output string
|
|
75
|
+
newStr = newStr.replace(word, replaceWord);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
div.innerHTML = newStr;
|
|
80
|
+
// console.log(div.innerHTML)
|
|
81
|
+
return div.innerHTML;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const render = () => {
|
|
85
|
+
const r = {
|
|
86
|
+
components: {
|
|
87
|
+
epterm: defineAsyncComponent(()=>import('../medias/EpTerm.vue')),
|
|
91
88
|
},
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
// const customRenderStringComponents = defineComponent({
|
|
95
|
-
// components:{
|
|
96
|
-
// 'epterm':EpTerm
|
|
97
|
-
// },
|
|
98
|
-
// template:`<div>${renderText.value}</div>`
|
|
99
|
-
// })
|
|
100
|
-
|
|
101
|
-
// const TextApp = createApp({
|
|
102
|
-
// setup(){
|
|
103
|
-
// return () => h(TextBlock, `<template>${renderText.value}</template>`)
|
|
104
|
-
// }
|
|
105
|
-
// })
|
|
106
|
-
|
|
89
|
+
template: `<div>${renderText.value}</div>`,
|
|
90
|
+
};
|
|
107
91
|
|
|
92
|
+
return h(r);
|
|
93
|
+
};
|
|
108
94
|
|
|
109
|
-
|
|
110
|
-
const {compact} = toRefs(props)
|
|
111
|
-
|
|
95
|
+
const { compact } = toRefs(props);
|
|
112
96
|
</script>
|
|
113
97
|
|
|
114
98
|
<template>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
99
|
+
<div>
|
|
100
|
+
bloc du texte (to delete)
|
|
101
|
+
{{renderText}}
|
|
102
|
+
<hr>
|
|
103
|
+
<p>text :</p>
|
|
104
|
+
<render v-if="!compact"></render>
|
|
105
|
+
<EpAccordeon outlined :title="renderTitle" v-else>
|
|
106
|
+
<render></render>
|
|
107
|
+
</EpAccordeon>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
package/dist/BgAudio-d9308f99.js
DELETED
package/dist/EpAlert-c5ccf377.js
DELETED
package/dist/EpAudio-ee4175aa.js
DELETED
package/dist/EpBadge-6fc0f5fc.js
DELETED
package/dist/EpBtn-010839a7.js
DELETED
package/dist/EpCard-d67b77b2.js
DELETED
package/dist/EpEdu-74aed121.js
DELETED
package/dist/EpFlex-232d7513.js
DELETED
package/dist/EpImg-7f4c35bd.js
DELETED
package/dist/EpLink-c2a1a872.js
DELETED
package/dist/EpModal-1b4d1ff9.js
DELETED
package/dist/EpQuote-adfe2a2b.js
DELETED
package/dist/EpRadio-53f60b1a.js
DELETED
package/dist/EpScope-494ffdec.js
DELETED
package/dist/EpSvg-a2ebcc93.js
DELETED
package/dist/EpTable-0555285d.js
DELETED
package/dist/EpTerm-87ed74e7.js
DELETED
package/dist/EpText-7c29711c.js
DELETED
package/dist/EpVideo-fe865980.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineComponent as t, openBlock as o, createElementBlock as n, createTextVNode as r, renderSlot as l } from "vue";
|
|
2
|
-
const s = /* @__PURE__ */ t({
|
|
3
|
-
__name: "TextBloc",
|
|
4
|
-
setup(c) {
|
|
5
|
-
return (e, a) => (o(), n("div", null, [
|
|
6
|
-
r(" block "),
|
|
7
|
-
l(e.$slots, "default")
|
|
8
|
-
]));
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
export {
|
|
12
|
-
s as default
|
|
13
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
|
|
2
|
-
default?(_: {}): any;
|
|
3
|
-
}>;
|
|
4
|
-
export default _default;
|
|
5
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
-
new (): {
|
|
7
|
-
$slots: S;
|
|
8
|
-
};
|
|
9
|
-
};
|