picocrank 1.3.1 → 1.4.0
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/package.json +1 -1
- package/vue/components/Header.vue +5 -3
- package/vue/components/Sidebar.vue +19 -1
- package/vue/views/App.vue +3 -0
package/package.json
CHANGED
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
<div class = "fg1"></div>
|
|
19
19
|
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
20
|
+
<slot name = "user-info">
|
|
21
|
+
<div class = "user-info">
|
|
22
|
+
<span v-if="username">{{ username }}</span>
|
|
23
|
+
</div>
|
|
24
|
+
</slot>
|
|
23
25
|
</header>
|
|
24
26
|
</template>
|
|
25
27
|
|
|
@@ -18,7 +18,12 @@
|
|
|
18
18
|
<li v-for="link in navigationLinks" :key="link.name" :title="link.title">
|
|
19
19
|
<!-- Render separator if link is a separator -->
|
|
20
20
|
<div v-if="link.type === 'separator'" class="separator"></div>
|
|
21
|
-
|
|
21
|
+
<div v-else-if="link.type === 'callback'">
|
|
22
|
+
<a href="#" @click.prevent="link.callback()">
|
|
23
|
+
<HugeiconsIcon :icon="link.icon" />
|
|
24
|
+
<span>{{ link.title }}</span>
|
|
25
|
+
</a>
|
|
26
|
+
</div>
|
|
22
27
|
<router-link v-else :to="link.path" :class="{ active: isActive(link.path) }">
|
|
23
28
|
<HugeiconsIcon :icon="link.icon" />
|
|
24
29
|
<span>{{ link.title }}</span>
|
|
@@ -68,6 +73,18 @@ function addNavigationLink(link) {
|
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
|
|
76
|
+
function addCallback(title, callback, options = {}) {
|
|
77
|
+
const callbackLink = {
|
|
78
|
+
name: options.name || title.toLowerCase().replace(/\s+/g, '-'),
|
|
79
|
+
type: 'callback',
|
|
80
|
+
icon: options.icon || PinIcon,
|
|
81
|
+
callback: callback || (() => {}),
|
|
82
|
+
title: title
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
addNavigationLink(callbackLink)
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
function addSeparator(id) {
|
|
72
89
|
const separator = {
|
|
73
90
|
name: id || `nav-separator-${Date.now()}`,
|
|
@@ -131,6 +148,7 @@ defineExpose({
|
|
|
131
148
|
isActive,
|
|
132
149
|
addNavigationLink,
|
|
133
150
|
addRouterLink,
|
|
151
|
+
addCallback,
|
|
134
152
|
addSeparator,
|
|
135
153
|
removeNavigationLink,
|
|
136
154
|
clearNavigationLinks,
|
package/vue/views/App.vue
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
<script setup>
|
|
29
29
|
import { ref, onMounted } from 'vue';
|
|
30
30
|
import { useRouter } from 'vue-router';
|
|
31
|
+
import { Pin02Icon } from '@hugeicons/core-free-icons'
|
|
31
32
|
|
|
32
33
|
import QuickSearch from './../components/QuickSearch.vue'
|
|
33
34
|
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
sidebar.value.addSeparator('separator-1');
|
|
48
49
|
sidebar.value.addRouterLink('ViewItem', { id: 1 })
|
|
49
50
|
sidebar.value.addSeparator('separator-2');
|
|
51
|
+
sidebar.value.addCallback('Hello World', helloWorld, { icon: Pin02Icon })
|
|
52
|
+
sidebar.value.addSeparator('separator-3');
|
|
50
53
|
sidebar.value.addRouterLink('Admin')
|
|
51
54
|
sidebar.value.open();
|
|
52
55
|
sidebar.value.stick();
|