v-nuxt-ui 0.1.19 → 0.1.20
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/button/Theme.vue +2 -1
- package/dist/runtime/components/layout/button/Collapse.d.vue.ts +3 -0
- package/dist/runtime/components/layout/button/Collapse.vue +15 -0
- package/dist/runtime/components/layout/button/Collapse.vue.d.ts +3 -0
- package/dist/runtime/components/layout/button/ModuleMenu.vue +1 -1
- package/dist/runtime/components/layout/button/ThemePicker.vue +23 -6
- package/dist/runtime/components/layout/button/UserMenu.vue +5 -6
- package/dist/runtime/components/layout/default.d.vue.ts +2 -2
- package/dist/runtime/components/layout/default.vue +38 -31
- package/dist/runtime/components/layout/default.vue.d.ts +2 -2
- package/dist/runtime/components/table/Page.vue +46 -48
- package/dist/runtime/components/table/Pagination.vue +1 -1
- package/dist/runtime/components/table/index.vue +1 -1
- package/dist/runtime/composables/useApp.d.ts +6 -0
- package/dist/runtime/composables/useApp.js +28 -1
- package/dist/runtime/composables/useTheme.d.ts +8 -0
- package/dist/runtime/composables/useTheme.js +34 -1
- package/dist/runtime/types/app.d.ts +4 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -11,6 +11,7 @@ const props = defineProps({
|
|
|
11
11
|
});
|
|
12
12
|
const slots = defineSlots();
|
|
13
13
|
const colorMode = useColorMode();
|
|
14
|
+
const emojiFlag = computed(() => props.locale ? getEmojiFlag(props.locale) : "");
|
|
14
15
|
const chipColor = computed(() => {
|
|
15
16
|
if (!props.chip) return void 0;
|
|
16
17
|
if (props.chip === "black") return "black";
|
|
@@ -37,7 +38,7 @@ const chipColor = computed(() => {
|
|
|
37
38
|
/>
|
|
38
39
|
</slot>
|
|
39
40
|
<slot v-else-if="locale" name="leading">
|
|
40
|
-
{{
|
|
41
|
+
{{ emojiFlag }}
|
|
41
42
|
</slot>
|
|
42
43
|
<slot v-else name="leading" />
|
|
43
44
|
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useApp, useTheme } from "#v/composables";
|
|
3
|
+
const app = useApp();
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<UButton
|
|
9
|
+
:icon="theme.sidebarSide.value === 'left' ? 'i-lucide-panel-left' : 'i-lucide-panel-right'"
|
|
10
|
+
color="neutral"
|
|
11
|
+
variant="ghost"
|
|
12
|
+
aria-label="Toggle sidebar"
|
|
13
|
+
@click="app.sidebarCollapsed.value = !app.sidebarCollapsed.value"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useTheme } from "#v/composables";
|
|
3
3
|
import ButtonTheme from "#v/components/button/Theme.vue";
|
|
4
4
|
const theme = useTheme();
|
|
5
|
+
const neutralColorOptions = theme.neutralColors.map((c) => ({ color: c, chip: c === "neutral" ? "old-neutral" : c }));
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
8
|
<template>
|
|
@@ -53,12 +54,12 @@ const theme = useTheme();
|
|
|
53
54
|
|
|
54
55
|
<div class="grid grid-cols-3 gap-2 -mx-2">
|
|
55
56
|
<ButtonTheme
|
|
56
|
-
v-for="
|
|
57
|
-
:key="color"
|
|
58
|
-
:label="color"
|
|
59
|
-
:chip="
|
|
60
|
-
:selected="theme.neutral.value === color"
|
|
61
|
-
@click="theme.neutral.value = color"
|
|
57
|
+
v-for="item in neutralColorOptions"
|
|
58
|
+
:key="item.color"
|
|
59
|
+
:label="item.color"
|
|
60
|
+
:chip="item.chip"
|
|
61
|
+
:selected="theme.neutral.value === item.color"
|
|
62
|
+
@click="theme.neutral.value = item.color"
|
|
62
63
|
/>
|
|
63
64
|
</div>
|
|
64
65
|
</fieldset>
|
|
@@ -95,6 +96,22 @@ const theme = useTheme();
|
|
|
95
96
|
/>
|
|
96
97
|
</div>
|
|
97
98
|
</fieldset>
|
|
99
|
+
|
|
100
|
+
<fieldset>
|
|
101
|
+
<legend class="text-[11px] leading-none font-semibold mb-2">
|
|
102
|
+
侧边栏样式
|
|
103
|
+
</legend>
|
|
104
|
+
|
|
105
|
+
<div class="grid grid-cols-3 gap-2 -mx-2">
|
|
106
|
+
<ButtonTheme
|
|
107
|
+
v-for="m in theme.sidebarVariantOptions.value"
|
|
108
|
+
:key="m.label"
|
|
109
|
+
v-bind="m"
|
|
110
|
+
:selected="theme.sidebarVariant.value === m.value"
|
|
111
|
+
@click="theme.sidebarVariant.value = m.value"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
</fieldset>
|
|
98
115
|
</template>
|
|
99
116
|
</UPopover>
|
|
100
117
|
</template>
|
|
@@ -44,19 +44,18 @@ const items = computed(() => [
|
|
|
44
44
|
<UDropdownMenu
|
|
45
45
|
:items="items"
|
|
46
46
|
:content="{ align: 'center', collisionPadding: 12 }"
|
|
47
|
-
:ui="{ content:
|
|
47
|
+
:ui="{ content: 'w-(--reka-dropdown-menu-trigger-width) min-w-48' }"
|
|
48
48
|
>
|
|
49
49
|
<UButton
|
|
50
|
-
:label="
|
|
50
|
+
:label="auth.loginUser.value?.nickname ?? 'Hello'"
|
|
51
51
|
leading-icon="i-lucide-user-circle"
|
|
52
52
|
:trailing-icon="collapsed || headerMode ? void 0 : 'i-lucide-chevrons-up-down'"
|
|
53
53
|
color="neutral"
|
|
54
54
|
variant="ghost"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
class="data-[state=open]:bg-elevated"
|
|
55
|
+
square
|
|
56
|
+
class="data-[state=open]:bg-elevated w-full overflow-hidden"
|
|
58
57
|
:ui="{
|
|
59
|
-
trailingIcon: 'text-dimmed'
|
|
58
|
+
trailingIcon: 'text-dimmed ms-auto'
|
|
60
59
|
}"
|
|
61
60
|
/>
|
|
62
61
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var __VLS_42: {};
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
|
-
default?: (props: typeof
|
|
3
|
+
default?: (props: typeof __VLS_42) => any;
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
6
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useSidebarMenus, useAuth, useTheme, useApp } from "#v/composables";
|
|
3
3
|
import { useRoute } from "nuxt/app";
|
|
4
4
|
import { stringsJoin } from "#v/utils";
|
|
5
|
-
import UDashboardGroup from "@nuxt/ui/components/DashboardGroup.vue";
|
|
6
|
-
import UDashboardSidebar from "@nuxt/ui/components/DashboardSidebar.vue";
|
|
7
5
|
import UNavigationMenu from "@nuxt/ui/components/NavigationMenu.vue";
|
|
8
6
|
import ScrollArea from "#v/components/ScrollArea.vue";
|
|
9
7
|
import LayoutModuleMenu from "#v/components/layout/button/ModuleMenu.vue";
|
|
10
8
|
import LayoutThemePicker from "#v/components/layout/button/ThemePicker.vue";
|
|
11
9
|
import LayoutUserMenu from "#v/components/layout/button/UserMenu.vue";
|
|
12
10
|
import Watermark from "#v/components/Watermark.vue";
|
|
13
|
-
import {
|
|
14
|
-
const open = ref(false);
|
|
11
|
+
import { watch } from "vue";
|
|
15
12
|
const app = useApp();
|
|
13
|
+
const theme = useTheme();
|
|
16
14
|
const loginUser = useAuth().loginUser;
|
|
17
15
|
const route = useRoute();
|
|
18
16
|
const { sidebarMenus, expandSidebarMenu, breadcrumbs, getBreadcrumbs } = useSidebarMenus();
|
|
@@ -31,53 +29,62 @@ watch(
|
|
|
31
29
|
</script>
|
|
32
30
|
|
|
33
31
|
<template>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
<div
|
|
33
|
+
class="flex flex-1 h-full"
|
|
34
|
+
:class="[
|
|
35
|
+
theme.sidebarVariant.value === 'inset' && 'bg-neutral-50 dark:bg-neutral-950',
|
|
36
|
+
theme.sidebarSide.value === 'right' && 'flex-row-reverse'
|
|
37
|
+
]"
|
|
38
|
+
>
|
|
39
|
+
<!-- sidebar -->
|
|
40
|
+
<USidebar
|
|
41
|
+
v-model:open="app.sidebarCollapsed.value"
|
|
42
|
+
:variant="theme.sidebarVariant.value"
|
|
43
|
+
:collapsible="theme.sidebarCollapsible.value"
|
|
44
|
+
:side="theme.sidebarSide.value"
|
|
42
45
|
:ui="{
|
|
43
|
-
root: 'bg-muted min-w-[65px]',
|
|
44
|
-
// 64 + 1: 1 is border-r
|
|
45
|
-
footer: 'lg:border-t lg:border-default sm:px-4',
|
|
46
46
|
body: 'px-0 sm:px-0',
|
|
47
|
-
|
|
47
|
+
footer: 'h-(--ui-footer-height)'
|
|
48
48
|
}"
|
|
49
49
|
>
|
|
50
|
-
<template #header="{
|
|
51
|
-
<LayoutModuleMenu :collapsed="collapsed" class="
|
|
52
|
-
<LayoutThemePicker v-if="
|
|
50
|
+
<template #header="{ state }">
|
|
51
|
+
<LayoutModuleMenu :collapsed="state === 'collapsed'" class="flex-1" />
|
|
52
|
+
<LayoutThemePicker v-if="state !== 'collapsed'" class="ml-auto" />
|
|
53
53
|
</template>
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
<template #default="{ state }">
|
|
55
56
|
<ScrollArea>
|
|
56
57
|
<div class="px-4 flex flex-col gap-2">
|
|
57
58
|
<UNavigationMenu
|
|
58
59
|
:items="sidebarMenus"
|
|
59
|
-
:collapsed="collapsed"
|
|
60
|
+
:collapsed="state === 'collapsed'"
|
|
60
61
|
trailing-icon="i-lucide-chevron-down"
|
|
61
62
|
orientation="vertical"
|
|
62
63
|
tooltip
|
|
63
64
|
popover
|
|
65
|
+
:ui="{ link: 'px-1.5 overflow-hidden' }"
|
|
64
66
|
/>
|
|
65
67
|
</div>
|
|
66
68
|
</ScrollArea>
|
|
67
69
|
</template>
|
|
68
70
|
|
|
69
|
-
<template #footer="{
|
|
70
|
-
<LayoutUserMenu :collapsed="collapsed" />
|
|
71
|
+
<template #footer="{ state }">
|
|
72
|
+
<LayoutUserMenu :collapsed="state === 'collapsed'" />
|
|
71
73
|
</template>
|
|
72
|
-
</
|
|
74
|
+
</USidebar>
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
<!-- main content -->
|
|
77
|
+
<div
|
|
78
|
+
class="flex-1 flex flex-col w-full overflow-hidden lg:peer-data-[variant=floating]:my-4 peer-data-[variant=inset]:m-4 lg:peer-data-[variant=inset]:not-peer-data-[collapsible=offcanvas]:ms-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:ring peer-data-[variant=inset]:ring-default bg-default"
|
|
79
|
+
>
|
|
80
|
+
<Watermark
|
|
81
|
+
:text="stringsJoin([
|
|
76
82
|
loginUser?.nickname ?? loginUser?.username,
|
|
77
83
|
loginUser?.department?.company?.nickname ?? loginUser?.department?.name
|
|
78
84
|
], '@')"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
>
|
|
86
|
+
<slot />
|
|
87
|
+
</Watermark>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
83
90
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var __VLS_42: {};
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
|
-
default?: (props: typeof
|
|
3
|
+
default?: (props: typeof __VLS_42) => any;
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
6
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -4,6 +4,7 @@ import TableHeader from "#v/components/table/header/index.vue";
|
|
|
4
4
|
import TableQueryWhere from "#v/components/table/query/where/index.vue";
|
|
5
5
|
import TablePagination from "#v/components/table/Pagination.vue";
|
|
6
6
|
import ScrollArea from "#v/components/ScrollArea.vue";
|
|
7
|
+
import LayoutButtonCollapse from "#v/components/layout/button/Collapse.vue";
|
|
7
8
|
const props = defineProps({
|
|
8
9
|
name: { type: String, required: true },
|
|
9
10
|
cnName: { type: String, required: true },
|
|
@@ -74,57 +75,54 @@ defineExpose({ createRow, updateRow, deleteRow, refresh: fetchList, stats, data
|
|
|
74
75
|
</script>
|
|
75
76
|
|
|
76
77
|
<template>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</template>
|
|
87
|
-
</UDashboardNavbar>
|
|
88
|
-
</template>
|
|
78
|
+
<div class="flex-1 flex flex-col overflow-hidden">
|
|
79
|
+
<!-- header -->
|
|
80
|
+
<div class="h-(--ui-header-height) flex items-center pl-2.5 pr-2.5 border-b border-default">
|
|
81
|
+
<div class="flex items-center gap-1">
|
|
82
|
+
<LayoutButtonCollapse />
|
|
83
|
+
<span class="font-bold">{{ cnName }}</span>
|
|
84
|
+
</div>
|
|
85
|
+
<TableHeader v-bind="tblHeaderProps" class="ml-auto" />
|
|
86
|
+
</div>
|
|
89
87
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</UCollapsible>
|
|
88
|
+
<!-- query where -->
|
|
89
|
+
<UCollapsible :open="tblHeaderProps.whereQueryProps.whereQueryOpen">
|
|
90
|
+
<template #content>
|
|
91
|
+
<TableQueryWhere ref="proTableQueryWhere" v-bind="tblWhereQueryProps" class="bg-muted border-b border-default" />
|
|
92
|
+
</template>
|
|
93
|
+
</UCollapsible>
|
|
97
94
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
95
|
+
<!-- table -->
|
|
96
|
+
<div ref="table" class="flex-1 flex flex-col h-full overflow-hidden border-b border-default">
|
|
97
|
+
<!-- table -->
|
|
98
|
+
<UContextMenu :items="tblContextMenuItems">
|
|
99
|
+
<ScrollArea class="flex-1">
|
|
100
|
+
<UTable
|
|
101
|
+
v-bind="tblProps"
|
|
102
|
+
:row-selection="rowSelection"
|
|
103
|
+
:class="tblClasses"
|
|
104
|
+
:ui="tblUi"
|
|
105
|
+
@resize="updateTableWidth"
|
|
106
|
+
@update:row-selection="onUpdateRowSelection"
|
|
107
|
+
>
|
|
108
|
+
<template v-if="expandable" #expanded="{ row }">
|
|
109
|
+
<div
|
|
110
|
+
class="px-1 py-3 sticky inset-4"
|
|
111
|
+
:style="{
|
|
113
112
|
width: `${tableWidth - 38}px`
|
|
114
113
|
}"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
>
|
|
115
|
+
<KeepAlive>
|
|
116
|
+
<component :is="expandVNode?.(row.original)" :key="row.original[rowKey]" role="expand-row" />
|
|
117
|
+
</KeepAlive>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
</UTable>
|
|
121
|
+
</ScrollArea>
|
|
122
|
+
</UContextMenu>
|
|
123
|
+
</div>
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</template>
|
|
129
|
-
</UDashboardPanel>
|
|
125
|
+
<!-- pagination -->
|
|
126
|
+
<TablePagination v-bind="tblPaginationProps" />
|
|
127
|
+
</div>
|
|
130
128
|
</template>
|
|
@@ -16,7 +16,7 @@ const isMobile = useApp().isMobile;
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<div class="flex items-center justify-between gap-3 h-(--ui-footer-height)
|
|
19
|
+
<div class="flex items-center justify-between gap-3 h-(--ui-footer-height) p-3">
|
|
20
20
|
<div v-if="!isMobile" class="text-sm text-muted truncate">
|
|
21
21
|
{{ selectedIds?.length ?? 0 }} of
|
|
22
22
|
{{ data.length }} 行已选择
|
|
@@ -85,7 +85,7 @@ defineExpose({ createRow, updateRow, deleteRow, refresh: fetchList, stats, data
|
|
|
85
85
|
</div>
|
|
86
86
|
<UCollapsible :open="tblHeaderProps.whereQueryProps.whereQueryOpen">
|
|
87
87
|
<template #content>
|
|
88
|
-
<TableQueryWhere ref="proTableQueryWhere" v-bind="tblWhereQueryProps" class="border-b border-default" />
|
|
88
|
+
<TableQueryWhere ref="proTableQueryWhere" v-bind="tblWhereQueryProps" class="border-b border-default bg-muted" />
|
|
89
89
|
</template>
|
|
90
90
|
</UCollapsible>
|
|
91
91
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CustomAppConfig, type I18nLocale } from '#v/types';
|
|
2
|
+
import type { SidebarProps } from '@nuxt/ui';
|
|
2
3
|
export declare const defaultAppSettings: CustomAppConfig;
|
|
3
4
|
export declare const useApp: () => {
|
|
4
5
|
themeSettingsVisible: import("vue").Ref<boolean, boolean>;
|
|
@@ -10,6 +11,11 @@ export declare const useApp: () => {
|
|
|
10
11
|
updateNeutralColor: (color: string) => void;
|
|
11
12
|
updateRadius: (radius: number) => void;
|
|
12
13
|
updateLocale: (locale: I18nLocale) => void;
|
|
14
|
+
updateSidebarSide: (side: SidebarProps["side"]) => void;
|
|
15
|
+
updateSidebarVariant: (variant: SidebarProps["variant"]) => void;
|
|
16
|
+
updateSidebarCollapsible: (collapsible: SidebarProps["collapsible"]) => void;
|
|
17
|
+
updateSidebarCollapsed: (collapsed: boolean) => void;
|
|
18
|
+
sidebarCollapsed: import("vue").WritableComputedRef<boolean, boolean>;
|
|
13
19
|
keepalive: import("vue").WritableComputedRef<boolean, boolean>;
|
|
14
20
|
setKeepalive: (value: boolean) => boolean;
|
|
15
21
|
isMobile: import("vue").ComputedRef<boolean>;
|
|
@@ -5,6 +5,9 @@ import { cloneJson } from "#v/utils";
|
|
|
5
5
|
export const defaultAppSettings = {
|
|
6
6
|
headerHeight: 48,
|
|
7
7
|
tabHeight: 40,
|
|
8
|
+
side: "left",
|
|
9
|
+
variant: "inset",
|
|
10
|
+
collapsible: "icon",
|
|
8
11
|
siderMaxWidth: 20,
|
|
9
12
|
siderMinWidth: 10,
|
|
10
13
|
siderCollapsed: false,
|
|
@@ -26,7 +29,6 @@ const _useApp = () => {
|
|
|
26
29
|
};
|
|
27
30
|
const updateNeutralColor = (color) => {
|
|
28
31
|
appConfig.value = { ...appConfig.value, neutral: color };
|
|
29
|
-
console.log("Updated neutral color to", appConfig.value);
|
|
30
32
|
};
|
|
31
33
|
const updateRadius = (radius) => {
|
|
32
34
|
appConfig.value = { ...appConfig.value, radius };
|
|
@@ -34,6 +36,26 @@ const _useApp = () => {
|
|
|
34
36
|
const updateLocale = (locale) => {
|
|
35
37
|
appConfig.value = { ...appConfig.value, locale };
|
|
36
38
|
};
|
|
39
|
+
const updateSidebarSide = (side) => {
|
|
40
|
+
appConfig.value = { ...appConfig.value, side };
|
|
41
|
+
};
|
|
42
|
+
const updateSidebarVariant = (variant) => {
|
|
43
|
+
appConfig.value = { ...appConfig.value, variant };
|
|
44
|
+
};
|
|
45
|
+
const updateSidebarCollapsible = (collapsible) => {
|
|
46
|
+
appConfig.value = { ...appConfig.value, collapsible };
|
|
47
|
+
};
|
|
48
|
+
const updateSidebarCollapsed = (collapsed) => {
|
|
49
|
+
appConfig.value = { ...appConfig.value, siderCollapsed: collapsed };
|
|
50
|
+
};
|
|
51
|
+
const sidebarCollapsed = computed({
|
|
52
|
+
get() {
|
|
53
|
+
return appConfig.value.siderCollapsed ?? false;
|
|
54
|
+
},
|
|
55
|
+
set(value) {
|
|
56
|
+
appConfig.value = { ...appConfig.value, siderCollapsed: value };
|
|
57
|
+
}
|
|
58
|
+
});
|
|
37
59
|
const keepalive = computed({
|
|
38
60
|
get() {
|
|
39
61
|
return appConfig.value.keepalive ?? true;
|
|
@@ -69,6 +91,11 @@ const _useApp = () => {
|
|
|
69
91
|
updateNeutralColor,
|
|
70
92
|
updateRadius,
|
|
71
93
|
updateLocale,
|
|
94
|
+
updateSidebarSide,
|
|
95
|
+
updateSidebarVariant,
|
|
96
|
+
updateSidebarCollapsible,
|
|
97
|
+
updateSidebarCollapsed,
|
|
98
|
+
sidebarCollapsed,
|
|
72
99
|
keepalive,
|
|
73
100
|
setKeepalive,
|
|
74
101
|
isMobile,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { I18nLocale } from '#v/types';
|
|
2
|
+
import type { SidebarProps } from '@nuxt/ui';
|
|
2
3
|
export declare const useTheme: () => {
|
|
3
4
|
blackAsPrimary: import("vue").WritableComputedRef<any, any>;
|
|
4
5
|
neutralColors: string[];
|
|
@@ -17,4 +18,11 @@ export declare const useTheme: () => {
|
|
|
17
18
|
mode: import("vue").WritableComputedRef<"auto" | "light" | "dark", "auto" | "light" | "dark">;
|
|
18
19
|
locale: import("vue").WritableComputedRef<I18nLocale, I18nLocale>;
|
|
19
20
|
locales: import("@nuxt/ui").Locale<import("@nuxt/ui").Messages>[];
|
|
21
|
+
sidebarSide: import("vue").WritableComputedRef<string | number | symbol, string | number | symbol | undefined>;
|
|
22
|
+
sidebarVariant: import("vue").WritableComputedRef<string | number | symbol | undefined, string | number | symbol | undefined>;
|
|
23
|
+
sidebarVariantOptions: import("vue").ComputedRef<{
|
|
24
|
+
label: string;
|
|
25
|
+
value: SidebarProps["variant"];
|
|
26
|
+
}[]>;
|
|
27
|
+
sidebarCollapsible: import("vue").WritableComputedRef<string | number | symbol, string | number | symbol | undefined>;
|
|
20
28
|
};
|
|
@@ -90,6 +90,35 @@ const _useTheme = () => {
|
|
|
90
90
|
app.updateLocale(value);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
|
+
const sidebarSide = computed({
|
|
94
|
+
get() {
|
|
95
|
+
return app.appConfig.value.side ?? "left";
|
|
96
|
+
},
|
|
97
|
+
set(value) {
|
|
98
|
+
app.updateSidebarSide(value);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const sidebarVariant = computed({
|
|
102
|
+
get() {
|
|
103
|
+
return app.appConfig.value.variant ?? "sidebar";
|
|
104
|
+
},
|
|
105
|
+
set(value) {
|
|
106
|
+
app.updateSidebarVariant(value);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const sidebarVariantOptions = computed(() => [
|
|
110
|
+
{ label: "\u5D4C\u5165\u5F0F", value: "inset" },
|
|
111
|
+
{ label: "\u60AC\u6D6E\u5F0F", value: "floating" },
|
|
112
|
+
{ label: "\u5206\u79BB\u5F0F", value: "separated" }
|
|
113
|
+
]);
|
|
114
|
+
const sidebarCollapsible = computed({
|
|
115
|
+
get() {
|
|
116
|
+
return app.appConfig.value.collapsible ?? "responsive";
|
|
117
|
+
},
|
|
118
|
+
set(value) {
|
|
119
|
+
app.updateSidebarCollapsible(value);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
93
122
|
return {
|
|
94
123
|
blackAsPrimary,
|
|
95
124
|
neutralColors: twNeutralColorNames,
|
|
@@ -103,7 +132,11 @@ const _useTheme = () => {
|
|
|
103
132
|
modes,
|
|
104
133
|
mode,
|
|
105
134
|
locale,
|
|
106
|
-
locales
|
|
135
|
+
locales,
|
|
136
|
+
sidebarSide,
|
|
137
|
+
sidebarVariant,
|
|
138
|
+
sidebarVariantOptions,
|
|
139
|
+
sidebarCollapsible
|
|
107
140
|
};
|
|
108
141
|
};
|
|
109
142
|
export const useTheme = createSharedComposable(_useTheme);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SidebarProps } from '@nuxt/ui';
|
|
1
2
|
import type { I18nLocale } from './locale.js';
|
|
2
3
|
/** Header config */
|
|
3
4
|
export interface HeaderConfig {
|
|
@@ -13,6 +14,9 @@ export interface TabConfig {
|
|
|
13
14
|
}
|
|
14
15
|
/** Sider config */
|
|
15
16
|
interface SiderConfig {
|
|
17
|
+
side?: SidebarProps['side'];
|
|
18
|
+
variant?: SidebarProps['variant'];
|
|
19
|
+
collapsible?: SidebarProps['collapsible'];
|
|
16
20
|
hideSider?: boolean;
|
|
17
21
|
siderClass?: string;
|
|
18
22
|
siderMobileClass?: string;
|
package/package.json
CHANGED