Skip to content

Commit d04b475

Browse files
committed
perf: change favorite folder
1 parent cd9efcf commit d04b475

4 files changed

Lines changed: 345 additions & 40 deletions

File tree

src/app/elements/asset-tree/asset-tree.component.html

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,36 @@
6565
>
6666
<table>
6767
<tbody>
68-
<tr *ngFor="let menu of rMenuList; let i = index" class="view-menu__item">
68+
<tr
69+
*ngFor="let menu of rMenuList; let i = index"
70+
[class.view-menu__item--has-submenu]="menu.children?.length"
71+
[ngStyle]="{ display: menu.hide ? 'none' : '' }"
72+
class="view-menu__item"
73+
>
6974
<td
70-
(click)="handleMenuClick(menu)"
75+
(click)="!menu.children?.length && handleMenuClick(menu, $event)"
7176
[attr.data-num]="i"
72-
[ngStyle]="{ display: menu.hide ? 'none' : '', opacity: menu.disabled ? 0.4 : 1 }"
77+
[ngStyle]="{ opacity: menu.disabled ? 0.4 : 1 }"
7378
class="view-menu__data"
7479
>
75-
<span [ngClass]="menu.fa" class="view-menu__icon fa"></span> {{ menu.name | translate }}
80+
<span [ngClass]="menu.fa" class="view-menu__icon fa"></span>
81+
<span class="view-menu__label">{{ menu.name | translate }}</span>
82+
<i *ngIf="menu.children?.length" class="fa fa-angle-right view-menu__submenu-arrow"></i>
83+
<div *ngIf="menu.children?.length" class="view-menu__submenu">
84+
<table>
85+
<tbody>
86+
<tr *ngFor="let child of menu.children" class="view-menu__item">
87+
<td
88+
(click)="handleSubmenuClick($event, child)"
89+
class="view-menu__data view-menu__submenu-data"
90+
>
91+
<span class="view-menu__submenu-label">{{ child.name }}</span>
92+
<i *ngIf="child.checked" class="fa fa-check view-menu__submenu-check"></i>
93+
</td>
94+
</tr>
95+
</tbody>
96+
</table>
97+
</div>
7698
</td>
7799
</tr>
78100
</tbody>

src/app/elements/asset-tree/asset-tree.component.scss

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,64 @@ tr:hover {
286286
}
287287

288288
.view-menu__data {
289+
position: relative;
289290
padding: 0 6px;
290291
}
291292

293+
.view-menu__label {
294+
flex: 1;
295+
}
296+
297+
.view-menu__submenu-arrow {
298+
margin-left: 12px;
299+
font-size: 12px;
300+
opacity: 0.6;
301+
}
302+
303+
.view-menu__item--has-submenu {
304+
.view-menu__data {
305+
display: flex;
306+
align-items: center;
307+
padding-right: 10px;
308+
}
309+
310+
&:hover > .view-menu__data > .view-menu__submenu {
311+
display: block;
312+
}
313+
}
314+
315+
.view-menu__submenu {
316+
display: none;
317+
position: absolute;
318+
top: -6px;
319+
left: 100%;
320+
margin: 0;
321+
padding: 6px 0;
322+
min-width: 120px;
323+
border-radius: 2px;
324+
background-color: var(--el-dropdown-bg-color);
325+
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
326+
z-index: 1001;
327+
328+
.view-menu__submenu-data {
329+
display: flex;
330+
align-items: center;
331+
justify-content: space-between;
332+
min-width: 140px;
333+
padding-right: 10px;
334+
}
335+
336+
.view-menu__submenu-label {
337+
flex: 1;
338+
padding-right: 8px;
339+
}
340+
341+
.view-menu__submenu-check {
342+
font-size: 12px;
343+
color: #52c41a;
344+
}
345+
}
346+
292347
.open-tree {
293348
flex: 1;
294349
}

0 commit comments

Comments
 (0)