cec-nuxt-lib 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -39,13 +39,15 @@ const abbr = (data) => {
|
|
|
39
39
|
return `<abbr title="${text(data.entryDescription)}">${text(data.entryTitle)}</abbr>`;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const accordion = (data) => {
|
|
43
|
+
if (!data.id) {
|
|
44
|
+
data.id = data.sys.id;
|
|
45
|
+
}
|
|
46
|
+
let html = data.expandAll
|
|
45
47
|
? `
|
|
46
48
|
<div class="text-end">
|
|
47
49
|
<button
|
|
48
|
-
id="${
|
|
50
|
+
id="${data.id}"
|
|
49
51
|
class="expand-all btn btn-outline-success"
|
|
50
52
|
type="button"
|
|
51
53
|
>
|
|
@@ -61,22 +63,29 @@ const accordionComponent = (props: any) => {
|
|
|
61
63
|
</p>
|
|
62
64
|
<section class="access-acc-container">
|
|
63
65
|
`;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
let accId = `${id}_${i}`;
|
|
66
|
+
data.accordionSection.forEach((e, i) => {
|
|
67
|
+
let accId = `${data.id}_${i}`;
|
|
67
68
|
html += `
|
|
68
|
-
<input class="${id}"
|
|
69
|
+
<input class="${data.id}"
|
|
69
70
|
id="${accId}"
|
|
70
71
|
type="checkbox"
|
|
71
72
|
/>
|
|
72
73
|
<label for="${accId}">${e.accLabel}</label>
|
|
73
|
-
<article>${e.content}
|
|
74
|
+
<article>${e.content ? e.content : ''}
|
|
75
|
+
${e.genericList ? genList(e.genericList, accId) : ''}
|
|
76
|
+
|
|
77
|
+
</article>
|
|
78
|
+
|
|
74
79
|
`;
|
|
75
80
|
});
|
|
76
81
|
html += '</section>';
|
|
77
82
|
return html;
|
|
78
83
|
};
|
|
79
84
|
|
|
85
|
+
const accordionComponent = (props: any) => {
|
|
86
|
+
return accordion({ ...props.block.value, id: props.block.id });
|
|
87
|
+
};
|
|
88
|
+
|
|
80
89
|
const anchor = (data) => {
|
|
81
90
|
return `<${data.tag} id="${data.id}">${data.text}</${data.tag}>`;
|
|
82
91
|
};
|
|
@@ -600,11 +609,14 @@ const processUri = (uri) => {
|
|
|
600
609
|
};
|
|
601
610
|
|
|
602
611
|
const genericList = (props: any) => {
|
|
603
|
-
|
|
604
|
-
|
|
612
|
+
return genList(props.block.value, props.block.id);
|
|
613
|
+
};
|
|
614
|
+
const genList = (item, id) => {
|
|
615
|
+
let heading = item.title ? `<h2 class="fs-4 mt-3">${item.title}</h2>` : '';
|
|
616
|
+
|
|
605
617
|
return listItems.value[id]
|
|
606
618
|
? `
|
|
607
|
-
|
|
619
|
+
${heading}
|
|
608
620
|
<ul>
|
|
609
621
|
${listItems.value[id].reduce((acc, e) => {
|
|
610
622
|
return e.sys.dataFormat === 'webpage'
|
|
@@ -630,6 +642,8 @@ const myInlineEntry = (props: any) => {
|
|
|
630
642
|
let data = props.block?.value;
|
|
631
643
|
let id = props.block?.id;
|
|
632
644
|
switch (props.block?.value.sys.contentTypeId) {
|
|
645
|
+
case 'accordion':
|
|
646
|
+
return accordion(data);
|
|
633
647
|
case 'abbreviation':
|
|
634
648
|
return abbr(data);
|
|
635
649
|
case 'anchor':
|
|
@@ -707,7 +721,6 @@ onMounted(() => {
|
|
|
707
721
|
// Expand all buttons
|
|
708
722
|
const expandAll = (btn) => {
|
|
709
723
|
btn.addEventListener('click', (e) => {
|
|
710
|
-
console.log(btn.id);
|
|
711
724
|
const op = btn.innerText;
|
|
712
725
|
btn.innerText = op === 'Expand all' ? 'Close all' : 'Expand all';
|
|
713
726
|
Array.from(document.getElementsByClassName(btn.id)).forEach(
|
package/package.json
CHANGED