@modelmenu/navigation 3.0.0 → 3.2.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 +185 -176
- package/dist/index.umd.js +7 -7
- package/menu/MenuPlate.vue +6 -9
- package/menu/components/menu-item.vue +4 -5
- package/menu/components/sub-menu-items.vue +63 -33
- package/menu/components/top-menu-items/top-menu-item.vue +16 -15
- package/menu/components/top-menu-items/top-sub-menu-items.vue +13 -3
- package/package.json +1 -1
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="sub-menu-items"
|
|
4
|
+
:class="{ itemsOpened: item.opened, itemsClosed: !item.opened }"
|
|
5
|
+
>
|
|
6
|
+
<div class="sub-menu-content">
|
|
7
|
+
<div
|
|
8
|
+
v-for="(subItem, subIndex) in item.items"
|
|
9
|
+
:key="subIndex"
|
|
10
|
+
class="item"
|
|
11
|
+
:class="{ 'menu-item-opened': menuBar.opened }"
|
|
12
|
+
@mouseenter="showTooltipItems($event)"
|
|
13
|
+
@mouseleave="hideTooltipItems($event)"
|
|
14
|
+
>
|
|
15
|
+
<MenuItem
|
|
16
|
+
:item="subItem"
|
|
17
|
+
:leftItems="leftMenuItems"
|
|
18
|
+
@changeMenuItem="handleMenuItem($event)"
|
|
19
|
+
:menuBar="menuBar"
|
|
20
|
+
></MenuItem>
|
|
21
|
+
<SubMenuItems
|
|
22
|
+
v-if="subItem.items?.length"
|
|
23
|
+
@changeMenuItem="handleMenuItem($event)"
|
|
24
|
+
v-show="menuBar.opened"
|
|
25
|
+
:item="subItem"
|
|
26
|
+
:menuBar="menuBar"
|
|
27
|
+
></SubMenuItems>
|
|
28
|
+
<div class="active-tooltip" v-if="tooltip && subItem.items?.length">
|
|
29
|
+
<div
|
|
30
|
+
v-for="value in subItem.items"
|
|
31
|
+
:key="value.name"
|
|
32
|
+
class="tooltip-item"
|
|
33
|
+
@click="tooltipItemClick($event, subItem, value)"
|
|
34
|
+
v-if="!menuBar.opened"
|
|
35
|
+
@mouseenter="showTooltipItems($event)"
|
|
36
|
+
@mouseleave="hideTooltipItems($event)"
|
|
37
|
+
>
|
|
38
|
+
{{ value.name }}
|
|
39
|
+
</div>
|
|
35
40
|
</div>
|
|
36
41
|
</div>
|
|
37
42
|
</div>
|
|
@@ -143,4 +148,29 @@ export default {
|
|
|
143
148
|
font-size: 16px;
|
|
144
149
|
padding: 4px;
|
|
145
150
|
}
|
|
151
|
+
|
|
152
|
+
.sub-menu-items {
|
|
153
|
+
display: grid;
|
|
154
|
+
grid-template-rows: 0fr;
|
|
155
|
+
opacity: 0;
|
|
156
|
+
pointer-events: none;
|
|
157
|
+
transition:
|
|
158
|
+
grid-template-rows 0.35s ease,
|
|
159
|
+
opacity 0.25s ease;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.sub-menu-items.itemsOpened {
|
|
163
|
+
grid-template-rows: 1fr;
|
|
164
|
+
opacity: 1;
|
|
165
|
+
pointer-events: auto;
|
|
166
|
+
}
|
|
167
|
+
.sub-menu-items.itemsClosed {
|
|
168
|
+
grid-template-rows: 0fr;
|
|
169
|
+
opacity: 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.sub-menu-content {
|
|
173
|
+
min-height: 0;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
}
|
|
146
176
|
</style>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
class="horizontal-top-menu-item"
|
|
7
7
|
:class="{ 'menu-hover': item.opened, active: item.opened }"
|
|
8
8
|
@mouseenter="hoverOpenTopMenuItem($event, item)"
|
|
9
|
+
@mouseleave="closeTopMenuItem($event, item)"
|
|
9
10
|
>
|
|
10
11
|
<div
|
|
11
12
|
class="top-menu-item-heading"
|
|
@@ -23,7 +24,6 @@
|
|
|
23
24
|
</div>
|
|
24
25
|
|
|
25
26
|
<TopSubMenuItems
|
|
26
|
-
@mouseleave="closeTopMenuItem($event, item)"
|
|
27
27
|
v-if="item.items?.length"
|
|
28
28
|
:item="item"
|
|
29
29
|
:topMenuItems="topMenuItems"
|
|
@@ -85,6 +85,10 @@ export default {
|
|
|
85
85
|
if (this.menuTimeout) {
|
|
86
86
|
clearTimeout(this.menuTimeout);
|
|
87
87
|
}
|
|
88
|
+
if (item.opened) {
|
|
89
|
+
this.menuTimeout = null;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
88
92
|
document
|
|
89
93
|
.querySelector<Element>(`.horizontal-top-menu-item-${item.id}`)
|
|
90
94
|
?.classList.add("menu-hover");
|
|
@@ -96,14 +100,14 @@ export default {
|
|
|
96
100
|
|
|
97
101
|
this.menuTimeout = setTimeout(() => {
|
|
98
102
|
item.opened = true;
|
|
99
|
-
this.closeSubItems(item);
|
|
100
103
|
this.menuTimeout = null;
|
|
101
104
|
}, 200);
|
|
102
105
|
},
|
|
103
106
|
closeTopMenuItem(event: MouseEvent, item: any) {
|
|
104
|
-
document
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
const dataItem = document.querySelector<Element>(
|
|
108
|
+
`.horizontal-top-menu-item-${item.id}`
|
|
109
|
+
);
|
|
110
|
+
dataItem?.classList.remove("menu-hover");
|
|
107
111
|
|
|
108
112
|
if (this.menuTimeout) {
|
|
109
113
|
clearTimeout(this.menuTimeout);
|
|
@@ -120,7 +124,6 @@ export default {
|
|
|
120
124
|
item.opened = false;
|
|
121
125
|
item.openIcon = faChevronDown;
|
|
122
126
|
}
|
|
123
|
-
this.closeSubItems(item);
|
|
124
127
|
},
|
|
125
128
|
openMenuItem(event: MouseEvent, item: any) {
|
|
126
129
|
item.openIcon = faChevronUp;
|
|
@@ -133,16 +136,14 @@ export default {
|
|
|
133
136
|
for (const item of items) {
|
|
134
137
|
item.opened = false;
|
|
135
138
|
item.openIcon = faChevronDown;
|
|
139
|
+
this.closeSubItems(item);
|
|
136
140
|
}
|
|
137
141
|
},
|
|
138
142
|
closeSubItems(item: any) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.closeSubItems(subItem);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
143
|
+
for (const subItem of item.items ?? []) {
|
|
144
|
+
subItem.opened = false;
|
|
145
|
+
subItem.openIcon = faChevronDown;
|
|
146
|
+
this.closeSubItems(subItem);
|
|
146
147
|
}
|
|
147
148
|
},
|
|
148
149
|
},
|
|
@@ -215,10 +216,10 @@ export default {
|
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
.icon-opened {
|
|
218
|
-
animation: openMenu 0.
|
|
219
|
+
animation: openMenu 0.4s ease forwards;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
.icon-closed {
|
|
222
|
-
animation: closeMenu 0.
|
|
223
|
+
animation: closeMenu 0.4s ease forwards;
|
|
223
224
|
}
|
|
224
225
|
</style>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
v-for="(subSubItem, index) in item.items"
|
|
9
9
|
:key="subSubItem.id"
|
|
10
10
|
class="item"
|
|
11
|
+
@mouseleave="closeTopMenuItem($event, subSubItem)"
|
|
11
12
|
>
|
|
12
13
|
<div
|
|
13
14
|
class="top-menu-item"
|
|
@@ -18,13 +19,12 @@
|
|
|
18
19
|
<div v-if="subSubItem.items?.length">
|
|
19
20
|
<FontAwesomeIcon
|
|
20
21
|
:size="'sm'"
|
|
21
|
-
:class="{ 'icon-opened':
|
|
22
|
+
:class="{ 'icon-opened': subSubItem.opened }"
|
|
22
23
|
:icon="subSubItem.openIcon"
|
|
23
24
|
></FontAwesomeIcon>
|
|
24
25
|
</div>
|
|
25
26
|
</div>
|
|
26
27
|
<TopSubMenuItems
|
|
27
|
-
@mouseleave="closeTopMenuItem($event, subSubItem)"
|
|
28
28
|
:style="{ top: `${Number(index) * 70}px`, right: `${2 * 10 + 40}px` }"
|
|
29
29
|
v-if="subSubItem.items?.length"
|
|
30
30
|
:key="subSubItem.id"
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
<script lang="ts">
|
|
41
41
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
42
|
+
import { faChevronDown } from "@fortawesome/free-solid-svg-icons";
|
|
42
43
|
import { toTop } from "../../routing/routing";
|
|
43
44
|
import { TopMenuItems } from "../../models/menu-models";
|
|
44
45
|
|
|
@@ -84,6 +85,15 @@ export default {
|
|
|
84
85
|
},
|
|
85
86
|
closeTopMenuItem(event: MouseEvent, item: any) {
|
|
86
87
|
item.opened = false;
|
|
88
|
+
item.openIcon = faChevronDown;
|
|
89
|
+
this.closeSubItems(item);
|
|
90
|
+
},
|
|
91
|
+
closeSubItems(item: any) {
|
|
92
|
+
for (const subItem of item.items ?? []) {
|
|
93
|
+
subItem.opened = false;
|
|
94
|
+
subItem.openIcon = faChevronDown;
|
|
95
|
+
this.closeSubItems(subItem);
|
|
96
|
+
}
|
|
87
97
|
},
|
|
88
98
|
openTopMenuItem(event: MouseEvent, item: any) {
|
|
89
99
|
if (!item.items?.length) {
|
|
@@ -98,7 +108,7 @@ export default {
|
|
|
98
108
|
<style>
|
|
99
109
|
.top-sub-menu-items {
|
|
100
110
|
position: absolute;
|
|
101
|
-
top:
|
|
111
|
+
top: 42px;
|
|
102
112
|
right: 0px;
|
|
103
113
|
padding: 8px 0px;
|
|
104
114
|
margin-top: 1px;
|