@ysgroup/ui 0.1.30 → 0.1.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/package.json +3 -3
- package/src/components/YsPageLayout.vue +24 -59
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ysgroup/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@element-plus/icons-vue": "^2.3.1",
|
|
9
|
-
"@ysgroup/contracts": "0.1.8"
|
|
10
|
-
"@ysgroup/theme": "^0.1.0"
|
|
9
|
+
"@ysgroup/contracts": "0.1.8"
|
|
11
10
|
},
|
|
12
11
|
"peerDependencies": {
|
|
12
|
+
"@ysgroup/theme": ">=0.2.0",
|
|
13
13
|
"element-plus": ">=2.9",
|
|
14
14
|
"vue": ">=3.5"
|
|
15
15
|
},
|
|
@@ -1,29 +1,18 @@
|
|
|
1
|
-
<!-- YsPageLayout —— 统一布局骨架:顶栏(logo/app
|
|
1
|
+
<!-- YsPageLayout —— 统一布局骨架:顶栏(logo/app名/工具条) + 侧栏 + 内容。 -->
|
|
2
2
|
<script setup lang="ts">
|
|
3
|
-
import { ref } from "vue";
|
|
4
|
-
import { applyTheme, currentMode, type ThemeMode } from "@ysgroup/theme";
|
|
5
|
-
|
|
6
3
|
defineProps<{
|
|
7
4
|
appTitle: string;
|
|
8
5
|
logoUrl?: string;
|
|
9
|
-
username?: string;
|
|
10
6
|
menus?: { key: string; title: string; icon?: string }[];
|
|
11
7
|
active?: string;
|
|
12
8
|
}>();
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const current = document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
|
|
19
|
-
mode.value = current === "dark" ? "light" : "dark";
|
|
20
|
-
applyTheme(mode.value);
|
|
21
|
-
}
|
|
10
|
+
defineSlots<{
|
|
11
|
+
toolbar?: () => unknown;
|
|
12
|
+
default?: () => unknown;
|
|
13
|
+
}>();
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
if (command === "settings") emit("settings");
|
|
25
|
-
if (command === "logout") emit("logout");
|
|
26
|
-
}
|
|
15
|
+
const emit = defineEmits<{ navigate: [key: string] }>();
|
|
27
16
|
</script>
|
|
28
17
|
|
|
29
18
|
<template>
|
|
@@ -34,23 +23,9 @@ function handleUserCommand(command: string) {
|
|
|
34
23
|
<span class="ys-layout__title">{{ appTitle }}</span>
|
|
35
24
|
</div>
|
|
36
25
|
<div class="ys-layout__spacer" />
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
aria-label="切换明暗模式"
|
|
41
|
-
@click="toggleTheme"
|
|
42
|
-
>
|
|
43
|
-
<span class="ys-layout__theme-icon">{{ mode === "dark" ? "☾" : "☀" }}</span>
|
|
44
|
-
</el-button>
|
|
45
|
-
<el-dropdown v-if="username" @command="handleUserCommand">
|
|
46
|
-
<span class="ys-layout__user">{{ username }}</span>
|
|
47
|
-
<template #dropdown>
|
|
48
|
-
<el-dropdown-menu>
|
|
49
|
-
<el-dropdown-item command="settings">设置中心</el-dropdown-item>
|
|
50
|
-
<el-dropdown-item divided command="logout">退出登录</el-dropdown-item>
|
|
51
|
-
</el-dropdown-menu>
|
|
52
|
-
</template>
|
|
53
|
-
</el-dropdown>
|
|
26
|
+
<div v-if="$slots.toolbar" class="ys-layout__toolbar">
|
|
27
|
+
<slot name="toolbar" />
|
|
28
|
+
</div>
|
|
54
29
|
</header>
|
|
55
30
|
<div class="ys-layout__body">
|
|
56
31
|
<aside v-if="menus?.length" class="ys-layout__side">
|
|
@@ -78,18 +53,23 @@ function handleUserCommand(command: string) {
|
|
|
78
53
|
flex-direction: column;
|
|
79
54
|
}
|
|
80
55
|
.ys-layout__top {
|
|
81
|
-
height:
|
|
56
|
+
height: 54px;
|
|
82
57
|
display: flex;
|
|
83
58
|
align-items: center;
|
|
84
|
-
padding: 0 16px;
|
|
85
|
-
gap: 8px;
|
|
59
|
+
padding: 0 16px 0 0;
|
|
86
60
|
background: var(--ys-color-bg-elevated);
|
|
87
61
|
border-bottom: 1px solid var(--ys-color-border);
|
|
62
|
+
overflow: visible;
|
|
88
63
|
}
|
|
89
64
|
.ys-layout__brand {
|
|
90
65
|
display: flex;
|
|
91
66
|
align-items: center;
|
|
92
67
|
gap: 10px;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
width: 220px;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
padding-left: 16px;
|
|
72
|
+
overflow: hidden;
|
|
93
73
|
}
|
|
94
74
|
.ys-layout__logo {
|
|
95
75
|
width: 30px;
|
|
@@ -99,32 +79,17 @@ function handleUserCommand(command: string) {
|
|
|
99
79
|
.ys-layout__title {
|
|
100
80
|
font-weight: 600;
|
|
101
81
|
color: var(--ys-color-text-1);
|
|
82
|
+
white-space: nowrap;
|
|
102
83
|
}
|
|
103
84
|
.ys-layout__spacer {
|
|
104
85
|
flex: 1;
|
|
86
|
+
min-width: 0;
|
|
105
87
|
}
|
|
106
|
-
.ys-
|
|
107
|
-
|
|
108
|
-
height:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
background: var(--ys-color-bg-elevated);
|
|
112
|
-
color: var(--ys-color-text-2);
|
|
113
|
-
}
|
|
114
|
-
.ys-layout__theme-toggle:hover,
|
|
115
|
-
.ys-layout__theme-toggle:focus-visible {
|
|
116
|
-
border-color: var(--ys-color-primary);
|
|
117
|
-
background: var(--ys-color-bg-hover);
|
|
118
|
-
color: var(--ys-color-primary);
|
|
119
|
-
}
|
|
120
|
-
.ys-layout__theme-icon {
|
|
121
|
-
font-size: 16px;
|
|
122
|
-
line-height: 1;
|
|
123
|
-
}
|
|
124
|
-
.ys-layout__user {
|
|
125
|
-
cursor: pointer;
|
|
126
|
-
color: var(--ys-color-text-2);
|
|
127
|
-
padding: 0 8px;
|
|
88
|
+
.ys-layout__toolbar {
|
|
89
|
+
flex: none;
|
|
90
|
+
height: 100%;
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
128
93
|
}
|
|
129
94
|
.ys-layout__body {
|
|
130
95
|
flex: 1;
|