|
|
|
@ -1,5 +1,13 @@
|
|
|
|
|
import { ABP, RoutesService, TreeNode } from '@abp/ng.core';
|
|
|
|
|
import { Component, Input, TrackByFunction } from '@angular/core';
|
|
|
|
|
import {
|
|
|
|
|
Component,
|
|
|
|
|
ElementRef,
|
|
|
|
|
Input,
|
|
|
|
|
QueryList,
|
|
|
|
|
Renderer2,
|
|
|
|
|
TrackByFunction,
|
|
|
|
|
ViewChildren,
|
|
|
|
|
} from '@angular/core';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'abp-routes',
|
|
|
|
@ -8,11 +16,20 @@ import { Component, Input, TrackByFunction } from '@angular/core';
|
|
|
|
|
export class RoutesComponent {
|
|
|
|
|
@Input() smallScreen: boolean;
|
|
|
|
|
|
|
|
|
|
@ViewChildren('childrenContainer') childrenContainers: QueryList<ElementRef<HTMLDivElement>>;
|
|
|
|
|
|
|
|
|
|
trackByFn: TrackByFunction<TreeNode<ABP.Route>> = (_, item) => item.name;
|
|
|
|
|
|
|
|
|
|
constructor(public readonly routes: RoutesService) {}
|
|
|
|
|
constructor(public readonly routes: RoutesService, protected renderer: Renderer2) {}
|
|
|
|
|
|
|
|
|
|
isDropdown(node: TreeNode<ABP.Route>) {
|
|
|
|
|
return !node?.isLeaf || this.routes.hasChildren(node.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closeDropdown() {
|
|
|
|
|
this.childrenContainers.forEach(({ nativeElement }) => {
|
|
|
|
|
this.renderer.addClass(nativeElement, 'd-none');
|
|
|
|
|
setTimeout(() => this.renderer.removeClass(nativeElement, 'd-none'), 0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|