@falcondev-oss/nuxt-layers-base 0.30.0 → 0.31.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/.playground/app/pages/index.vue +7 -1
- package/app/components/layout/{Sidebar.vue → LayoutSidebar.vue} +43 -15
- package/app/composables/usePreventPageLeave.ts +3 -4
- package/app/composables/useRouteParamString.ts +2 -1
- package/package.json +1 -1
- /package/app/components/layout/{Navbar.vue → LayoutNavbar.vue} +0 -0
|
@@ -145,7 +145,13 @@ const columns = useTableColumns<typeof data>(
|
|
|
145
145
|
]"
|
|
146
146
|
:user-menu="{
|
|
147
147
|
name: 'Benjamin Canac',
|
|
148
|
-
|
|
148
|
+
avatar: { src: 'https://github.com/benjamincanac.png' },
|
|
149
|
+
items: [
|
|
150
|
+
{
|
|
151
|
+
icon: 'lucide:log-out',
|
|
152
|
+
label: 'Logout',
|
|
153
|
+
},
|
|
154
|
+
],
|
|
149
155
|
}"
|
|
150
156
|
>
|
|
151
157
|
<LayoutNavbar
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AvatarProps,
|
|
4
|
+
DashboardSidebarProps,
|
|
5
|
+
DropdownMenuItem,
|
|
6
|
+
NavigationMenuItem,
|
|
7
|
+
NavigationMenuProps,
|
|
8
|
+
} from '@nuxt/ui'
|
|
3
9
|
|
|
4
10
|
defineProps<{
|
|
5
11
|
sidebar?: DashboardSidebarProps
|
|
@@ -11,7 +17,8 @@ defineProps<{
|
|
|
11
17
|
bottomItems?: NavigationMenuItem[]
|
|
12
18
|
userMenu?: {
|
|
13
19
|
name: string
|
|
14
|
-
|
|
20
|
+
avatar?: AvatarProps
|
|
21
|
+
items: DropdownMenuItem[]
|
|
15
22
|
}
|
|
16
23
|
itemsUi?: NavigationMenuProps['ui']
|
|
17
24
|
bottomItemsUi?: NavigationMenuProps['ui']
|
|
@@ -28,7 +35,17 @@ const config = useRuntimeConfig()
|
|
|
28
35
|
|
|
29
36
|
<template>
|
|
30
37
|
<UDashboardGroup storage="local" :storage-key="`${config.public.projectId}-dashboard`" unit="rem">
|
|
31
|
-
<UDashboardSidebar
|
|
38
|
+
<UDashboardSidebar
|
|
39
|
+
v-bind="sidebar"
|
|
40
|
+
class="bg-white"
|
|
41
|
+
mode="drawer"
|
|
42
|
+
:default-size="16"
|
|
43
|
+
collapsible
|
|
44
|
+
:ui="{
|
|
45
|
+
header: 'border-b border-default',
|
|
46
|
+
footer: 'border-t border-default',
|
|
47
|
+
}"
|
|
48
|
+
>
|
|
32
49
|
<template
|
|
33
50
|
v-if="logo?.src || logo?.iconSrc || slots.logo || slots.icon"
|
|
34
51
|
#header="{ collapsed }"
|
|
@@ -66,19 +83,30 @@ const config = useRuntimeConfig()
|
|
|
66
83
|
/>
|
|
67
84
|
</template>
|
|
68
85
|
<template v-if="userMenu" #footer="{ collapsed }">
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
<UDropdownMenu :items="userMenu.items">
|
|
87
|
+
<UButton
|
|
88
|
+
:label="collapsed ? undefined : userMenu.name"
|
|
89
|
+
:trailing-icon="collapsed ? undefined : 'ph:caret-up-down'"
|
|
90
|
+
:icon="userMenu.avatar ? undefined : 'lucide:user-round'"
|
|
91
|
+
:avatar="userMenu.avatar"
|
|
92
|
+
color="neutral"
|
|
93
|
+
variant="ghost"
|
|
94
|
+
block
|
|
95
|
+
:square="collapsed"
|
|
96
|
+
class="data-[state=open]:bg-elevated"
|
|
97
|
+
:ui="{
|
|
98
|
+
leadingIcon: 'text-accented',
|
|
99
|
+
trailingIcon: 'text-dimmed',
|
|
100
|
+
}"
|
|
101
|
+
/>
|
|
102
|
+
</UDropdownMenu>
|
|
80
103
|
</template>
|
|
81
104
|
</UDashboardSidebar>
|
|
82
|
-
|
|
105
|
+
|
|
106
|
+
<div class="relative w-full">
|
|
107
|
+
<Suspense>
|
|
108
|
+
<slot />
|
|
109
|
+
</Suspense>
|
|
110
|
+
</div>
|
|
83
111
|
</UDashboardGroup>
|
|
84
112
|
</template>
|
|
@@ -20,11 +20,10 @@ export function usePreventPageLeave(
|
|
|
20
20
|
if (!toValue(preventPageLeave)) return next()
|
|
21
21
|
|
|
22
22
|
const allowLeave = await confirm.confirmDestructive({
|
|
23
|
-
title: opts?.leaveTitle || '
|
|
23
|
+
title: opts?.leaveTitle || 'Ungespeicherte Änderungen',
|
|
24
24
|
description:
|
|
25
|
-
opts?.leaveDescription ||
|
|
26
|
-
|
|
27
|
-
submitLabel: 'Leave Page',
|
|
25
|
+
opts?.leaveDescription || 'Es gibt ungespeicherte Änderungen. Seite trotzdem verlassen?',
|
|
26
|
+
submitLabel: 'Verlassen',
|
|
28
27
|
})
|
|
29
28
|
if (allowLeave) return next()
|
|
30
29
|
})
|
|
@@ -7,7 +7,8 @@ export function useRouteParamString(paramName: string) {
|
|
|
7
7
|
const stop = watch(
|
|
8
8
|
param,
|
|
9
9
|
() => {
|
|
10
|
-
if (typeof param.value !== 'string')
|
|
10
|
+
if (typeof param.value !== 'string')
|
|
11
|
+
throw new Error(`Route parameter '[${paramName}]' must be a string`)
|
|
11
12
|
paramRef.value = param.value
|
|
12
13
|
},
|
|
13
14
|
{ immediate: true },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@falcondev-oss/nuxt-layers-base",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.31.0",
|
|
5
5
|
"description": "Nuxt layer with lots of useful helpers and @nuxt/ui components",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:falcondev-oss/nuxt-layers",
|
|
File without changes
|