@mptw/skylens-ui 1.4.34 → 1.4.36
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/app.vue +2 -4
- package/components/SLProfileButton.vue +10 -1
- package/components/SLSidebarNav.vue +263 -0
- package/components/SLSidebarNavGroupItem.vue +37 -0
- package/components/SLSidebarNavGroupItemSection.vue +435 -0
- package/components/SLSidebarNavLinkItem.vue +255 -0
- package/components/SLSitePage.vue +2 -1
- package/package.json +4 -4
- package/tailwind.config.js +2 -2
- package/components/SLSiderbarNav.vue +0 -394
- package/components/SLSiderbarNavItem.vue +0 -204
package/app.vue
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
.profile-button(ref='el')
|
|
3
3
|
a(
|
|
4
4
|
href="javascript:;"
|
|
5
|
+
:class='{ active: isShowPopup }'
|
|
5
6
|
@click.stop.prevent="onClickedToggle"
|
|
6
7
|
ref="toggleEl"
|
|
7
8
|
).btn.toggle-button {{ title }}
|
|
@@ -42,6 +43,7 @@ export default defineComponent({
|
|
|
42
43
|
const el = shallowRef<HTMLElement | null>(null);
|
|
43
44
|
const toggleEl = shallowRef<HTMLElement | null>(null);
|
|
44
45
|
const popupEl = shallowRef<HTMLElement | null>(null);
|
|
46
|
+
const isShowPopup = ref(false);
|
|
45
47
|
|
|
46
48
|
let popperInstance: any = null;
|
|
47
49
|
let clickSubscriber: any = null;
|
|
@@ -84,6 +86,7 @@ export default defineComponent({
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
function show() {
|
|
89
|
+
isShowPopup.value = true;
|
|
87
90
|
subscribeClick();
|
|
88
91
|
if (popupEl.value) {
|
|
89
92
|
popupEl.value.setAttribute("data-show", "");
|
|
@@ -106,6 +109,7 @@ export default defineComponent({
|
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
function hide() {
|
|
112
|
+
isShowPopup.value = false;
|
|
109
113
|
if (popupEl.value && popupEl.value.getAttribute("data-show") === null)
|
|
110
114
|
return;
|
|
111
115
|
|
|
@@ -150,6 +154,7 @@ export default defineComponent({
|
|
|
150
154
|
el,
|
|
151
155
|
toggleEl,
|
|
152
156
|
popupEl,
|
|
157
|
+
isShowPopup,
|
|
153
158
|
title,
|
|
154
159
|
showEditProfile,
|
|
155
160
|
onClickedToggle,
|
|
@@ -167,7 +172,11 @@ export default defineComponent({
|
|
|
167
172
|
<style lang="stylus">
|
|
168
173
|
.profile-button
|
|
169
174
|
.toggle-button
|
|
170
|
-
@apply inline-flex items-center justify-center w-
|
|
175
|
+
@apply inline-flex items-center justify-center w-7 h-7 p-0 rounded-full bg-primary-400 text-lg text-white font-bold
|
|
176
|
+
@apply s('hover:bg-primary-600') s('active:bg-primary')
|
|
177
|
+
|
|
178
|
+
&.active
|
|
179
|
+
@apply bg-primary
|
|
171
180
|
|
|
172
181
|
.profile-nav-popup
|
|
173
182
|
@apply z-60 absolute s('min-w-[10.25rem]') p-4 border border-primary bg-primary-50 rounded shadow-popup-lg pointer-events-none invisible
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
.sidebar(:class="{ closure: closuredProxy, dark }")
|
|
3
|
+
.sidebar-modal(@click="onClickedToggle")
|
|
4
|
+
.sidebar-logo
|
|
5
|
+
a.logo(href="javascript:;" @click="onClickedLogo")
|
|
6
|
+
img.color-big(src="~/assets/images/commons/app-logo-big.svg")
|
|
7
|
+
img.white-big(src="~/assets/images/commons/app-logo-big-white.svg")
|
|
8
|
+
img.color-small(src='~/assets/images/commons/app-logo-small.svg')
|
|
9
|
+
img.white-small(src='~/assets/images/commons/app-logo-small-white.svg')
|
|
10
|
+
nav.site-nav
|
|
11
|
+
.nav-wrapper.custom-scrollbar-y
|
|
12
|
+
template(v-for='item in config')
|
|
13
|
+
SLSidebarNavLinkItem(
|
|
14
|
+
v-if='item.navType === "link"'
|
|
15
|
+
:nav-collapsed='closured'
|
|
16
|
+
:item-config='item'
|
|
17
|
+
@click:item='onClickedItem'
|
|
18
|
+
)
|
|
19
|
+
SLSidebarNavSectionItem(
|
|
20
|
+
v-else-if='item.navType === "section"'
|
|
21
|
+
:nav-collapsed='closured'
|
|
22
|
+
:item-config='item'
|
|
23
|
+
@click:item='onClickedItem'
|
|
24
|
+
)
|
|
25
|
+
SLSidebarNavGroupItem(
|
|
26
|
+
v-else-if='item.navType === "group"'
|
|
27
|
+
:nav-collapsed='closured'
|
|
28
|
+
:item-config='item'
|
|
29
|
+
@click:item='onClickedItem'
|
|
30
|
+
)
|
|
31
|
+
.sidebar-nav-divide-item(
|
|
32
|
+
v-else
|
|
33
|
+
)
|
|
34
|
+
.sidebar-mode-setting
|
|
35
|
+
.sidebar-mode-setting-title 模式
|
|
36
|
+
SLIOSSwitch(
|
|
37
|
+
:modelValue="dark"
|
|
38
|
+
trueLabel="深色"
|
|
39
|
+
minTrueLabel="深"
|
|
40
|
+
falseLabel="淺色"
|
|
41
|
+
minFalseLabel="淺"
|
|
42
|
+
:size="closuredProxy ? 'min' : ''"
|
|
43
|
+
@update:modelValue="onUpdatedMode"
|
|
44
|
+
)
|
|
45
|
+
a.sidebar-toggle(href="javascript:;", @click="onClickedToggle")
|
|
46
|
+
SLIcon(icon="chevron-left")
|
|
47
|
+
SLIcon(icon="chevron-right")
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script lang="ts">
|
|
51
|
+
import type { PropType } from "vue";
|
|
52
|
+
import type { NavConfigType } from "~ui/interface/NavConfigType";
|
|
53
|
+
|
|
54
|
+
export default defineComponent({
|
|
55
|
+
name: "SLSidebarNav",
|
|
56
|
+
props: {
|
|
57
|
+
dark: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
closured: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
65
|
+
config: {
|
|
66
|
+
type: Array as PropType<NavConfigType>,
|
|
67
|
+
default: () => [],
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
emits: ["click:logo", "update:dark", "update:closured", "click:insight"],
|
|
71
|
+
setup(props, { emit }) {
|
|
72
|
+
const { closured } = toRefs(props);
|
|
73
|
+
|
|
74
|
+
const closuredProxy = computed({
|
|
75
|
+
get: () => closured.value,
|
|
76
|
+
set: (newValue) => emit('update:closured', newValue),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
function onClickedToggle() {
|
|
80
|
+
closuredProxy.value = !closuredProxy.value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function onClickedLogo() {
|
|
84
|
+
emit("click:logo");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function onClickedItem(
|
|
88
|
+
eventName:
|
|
89
|
+
| "click:logo"
|
|
90
|
+
| "update:dark"
|
|
91
|
+
| "update:closured"
|
|
92
|
+
| "click:insight"
|
|
93
|
+
) {
|
|
94
|
+
emit(eventName);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function onUpdatedMode(isDark: boolean) {
|
|
98
|
+
emit("update:dark", isDark);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
closuredProxy,
|
|
103
|
+
onClickedToggle,
|
|
104
|
+
onClickedLogo,
|
|
105
|
+
onClickedItem,
|
|
106
|
+
onUpdatedMode,
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style lang="stylus">
|
|
113
|
+
.sidebar
|
|
114
|
+
@apply relative flex flex-col s('w-[188px]') h-full bg-white rounded-r-lg shadow transition-all
|
|
115
|
+
|
|
116
|
+
&.dark
|
|
117
|
+
@apply bg-primary
|
|
118
|
+
|
|
119
|
+
&.closure
|
|
120
|
+
.sidebar-logo
|
|
121
|
+
.logo
|
|
122
|
+
img.color-small
|
|
123
|
+
@apply s('lg:hidden')
|
|
124
|
+
|
|
125
|
+
img.white-big
|
|
126
|
+
@apply s('lg:hidden')
|
|
127
|
+
|
|
128
|
+
img.white-small
|
|
129
|
+
@apply s('lg:block')
|
|
130
|
+
|
|
131
|
+
.sidebar-toggle
|
|
132
|
+
&:hover
|
|
133
|
+
@apply bg-primary-300 text-white
|
|
134
|
+
|
|
135
|
+
.sidebar-logo
|
|
136
|
+
.logo
|
|
137
|
+
img.color-big
|
|
138
|
+
@apply hidden
|
|
139
|
+
|
|
140
|
+
img.white-big
|
|
141
|
+
@apply block
|
|
142
|
+
|
|
143
|
+
nav
|
|
144
|
+
.nav-wrapper.custom-scrollbar-y
|
|
145
|
+
/* Handle */
|
|
146
|
+
&::-webkit-scrollbar-thumb
|
|
147
|
+
@apply bg-primary-600
|
|
148
|
+
|
|
149
|
+
/* Handle on hover */
|
|
150
|
+
&::-webkit-scrollbar-thumb:hover
|
|
151
|
+
@apply bg-primary-600
|
|
152
|
+
|
|
153
|
+
.sidebar-mode-setting
|
|
154
|
+
@apply text-white
|
|
155
|
+
|
|
156
|
+
.ios-switch
|
|
157
|
+
label
|
|
158
|
+
@apply border-primary-600
|
|
159
|
+
background #2D2F57
|
|
160
|
+
|
|
161
|
+
&:before
|
|
162
|
+
@apply border-2 border-primary-600 bg-primary-300
|
|
163
|
+
|
|
164
|
+
.sidebar-toggle
|
|
165
|
+
@apply bg-primary-300 text-white
|
|
166
|
+
|
|
167
|
+
&:hover
|
|
168
|
+
@apply bg-primary-25 text-primary
|
|
169
|
+
|
|
170
|
+
&.closure
|
|
171
|
+
@apply s('-ml-[188px]')
|
|
172
|
+
@apply s('lg:ml-0') s('lg:w-[84px]')
|
|
173
|
+
|
|
174
|
+
.sidebar-modal
|
|
175
|
+
@apply hidden
|
|
176
|
+
|
|
177
|
+
.sidebar-logo
|
|
178
|
+
@apply s('lg:py-3') s('lg:px-0')
|
|
179
|
+
.logo
|
|
180
|
+
img.color-big
|
|
181
|
+
@apply s('lg:hidden')
|
|
182
|
+
|
|
183
|
+
img.color-small
|
|
184
|
+
@apply s('lg:block')
|
|
185
|
+
|
|
186
|
+
.sidebar-toggle
|
|
187
|
+
@apply bg-primary-600 text-white
|
|
188
|
+
margin-right -20px
|
|
189
|
+
border-radius 0px 12px 12px 0px
|
|
190
|
+
|
|
191
|
+
&:hover
|
|
192
|
+
@apply bg-primary-300 text-white
|
|
193
|
+
|
|
194
|
+
.icon-chevron-left
|
|
195
|
+
@apply hidden
|
|
196
|
+
|
|
197
|
+
.icon-chevron-right
|
|
198
|
+
@apply inline-block
|
|
199
|
+
|
|
200
|
+
nav.site-nav
|
|
201
|
+
.nav-wrapper
|
|
202
|
+
@apply s('lg:items-center')
|
|
203
|
+
|
|
204
|
+
.sidebar-mode-setting
|
|
205
|
+
@apply p-0 justify-center space-x-0
|
|
206
|
+
|
|
207
|
+
&-title
|
|
208
|
+
@apply hidden
|
|
209
|
+
|
|
210
|
+
.ios-switch
|
|
211
|
+
@apply flex-grow-0 flex-shrink-0
|
|
212
|
+
|
|
213
|
+
&-modal
|
|
214
|
+
@apply fixed top-0 left-0 w-full h-full bg-white opacity-0
|
|
215
|
+
@apply s('lg:hidden')
|
|
216
|
+
|
|
217
|
+
&-logo
|
|
218
|
+
@apply flex-grow-0 flex-shrink-0 relative flex justify-center py-4 pr-11 pl-6 transition-all
|
|
219
|
+
|
|
220
|
+
.logo
|
|
221
|
+
@apply block
|
|
222
|
+
|
|
223
|
+
img.white-big, img.white-small, img.color-small
|
|
224
|
+
@apply hidden
|
|
225
|
+
|
|
226
|
+
nav.site-nav
|
|
227
|
+
@apply flex-grow px-1 overflow-hidden
|
|
228
|
+
|
|
229
|
+
.nav-wrapper
|
|
230
|
+
@apply flex flex-col h-full px-3
|
|
231
|
+
|
|
232
|
+
.sidebar-nav-divide-item
|
|
233
|
+
@apply w-full h-px my-2 bg-primary-200
|
|
234
|
+
|
|
235
|
+
.sidebar-mode-setting
|
|
236
|
+
@apply flex-grow-0 flex-shrink-0 flex items-center justify-end my-4 pr-4 s('pl-[42px]') space-x-2 text-base text-primary
|
|
237
|
+
|
|
238
|
+
&-title
|
|
239
|
+
@apply flex-grow-0 flex-shrink-0
|
|
240
|
+
|
|
241
|
+
.ios-switch
|
|
242
|
+
@apply flex-grow
|
|
243
|
+
|
|
244
|
+
label
|
|
245
|
+
@apply border-primary-100 bg-primary-25
|
|
246
|
+
|
|
247
|
+
&:before
|
|
248
|
+
@apply border-2 border-primary-100
|
|
249
|
+
|
|
250
|
+
&-toggle
|
|
251
|
+
@apply absolute top-0 right-0 flex justify-center items-center bg-primary-50 text-sm text-primary-600 leading-none transition-all
|
|
252
|
+
width 20px
|
|
253
|
+
height 40px
|
|
254
|
+
margin-top 10px
|
|
255
|
+
border-radius 12px 0px 0px 12px
|
|
256
|
+
|
|
257
|
+
&:hover
|
|
258
|
+
@apply bg-primary-300 text-white
|
|
259
|
+
|
|
260
|
+
.icon-chevron-right
|
|
261
|
+
@apply hidden
|
|
262
|
+
</style>
|
|
263
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
.sidebar-nav-group-item
|
|
3
|
+
SLSidebarNavGroupItemSection(
|
|
4
|
+
v-for='(groupSection, i) in itemConfig.sections'
|
|
5
|
+
:nav-collapsed='navCollapsed'
|
|
6
|
+
:item-config='groupSection'
|
|
7
|
+
:key='`${groupSection.code}-${i}`'
|
|
8
|
+
)
|
|
9
|
+
.sidebar-nav-group-section-header
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import type { NavItemGroup } from '~/interface/NavConfigType';
|
|
14
|
+
|
|
15
|
+
export default defineComponent({
|
|
16
|
+
name: 'SLSidebarNavGroupItem',
|
|
17
|
+
props: {
|
|
18
|
+
navCollapsed: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
itemConfig: {
|
|
23
|
+
type: Object as PropType<NavItemGroup>,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
emits: ['click:item'],
|
|
28
|
+
setup() {
|
|
29
|
+
return {};
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<style lang="stylus">
|
|
35
|
+
.sidebar-nav-group-item
|
|
36
|
+
@apply w-full mt-1 p-2 space-y-1 bg-primary-50 rounded-lg overflow-hidden
|
|
37
|
+
</style>
|