@modelmenu/navigation 2.5.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.
@@ -1,504 +1,544 @@
1
- <template>
2
- <div class="menu-container">
3
- <div class="horizontal-menu">
4
- <div class="menu-button" >
5
- <div class="menu-icon" @click="openVerticalMenu($event)">
6
- <FontAwesomeIcon v-if="menuBar.icon" :icon="menuBar.icon"></FontAwesomeIcon>
7
- </div>
8
- </div>
9
- <TopMenuItem :topMenuItems="topMenuItems" :menuBar="menuBar"></TopMenuItem>
10
- </div>
11
-
12
- <div class="vertical-menu" :class="{'vertical-menu-opened': menuBar.opened}">
13
- <div v-for="(item, index) in leftMenuItems" :key="index" :class="['menu-item-heading', { 'item-active': item.active }]" @mouseenter="showTooltipItems($event, item.items)">
14
- <div class="item" :class="{'menu-item-opened': menuBar.opened, }">
15
- <MenuItem :item="item" :menuBar="menuBar" :left-items="leftMenuItems"></MenuItem>
16
- <SubMenuItems @openmenu="handleOpenMenu($event)" @changeMenuItem="handleMenuItem($event)" v-show="menuBar.opened" :left-menu-items="leftMenuItems" :item="item" :menuBar="menuBar"></SubMenuItems>
17
- <div :class="['active-tooltip', { 'tooltip-opened': tooltip && item.items?.length && !menuBar.opened } ]" v-if="tooltip && item.items?.length && !menuBar.opened" @mouseleave="hideTooltipItems($event)">
18
- <div v-for="value in item.items" :key="value.name" class="tooltip-item" @click="openTooltipItem($event, value, item)">
19
- {{ value.name }}
20
-
21
- </div>
22
- </div>
23
- </div>
24
-
25
- </div>
26
-
27
- </div>
28
-
29
-
30
- <div class="main" :class="{'main-loading': menuBar.loading}">
31
- <slot name="handler"></slot>
32
- </div>
33
-
34
- <div class="loader " v-if="menuBar.loading">
35
- <svg class="loader-icon" viewBox="0 0 64 64" aria-hidden="true">
36
- <circle class="loader-track" cx="32" cy="32" r="24"></circle>
37
- <circle class="loader-ring" cx="32" cy="32" r="24"></circle>
38
- </svg>
39
- </div>
40
- </div>
41
-
42
- </template>
43
-
44
- <script lang="ts">
45
- import { defineComponent, watch } from 'vue';
46
- import { LeftMenuItems, MenuBarModel, ThemeModel, TopMenuItems } from './models/menu-models';
47
- import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
48
- import { faChevronDown, faChevronLeft, faChevronRight, faChevronUp } from '@fortawesome/free-solid-svg-icons';
49
- import MenuItem from './components/menu-item.vue';
50
- import SubMenuItems from './components/sub-menu-items.vue';
51
- import { load, router, toTop, menubar } from './routing/routing';
52
- import TopMenuItem from './components/top-menu-items/top-menu-item.vue';
53
- import { themes } from './resources/theme';
54
-
55
- export default defineComponent({
56
- name: 'MenuPlate',
57
- components: {
58
- FontAwesomeIcon: FontAwesomeIcon,
59
- MenuItem: MenuItem,
60
- SubMenuItems: SubMenuItems,
61
- TopMenuItem: TopMenuItem
62
- },
63
- props: {
64
- initialMenuBar: {
65
- type: Object as () => MenuBarModel,
66
- default: () => (new MenuBarModel())
67
- },
68
- leftItems: {
69
- type: Array as () => any[],
70
- default: () => [] as any[]
71
- },
72
- Router: {
73
- type: null,
74
- required: false
75
- },
76
- topItems: {
77
- type: Array as () => any[],
78
- default: () => [] as any[]
79
- },
80
- theme: {
81
- type: ThemeModel,
82
- default: () => new ThemeModel()
83
- }
84
- },
85
- emits: [
86
- 'changeTheme'
87
- ],
88
- watch: {
89
- initialMenuBar(newVal: any) {
90
- this.menuBar = newVal;
91
- },
92
- leftItems(newVal: any) {
93
- this.leftItems = newVal;
94
- const idCounter = { value: 0 };
95
- this.leftMenuItems = this.toLeftMenuItems(newVal, idCounter);
96
- },
97
- topItems(newVal: any) {
98
- this.topItems = newVal;
99
- },
100
- },
101
- mounted() {
102
- },
103
- created() {
104
- const idCounter = { value: 0 };
105
- this.leftMenuItems = this.toLeftMenuItems(this.leftItems, idCounter);
106
- this.topMenuItems = this.toTopMenuItems(this.topItems, idCounter);
107
- router(this.Router);
108
- load(false);
109
- menubar(this.menuBar);
110
- },
111
- initTheme(){
112
- let themeLink = themes.find(x=> x.type === this.theme.type);
113
- if(themeLink){
114
- document.documentElement.setAttribute('data-theme', themeLink.value);
115
- }
116
- this.$emit('changeTheme', this.theme);
117
- },
118
- data() {
119
- return {
120
- menuBar: this.initialMenuBar,
121
- faChevronDown: faChevronDown,
122
- faChevronUp: faChevronUp,
123
- topMenuItems: [] as TopMenuItems[],
124
- leftMenuItems: [] as LeftMenuItems[],
125
- tooltip: false,
126
- tooltipItems: [] as any[],
127
- topItems: this.topItems,
128
- leftItems: this.leftItems,
129
- floor: 20,
130
- router: router,
131
- toTop: toTop,
132
- menubar: menubar,
133
- themes: themes
134
- }
135
- },
136
- methods: {
137
- toLeftMenuItems(items: any[], counter: { value: number }) : LeftMenuItems[] {
138
- let leftMenuItems: LeftMenuItems[] = [];
139
- for(let item of items){
140
- let leftMenuItem = new LeftMenuItems();
141
- leftMenuItem.id = counter.value++;
142
- leftMenuItem.name = item.name;
143
- leftMenuItem.icon = item.icon;
144
- leftMenuItem.route = item.route;
145
-
146
- if(item.items?.length){
147
- leftMenuItem.items = this.toTopMenuItems(item.items, counter);
148
- }
149
-
150
- leftMenuItems = [...leftMenuItems, leftMenuItem];
151
- }
152
- return leftMenuItems;
153
- },
154
- handleMenuItem(items: any[]){
155
- this.leftMenuItems = items;
156
- },
157
- toTopMenuItems(items: any[], counter: { value: number }) : TopMenuItems[] {
158
- let topMenuItems: TopMenuItems[] = [];
159
- for(let item of items){
160
- let topMenuItem = new TopMenuItems();
161
- topMenuItem.id = counter.value++;
162
- topMenuItem.name = item.name;
163
- topMenuItem.route = item.route;
164
- if(item.items?.length){
165
- topMenuItem.items = this.toTopMenuItems(item.items, counter);
166
- }
167
-
168
- topMenuItems = [...topMenuItems, topMenuItem];
169
- }
170
- return topMenuItems;
171
- },
172
- openVerticalMenu(event: MouseEvent) {
173
- this.menuBar.opened = !this.menuBar.opened;
174
- this.menuBar.changeIcon = 'flip';
175
- this.menuBar.icon = this.menuBar.opened ? faChevronUp : faChevronDown;
176
- },
177
- openSubMenu(item: any) {
178
- item.opened = !item.opened;
179
- },
180
- showTooltipItems(event: any, items: any[]) {
181
- if (!this.menuBar.opened) {
182
- if(items?.length){
183
- this.tooltip = true;
184
- this.tooltipItems = items;
185
- }
186
- }
187
- },
188
- hideTooltipItems(event: any) {
189
- if (!this.menuBar.opened) {
190
- this.tooltip = false;
191
- this.tooltipItems = [];
192
- }
193
- },
194
- handleOpenMenu(item: any) {
195
- for(let subItem of this.leftMenuItems || []){
196
- if(subItem.items?.length){
197
- subItem.opened = true;
198
- subItem.openIcon = subItem.openIcon ? faChevronDown : faChevronUp;
199
- }
200
- }
201
- let item1 = this.leftMenuItems.find(x=> x.name === item.name);
202
- if(item1){
203
- item1.opened = !item1.opened;
204
- item1.openIcon = item1.opened ? faChevronDown : faChevronUp;
205
- }
206
- },
207
- openTooltipItem(event: any, item: any, parentItem: any) {
208
- this.closeItems(this.leftMenuItems);
209
- if(item.items?.length){
210
- this.openVerticalMenu(event);
211
- let parent = this.leftMenuItems.find((x: any) => x.id === parentItem.id)!;
212
- parent.opened = true;
213
-
214
- let currentItem = parent.items.find((x: any) => x.id === item.id)!;
215
- currentItem.opened = true;
216
- return;
217
- }
218
- parentItem.active = true;
219
- toTop(item.route);
220
- },
221
- closeItems(items: any[]) {
222
- for(let item of items){
223
- item.active = false;
224
- if(item.items?.length){
225
- this.closeItems(item.items);
226
- }
227
- }
228
- },
229
- }
230
- });
231
- </script>
232
-
233
- <style scoped>
234
- .menu-container {
235
- position: relative;
236
- width: 100%;
237
- height: 100%;
238
- }
239
-
240
- .top-sub-menu-items {
241
- position: absolute;
242
- top: 38px;
243
- right: 0px;
244
- border: 1px solid #424242;
245
- padding: 10px;
246
- width: 150px;
247
- z-index: 99999;
248
- }
249
-
250
- .item-active{
251
- background-color: #f2f2f2;
252
- }
253
-
254
- .horizontal-menu-item{
255
- cursor: pointer;
256
- }
257
-
258
- .horizontal-items{
259
- display: flex;
260
- gap: 20px;
261
- padding: 10px;
262
- }
263
-
264
- .loader{
265
- width: 100%;
266
- display: flex;
267
- position: fixed;
268
- top: 40%;
269
- left: 50%;
270
- height: 36dvh;
271
- }
272
-
273
- .loader-icon{
274
- width: 60px;
275
- height: 60px;
276
- transform-origin: center;
277
- animation: rotateLoader 1s linear infinite;
278
- }
279
-
280
- @keyframes rotateLoader {
281
- from {
282
- transform: rotate(0deg);
283
- }
284
- to {
285
- transform: rotate(360deg);
286
- }
287
- }
288
-
289
-
290
- .tooltip-opened{
291
- animation: menuTooltipOpened 0.2s ease forwards;
292
- }
293
-
294
- .loader-track,
295
- .loader-ring {
296
- fill: none;
297
- stroke-width: 8;
298
- }
299
-
300
- .loader-track {
301
- stroke: rgba(66, 148, 255, 0.18);
302
- }
303
-
304
- .loader-ring {
305
- stroke: #4294ff;
306
- stroke-dasharray: 110 160;
307
- stroke-dashoffset: 0;
308
- }
309
-
310
- .menu-text-opened {
311
- display: inline-block;
312
- }
313
-
314
- .menu-text-closed {
315
- display: none;
316
- }
317
- .item{
318
- display: flex;
319
- flex-wrap: wrap;
320
- cursor: pointer;
321
- width: 180px;
322
- }
323
-
324
- .menu-item p {
325
- margin-left: 10px;
326
- }
327
-
328
-
329
- .menu-item-opened {
330
- display: flex;
331
- }
332
-
333
- .horizontal-items{
334
- display: flex;
335
- align-self: flex-end;
336
- }
337
-
338
- .tooltip-item{
339
- padding: 8px;
340
- cursor: pointer;
341
- }
342
-
343
- .horizontal-menu {
344
- position: absolute;
345
- border-bottom: 2px solid rgba(70, 70, 70, 0.4);
346
- top: 0;
347
- left: 0;
348
- width: 100%;
349
- height: 50px;
350
- display: flex;
351
- align-items: center;
352
- justify-content: space-between;
353
- }
354
-
355
- .vertical-menu {
356
- position: absolute;
357
- top: 50px;
358
- overflow-x: hidden;
359
- left: 0;
360
- z-index: 200;
361
- width: 70px;
362
- animation: closeMenu 0.3s ease-out forwards;
363
- height: 100dvh;
364
- background-color: white;
365
- border-right: 2px solid rgba(70, 70, 70, 0.4);
366
- }
367
-
368
- .menu-item {
369
- margin: 0 auto;
370
- margin-top: 10px;
371
- margin-bottom: 10px;
372
- width: 180px;
373
- margin-left: 20px;
374
- height: 30px;
375
- cursor: pointer;
376
- display: flex;
377
- justify-content: flex-start;
378
- align-items: center;
379
- }
380
-
381
- @keyframes openMenu {
382
- from {
383
- width: 70px;
384
- }
385
- to {
386
- width: 200px;
387
- }
388
- }
389
-
390
- @keyframes closeMenu {
391
- from {
392
- width: 200px;
393
- }
394
- to {
395
- width: 70px;
396
- }
397
- }
398
-
399
- .vertical-menu.vertical-menu-opened {
400
- width: 200px;
401
- animation: openMenu 0.3s ease-in forwards;
402
- }
403
-
404
- .menu-button{
405
- width: 74px;
406
- height: 50px;
407
- display: flex;
408
- justify-content: center;
409
- cursor: pointer;
410
- align-items: center;
411
- border-right: 2px solid rgba(70, 70, 70, 0.4);
412
- }
413
-
414
- .menu-icon{
415
- width: 30px;
416
- height: 30px;
417
- border: 2px solid rgba(70, 70, 70, 0.4);
418
- display: flex;
419
- justify-content: center;
420
- align-items: center;
421
- border-radius: 4px;
422
- }
423
-
424
- .menu-icon:hover {
425
- cursor: pointer;
426
- background-color: rgba(133, 133, 133, 0.1);
427
- }
428
-
429
- @keyframes flipAnimation {
430
- from {
431
- transform: rotate(0deg);
432
- }
433
- to {
434
- transform: rotate(180deg);
435
- }
436
- }
437
-
438
- @keyframes rotateAnimation {
439
- from {
440
- transform: rotate(0deg);
441
- }
442
- to {
443
- transform: rotate(90deg);
444
- }
445
- }
446
-
447
-
448
- @keyframes hoverAnimation {
449
- from {
450
- transform: scale(1);
451
- }
452
- to {
453
- transform: scale(1.2);
454
- }
455
- }
456
-
457
-
458
- .menu-icon.opened.flip svg{
459
- transform: rotate(180deg);
460
- }
461
-
462
- .menu-icon.opened.rotate svg{
463
- animation: rotateAnimation 0.5s forwards;
464
- }
465
-
466
- .menu-icon.opened.hover svg{
467
- animation: hoverAnimation 0.5s forwards;
468
- }
469
-
470
- .none{
471
- transform: none;
472
- }
473
-
474
- .horizontal-menu-item{
475
- display: flex;
476
- align-items: center;
477
- justify-content:center;
478
- margin-right: 10px !important;
479
- margin: 0 auto;
480
- }
481
-
482
- .active-tooltip {
483
- position: fixed;
484
- left: 80px;
485
- width: 240px;
486
- border-radius: 4px;
487
- background-color: white;
488
- z-index: 9999999;
489
- border: 2px solid rgba(70, 70, 70, 0.4);
490
- }
491
-
492
- .main{
493
- width: calc(100vw - 300px);
494
- height: 100%;
495
- position: absolute;
496
- left: 180px;
497
- top: 70px;
498
- }
499
-
500
- .main-loading{
501
- opacity: 0;
502
- background-color: white;
503
- }
504
- </style>
1
+ <template>
2
+ <div class="menu-container">
3
+ <div class="horizontal-menu">
4
+ <div class="menu-button">
5
+ <div class="menu-icon" @click="openVerticalMenu($event)">
6
+ <FontAwesomeIcon
7
+ v-if="menuBar.icon"
8
+ :icon="menuBar.icon"
9
+ ></FontAwesomeIcon>
10
+ </div>
11
+ </div>
12
+ <TopMenuItem
13
+ :topMenuItems="topMenuItems"
14
+ :menuBar="menuBar"
15
+ ></TopMenuItem>
16
+ </div>
17
+
18
+ <div
19
+ class="vertical-menu"
20
+ :class="{ 'vertical-menu-opened': menuBar.opened }"
21
+ >
22
+ <div
23
+ v-for="(item, index) in leftMenuItems"
24
+ :key="index"
25
+ :class="['menu-item-heading', { 'item-active': item.active }]"
26
+ @mouseenter="showTooltipItems($event, item.items)"
27
+ >
28
+ <div class="item" :class="{ 'menu-item-opened': menuBar.opened }">
29
+ <MenuItem
30
+ :item="item"
31
+ :menuBar="menuBar"
32
+ :left-items="leftMenuItems"
33
+ ></MenuItem>
34
+ <SubMenuItems
35
+ @openmenu="handleOpenMenu($event)"
36
+ @changeMenuItem="handleMenuItem($event)"
37
+ v-show="menuBar.opened"
38
+ :left-menu-items="leftMenuItems"
39
+ :item="item"
40
+ :menuBar="menuBar"
41
+ ></SubMenuItems>
42
+ <div
43
+ :class="[
44
+ 'active-tooltip',
45
+ {
46
+ 'tooltip-opened':
47
+ tooltip && item.items?.length && !menuBar.opened,
48
+ },
49
+ ]"
50
+ v-if="tooltip && item.items?.length && !menuBar.opened"
51
+ @mouseleave="hideTooltipItems($event)"
52
+ >
53
+ <div
54
+ v-for="value in item.items"
55
+ :key="value.name"
56
+ class="tooltip-item"
57
+ @click="openTooltipItem($event, value, item)"
58
+ >
59
+ {{ value.name }}
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+
66
+ <div class="main" :class="{ 'main-loading': menuBar.loading }">
67
+ <slot name="handler"></slot>
68
+ </div>
69
+
70
+ <div class="loader" v-if="menuBar.loading">
71
+ <svg class="loader-icon" viewBox="0 0 64 64" aria-hidden="true">
72
+ <circle class="loader-track" cx="32" cy="32" r="24"></circle>
73
+ <circle class="loader-ring" cx="32" cy="32" r="24"></circle>
74
+ </svg>
75
+ </div>
76
+ </div>
77
+ </template>
78
+
79
+ <script lang="ts">
80
+ import { defineComponent, watch } from "vue";
81
+ import {
82
+ LeftMenuItems,
83
+ MenuBarModel,
84
+ ThemeModel,
85
+ TopMenuItems,
86
+ } from "./models/menu-models";
87
+ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
88
+ import {
89
+ faChevronDown,
90
+ faChevronLeft,
91
+ faChevronRight,
92
+ faChevronUp,
93
+ } from "@fortawesome/free-solid-svg-icons";
94
+ import MenuItem from "./components/menu-item.vue";
95
+ import SubMenuItems from "./components/sub-menu-items.vue";
96
+ import { load, router, toTop, menubar } from "./routing/routing";
97
+ import TopMenuItem from "./components/top-menu-items/top-menu-item.vue";
98
+ import { themes } from "./resources/theme";
99
+
100
+ export default defineComponent({
101
+ name: "MenuPlate",
102
+ components: {
103
+ FontAwesomeIcon: FontAwesomeIcon,
104
+ MenuItem: MenuItem,
105
+ SubMenuItems: SubMenuItems,
106
+ TopMenuItem: TopMenuItem,
107
+ },
108
+ props: {
109
+ initialMenuBar: {
110
+ type: Object as () => MenuBarModel,
111
+ default: () => new MenuBarModel(),
112
+ },
113
+ leftItems: {
114
+ type: Array as () => any[],
115
+ default: () => [] as any[],
116
+ },
117
+ Router: {
118
+ type: null,
119
+ required: false,
120
+ },
121
+ topItems: {
122
+ type: Array as () => any[],
123
+ default: () => [] as any[],
124
+ },
125
+ theme: {
126
+ type: ThemeModel,
127
+ default: () => new ThemeModel(),
128
+ },
129
+ },
130
+ emits: ["changeTheme"],
131
+ watch: {
132
+ initialMenuBar(newVal: any) {
133
+ this.menuBar = newVal;
134
+ },
135
+ leftItems(newVal: any) {
136
+ this.leftItems = newVal;
137
+ const idCounter = { value: 0 };
138
+ this.leftMenuItems = this.toLeftMenuItems(newVal, idCounter);
139
+ },
140
+ topItems(newVal: any) {
141
+ this.topItems = newVal;
142
+ },
143
+ },
144
+ mounted() {},
145
+ created() {
146
+ const idCounter = { value: 0 };
147
+ this.leftMenuItems = this.toLeftMenuItems(this.leftItems, idCounter);
148
+ this.topMenuItems = this.toTopMenuItems(this.topItems, idCounter);
149
+ router(this.Router);
150
+ load(false);
151
+ menubar(this.menuBar);
152
+ },
153
+ initTheme() {
154
+ const themeLink = themes.find((x) => x.type === this.theme.type);
155
+ if (themeLink) {
156
+ document.documentElement.setAttribute("data-theme", themeLink.value);
157
+ }
158
+ this.$emit("changeTheme", this.theme);
159
+ },
160
+ data() {
161
+ return {
162
+ menuBar: this.initialMenuBar,
163
+ faChevronDown: faChevronDown,
164
+ faChevronUp: faChevronUp,
165
+ topMenuItems: [] as TopMenuItems[],
166
+ leftMenuItems: [] as LeftMenuItems[],
167
+ tooltip: false,
168
+ tooltipItems: [] as any[],
169
+ topItems: this.topItems,
170
+ leftItems: this.leftItems,
171
+ floor: 20,
172
+ router: router,
173
+ toTop: toTop,
174
+ menubar: menubar,
175
+ themes: themes,
176
+ };
177
+ },
178
+ methods: {
179
+ toLeftMenuItems(items: any[], counter: { value: number }): LeftMenuItems[] {
180
+ let leftMenuItems: LeftMenuItems[] = [];
181
+ for (const item of items) {
182
+ const leftMenuItem = new LeftMenuItems();
183
+ leftMenuItem.id = counter.value++;
184
+ leftMenuItem.name = item.name;
185
+ leftMenuItem.icon = item.icon;
186
+ leftMenuItem.route = item.route;
187
+
188
+ if (item.items?.length) {
189
+ leftMenuItem.items = this.toTopMenuItems(item.items, counter);
190
+ }
191
+
192
+ leftMenuItems = [...leftMenuItems, leftMenuItem];
193
+ }
194
+ return leftMenuItems;
195
+ },
196
+ handleMenuItem(items: any[]) {
197
+ this.leftMenuItems = items;
198
+ },
199
+ toTopMenuItems(items: any[], counter: { value: number }): TopMenuItems[] {
200
+ let topMenuItems: TopMenuItems[] = [];
201
+ for (const item of items) {
202
+ const topMenuItem = new TopMenuItems();
203
+ topMenuItem.id = counter.value++;
204
+ topMenuItem.name = item.name;
205
+ topMenuItem.route = item.route;
206
+ if (item.items?.length) {
207
+ topMenuItem.items = this.toTopMenuItems(item.items, counter);
208
+ }
209
+
210
+ topMenuItems = [...topMenuItems, topMenuItem];
211
+ }
212
+ return topMenuItems;
213
+ },
214
+ openVerticalMenu(event: MouseEvent) {
215
+ this.menuBar.opened = !this.menuBar.opened;
216
+ this.menuBar.changeIcon = "flip";
217
+ this.menuBar.icon = this.menuBar.opened ? faChevronRight : faChevronLeft;
218
+ },
219
+ openSubMenu(item: any) {
220
+ item.opened = !item.opened;
221
+ },
222
+ showTooltipItems(event: any, items: any[]) {
223
+ if (!this.menuBar.opened) {
224
+ if (items?.length) {
225
+ this.tooltip = true;
226
+ this.tooltipItems = items;
227
+ }
228
+ }
229
+ },
230
+ hideTooltipItems(event: any) {
231
+ if (!this.menuBar.opened) {
232
+ this.tooltip = false;
233
+ this.tooltipItems = [];
234
+ }
235
+ },
236
+ handleOpenMenu(item: any) {
237
+ for (const subItem of this.leftMenuItems || []) {
238
+ if (subItem.items?.length) {
239
+ subItem.opened = true;
240
+ subItem.openIcon = subItem.openIcon ? faChevronDown : faChevronUp;
241
+ }
242
+ }
243
+ const item1 = this.leftMenuItems.find((x) => x.name === item.name);
244
+ if (item1) {
245
+ item1.opened = !item1.opened;
246
+ item1.openIcon = item1.opened ? faChevronDown : faChevronUp;
247
+ }
248
+ },
249
+ openTooltipItem(event: any, item: any, parentItem: any) {
250
+ this.closeItems(this.leftMenuItems);
251
+ if (item.items?.length) {
252
+ this.openVerticalMenu(event);
253
+ const parent = this.leftMenuItems.find(
254
+ (x: any) => x.id === parentItem.id
255
+ )!;
256
+ parent.opened = true;
257
+
258
+ const currentItem = parent.items.find((x: any) => x.id === item.id)!;
259
+ currentItem.opened = true;
260
+ return;
261
+ }
262
+ parentItem.active = true;
263
+ toTop(item.route);
264
+ },
265
+ closeItems(items: any[]) {
266
+ for (const item of items) {
267
+ item.active = false;
268
+ if (item.items?.length) {
269
+ this.closeItems(item.items);
270
+ }
271
+ }
272
+ },
273
+ },
274
+ });
275
+ </script>
276
+
277
+ <style scoped>
278
+ .menu-container {
279
+ position: relative;
280
+ width: 100%;
281
+ height: 100%;
282
+ }
283
+
284
+ .top-sub-menu-items {
285
+ position: absolute;
286
+ top: 38px;
287
+ right: 0px;
288
+ border: 1px solid #424242;
289
+ padding: 10px;
290
+ width: 150px;
291
+ z-index: 99999;
292
+ }
293
+
294
+ .item-active {
295
+ background-color: #f2f2f2;
296
+ }
297
+
298
+ .horizontal-menu-item {
299
+ cursor: pointer;
300
+ }
301
+
302
+ .horizontal-items {
303
+ display: flex;
304
+ gap: 20px;
305
+ padding: 10px;
306
+ }
307
+
308
+ .loader {
309
+ width: 100%;
310
+ display: flex;
311
+ position: fixed;
312
+ top: 40%;
313
+ left: 50%;
314
+ height: 36dvh;
315
+ }
316
+
317
+ .loader-icon {
318
+ width: 60px;
319
+ height: 60px;
320
+ transform-origin: center;
321
+ animation: rotateLoader 1s linear infinite;
322
+ }
323
+
324
+ @keyframes rotateLoader {
325
+ from {
326
+ transform: rotate(0deg);
327
+ }
328
+ to {
329
+ transform: rotate(360deg);
330
+ }
331
+ }
332
+
333
+ .tooltip-opened {
334
+ animation: menuTooltipOpened 0.2s ease forwards;
335
+ }
336
+
337
+ .loader-track,
338
+ .loader-ring {
339
+ fill: none;
340
+ stroke-width: 8;
341
+ }
342
+
343
+ .loader-track {
344
+ stroke: rgba(66, 148, 255, 0.18);
345
+ }
346
+
347
+ .loader-ring {
348
+ stroke: #4294ff;
349
+ stroke-dasharray: 110 160;
350
+ stroke-dashoffset: 0;
351
+ }
352
+
353
+ .menu-text-opened {
354
+ display: inline-block;
355
+ }
356
+
357
+ .menu-text-closed {
358
+ display: none;
359
+ }
360
+ .item {
361
+ display: flex;
362
+ flex-wrap: wrap;
363
+ cursor: pointer;
364
+ width: 180px;
365
+ }
366
+
367
+ .menu-item p {
368
+ margin-left: 10px;
369
+ }
370
+
371
+ .menu-item-opened {
372
+ display: flex;
373
+ }
374
+
375
+ .horizontal-items {
376
+ display: flex;
377
+ align-self: flex-end;
378
+ }
379
+
380
+ .tooltip-item {
381
+ padding: 8px;
382
+ cursor: pointer;
383
+ }
384
+
385
+ .horizontal-menu {
386
+ position: absolute;
387
+ border-bottom: 2px solid rgba(70, 70, 70, 0.4);
388
+ top: 0;
389
+ left: 0;
390
+ width: 100%;
391
+ height: 50px;
392
+ display: flex;
393
+ align-items: center;
394
+ justify-content: space-between;
395
+ }
396
+
397
+ .vertical-menu {
398
+ position: absolute;
399
+ top: 50px;
400
+ overflow-x: hidden;
401
+ left: 0;
402
+ z-index: 200;
403
+ width: 70px;
404
+ animation: closeMenu 0.3s ease-out forwards;
405
+ height: 100dvh;
406
+ background-color: white;
407
+ border-right: 2px solid rgba(70, 70, 70, 0.4);
408
+ }
409
+
410
+ .menu-item {
411
+ margin: 0 auto;
412
+ margin-top: 10px;
413
+ margin-bottom: 10px;
414
+ width: 180px;
415
+ margin-left: 20px;
416
+ height: 30px;
417
+ cursor: pointer;
418
+ display: flex;
419
+ justify-content: flex-start;
420
+ align-items: center;
421
+ }
422
+
423
+ @keyframes openMenu {
424
+ from {
425
+ width: 70px;
426
+ }
427
+ to {
428
+ width: 200px;
429
+ }
430
+ }
431
+
432
+ @keyframes closeMenu {
433
+ from {
434
+ width: 200px;
435
+ }
436
+ to {
437
+ width: 70px;
438
+ }
439
+ }
440
+
441
+ .vertical-menu.vertical-menu-opened {
442
+ width: 200px;
443
+ animation: openMenu 0.3s ease-in forwards;
444
+ }
445
+
446
+ .menu-button {
447
+ width: 74px;
448
+ height: 50px;
449
+ display: flex;
450
+ justify-content: center;
451
+ cursor: pointer;
452
+ align-items: center;
453
+ border-right: 2px solid rgba(70, 70, 70, 0.4);
454
+ }
455
+
456
+ .menu-icon {
457
+ width: 30px;
458
+ height: 30px;
459
+ border: 2px solid rgba(70, 70, 70, 0.4);
460
+ display: flex;
461
+ justify-content: center;
462
+ align-items: center;
463
+ border-radius: 4px;
464
+ }
465
+
466
+ .menu-icon:hover {
467
+ cursor: pointer;
468
+ background-color: rgba(133, 133, 133, 0.1);
469
+ }
470
+
471
+ @keyframes flipAnimation {
472
+ from {
473
+ transform: rotate(0deg);
474
+ }
475
+ to {
476
+ transform: rotate(180deg);
477
+ }
478
+ }
479
+
480
+ @keyframes rotateAnimation {
481
+ from {
482
+ transform: rotate(0deg);
483
+ }
484
+ to {
485
+ transform: rotate(90deg);
486
+ }
487
+ }
488
+
489
+ @keyframes hoverAnimation {
490
+ from {
491
+ transform: scale(1);
492
+ }
493
+ to {
494
+ transform: scale(1.2);
495
+ }
496
+ }
497
+
498
+ .menu-icon.opened.flip svg {
499
+ transform: rotate(180deg);
500
+ }
501
+
502
+ .menu-icon.opened.rotate svg {
503
+ animation: rotateAnimation 0.5s forwards;
504
+ }
505
+
506
+ .menu-icon.opened.hover svg {
507
+ animation: hoverAnimation 0.5s forwards;
508
+ }
509
+
510
+ .none {
511
+ transform: none;
512
+ }
513
+
514
+ .horizontal-menu-item {
515
+ display: flex;
516
+ align-items: center;
517
+ justify-content: center;
518
+ margin-right: 10px !important;
519
+ margin: 0 auto;
520
+ }
521
+
522
+ .active-tooltip {
523
+ position: fixed;
524
+ left: 80px;
525
+ width: 240px;
526
+ border-radius: 4px;
527
+ background-color: white;
528
+ z-index: 9999999;
529
+ border: 2px solid rgba(70, 70, 70, 0.4);
530
+ }
531
+
532
+ .main {
533
+ width: calc(100vw - 300px);
534
+ height: 100%;
535
+ position: absolute;
536
+ left: 180px;
537
+ top: 70px;
538
+ }
539
+
540
+ .main-loading {
541
+ opacity: 0;
542
+ background-color: white;
543
+ }
544
+ </style>