UNPKG

@controladad/ng-base

Version:
53 lines (52 loc) 2.46 kB
import { ActivatedRouteSnapshot } from '@angular/router'; import { RouteExtended, RouteItem, RoutePermission } from '../interfaces'; import * as i0 from "@angular/core"; export declare class RouteHelperService { private router; private location; private auth; private _initialized; private _allRoutes; private _currentRoutePermissionTree; path: import("@angular/core").WritableSignal<string>; layout: import("@angular/core").WritableSignal<RouteExtended>; layoutRootPath: import("@angular/core").WritableSignal<string>; allRoutes: import("@angular/core").Signal<RouteItem[]>; currentRoutePermissionTree: import("@angular/core").Signal<RoutePermission[] | undefined>; pathChunks: import("@angular/core").Signal<string[]>; routes: import("@angular/core").Signal<RouteItem[]>; routeItems: import("@angular/core").Signal<RouteItem[]>; constructor(); getRoutePermissions(state?: ActivatedRouteSnapshot | null): RoutePermission[]; navigate(pathOrItem: string | string[] | RouteItem): Promise<boolean>; /** * Check if a route is currently active (default behavior will check if the route is exactly activated) * @param route route to check if active * @param partial returns true if the given route is a parent of the activated route */ isActive(route: string | string[] | RouteItem, partial?: boolean): boolean; /** * Same as `isActive(route, true)` function but returns true if either given route is a parent of the activated route or is exactly activated * @param route route to check if active */ isActivePartially(route: string | string[] | RouteItem): boolean; getRouteItemAtLevel(level: number, url?: string): RouteItem | undefined; getRouteChildrenAtLevel(level: number, url?: string): RouteItem[]; getRoutePathAtLevel(level: number, url?: string): string | undefined; getFirstAllowedRoute(): string | null; private setupRouterEvents; private updateConfig; private getRoutesAtLevel; private resolveRoutePath; private cleanupRouteUrl; private parseRouteConfig; private getRouteChildren; private routeToChunks; private routeToRouteItem; private extractPermissions; private extractIcon; private getRouteItems; private filterRoutes; static ɵfac: i0.ɵɵFactoryDeclaration<RouteHelperService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RouteHelperService>; }