mirror of https://github.com/abpframework/abp.git
3 changed files with 32 additions and 9 deletions
@ -1,15 +1,22 @@ |
|||||
import { AbpVisibleDirective, NavItem, NavItemsService } from '@abp/ng.theme.shared'; |
import { NavItem, NavItemsService } from '@abp/ng.theme.shared'; |
||||
import { Component, TrackByFunction } from '@angular/core'; |
import { Component, TrackByFunction } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
import { CommonModule } from '@angular/common'; |
||||
import { PermissionDirective, ToInjectorPipe } from '@abp/ng.core'; |
import { PermissionDirective, ToInjectorPipe } from '@abp/ng.core'; |
||||
|
import { map } from 'rxjs/operators'; |
||||
|
|
||||
|
//TODO: Refactor AbpVisibleDirective to ssr compatible
|
||||
|
|
||||
@Component({ |
@Component({ |
||||
selector: 'abp-nav-items', |
selector: 'abp-nav-items', |
||||
templateUrl: 'nav-items.component.html', |
templateUrl: 'nav-items.component.html', |
||||
imports: [CommonModule, AbpVisibleDirective, PermissionDirective, ToInjectorPipe], |
imports: [CommonModule, PermissionDirective, ToInjectorPipe], |
||||
}) |
}) |
||||
export class NavItemsComponent { |
export class NavItemsComponent { |
||||
trackByFn: TrackByFunction<NavItem> = (_, element) => element.id; |
trackByFn: TrackByFunction<NavItem> = (_, element) => element.id; |
||||
|
visibleItems$ = this.navItems.items$.pipe( |
||||
|
map( |
||||
|
items => items.filter(item => !item.visible || item.visible(item)), // sadece görünmesi gerekenleri seç
|
||||
|
), |
||||
|
); |
||||
constructor(public readonly navItems: NavItemsService) {} |
constructor(public readonly navItems: NavItemsService) {} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue