bt-core-app 1.3.5 → 1.3.7
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/bt-core-app.js +9920 -9307
- package/dist/components/BT-Nav-Menu-Item.vue.d.ts +36 -0
- package/dist/components/BT-Nav-Sidebar.vue.d.ts +25 -0
- package/dist/index.d.ts +3 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/BT-Btn.vue +1 -0
- package/src/components/BT-Nav-Menu-Item.vue +61 -0
- package/src/components/BT-Nav-Sidebar.vue +79 -0
- package/src/index.ts +5 -0
- package/vite.config.ts +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-list-group v-if="doShowItem && relevantChildren.length > 0"
|
|
3
|
+
color="accent"
|
|
4
|
+
:subGroup="isSubGroup"
|
|
5
|
+
fluid>
|
|
6
|
+
<template #activator="{ props }">
|
|
7
|
+
<v-list-item v-bind="props"
|
|
8
|
+
:prepend-icon="item.icon"
|
|
9
|
+
:title="item.displayName" />
|
|
10
|
+
</template>
|
|
11
|
+
<BT-Nav-Menu-Item
|
|
12
|
+
v-for="child in relevantChildren"
|
|
13
|
+
:key="child.name"
|
|
14
|
+
isSubGroup
|
|
15
|
+
:item="child" />
|
|
16
|
+
</v-list-group>
|
|
17
|
+
<v-list-item v-else-if="doShowItem"
|
|
18
|
+
color="accent"
|
|
19
|
+
:prepend-icon="item.icon"
|
|
20
|
+
nav
|
|
21
|
+
:title="item.displayName ?? item.name"
|
|
22
|
+
:to="{ name: item.name }">
|
|
23
|
+
</v-list-item>
|
|
24
|
+
<v-divider v-else-if="item.isDivider" />
|
|
25
|
+
<div v-else>test</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import BTNavMenuItem from './BT-Nav-Menu-Item.vue'
|
|
30
|
+
import { computed } from 'vue'
|
|
31
|
+
import { useAuth } from '../composables/auth'
|
|
32
|
+
import { isLengthyArray } from '../composables/helpers'
|
|
33
|
+
import { type NavigationItem } from '../composables/navigation'
|
|
34
|
+
import { VListItem, VListGroup, VDivider } from 'vuetify/components'
|
|
35
|
+
|
|
36
|
+
interface ItemProps {
|
|
37
|
+
allowedSubscriptionCodes?: string[],
|
|
38
|
+
isSubGroup?: boolean,
|
|
39
|
+
item?: any
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const props = withDefaults(defineProps<ItemProps>(), {
|
|
43
|
+
allowedSubscriptionCodes: () => [],
|
|
44
|
+
isSubGroup: false,
|
|
45
|
+
item: null
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const { doShowByNav } = useAuth()
|
|
49
|
+
|
|
50
|
+
const relevantChildren = computed(() => {
|
|
51
|
+
const l = props.item.children?.filter((x: NavigationItem) => x.isInNavMenu !== false) ?? []
|
|
52
|
+
if (!isLengthyArray(props.allowedSubscriptionCodes)) {
|
|
53
|
+
return l
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return l.filter((navItem: NavigationItem) => !isLengthyArray(navItem.subFilters) || props.allowedSubscriptionCodes.some(code => navItem.subFilters?.some(sFilter => sFilter == code)))
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const doShowItem = computed(() => doShowByNav(props.item, true))
|
|
60
|
+
|
|
61
|
+
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-navigation-drawer
|
|
3
|
+
v-if="isLoggedIn"
|
|
4
|
+
disabled-resize-watcher
|
|
5
|
+
expand-on-hover
|
|
6
|
+
:rail="!state.drawerStick"
|
|
7
|
+
permanent
|
|
8
|
+
v-model="state.drawer">
|
|
9
|
+
<slot>
|
|
10
|
+
<v-list class="pt-1">
|
|
11
|
+
<v-list-item nav :title="title">
|
|
12
|
+
<template #prepend>
|
|
13
|
+
<v-avatar size="36">
|
|
14
|
+
<v-img :src="iconSrc" />
|
|
15
|
+
</v-avatar>
|
|
16
|
+
</template>
|
|
17
|
+
<template #append>
|
|
18
|
+
<v-row class="mr-1">
|
|
19
|
+
<v-btn
|
|
20
|
+
@click="toggleDrawerStick"
|
|
21
|
+
flat
|
|
22
|
+
icon
|
|
23
|
+
size="small"
|
|
24
|
+
title="Pin/Unpin Menu">
|
|
25
|
+
<v-icon>{{ state.drawerStick ? 'mdi-pin-off' : 'mdi-pin' }}</v-icon>
|
|
26
|
+
</v-btn>
|
|
27
|
+
</v-row>
|
|
28
|
+
</template>
|
|
29
|
+
</v-list-item>
|
|
30
|
+
<slot name="top-list">
|
|
31
|
+
|
|
32
|
+
</slot>
|
|
33
|
+
</v-list>
|
|
34
|
+
|
|
35
|
+
<slot name="middle-list">
|
|
36
|
+
<v-list nav>
|
|
37
|
+
<BT-Nav-Menu-Item
|
|
38
|
+
v-for="(item, index) in navItems"
|
|
39
|
+
:key="index"
|
|
40
|
+
:item="item" />
|
|
41
|
+
</v-list>
|
|
42
|
+
</slot>
|
|
43
|
+
</slot>
|
|
44
|
+
<template #append>
|
|
45
|
+
<slot name="bottom-list">
|
|
46
|
+
<v-list v-if="isLoggedIn" class="ma-0 pa-0">
|
|
47
|
+
<v-list-item
|
|
48
|
+
class="bg-primary"
|
|
49
|
+
prepend-icon="mdi-logout"
|
|
50
|
+
title="Logout"
|
|
51
|
+
@click="() => logout()" />
|
|
52
|
+
</v-list>
|
|
53
|
+
</slot>
|
|
54
|
+
</template>
|
|
55
|
+
</v-navigation-drawer>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup lang="ts">
|
|
59
|
+
import BTNavMenuItem from './BT-Nav-Menu-Item.vue'
|
|
60
|
+
import { useCosmetics } from '../composables/cosmetics'
|
|
61
|
+
import { useNavigation } from '../composables/navigation'
|
|
62
|
+
import { useAuth } from '../composables/auth'
|
|
63
|
+
import { computed } from 'vue'
|
|
64
|
+
import { VListItem, VList, VNavigationDrawer, VAvatar, VImg, VRow, VBtn } from 'vuetify/components'
|
|
65
|
+
|
|
66
|
+
interface SidebarProps {
|
|
67
|
+
// greeting?: string
|
|
68
|
+
iconSrc?: string
|
|
69
|
+
title?: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
defineProps<SidebarProps>()
|
|
73
|
+
const { state, toggleDrawerStick } = useCosmetics()
|
|
74
|
+
const { isLoggedIn, logout } = useAuth()
|
|
75
|
+
const navigation = useNavigation()
|
|
76
|
+
|
|
77
|
+
const navItems = computed(() => navigation.navigationItems.filter(x => x.isInNavMenu !== false && navigation.backgroundName.value == x.background));
|
|
78
|
+
|
|
79
|
+
</script>
|
package/src/index.ts
CHANGED
|
@@ -43,6 +43,11 @@ export type { CoreApp, CreateCoreOptions } from './core'
|
|
|
43
43
|
export { createCore } from './core'
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
import BTNavMenuItem from './components/BT-Nav-Menu-Item.vue'
|
|
47
|
+
import BTNavSidebar from './components/BT-Nav-Sidebar.vue'
|
|
48
|
+
|
|
49
|
+
export { BTNavMenuItem, BTNavSidebar }
|
|
50
|
+
|
|
46
51
|
// import BTBtn from './components/BT-Btn.vue'
|
|
47
52
|
// import BTCol from './components/BT-Col.vue'
|
|
48
53
|
|