@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.
@@ -1,511 +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
- faChevronRight: faChevronRight,
122
- topMenuItems: [] as TopMenuItems[],
123
- leftMenuItems: [] as LeftMenuItems[],
124
- tooltip: false,
125
- tooltipItems: [] as any[],
126
- topItems: this.topItems,
127
- leftItems: this.leftItems,
128
- floor: 20,
129
- router: router,
130
- toTop: toTop,
131
- menubar: menubar,
132
- themes: themes
133
- }
134
- },
135
- methods: {
136
- toLeftMenuItems(items: any[], counter: { value: number }) : LeftMenuItems[] {
137
- let leftMenuItems: LeftMenuItems[] = [];
138
- for(let item of items){
139
- let leftMenuItem = new LeftMenuItems();
140
- leftMenuItem.id = counter.value++;
141
- leftMenuItem.name = item.name;
142
- leftMenuItem.icon = item.icon;
143
- leftMenuItem.route = item.route;
144
-
145
- if(item.items?.length){
146
- leftMenuItem.items = this.toTopMenuItems(item.items, counter);
147
- }
148
-
149
- leftMenuItems = [...leftMenuItems, leftMenuItem];
150
- }
151
- return leftMenuItems;
152
- },
153
- handleMenuItem(items: any[]){
154
- this.leftMenuItems = items;
155
- },
156
- toTopMenuItems(items: any[], counter: { value: number }) : TopMenuItems[] {
157
- let topMenuItems: TopMenuItems[] = [];
158
- for(let item of items){
159
- let topMenuItem = new TopMenuItems();
160
- topMenuItem.id = counter.value++;
161
- topMenuItem.name = item.name;
162
- topMenuItem.route = item.route;
163
- if(item.items?.length){
164
- topMenuItem.items = this.toTopMenuItems(item.items, counter);
165
- }
166
-
167
- topMenuItems = [...topMenuItems, topMenuItem];
168
- }
169
- return topMenuItems;
170
- },
171
- openVerticalMenu(event: MouseEvent) {
172
- this.menuBar.opened = !this.menuBar.opened;
173
- this.menuBar.changeIcon = 'flip';
174
- this.menuBar.icon = this.menuBar.opened ? faChevronRight : faChevronLeft;
175
- },
176
- openSubMenu(item: any) {
177
- item.opened = !item.opened;
178
- },
179
- showTooltipItems(event: any, items: any[]) {
180
- if (!this.menuBar.opened) {
181
- if(items?.length){
182
- this.tooltip = true;
183
- this.tooltipItems = items;
184
- }
185
- }
186
- },
187
- hideTooltipItems(event: any) {
188
- if (!this.menuBar.opened) {
189
- this.tooltip = false;
190
- this.tooltipItems = [];
191
- }
192
- },
193
- handleOpenMenu(item: any) {
194
- for(let subItem of this.leftMenuItems || []){
195
- if(subItem.items?.length){
196
- subItem.opened = true;
197
- subItem.openIcon = subItem.openIcon ? faChevronDown : faChevronUp;
198
- }
199
- }
200
- let item1 = this.leftMenuItems.find(x=> x.name === item.name);
201
- if(item1){
202
- item1.opened = !item1.opened;
203
- item1.openIcon = item1.opened ? faChevronDown : faChevronUp;
204
- }
205
- },
206
- openTooltipItem(event: any, item: any, parentItem: any) {
207
- this.closeItems(this.leftMenuItems);
208
- if(item.items?.length){
209
- this.openVerticalMenu(event);
210
- let parent = this.leftMenuItems.find((x: any) => x.id === parentItem.id)!;
211
- parent.opened = true;
212
-
213
- let currentItem = parent.items.find((x: any) => x.id === item.id)!;
214
- currentItem.opened = true;
215
- return;
216
- }
217
- parentItem.active = true;
218
- toTop(item.route);
219
- },
220
- closeItems(items: any[]) {
221
- for(let item of items){
222
- item.active = false;
223
- if(item.items?.length){
224
- this.closeItems(item.items);
225
- }
226
- }
227
- },
228
- }
229
- });
230
- </script>
231
-
232
- <style scoped>
233
- .menu-container {
234
- position: relative;
235
- width: 100%;
236
- height: 100%;
237
- }
238
-
239
- .top-sub-menu-items {
240
- position: absolute;
241
- top: 38px;
242
- right: 0px;
243
- border: 1px solid #424242;
244
- padding: 10px;
245
- width: 150px;
246
- z-index: 99999;
247
- }
248
-
249
- .item-active{
250
- background-color: #f2f2f2;
251
- }
252
-
253
- .horizontal-menu-item{
254
- cursor: pointer;
255
- }
256
-
257
- .horizontal-items{
258
- display: flex;
259
- gap: 20px;
260
- padding: 10px;
261
- }
262
-
263
- .loader{
264
- width: 100%;
265
- display: flex;
266
- position: fixed;
267
- top: 40%;
268
- left: 50%;
269
- height: 36dvh;
270
- }
271
-
272
- .loader-icon{
273
- width: 60px;
274
- height: 60px;
275
- transform-origin: center;
276
- animation: rotateLoader 1s linear infinite;
277
- }
278
-
279
- @keyframes rotateLoader {
280
- from {
281
- transform: rotate(0deg);
282
- }
283
- to {
284
- transform: rotate(360deg);
285
- }
286
- }
287
-
288
- @keyframes menuTooltipOpened {
289
- from{
290
- transform: translateX(-1px);
291
- }
292
- to{
293
- transform: translateX(0px);
294
- }
295
- }
296
-
297
- .tooltip-opened{
298
- animation: menuTooltipOpened 0.2s ease forwards;
299
- }
300
-
301
- .loader-track,
302
- .loader-ring {
303
- fill: none;
304
- stroke-width: 8;
305
- }
306
-
307
- .loader-track {
308
- stroke: rgba(66, 148, 255, 0.18);
309
- }
310
-
311
- .loader-ring {
312
- stroke: #4294ff;
313
- stroke-dasharray: 110 160;
314
- stroke-dashoffset: 0;
315
- }
316
-
317
- .menu-text-opened {
318
- display: inline-block;
319
- }
320
-
321
- .menu-text-closed {
322
- display: none;
323
- }
324
- .item{
325
- display: flex;
326
- flex-wrap: wrap;
327
- cursor: pointer;
328
- width: 180px;
329
- }
330
-
331
- .menu-item p {
332
- margin-left: 10px;
333
- }
334
-
335
-
336
- .menu-item-opened {
337
- display: flex;
338
- }
339
-
340
- .horizontal-items{
341
- display: flex;
342
- align-self: flex-end;
343
- }
344
-
345
- .tooltip-item{
346
- padding: 8px;
347
- cursor: pointer;
348
- }
349
-
350
- .horizontal-menu {
351
- position: absolute;
352
- border-bottom: 2px solid rgba(70, 70, 70, 0.4);
353
- top: 0;
354
- left: 0;
355
- width: 100%;
356
- height: 50px;
357
- display: flex;
358
- align-items: center;
359
- justify-content: space-between;
360
- }
361
-
362
- .vertical-menu {
363
- position: absolute;
364
- top: 50px;
365
- overflow-x: hidden;
366
- left: 0;
367
- z-index: 200;
368
- width: 70px;
369
- animation: closeMenu 0.3s ease-out forwards;
370
- height: 100dvh;
371
- background-color: white;
372
- border-right: 2px solid rgba(70, 70, 70, 0.4);
373
- }
374
-
375
- .menu-item {
376
- margin: 0 auto;
377
- margin-top: 10px;
378
- margin-bottom: 10px;
379
- width: 180px;
380
- margin-left: 20px;
381
- height: 30px;
382
- cursor: pointer;
383
- display: flex;
384
- justify-content: flex-start;
385
- align-items: center;
386
- }
387
-
388
- @keyframes openMenu {
389
- from {
390
- width: 70px;
391
- }
392
- to {
393
- width: 200px;
394
- }
395
- }
396
-
397
- @keyframes closeMenu {
398
- from {
399
- width: 200px;
400
- }
401
- to {
402
- width: 70px;
403
- }
404
- }
405
-
406
- .vertical-menu.vertical-menu-opened {
407
- width: 200px;
408
- animation: openMenu 0.3s ease-in forwards;
409
- }
410
-
411
- .menu-button{
412
- width: 74px;
413
- height: 50px;
414
- display: flex;
415
- justify-content: center;
416
- cursor: pointer;
417
- align-items: center;
418
- border-right: 2px solid rgba(70, 70, 70, 0.4);
419
- }
420
-
421
- .menu-icon{
422
- width: 30px;
423
- height: 30px;
424
- border: 2px solid rgba(70, 70, 70, 0.4);
425
- display: flex;
426
- justify-content: center;
427
- align-items: center;
428
- border-radius: 4px;
429
- }
430
-
431
- .menu-icon:hover {
432
- cursor: pointer;
433
- background-color: rgba(133, 133, 133, 0.1);
434
- }
435
-
436
- @keyframes flipAnimation {
437
- from {
438
- transform: rotate(0deg);
439
- }
440
- to {
441
- transform: rotate(180deg);
442
- }
443
- }
444
-
445
- @keyframes rotateAnimation {
446
- from {
447
- transform: rotate(0deg);
448
- }
449
- to {
450
- transform: rotate(90deg);
451
- }
452
- }
453
-
454
-
455
- @keyframes hoverAnimation {
456
- from {
457
- transform: scale(1);
458
- }
459
- to {
460
- transform: scale(1.2);
461
- }
462
- }
463
-
464
-
465
- .menu-icon.opened.flip svg{
466
- transform: rotate(180deg);
467
- }
468
-
469
- .menu-icon.opened.rotate svg{
470
- animation: rotateAnimation 0.5s forwards;
471
- }
472
-
473
- .menu-icon.opened.hover svg{
474
- animation: hoverAnimation 0.5s forwards;
475
- }
476
-
477
- .none{
478
- transform: none;
479
- }
480
-
481
- .horizontal-menu-item{
482
- display: flex;
483
- align-items: center;
484
- justify-content:center;
485
- margin-right: 10px !important;
486
- margin: 0 auto;
487
- }
488
-
489
- .active-tooltip {
490
- position: fixed;
491
- left: 80px;
492
- width: 240px;
493
- border-radius: 4px;
494
- background-color: white;
495
- z-index: 9999999;
496
- border: 2px solid rgba(70, 70, 70, 0.4);
497
- }
498
-
499
- .main{
500
- width: calc(100vw - 300px);
501
- height: 100%;
502
- position: absolute;
503
- left: 180px;
504
- top: 70px;
505
- }
506
-
507
- .main-loading{
508
- opacity: 0;
509
- background-color: white;
510
- }
511
- </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>