cec-nuxt-lib 0.12.10 → 0.13.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/dist/module.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useState } from "#app";
|
|
3
3
|
import { createRenderer, text } from "@contensis/canvas-html";
|
|
4
4
|
const getCanvas = (data) => renderer({ data });
|
|
5
|
+
const { toCamelCase } = useGrantFunded();
|
|
5
6
|
const page = useState("page");
|
|
6
7
|
let canvasHtml;
|
|
7
8
|
const props = defineProps({
|
|
@@ -622,6 +623,11 @@ const genList = (item, id) => {
|
|
|
622
623
|
</ul>
|
|
623
624
|
` : "";
|
|
624
625
|
};
|
|
626
|
+
const grantFundedTable = (props2) => {
|
|
627
|
+
const grantType = props2.block?.value.grantType;
|
|
628
|
+
const id = toCamelCase(grantType);
|
|
629
|
+
return `<div ref="${id}">Grant funded projects: ${grantType}</div>`;
|
|
630
|
+
};
|
|
625
631
|
const myInlineEntry = (props2) => {
|
|
626
632
|
let data = props2.block?.value;
|
|
627
633
|
let id = props2.block?.id;
|
|
@@ -666,6 +672,7 @@ const renderer = createRenderer({
|
|
|
666
672
|
promotionalFullWidthImageWithSideOverlay,
|
|
667
673
|
genericList,
|
|
668
674
|
genericListAsAccordion,
|
|
675
|
+
grantFundedTable,
|
|
669
676
|
heroUnit,
|
|
670
677
|
horizontalTable,
|
|
671
678
|
htmlComponent,
|
|
@@ -11,41 +11,49 @@ const doSearch = async () => {
|
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
+
const openAccAndScroll = (el) => {
|
|
15
|
+
let parent = el.parentNode;
|
|
16
|
+
while (parent.tagName && parent.tagName !== "ARTICLE") {
|
|
17
|
+
parent = parent.parentNode;
|
|
18
|
+
}
|
|
19
|
+
if (parent) {
|
|
20
|
+
let elem = parent.previousElementSibling;
|
|
21
|
+
if (elem && elem.tagName === "LABEL") {
|
|
22
|
+
let checkBox = elem.control;
|
|
23
|
+
checkBox.checked = true;
|
|
24
|
+
el.scrollIntoView();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
14
28
|
onMounted(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
const thisPage = window.location.href.split("#")[0];
|
|
30
|
+
const internalLinks = Array.from(document.getElementsByTagName("a")).filter(
|
|
31
|
+
(el) => el.href.startsWith(`${thisPage}#`)
|
|
32
|
+
);
|
|
33
|
+
internalLinks.forEach((el) => {
|
|
34
|
+
const target = document.getElementById(el.href.split("#")[1]);
|
|
35
|
+
if (target) {
|
|
36
|
+
el.addEventListener("click", () => openAccAndScroll(target));
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
let hash = window.location.hash;
|
|
40
|
+
if (hash.length) {
|
|
41
|
+
let accordions = Array.from(
|
|
42
|
+
document.getElementsByClassName("access-acc-container")
|
|
43
|
+
).filter((e) => !Array.from(e.classList).includes("details"));
|
|
44
|
+
let elem = document.getElementById(hash.slice(1));
|
|
45
|
+
if (elem) {
|
|
46
|
+
openAccAndScroll(elem);
|
|
47
|
+
} else {
|
|
20
48
|
hash = hash.toLowerCase().replace(/^#/, "").replace(/_/g, " ");
|
|
21
49
|
let l = Array.from(document.getElementsByTagName("LABEL")).filter(
|
|
22
50
|
(e) => e.innerText.toLowerCase().startsWith(hash)
|
|
23
51
|
);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
27
|
-
if (accs.length) {
|
|
28
|
-
let el = accs[0].previousElementSibling;
|
|
52
|
+
if (l.length && l[0].parentNode.tagName === "SECTION") {
|
|
53
|
+
let el = l[0].previousElementSibling;
|
|
29
54
|
if (el.tagName === "INPUT") {
|
|
30
55
|
el.checked = true;
|
|
31
56
|
el.scrollIntoView();
|
|
32
|
-
found = true;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (!found) {
|
|
36
|
-
let h3s = Array.from(document.getElementsByTagName("H3")).filter(
|
|
37
|
-
(e) => e.innerHTML.toLowerCase().includes(hash)
|
|
38
|
-
);
|
|
39
|
-
if (h3s.length) {
|
|
40
|
-
let parent = h3s[0].parentNode;
|
|
41
|
-
if (parent.tagName === "ARTICLE") {
|
|
42
|
-
let el = parent.previousElementSibling;
|
|
43
|
-
let input = el.tagName === "LABEL" ? el.control : el.tagName === "INPUT" ? el : void 0;
|
|
44
|
-
if (input) {
|
|
45
|
-
input.checked = true;
|
|
46
|
-
el.scrollIntoView();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.13.1",
|
|
3
3
|
"name": "cec-nuxt-lib",
|
|
4
4
|
"description": "Nuxt components and assets",
|
|
5
5
|
"license": "MIT",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"link": "npm link"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@contensis/canvas-html": "^1.3.0",
|
|
36
37
|
"@nuxt/kit": "^3.16.2"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|