@modelmenu/navigation 2.4.0 → 2.6.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/dist/index.es.js +680 -672
- package/dist/index.umd.js +11 -11
- package/menu/MenuPlate.vue +544 -511
- package/menu/components/menu-item.vue +256 -236
- package/menu/components/sub-menu-items.vue +146 -125
- package/menu/components/top-menu-items/top-menu-item.vue +224 -178
- package/menu/components/top-menu-items/top-sub-menu-items.vue +156 -134
- package/menu/index.d.ts +13 -8
- package/menu/index.ts +13 -8
- package/menu/models/menu-models.ts +53 -49
- package/menu/resources/theme.ts +42 -42
- package/menu/routing/routing.ts +41 -41
- package/package.json +1 -1
|
@@ -1,178 +1,224 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="horizontal-top-menu">
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
topMenuItems
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="horizontal-top-menu">
|
|
3
|
+
<div
|
|
4
|
+
v-for="item in topMenuItems"
|
|
5
|
+
:key="item.id"
|
|
6
|
+
class="horizontal-top-menu-item"
|
|
7
|
+
:class="{ 'menu-hover': item.opened, active: item.opened }"
|
|
8
|
+
@mouseenter="hoverOpenTopMenuItem($event, item)"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="top-menu-item-heading"
|
|
12
|
+
@click="openMenuItem($event, item)"
|
|
13
|
+
@mouseleave="closeTopMenu($event, item)"
|
|
14
|
+
>
|
|
15
|
+
<div>{{ item.name }}</div>
|
|
16
|
+
<div v-if="item.items?.length">
|
|
17
|
+
<FontAwesomeIcon
|
|
18
|
+
:size="'sm'"
|
|
19
|
+
:class="{ 'icon-opened': item.opened }"
|
|
20
|
+
:icon="item.openIcon"
|
|
21
|
+
></FontAwesomeIcon>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<TopSubMenuItems
|
|
26
|
+
@mouseleave="closeTopMenuItem($event, item)"
|
|
27
|
+
v-if="item.items?.length"
|
|
28
|
+
:item="item"
|
|
29
|
+
:topMenuItems="topMenuItems"
|
|
30
|
+
:menuBar="menuBar"
|
|
31
|
+
@click.stop
|
|
32
|
+
></TopSubMenuItems>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons";
|
|
39
|
+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
40
|
+
import TopSubMenuItems from "./../top-menu-items/top-sub-menu-items.vue";
|
|
41
|
+
import { toTop } from "../../routing/routing";
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
name: "TopMenuItems",
|
|
45
|
+
components: {
|
|
46
|
+
FontAwesomeIcon: FontAwesomeIcon,
|
|
47
|
+
TopSubMenuItems: TopSubMenuItems,
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
topMenuItems: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => [] as any[],
|
|
53
|
+
},
|
|
54
|
+
menuBar: {
|
|
55
|
+
type: Object,
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
created() {
|
|
60
|
+
console.log("Test", this.topMenuItems);
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
topMenuItems: this.topMenuItems as any[],
|
|
65
|
+
menuBar: this.menuBar,
|
|
66
|
+
toTop: toTop,
|
|
67
|
+
menuTimeout: null as ReturnType<typeof setTimeout> | null,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
watch: {
|
|
71
|
+
topMenuItems(newVal) {
|
|
72
|
+
this.topMenuItems = newVal;
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
openTopMenuItem(event: MouseEvent, item: any) {
|
|
77
|
+
console.log(item);
|
|
78
|
+
if (!item.items?.length) {
|
|
79
|
+
item.openIcon = faChevronUp;
|
|
80
|
+
toTop(item.route);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
hoverOpenTopMenuItem(event: MouseEvent, item: any) {
|
|
85
|
+
if (this.menuTimeout) {
|
|
86
|
+
clearTimeout(this.menuTimeout);
|
|
87
|
+
}
|
|
88
|
+
document
|
|
89
|
+
.querySelector<Element>(`.horizontal-top-menu-item-${item.id}`)
|
|
90
|
+
?.classList.add("menu-hover");
|
|
91
|
+
this.closeMenuTabs(this.topMenuItems);
|
|
92
|
+
|
|
93
|
+
for (const item of document.querySelectorAll(".top-sub-menu-items")) {
|
|
94
|
+
item.classList.remove("tooltip-opened");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.menuTimeout = setTimeout(() => {
|
|
98
|
+
item.opened = true;
|
|
99
|
+
this.closeSubItems(item);
|
|
100
|
+
this.menuTimeout = null;
|
|
101
|
+
}, 200);
|
|
102
|
+
},
|
|
103
|
+
closeTopMenuItem(event: MouseEvent, item: any) {
|
|
104
|
+
document
|
|
105
|
+
.querySelector<Element>(`.horizontal-top-menu-item-${item.id}`)
|
|
106
|
+
?.classList.remove("menu-hover");
|
|
107
|
+
|
|
108
|
+
if (this.menuTimeout) {
|
|
109
|
+
clearTimeout(this.menuTimeout);
|
|
110
|
+
}
|
|
111
|
+
this.menuTimeout = setTimeout(() => {
|
|
112
|
+
item.opened = false;
|
|
113
|
+
item.openIcon = faChevronDown;
|
|
114
|
+
this.closeSubItems(item);
|
|
115
|
+
this.menuTimeout = null;
|
|
116
|
+
}, 200);
|
|
117
|
+
},
|
|
118
|
+
closeTopMenu(event: MouseEvent, item: any) {
|
|
119
|
+
if (!item.items?.length) {
|
|
120
|
+
item.opened = false;
|
|
121
|
+
item.openIcon = faChevronDown;
|
|
122
|
+
}
|
|
123
|
+
this.closeSubItems(item);
|
|
124
|
+
},
|
|
125
|
+
openMenuItem(event: MouseEvent, item: any) {
|
|
126
|
+
item.openIcon = faChevronUp;
|
|
127
|
+
if (!item.items?.length) {
|
|
128
|
+
toTop(item.route);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
closeMenuTabs(items: any[]) {
|
|
133
|
+
for (const item of items) {
|
|
134
|
+
item.opened = false;
|
|
135
|
+
item.openIcon = faChevronDown;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
closeSubItems(item: any) {
|
|
139
|
+
if (!item.opened) {
|
|
140
|
+
for (const subItem of item.items || []) {
|
|
141
|
+
subItem.opened = false;
|
|
142
|
+
if (subItem.items?.length) {
|
|
143
|
+
this.closeSubItems(subItem);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<style scoped>
|
|
153
|
+
.item {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-wrap: wrap;
|
|
156
|
+
width: 180px;
|
|
157
|
+
}
|
|
158
|
+
.horizontal-items {
|
|
159
|
+
display: flex;
|
|
160
|
+
gap: 20px;
|
|
161
|
+
padding: 10px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.top-menu-item-heading {
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
column-gap: 4px;
|
|
169
|
+
border-bottom: 1px solid transparent;
|
|
170
|
+
margin: 4px;
|
|
171
|
+
box-sizing: border-box;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.horizontal-top-menu-item.active {
|
|
175
|
+
border-bottom: 2px solid black;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.menu-hover {
|
|
179
|
+
background-color: #eeeeee;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.horizontal-top-menu {
|
|
183
|
+
width: 100%;
|
|
184
|
+
display: flex;
|
|
185
|
+
justify-content: flex-end;
|
|
186
|
+
align-items: center;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.horizontal-top-menu-item {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
box-sizing: border-box;
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
height: 48px;
|
|
195
|
+
border-bottom: 2px solid transparent;
|
|
196
|
+
padding: 4px 12px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@keyframes openMenu {
|
|
200
|
+
from {
|
|
201
|
+
transform: rotate(0deg);
|
|
202
|
+
}
|
|
203
|
+
to {
|
|
204
|
+
transform: rotate(180deg);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@keyframes closeMenu {
|
|
209
|
+
from {
|
|
210
|
+
transform: rotate(0deg);
|
|
211
|
+
}
|
|
212
|
+
to {
|
|
213
|
+
transform: rotate(-180deg);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.icon-opened {
|
|
218
|
+
animation: openMenu 0.2s ease forwards;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.icon-closed {
|
|
222
|
+
animation: closeMenu 0.2s ease forwards;
|
|
223
|
+
}
|
|
224
|
+
</style>
|