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