cec-nuxt-lib 0.4.0 → 0.4.2

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
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-nuxt-lib",
3
3
  "configKey": "cec-nuxt-lib",
4
- "version": "0.4.0"
4
+ "version": "0.4.2"
5
5
  }
@@ -1,7 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { useState } from '#app';
2
+ import { useState, useRuntimeConfig } from '#app';
3
3
  import { useRoute } from 'vue-router';
4
4
 
5
+ const config = useRuntimeConfig();
6
+ const baseUrl = config.app.baseURL;
7
+
5
8
  const classicPath = useState('classicPath');
6
9
  const route = useRoute();
7
10
 
@@ -41,10 +44,20 @@ let routes = makeArr(routeTrim);
41
44
  // Get the classic path for legacy links
42
45
  let classic = trimPath(classicPath.value).split('/');
43
46
  const length = classic.length;
44
-
45
- let hrefs = `${classicPath.value}${routeTrim === '/' ? '' : routeTrim}`.split(
46
- '/'
47
- );
47
+ let hrefs;
48
+ if (baseUrl !== '/') {
49
+ hrefs = `${classicPath.value}${routeTrim === '/' ? '' : routeTrim}`.split(
50
+ '/'
51
+ );
52
+ } else {
53
+ hrefs = routes.reduce((acc, e, i) => {
54
+ if (classic[i]) {
55
+ return [...acc, classic[i]];
56
+ } else {
57
+ return [...acc, e];
58
+ }
59
+ }, []);
60
+ }
48
61
  const links = hrefs.map((e, i) => (!i ? 'Home' : toTitleCase(e)));
49
62
  </script>
50
63
  <template>
@@ -704,6 +704,21 @@ canvasHtml = canvasHtml.replace(
704
704
  );
705
705
 
706
706
  onMounted(() => {
707
+ // Expand all buttons
708
+ const expandAll = (btn) => {
709
+ btn.addEventListener('click', (e) => {
710
+ console.log(btn.id);
711
+ const op = btn.innerText;
712
+ btn.innerText = op === 'Expand all' ? 'Close all' : 'Expand all';
713
+ Array.from(document.getElementsByClassName(btn.id)).forEach(
714
+ (e) => (e.checked = op === 'Expand all')
715
+ );
716
+ });
717
+ };
718
+ Array.from(document.getElementsByClassName('expand-all')).forEach((b) => {
719
+ expandAll(b);
720
+ });
721
+
707
722
  let forms = Array.from(document.querySelectorAll('a')).filter(
708
723
  (a) =>
709
724
  regex.test(a.href) &&
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.4.0",
2
+ "version": "0.4.2",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",