UNPKG

@netgrif/components-core

Version:

Netgrif Application engine frontend core Angular library

83 lines (82 loc) 4.91 kB
import { OnDestroy, OnInit } from '@angular/core'; import { NestedTreeControl } from '@angular/cdk/tree'; import { ConfigurationService } from '../../configuration/configuration.service'; import { View, Views } from '../../../commons/schema'; import { Router } from '@angular/router'; import { MatTreeNestedDataSource } from '@angular/material/tree'; import { ReplaySubject } from 'rxjs'; import { LoggerService } from '../../logger/services/logger.service'; import { UserService } from '../../user/services/user.service'; import { AbstractNavigationResizableDrawerComponent } from '../navigation-drawer/abstract-navigation-resizable-drawer.component'; import { ActiveGroupService } from '../../groups/services/active-group.service'; import { TaskResourceService } from '../../resources/engine-endpoint/task-resource.service'; import { LanguageService } from '../../translate/language.service'; import { DynamicNavigationRouteProviderService } from '../../routing/dynamic-navigation-route-provider/dynamic-navigation-route-provider.service'; import { AccessService } from "../../authorization/permission/access.service"; import * as i0 from "@angular/core"; export interface NavigationNode { name: string; icon?: string; url: string; children?: Array<NavigationNode>; level?: number; translate?: boolean; } export declare abstract class AbstractNavigationTreeComponent extends AbstractNavigationResizableDrawerComponent implements OnInit, OnDestroy { protected _config: ConfigurationService; protected _router: Router; protected _log: LoggerService; protected _userService: UserService; protected _accessService: AccessService; protected _activeGroupService: ActiveGroupService; protected _taskResourceService: TaskResourceService; protected _languageService: LanguageService; protected _navigationRouteProvider: DynamicNavigationRouteProviderService; viewPath: string; parentUrl: string; routerChange: boolean; protected _reloadNavigation: ReplaySubject<void>; private _subscriptions; private _subGroupResolution; private _subLangChange; treeControl: NestedTreeControl<NavigationNode>; dataSource: MatTreeNestedDataSource<NavigationNode>; protected constructor(_config: ConfigurationService, _router: Router, _log: LoggerService, _userService: UserService, _accessService: AccessService, _activeGroupService: ActiveGroupService, _taskResourceService: TaskResourceService, _languageService: LanguageService, _navigationRouteProvider: DynamicNavigationRouteProviderService); ngOnInit(): void; ngOnDestroy(): void; hasChild(_: number, node: NavigationNode): boolean; protected resolveNavigation(): void; protected resolveNavigationNodesWithOffsetRoot(): Array<NavigationNode>; /** * Converts the provided {@link Views} object into the corresponding navigation tree * @param views navigation configuration * @param parentUrl URL of the parent navigation tree node * @param ancestorNodeContainer if the parent node has no navigation this attribute contains the * closest ancestor that has navigation * @protected */ protected resolveNavigationNodes(views: Views, parentUrl: string, ancestorNodeContainer?: Array<NavigationNode>): Array<NavigationNode>; protected hasNavigation(route: View): boolean; protected hasSubRoutes(route: View): boolean; protected buildNode(view: View, routeSegment: string, parentUrl: string): NavigationNode; protected getNodeName(view: View, routeSegment: string): string; protected getNodeIcon(view: View): string; /** * @param view configuration of some view, whose routeSegment we want to determine * @returns the routeSegment for the provided view, or undefined if none is specified */ protected getNodeRouteSegment(view: View): string; protected getNodeTranslateFlag(view: View): boolean; /** * Appends the route segment to the parent URL. * @param parentUrl URL of the parent. Should not end with '/' * @param routeSegment URL segment of the child * @returns `parentUrl/routeSegment` if the `routeSegment` is truthy (not an empty string). * Returns `parentUrl` if `routeSegment` is falsy (empty string). */ protected appendRouteSegment(parentUrl: string, routeSegment: string): string; protected resolveLevels(nodes: Array<NavigationNode>, parentLevel?: number): void; protected resolveChange(): void; static ɵfac: i0.ɵɵFactoryDeclaration<AbstractNavigationTreeComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<AbstractNavigationTreeComponent, "ncc-abstract-navigation-tree", never, { "viewPath": { "alias": "viewPath"; "required": false; }; "parentUrl": { "alias": "parentUrl"; "required": false; }; "routerChange": { "alias": "routerChange"; "required": false; }; }, {}, never, never, false, never>; }