@icvdeveloper/common-module 0.0.31 → 0.0.32
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 +1 -1
- package/dist/runtime/components/agenda/components/PresentationLink.vue +1 -1
- package/dist/runtime/components/core/Navbar.vue +154 -0
- package/dist/runtime/components/forms/ErrorField.vue +1 -3
- package/dist/runtime/components/forms/Message.vue +8 -2
- package/dist/runtime/components/forms/SearchInput.vue +12 -4
- package/dist/runtime/components/forms/SupportForm.vue +8 -5
- package/dist/runtime/components/forms/SwitchInput.vue +1 -0
- package/dist/runtime/components/forms/TextInput.vue +1 -0
- package/dist/runtime/composables/useNavigation.mjs +3 -0
- package/package.json +2 -1
package/dist/module.json
CHANGED
|
@@ -100,7 +100,7 @@ const presentationNameClass = computed(() => {
|
|
|
100
100
|
|
|
101
101
|
<!-- text only catchall -->
|
|
102
102
|
<span v-else class="font-semibold" :class="presentationNameClass"
|
|
103
|
-
>{{ presentation.name }}
|
|
103
|
+
>{{ presentation.name }}</span
|
|
104
104
|
>
|
|
105
105
|
|
|
106
106
|
<!-- session details -->
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, toRefs, computed } from "vue";
|
|
3
|
+
import { cloneDeep } from "lodash-es";
|
|
4
|
+
import { useNavigationConfigStore } from "../../store/navigationConfig";
|
|
5
|
+
import { useTemplateConfigsStore } from "../../store/templateConfigs";
|
|
6
|
+
import { useNavigation } from "../../composables/useNavigation";
|
|
7
|
+
|
|
8
|
+
type AdditionalItems = {
|
|
9
|
+
[index: number]: Array<{
|
|
10
|
+
name: string;
|
|
11
|
+
url: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// props
|
|
16
|
+
type Props = {
|
|
17
|
+
additionalItems?: AdditionalItems;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
21
|
+
additionalItems: () => {
|
|
22
|
+
return {};
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const { getEnabled } = useNavigationConfigStore();
|
|
27
|
+
const { globalConfigValue } = useTemplateConfigsStore();
|
|
28
|
+
|
|
29
|
+
// data
|
|
30
|
+
const { additionalItems } = toRefs(props);
|
|
31
|
+
const navItems = getEnabled();
|
|
32
|
+
const htmlHeader = globalConfigValue("html_header");
|
|
33
|
+
const open = ref<boolean>(false);
|
|
34
|
+
|
|
35
|
+
// methods
|
|
36
|
+
const { isExternalLink, formatLink } = useNavigation();
|
|
37
|
+
const toggle = () => {
|
|
38
|
+
open.value = !open.value;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// computed
|
|
42
|
+
const combinedNavItems = computed(() => {
|
|
43
|
+
const items = cloneDeep(navItems);
|
|
44
|
+
|
|
45
|
+
if (Object.keys(additionalItems.value).length > 0) {
|
|
46
|
+
// get index to insert items at.
|
|
47
|
+
Object.keys(additionalItems.value).forEach((index) => {
|
|
48
|
+
if (items[index] !== "undefined") {
|
|
49
|
+
for (let i = 0; i < additionalItems.value[index].length; i++) {
|
|
50
|
+
items.splice(index + i, 0, additionalItems.value[index][i]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return items;
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div>
|
|
62
|
+
<div class="flex flex-col">
|
|
63
|
+
<header class="min-w-full flex sticky pin-t z-50">
|
|
64
|
+
<!-- Standard Screen Nav -->
|
|
65
|
+
<div
|
|
66
|
+
class="hidden flex-1 flex-col mx-auto min-w-full"
|
|
67
|
+
:class="combinedNavItems.length < 7 ? 'md:flex' : 'lg:flex'"
|
|
68
|
+
>
|
|
69
|
+
<CommonDynamicHtml
|
|
70
|
+
v-if="htmlHeader.length"
|
|
71
|
+
class="flex-initial mb-0"
|
|
72
|
+
:template="htmlHeader"
|
|
73
|
+
></CommonDynamicHtml>
|
|
74
|
+
|
|
75
|
+
<nav class="flex flex-1 min-h-8 content-center">
|
|
76
|
+
<ul class="list-reset h-full">
|
|
77
|
+
<li v-for="(item, index) in combinedNavItems" :key="index">
|
|
78
|
+
<nuxt-link
|
|
79
|
+
v-if="!isExternalLink(item)"
|
|
80
|
+
:to="formatLink(item)"
|
|
81
|
+
exact
|
|
82
|
+
class="inline-block"
|
|
83
|
+
>
|
|
84
|
+
{{ item.label || item.name }}
|
|
85
|
+
</nuxt-link>
|
|
86
|
+
<a
|
|
87
|
+
v-else
|
|
88
|
+
:href="formatLink(item)"
|
|
89
|
+
:target="isExternalLink(item) ? '_blank' : ''"
|
|
90
|
+
>
|
|
91
|
+
{{ item.label || item.name }}
|
|
92
|
+
</a>
|
|
93
|
+
</li>
|
|
94
|
+
</ul>
|
|
95
|
+
</nav>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<!-- Mobile Nav -->
|
|
99
|
+
<div
|
|
100
|
+
class="flex flex-col content-start mx-auto min-w-full"
|
|
101
|
+
:class="combinedNavItems.length >= 7 ? 'lg:hidden' : 'md:hidden'"
|
|
102
|
+
>
|
|
103
|
+
<div class="mobile-nav flex flex-row justify-between">
|
|
104
|
+
<CommonDynamicHtml
|
|
105
|
+
v-if="htmlHeader.length"
|
|
106
|
+
class="flex-1"
|
|
107
|
+
:template="htmlHeader"
|
|
108
|
+
></CommonDynamicHtml>
|
|
109
|
+
|
|
110
|
+
<div class="float-right p-2">
|
|
111
|
+
<button class="flex items-center px-3 py-2" @click="toggle">
|
|
112
|
+
<svg
|
|
113
|
+
class="fill-current h-3 w-3"
|
|
114
|
+
viewBox="0 0 20 20"
|
|
115
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
116
|
+
>
|
|
117
|
+
<title>Menu</title>
|
|
118
|
+
<path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z" />
|
|
119
|
+
</svg>
|
|
120
|
+
</button>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<div class="flex">
|
|
125
|
+
<nav :class="open ? 'flex' : 'hidden'" class="w-full">
|
|
126
|
+
<ul class="flex-col self-center list-reset mx-auto">
|
|
127
|
+
<li v-for="(item, index) in combinedNavItems" :key="index">
|
|
128
|
+
<nuxt-link
|
|
129
|
+
v-if="!isExternalLink(item)"
|
|
130
|
+
:to="formatLink(item)"
|
|
131
|
+
exact
|
|
132
|
+
class="block w-full text-center"
|
|
133
|
+
@click.native="toggle"
|
|
134
|
+
>
|
|
135
|
+
{{ item.label || item.name }}
|
|
136
|
+
</nuxt-link>
|
|
137
|
+
|
|
138
|
+
<a
|
|
139
|
+
v-if="isExternalLink(item)"
|
|
140
|
+
:href="formatLink(item)"
|
|
141
|
+
target="_blank"
|
|
142
|
+
@click.native="toggle"
|
|
143
|
+
>
|
|
144
|
+
{{ item.label || item.name }}
|
|
145
|
+
</a>
|
|
146
|
+
</li>
|
|
147
|
+
</ul>
|
|
148
|
+
</nav>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</header>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</template>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { PropType } from "vue";
|
|
3
|
-
|
|
4
2
|
type Props = {
|
|
5
3
|
errors: Array<string>;
|
|
6
4
|
};
|
|
@@ -12,7 +10,7 @@ const { errors } = toRefs(props);
|
|
|
12
10
|
|
|
13
11
|
<template>
|
|
14
12
|
<div>
|
|
15
|
-
<div v-if="errors" class="my-1 text-red-
|
|
13
|
+
<div v-if="errors" class="my-1 text-red-500">
|
|
16
14
|
<div v-for="error in errors">{{ error }}</div>
|
|
17
15
|
</div>
|
|
18
16
|
</div>
|
|
@@ -10,11 +10,11 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
10
10
|
const { success } = toRefs(props);
|
|
11
11
|
|
|
12
12
|
const errorClass = computed(() => {
|
|
13
|
-
return "bg-red-100 border
|
|
13
|
+
return "message-base bg-red-100 border-red-400 text-red-600";
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const successClass = computed(() => {
|
|
17
|
-
return "bg-green-100 border
|
|
17
|
+
return "message-base bg-green-100 border-green-400 text-green-600";
|
|
18
18
|
});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
@@ -23,3 +23,9 @@ const successClass = computed(() => {
|
|
|
23
23
|
<slot class="pb-0" />
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
26
|
+
|
|
27
|
+
<style lang="scss" scoped>
|
|
28
|
+
.message-base {
|
|
29
|
+
@apply border font-bold px-4 py-3 mb-4 rounded relative;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import CloseIcon from "../../assets/svg/close-icon.svg";
|
|
3
3
|
|
|
4
|
+
type Props = {
|
|
5
|
+
placeholder: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
9
|
+
placeholder: "Search...",
|
|
10
|
+
});
|
|
11
|
+
|
|
4
12
|
const value = ref<string>("");
|
|
5
13
|
|
|
6
14
|
const emit = defineEmits<{
|
|
@@ -15,15 +23,15 @@ const clear = () => {
|
|
|
15
23
|
</script>
|
|
16
24
|
|
|
17
25
|
<template>
|
|
18
|
-
<div class="
|
|
26
|
+
<div class="flex flex-row items-center">
|
|
19
27
|
<input
|
|
20
28
|
v-model="value"
|
|
21
29
|
type="text"
|
|
22
|
-
class="
|
|
23
|
-
placeholder="
|
|
30
|
+
class="flex-1 pl-2 pr-5 py-1"
|
|
31
|
+
:placeholder="placeholder"
|
|
24
32
|
@input="emit('onChange', value)"
|
|
25
33
|
/>
|
|
26
|
-
<span class="
|
|
34
|
+
<span class="flex-initial cursor-pointer px-4 py-2" @click="clear">
|
|
27
35
|
<close-icon class="fill-current text-black" />
|
|
28
36
|
</span>
|
|
29
37
|
</div>
|
|
@@ -8,6 +8,8 @@ const form = ref({
|
|
|
8
8
|
message: "",
|
|
9
9
|
});
|
|
10
10
|
const submitted = ref<boolean>(false);
|
|
11
|
+
|
|
12
|
+
// @todo add error handling to other form fields, or remove error fields from each field
|
|
11
13
|
const errors = ref<[]>([]);
|
|
12
14
|
|
|
13
15
|
const supportStore = useSupportStore();
|
|
@@ -20,9 +22,10 @@ const handleForm = () => {
|
|
|
20
22
|
submitted.value = true;
|
|
21
23
|
})
|
|
22
24
|
.catch((error) => {
|
|
23
|
-
|
|
25
|
+
console.log(error.response);
|
|
26
|
+
errors.value = get(error.response._data, "errors", {});
|
|
24
27
|
errors.value.response = [
|
|
25
|
-
"Error: " + get(error.response.
|
|
28
|
+
"Error: " + get(error.response._data, "message", ""),
|
|
26
29
|
];
|
|
27
30
|
});
|
|
28
31
|
};
|
|
@@ -77,7 +80,7 @@ const acceptNumber = () => {
|
|
|
77
80
|
v-model="form.phone"
|
|
78
81
|
placeholder="Phone"
|
|
79
82
|
:required="false"
|
|
80
|
-
type="
|
|
83
|
+
type="tel"
|
|
81
84
|
@input="acceptNumber"
|
|
82
85
|
/>
|
|
83
86
|
</div>
|
|
@@ -89,13 +92,13 @@ const acceptNumber = () => {
|
|
|
89
92
|
|
|
90
93
|
<CommonTextArea v-model="form.message" />
|
|
91
94
|
|
|
92
|
-
<
|
|
95
|
+
<CommonErrorField :errors="errors['message']" />
|
|
93
96
|
</div>
|
|
94
97
|
|
|
98
|
+
<button class="btn btn-secondary" type="submit">Submit</button>
|
|
95
99
|
<div class="mb-3">
|
|
96
100
|
<CommonErrorField :errors="errors['response']" />
|
|
97
101
|
</div>
|
|
98
|
-
<button class="btn btn-secondary" type="submit">Submit</button>
|
|
99
102
|
</form>
|
|
100
103
|
|
|
101
104
|
<!-- Submitted Message -->
|
|
@@ -9,6 +9,9 @@ export const useNavigation = () => {
|
|
|
9
9
|
return url.startsWith("http") === true;
|
|
10
10
|
};
|
|
11
11
|
const formatLink = (navItem) => {
|
|
12
|
+
if (navItem.url && navItem.url.startsWith("#")) {
|
|
13
|
+
return navItem.url;
|
|
14
|
+
}
|
|
12
15
|
let link = "/" + navItem.name;
|
|
13
16
|
if (navItem.name === "home") {
|
|
14
17
|
link = "/";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icvdeveloper/common-module",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"prepack": "nuxt-module-build",
|
|
19
19
|
"dev": "nuxi dev playground",
|
|
20
20
|
"dev:build": "nuxi build playground",
|
|
21
|
+
"dev:docker": "rm -rf /tmp/nitro && nuxi dev --host 0.0.0.0 --port 3005 playground",
|
|
21
22
|
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|