@lambo-design/pro-layout 1.0.0-beta.236 → 1.0.0-beta.238
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/pro-layout-header.vue +2 -190
- package/src/index.vue +1 -2
- package/src/styles/color.less +113 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/pro-layout",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.238",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"registry": "https://registry.npmjs.org/"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@lambo-design/
|
|
14
|
-
"@lambo-design/
|
|
13
|
+
"@lambo-design/shared": "^1.0.0-beta.43",
|
|
14
|
+
"@lambo-design/core": "^4.7.1-beta.59"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {}
|
|
17
17
|
}
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<div class="logo-box">
|
|
7
7
|
<LamboProLogo></LamboProLogo>
|
|
8
8
|
</div>
|
|
9
|
-
<div class="nav-box" v-
|
|
9
|
+
<div class="nav-box" v-show="!systemInfo || !systemInfo.navType || systemInfo.navType == 'dropdown'">
|
|
10
10
|
<LamboProNav></LamboProNav>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="tools-box">
|
|
13
13
|
<LamboProTools></LamboProTools>
|
|
14
14
|
</div>
|
|
15
|
-
<div v-
|
|
15
|
+
<div v-show="systemInfo && systemInfo.navType && systemInfo.navType == 'slide'">
|
|
16
16
|
<LamboProNavSildeBtn></LamboProNavSildeBtn>
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
@@ -25,10 +25,6 @@ import LamboProNav from './pro-layout-nav'
|
|
|
25
25
|
import LamboProNavSildeBtn from './pro-layout-nav-slide-btn'
|
|
26
26
|
import LamboProTools from './pro-layout-tools'
|
|
27
27
|
import Bus from "@lambo-design/shared/utils/bus";
|
|
28
|
-
import {deepCopy} from "@lambo-design/shared/utils/assist";
|
|
29
|
-
import generatorMenuList from "@lambo-design/shared/utils/menu";
|
|
30
|
-
import {filterMenuName, filterMenuUri, tagExists} from "@lambo-design/shared/utils/platform";
|
|
31
|
-
import {findComponentsDownward} from "@lambo-design/core/src/utils/assist";
|
|
32
28
|
export default {
|
|
33
29
|
name: "pro-layout-header",
|
|
34
30
|
props:{
|
|
@@ -40,25 +36,6 @@ export default {
|
|
|
40
36
|
data(){
|
|
41
37
|
return {
|
|
42
38
|
systemInfo: {},
|
|
43
|
-
isShowSearch:'1',
|
|
44
|
-
navList: [],
|
|
45
|
-
originMenuList:[],
|
|
46
|
-
menuList: [],
|
|
47
|
-
appId: '',
|
|
48
|
-
primaryColor: '#ff0000',
|
|
49
|
-
collapsed: false,
|
|
50
|
-
accordion: true,
|
|
51
|
-
activeName: '',
|
|
52
|
-
openedNames: [],
|
|
53
|
-
activeMenu: null,
|
|
54
|
-
selectedMenuParent: null,
|
|
55
|
-
activeMenuItem: null,
|
|
56
|
-
openedSubMenu: null,
|
|
57
|
-
currentMenuItem: null,
|
|
58
|
-
selectedTopParent: '',
|
|
59
|
-
activeIcon: null,
|
|
60
|
-
tagValue: '',
|
|
61
|
-
tagList: []
|
|
62
39
|
}
|
|
63
40
|
},
|
|
64
41
|
components: {
|
|
@@ -78,179 +55,14 @@ export default {
|
|
|
78
55
|
Bus.$on('system-info',(data)=>{
|
|
79
56
|
this.initSystem(data)
|
|
80
57
|
});
|
|
81
|
-
Bus.$on('nav-list',(data)=>{
|
|
82
|
-
this.initNav(data)
|
|
83
|
-
});
|
|
84
|
-
Bus.$on('menu-list',(data)=>{
|
|
85
|
-
this.initMenu(data)
|
|
86
|
-
});
|
|
87
|
-
Bus.$on('trigger-change',(data)=>{
|
|
88
|
-
this.triggerChange(data)
|
|
89
|
-
});
|
|
90
|
-
Bus.$on('change-app', ({appId,appInfo})=> {
|
|
91
|
-
this.changeApp(appId,appInfo)
|
|
92
|
-
})
|
|
93
|
-
Bus.$on('tag-list',(data,current)=>{
|
|
94
|
-
this.initTags(data,current)
|
|
95
|
-
});
|
|
96
|
-
Bus.$on('menu-click',(current)=>{
|
|
97
|
-
this.menuClick(current)
|
|
98
|
-
});
|
|
99
58
|
},
|
|
100
59
|
destroyListener(){
|
|
101
60
|
Bus.$off('system-info')
|
|
102
|
-
Bus.$off('nav-list')
|
|
103
|
-
Bus.$off('menu-list')
|
|
104
|
-
Bus.$off('trigger-change')
|
|
105
|
-
Bus.$off('change-app')
|
|
106
|
-
Bus.$off('tag-list')
|
|
107
|
-
Bus.$off('menu-click')
|
|
108
61
|
},
|
|
109
62
|
initSystem(data){
|
|
110
63
|
if (data) {
|
|
111
64
|
this.systemInfo = data;
|
|
112
|
-
if (data.isShowSearch) {
|
|
113
|
-
this.isShowSearch = data.isShowSearch;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
initNav(data){
|
|
118
|
-
if (data.toString() === this.navList.toString()) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
this.navList = data;
|
|
122
|
-
},
|
|
123
|
-
handleSelect(name,uri,pid){
|
|
124
|
-
let menu = null;
|
|
125
|
-
if (name.indexOf("isTurnByHref_") > -1) {
|
|
126
|
-
name = name.replace("isTurnByHref_","");
|
|
127
|
-
menu = filterMenuUri(this.menuList,name);
|
|
128
|
-
} else {
|
|
129
|
-
menu = filterMenuName(this.menuList,name);
|
|
130
65
|
}
|
|
131
|
-
let tagList = this.tagList;
|
|
132
|
-
if (menu && menu.name) {
|
|
133
|
-
if (!tagExists(tagList,menu.name)) {
|
|
134
|
-
tagList.push(menu);
|
|
135
|
-
}
|
|
136
|
-
Bus.$emit('tag-list', tagList, menu.name)
|
|
137
|
-
}
|
|
138
|
-
if (menu.meta && Array.isArray(menu.meta.crumbs)) {
|
|
139
|
-
let parentMenu = menu.meta.crumbs[0]
|
|
140
|
-
this.$set(this, 'selectedTopParent', parentMenu.name);
|
|
141
|
-
} else {
|
|
142
|
-
// 处理没有父菜单的情况
|
|
143
|
-
this.$set(this, 'selectedTopParent', menu.name);
|
|
144
|
-
}
|
|
145
|
-
// 如果 uri 为空,则需要根据 pid 判断是展开父菜单还是同时展开父菜单和当前菜单
|
|
146
|
-
if (!uri) {
|
|
147
|
-
let parentName;
|
|
148
|
-
if (pid === 0) {
|
|
149
|
-
// 如果 pid 为 0,表示是最外层菜单
|
|
150
|
-
parentName = this.getNameOrHref(menu);
|
|
151
|
-
//console.log('parentName',parentName)
|
|
152
|
-
this.openedNames = [parentName]; // 设置最外层父菜单为展开状态
|
|
153
|
-
} else {
|
|
154
|
-
// 如果 pid 不等于 0,查找并打开对应的最外层父菜单
|
|
155
|
-
parentName = this.getTopParent(menu);
|
|
156
|
-
this.openedNames = [parentName]; // 设置最外层父菜单为展开状态
|
|
157
|
-
this.activeName = menu.name; // 设置当前菜单为激活状态
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
getTopParent(menu) {
|
|
163
|
-
return menu.parent ? this.getTopParent(menu.parent) : menu.name;
|
|
164
|
-
},
|
|
165
|
-
initMenu(data){
|
|
166
|
-
if (data && data.length > 0) {
|
|
167
|
-
let item = data[0];
|
|
168
|
-
if (item.appId && item.appId !== this.appId) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
this.originMenuList = deepCopy(data);
|
|
173
|
-
this.changeMenu()
|
|
174
|
-
},
|
|
175
|
-
changeApp(appId,appInfo){
|
|
176
|
-
this.appId = appId;
|
|
177
|
-
this.changeMenu()
|
|
178
|
-
},
|
|
179
|
-
changeMenu(){
|
|
180
|
-
let treeMenuList = generatorMenuList(this.originMenuList,this.appId);
|
|
181
|
-
if (treeMenuList && treeMenuList.length > 0) {
|
|
182
|
-
this.menuList = treeMenuList;
|
|
183
|
-
} else {
|
|
184
|
-
this.menuList = [];
|
|
185
|
-
}
|
|
186
|
-
this.openedNames = this.getOpenedNamesByActiveName();
|
|
187
|
-
},
|
|
188
|
-
activeIconBackground(item) {
|
|
189
|
-
// 如果当前菜单项是激活的,返回一个颜色值,否则返回空
|
|
190
|
-
return this.selectedMenuParent=== item.parent ? this.primaryColor : '';
|
|
191
|
-
},
|
|
192
|
-
triggerChange(data){
|
|
193
|
-
this.collapsed = data;
|
|
194
|
-
},
|
|
195
|
-
initTags(data,name){
|
|
196
|
-
this.tagList = data;
|
|
197
|
-
this.value = name;
|
|
198
|
-
},
|
|
199
|
-
menuClick(current) {
|
|
200
|
-
let item = this.originMenuList.filter(menu => menu.name === current);
|
|
201
|
-
if (item && item.length > 0){
|
|
202
|
-
let type = item[0].type;
|
|
203
|
-
if (type == 2) {
|
|
204
|
-
this.activeName = current;
|
|
205
|
-
} else {
|
|
206
|
-
let pItem = this.originMenuList.filter(menu => menu.permissionId === item[0].pid);
|
|
207
|
-
if (pItem && pItem.length > 0){
|
|
208
|
-
this.activeName = pItem[0].name;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
} else {
|
|
212
|
-
this.activeName = current;
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
getOpenedNamesByActiveName(){
|
|
216
|
-
let res = filterMenuName(this.menuList,this.activeName);
|
|
217
|
-
let openNames = []
|
|
218
|
-
if (res) {
|
|
219
|
-
const crumbs = res.meta.crumbs;
|
|
220
|
-
if (crumbs) {
|
|
221
|
-
crumbs.forEach(item => {
|
|
222
|
-
if (item.type === 1) {
|
|
223
|
-
openNames.push(item.name)
|
|
224
|
-
}
|
|
225
|
-
})
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return openNames
|
|
229
|
-
},
|
|
230
|
-
updateOpened () {
|
|
231
|
-
const items = findComponentsDownward(this, 'Submenu');
|
|
232
|
-
if (items.length) {
|
|
233
|
-
items.forEach(item => {
|
|
234
|
-
if (this.openedNames.indexOf(item.name) > -1) item.opened = true;
|
|
235
|
-
else item.opened = false;
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
updateActiveName () {
|
|
240
|
-
if (this.currentActiveName === undefined) {
|
|
241
|
-
this.currentActiveName = -1;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
watch:{
|
|
246
|
-
activeName(){
|
|
247
|
-
this.openedNames = this.getOpenedNamesByActiveName();
|
|
248
|
-
},
|
|
249
|
-
openedNames() {
|
|
250
|
-
this.$nextTick(() => {
|
|
251
|
-
this.updateOpened()
|
|
252
|
-
this.updateActiveName()
|
|
253
|
-
})
|
|
254
66
|
}
|
|
255
67
|
},
|
|
256
68
|
created(){
|
package/src/index.vue
CHANGED
|
@@ -290,8 +290,8 @@ export default {
|
|
|
290
290
|
|
|
291
291
|
<style lang="less">
|
|
292
292
|
@import "@lambo-design/core/src/styles/default";
|
|
293
|
+
@import "styles/color";
|
|
293
294
|
.pro-layout{
|
|
294
|
-
color: #ffffff;
|
|
295
295
|
height: 100vh;
|
|
296
296
|
width: 100%;
|
|
297
297
|
overflow: hidden;
|
|
@@ -311,7 +311,6 @@ export default {
|
|
|
311
311
|
height: ~"calc(100vh - 53px)";
|
|
312
312
|
.pro-layout-page{
|
|
313
313
|
overflow: hidden;
|
|
314
|
-
color: var(--text-color,@_text-color);
|
|
315
314
|
}
|
|
316
315
|
}
|
|
317
316
|
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
@import "@lambo-design/core/src/styles/default";
|
|
2
|
+
.pro-layout{
|
|
3
|
+
color: var(--layout-color ,@_layout-color);
|
|
4
|
+
.active {
|
|
5
|
+
color: var(--layout-active-color ,@_layout-active-color);
|
|
6
|
+
}
|
|
7
|
+
.pro-layout-header{
|
|
8
|
+
background: var(--layout-header-background,@_layout-header-background);
|
|
9
|
+
color: var(--layout-header-color ,@_layout-header-color);
|
|
10
|
+
.active {
|
|
11
|
+
color: var(--layout-header-active-color,@_layout-header-active-color);
|
|
12
|
+
}
|
|
13
|
+
.pro-layout-nav-wrapper{
|
|
14
|
+
background: var(--layout-header-background,@_layout-header-background);
|
|
15
|
+
color: var(--layout-header-nav-color,@_layout-header-nav-color);
|
|
16
|
+
.ivu-menu-dark{
|
|
17
|
+
background: var(--layout-header-background,@_layout-header-background);
|
|
18
|
+
color: var(--layout-header-nav-color,@_layout-header-nav-color);
|
|
19
|
+
.ivu-menu-item-active,.ivu-menu-item-selected{
|
|
20
|
+
background: linear-gradient(to bottom, var(--layout-header-nav-active-background-begin,@_layout-header-nav-active-background-begin) 0%, var(--layout-header-nav-active-background-end,@_layout-header-nav-active-background-end) 100%);
|
|
21
|
+
color: var(--layout-header-nav-active-color,@_layout-header-nav-active-color);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
.pro-layout-tools-wrapper{
|
|
26
|
+
.user-avatar-dropdown{
|
|
27
|
+
.ivu-select-dropdown{
|
|
28
|
+
background: var(--layout-header-background,@_layout-header-background);
|
|
29
|
+
color: var(--layout-header-drop-color,@_layout-header-drop-color);
|
|
30
|
+
.ivu-dropdown-item{
|
|
31
|
+
background: var(--layout-header-background,@_layout-header-background);
|
|
32
|
+
color: var(--layout-header-drop-color,@_layout-header-drop-color);
|
|
33
|
+
&.active {
|
|
34
|
+
background: var(--layout-header-drop-active-background,@_layout-header-drop-active-background);
|
|
35
|
+
color: var(--layout-header-drop-active-color,@_layout-header-drop-active-color);
|
|
36
|
+
}
|
|
37
|
+
&:hover {
|
|
38
|
+
background: var(--layout-header-drop-active-background,@_layout-header-drop-active-background);
|
|
39
|
+
color: var(--layout-header-drop-active-color,@_layout-header-drop-active-color);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.pro-layout-sider{
|
|
48
|
+
background: var(--layout-sider-background,@_layout-sider-background);
|
|
49
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
50
|
+
.pro-layout-sider-wrapper{
|
|
51
|
+
.ivu-menu-dark{
|
|
52
|
+
background: var(--layout-sider-menu-background,@_layout-sider-menu-background);
|
|
53
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
54
|
+
.ivu-menu-submenu{
|
|
55
|
+
background: var(--layout-sider-submenu-background,@_layout-sider-submenu-background);
|
|
56
|
+
.ivu-menu-submenu-title{
|
|
57
|
+
background: var(--layout-sider-background,@_layout-sider-background);
|
|
58
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
59
|
+
}
|
|
60
|
+
.ivu-menu-item{
|
|
61
|
+
background: var(--layout-sider-menuitem-background,@_layout-sider-menuitem-background);
|
|
62
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
63
|
+
&.ivu-menu-item-active,&.ivu-menu-item-selected{
|
|
64
|
+
background: var(--layout-sider-menuitem-active-background,@_layout-sider-menuitem-active-background);
|
|
65
|
+
color: var(--ayout-sider-menu-active-color,@_ayout-sider-menu-active-color);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
&.ivu-menu-item-active,&.ivu-menu-child-item-active{
|
|
69
|
+
background: var(--layout-sider-submenu-active-background,@_layout-sider-submenu-active-background);
|
|
70
|
+
color: var(--ayout-sider-menu-active-color,@_ayout-sider-menu-active-color);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.other-menu{
|
|
75
|
+
background: var(--layout-sider-menu-background,@_layout-sider-menu-background);
|
|
76
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
77
|
+
.other-menu-item{
|
|
78
|
+
&:hover {
|
|
79
|
+
background: var(--layout-sider-menuitem-active-background,@_layout-sider-menuitem-active-background);
|
|
80
|
+
color: var(--ayout-sider-menu-active-color,@_ayout-sider-menu-active-color);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
.search-fast-con{
|
|
85
|
+
background: var(--layout-sider-menu-background,@_layout-sider-menu-background);
|
|
86
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
87
|
+
.search-fast-con-side{
|
|
88
|
+
.sideInput{
|
|
89
|
+
.ivu-input{
|
|
90
|
+
background: var(--layout-sider-menu-background,@_layout-sider-menu-background);
|
|
91
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.search-fast-con-side-modal{
|
|
101
|
+
.ivu-modal-content{
|
|
102
|
+
background: var(--layout-sider-menu-background,@_layout-sider-menu-background);
|
|
103
|
+
color: var(--layout-sider-menu-color ,@_layout-sider-menu-color);
|
|
104
|
+
.menu-side-style{
|
|
105
|
+
background: var(--layout-sider-menu-background,@_layout-sider-menu-background);
|
|
106
|
+
color: var(--layout-header-drop-color,@_layout-header-drop-color);
|
|
107
|
+
&:hover {
|
|
108
|
+
background: var(--layout-header-drop-active-background,@_layout-header-drop-active-background);
|
|
109
|
+
color: var(--layout-header-drop-active-color,@_layout-header-drop-active-color);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|