Files
grimmory/booklore-ui/src/app/layout/component/layout-menu/app.menuitem.component.html
T

77 lines
3.1 KiB
HTML

<ng-container>
@if (root && item.visible !== false) {
<div class="layout-menuitem-root-text">{{ item.label }}</div>
}
@if ((!item.routerLink || item.items) && item.visible !== false) {
<a [attr.href]="item.url"
(click)="itemClick($event)"
[ngClass]="item.class" [attr.target]="item.target" tabindex="0" pRipple>
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
<span class="layout-menuitem-text">
{{ item.label }}
</span>
@if (item.items) {
<i class="pi pi-fw pi-angle-down layout-submenu-toggler"></i>
}
</a>
}
<div class="flex flex-row items-center justify-between">
@if ((item.routerLink && !item.items) && item.visible !== false) {
<a (click)="itemClick($event)"
[ngClass]="item.class"
[routerLink]="item.routerLink" routerLinkActive="active-route"
[routerLinkActiveOptions]="item.routerLinkActiveOptions || { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' }"
[fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling"
[preserveFragment]="item.preserveFragment"
[skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state"
[queryParams]="item.queryParams"
[attr.target]="item.target" tabindex="0" pRipple>
<i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
<span class="layout-menuitem-text w-full">
{{ item.label }}
</span>
@if (item.items) {
<i class="pi pi-fw pi-angle-down layout-submenu-toggler"></i>
}
</a>
}
@if ((item.routerLink && !item.items) && item.visible !== false) {
<span>
@if (item.type === 'Library' || item.type === 'Shelf') {
@if ((item.type !== 'Library' || (admin || canManipulateLibrary)) && item.label !== 'Unshelved') {
<p-button
(click)="entitymenu.toggle($event)"
(mouseover)="hovered = true"
(mouseleave)="hovered = false"
[text]="true"
[outlined]="false"
[rounded]="true"
[label]="hovered ? '' : (item.bookCount$ | async)?.toString() || ''"
[icon]="hovered ? 'pi pi-ellipsis-v' : ''"
[style.width]="'30px'"
[style.height]="'30px'"
[style.display]="'flex'">
</p-button>
}
<p-menu #entitymenu [model]="item.menu" [popup]="true" appendTo="body"></p-menu>
}
@if (item.type === 'Library' && (!admin && !canManipulateLibrary) || item.type === 'All Books' || item.label === 'Unshelved') {
<p class="text-[var(--primary-color)] pr-1">
{{ (item.bookCount$ | async)?.toString() || '0' }}
</p>
}
</span>
}
</div>
@if (item.items && item.visible !== false) {
<ul [@children]="submenuAnimation">
@for (child of item.items; track child; let i = $index) {
<li app-menuitem [item]="child" [index]="i" [parentKey]="key" [class]="child.badgeClass"></li>
}
</ul>
}
</ng-container>