core/navigator/navigator-node.component.ts
Navigator node renderer.
AfterViewInit
OnChanges
OnDestroy
selector | c8y-navigator-node |
templateUrl | ./navigator-node.component.html |
Properties |
Methods |
Inputs |
Outputs |
Accessors |
constructor(router: Router)
|
||||||
Parameters :
|
isRoot |
Type : boolean
|
Determines whether the navigator node is a root node (top node in the hierarchy). |
node |
Type : NavigatorNode
|
Navigator node. |
click | |||||||||||||||
click(from: "icon" | "expander" | "link", $event?: MouseEvent)
|
|||||||||||||||
Click event handler.
Parameters :
Returns :
void
|
expandCollapse | |||||||||||||||
expandCollapse(open, forNode: ClickOptions)
|
|||||||||||||||
Expands or collapses the navigator node and its children recursively.
Parameters :
Returns :
void
|
expandRecursiveParent | |||||||||||||||
expandRecursiveParent(nodes: NavigatorNode[], clickOption: ClickOptions)
|
|||||||||||||||
Expands the parent nodes recursively.
Parameters :
Returns :
void
|
ngOnChanges | ||||||
ngOnChanges(changes: SimpleChanges)
|
||||||
Parameters :
Returns :
void
|
nodeInit$ |
Default value : new Subject<void>()
|
A subject that is triggered as soon as the navigator node is initialized. |
expandTitle |
getexpandTitle()
|
Returns the expander title. |
<ng-container *ngIf="node.component">
<ng-container *c8yComponentOutlet="node.component; environmentInjector: node.injector"></ng-container>
</ng-container>
<div
class="slot"
*ngIf="!node.component"
[hidden]="node.hidden"
(dragstart)="node.dragStart($event)"
(dragend)="node.dragEnd($event)"
(drop)="node.drop($event)"
[draggable]="node.draggable"
[ngClass]="{ dragged: node.dragged, disabled: node.loading }"
>
<ng-container>
<div
class="link"
tabindex="-1"
[routerLink]="node.canNavigate ? node.path : undefined"
[ngClass]="{
active: isActive$ | async,
'dragged-hover': node.draggedHover && !node.dragged
}"
(dragover)="node.canDrop && $event.preventDefault()"
(dragenter)="node.canDrop && node.dragEnter($event)"
(dragleave)="node.canDrop && node.dragLeave($event)"
>
<ng-container *ngTemplateOutlet="navicon"></ng-container>
<button
class="btn-clean"
title="{{ node.translateLabel ? (node.label | translate) : node.label }}"
[attr.aria-expanded]="node.hasChildren ? node.open : null"
type="button"
draggable="false"
[attr.data-cy]="node.label"
[attr.id]="isRoot ? node.id : undefined"
(click)="click(node.canNavigate ? 'link' : 'expander', $event)"
[ngClass]="{
'root-link': isRoot,
open: node.open && node.hasChildren,
parent: node.hasChildren
}"
>
<ng-container *ngTemplateOutlet="inner"></ng-container>
</button>
</div>
</ng-container>
<div
class="children panel-expand expand"
*ngIf="node.children.length"
[collapse]="!node.open"
[isAnimated]="true"
>
<c8y-navigator-node
*ngFor="let childNode of node.children"
[node]="childNode"
(nodeClick)="nodeClick.emit($event)"
></c8y-navigator-node>
</div>
</div>
<!-- icon -->
<ng-template #navicon>
<!-- loader -->
<i
class="icon-spin loadingIndicator"
[c8yIcon]="'circle-o-notch'"
[ngClass]="{ 'm-l-16' : isRoot, 'm-l-8': !isRoot }"
*ngIf="node.loading && !isRoot"
></i>
<ng-container #icon></ng-container>
</ng-template>
<ng-template #inner>
<!--title -->
<span>{{ node.translateLabel ? (node.label | translate) : node.label }}</span>
<!--expander -->
<i
class="expander"
[c8yIcon]="'chevron-down'"
[attr.aria-label]="expandTitle"
role="button"
*ngIf="node.hasChildren"
(click)="click('expander', $event)"
data-cy="c8y-navigator-node--expander"
></i>
<!-- Popover confirm -->
<c8y-popover-confirm
triggers="focus"
containerClass="navigator-popover"
></c8y-popover-confirm>
</ng-template>