angular-cn/tools/public_api_guard/router/index.d.ts

415 lines
11 KiB
TypeScript
Raw Normal View History

2016-06-28 17:49:29 -04:00
/** @stable */
export declare class ActivatedRoute {
children: ActivatedRoute[];
component: Type<any> | string;
data: Observable<Data>;
firstChild: ActivatedRoute;
fragment: Observable<string>;
outlet: string;
params: Observable<Params>;
parent: ActivatedRoute;
pathFromRoot: ActivatedRoute[];
queryParams: Observable<Params>;
2016-08-07 23:34:00 -04:00
root: ActivatedRoute;
2016-07-28 20:59:05 -04:00
routeConfig: Route;
snapshot: ActivatedRouteSnapshot;
url: Observable<UrlSegment[]>;
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class ActivatedRouteSnapshot {
children: ActivatedRouteSnapshot[];
component: Type<any> | string;
data: Data;
firstChild: ActivatedRouteSnapshot;
fragment: string;
outlet: string;
params: Params;
parent: ActivatedRouteSnapshot;
pathFromRoot: ActivatedRouteSnapshot[];
queryParams: Params;
2016-08-07 23:34:00 -04:00
root: ActivatedRouteSnapshot;
2016-07-28 20:59:05 -04:00
routeConfig: Route;
url: UrlSegment[];
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export interface CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean;
}
/** @stable */
export interface CanActivateChild {
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export interface CanDeactivate<T> {
canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean;
}
2016-07-26 17:39:02 -04:00
/** @stable */
export interface CanLoad {
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare type Data = {
[name: string]: any;
};
/** @stable */
export declare class DefaultUrlSerializer implements UrlSerializer {
parse(url: string): UrlTree;
serialize(tree: UrlTree): string;
}
/** @experimental */
export declare type DetachedRouteHandle = {};
2016-06-28 17:49:29 -04:00
/** @stable */
2016-08-05 11:24:40 -04:00
export declare type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError | RoutesRecognized;
/** @stable */
export interface ExtraOptions {
enableTracing?: boolean;
errorHandler?: ErrorHandler;
initialNavigation?: boolean;
2016-09-16 20:31:24 -04:00
preloadingStrategy?: any;
useHash?: boolean;
}
/** @stable */
export declare type LoadChildren = string | LoadChildrenCallback;
/** @stable */
export declare type LoadChildrenCallback = () => Type<any> | Promise<Type<any>> | Observable<Type<any>>;
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationCancel {
id: number;
reason: string;
url: string;
2016-09-12 13:02:48 -04:00
constructor(
id: number,
url: string,
reason: string);
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationEnd {
id: number;
url: string;
urlAfterRedirects: string;
2016-09-12 13:02:48 -04:00
constructor(
id: number,
url: string,
urlAfterRedirects: string);
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationError {
error: any;
id: number;
url: string;
2016-09-12 13:02:48 -04:00
constructor(
id: number,
url: string,
error: any);
toString(): string;
}
2016-08-30 18:57:24 -04:00
/** @stable */
2016-07-18 19:42:33 -04:00
export interface NavigationExtras {
fragment?: string;
preserveFragment?: boolean;
preserveQueryParams?: boolean;
2016-07-18 19:42:33 -04:00
queryParams?: Params;
relativeTo?: ActivatedRoute;
replaceUrl?: boolean;
skipLocationChange?: boolean;
2016-07-18 19:42:33 -04:00
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class NavigationStart {
id: number;
url: string;
2016-09-12 13:02:48 -04:00
constructor(
id: number,
url: string);
toString(): string;
}
2016-09-16 20:31:24 -04:00
/** @experimental */
export declare class NoPreloading implements PreloadingStrategy {
preload(route: Route, fn: () => Observable<any>): Observable<any>;
}
/** @stable */
export declare type Params = {
[key: string]: any;
};
2016-09-16 20:31:24 -04:00
/** @experimental */
export declare class PreloadAllModules implements PreloadingStrategy {
preload(route: Route, fn: () => Observable<any>): Observable<any>;
}
/** @experimental */
export declare abstract class PreloadingStrategy {
abstract preload(route: Route, fn: () => Observable<any>): Observable<any>;
}
/** @stable */
export declare const PRIMARY_OUTLET: string;
/** @stable */
2016-07-06 19:19:52 -04:00
export declare function provideRoutes(routes: Routes): any;
2016-07-06 14:02:52 -04:00
/** @stable */
export interface Resolve<T> {
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<T> | Promise<T> | T;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare type ResolveData = {
[name: string]: any;
};
2016-06-28 17:49:29 -04:00
/** @stable */
export interface Route {
2016-07-28 17:36:05 -04:00
canActivate?: any[];
canActivateChild?: any[];
canDeactivate?: any[];
canLoad?: any[];
children?: Routes;
component?: Type<any>;
2016-07-28 17:36:05 -04:00
data?: Data;
loadChildren?: LoadChildren;
matcher?: UrlMatcher;
2016-07-28 17:36:05 -04:00
outlet?: string;
path?: string;
2016-07-28 17:36:05 -04:00
pathMatch?: string;
redirectTo?: string;
resolve?: ResolveData;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class Router {
config: Routes;
errorHandler: ErrorHandler;
events: Observable<Event>;
2016-09-12 13:02:48 -04:00
navigated: boolean;
routeReuseStrategy: RouteReuseStrategy;
routerState: RouterState;
url: string;
urlHandlingStrategy: UrlHandlingStrategy;
constructor(rootComponentType: Type<any>, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location, injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler, config: Routes);
createUrlTree(commands: any[], {relativeTo, queryParams, fragment, preserveQueryParams, preserveFragment}?: NavigationExtras): UrlTree;
dispose(): void;
initialNavigation(): void;
2016-07-28 20:59:05 -04:00
isActive(url: string | UrlTree, exact: boolean): boolean;
navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>;
navigateByUrl(url: string | UrlTree, extras?: NavigationExtras): Promise<boolean>;
ngOnDestroy(): void;
parseUrl(url: string): UrlTree;
2016-07-06 19:19:52 -04:00
resetConfig(config: Routes): void;
serializeUrl(url: UrlTree): string;
setUpLocationChangeListener(): void;
}
/** @stable */
export declare const ROUTER_CONFIGURATION: OpaqueToken;
/** @experimental */
export declare const ROUTER_INITIALIZER: OpaqueToken;
/** @experimental */
export declare abstract class RouteReuseStrategy {
abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle;
abstract shouldAttach(route: ActivatedRouteSnapshot): boolean;
abstract shouldDetach(route: ActivatedRouteSnapshot): boolean;
abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean;
abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void;
}
/** @stable */
export declare class RouterLink {
fragment: string;
preserveFragment: boolean;
preserveQueryParams: boolean;
queryParams: {
[k: string]: any;
};
replaceUrl: boolean;
routerLink: any[] | string;
skipLocationChange: boolean;
urlTree: UrlTree;
constructor(router: Router, route: ActivatedRoute, tabIndex: string, renderer: Renderer, el: ElementRef);
onClick(): boolean;
}
/** @stable */
export declare class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit {
isActive: boolean;
links: QueryList<RouterLink>;
linksWithHrefs: QueryList<RouterLinkWithHref>;
routerLinkActive: string[] | string;
routerLinkActiveOptions: {
exact: boolean;
};
constructor(router: Router, element: ElementRef, renderer: Renderer);
ngAfterContentInit(): void;
ngOnChanges(changes: {}): any;
ngOnDestroy(): any;
}
/** @stable */
export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
fragment: string;
href: string;
preserveFragment: boolean;
preserveQueryParams: boolean;
queryParams: {
[k: string]: any;
};
replaceUrl: boolean;
routerLink: any[] | string;
skipLocationChange: boolean;
target: string;
urlTree: UrlTree;
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
ngOnChanges(changes: {}): any;
ngOnDestroy(): any;
onClick(button: number, ctrlKey: boolean, metaKey: boolean): boolean;
}
/** @stable */
2016-07-07 17:13:32 -04:00
export declare class RouterModule {
constructor(guard: any);
static forChild(routes: Routes): ModuleWithProviders;
static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders;
}
/** @stable */
export declare class RouterOutlet implements OnDestroy {
activateEvents: EventEmitter<any>;
activatedRoute: ActivatedRoute;
component: Object;
deactivateEvents: EventEmitter<any>;
isActivated: boolean;
locationFactoryResolver: ComponentFactoryResolver;
locationInjector: Injector;
outletMap: RouterOutletMap;
2016-07-06 14:02:52 -04:00
constructor(parentOutletMap: RouterOutletMap, location: ViewContainerRef, resolver: ComponentFactoryResolver, name: string);
activate(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver, injector: Injector, providers: ResolvedReflectiveProvider[], outletMap: RouterOutletMap): void;
attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute): void;
deactivate(): void;
detach(): ComponentRef<any>;
ngOnDestroy(): void;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RouterOutletMap {
registerOutlet(name: string, outlet: RouterOutlet): void;
removeOutlet(name: string): void;
}
/** @stable */
export declare class RouterPreloader {
constructor(router: Router, moduleLoader: NgModuleFactoryLoader, compiler: Compiler, injector: Injector, preloadingStrategy: PreloadingStrategy);
ngOnDestroy(): void;
preload(): Observable<any>;
setUpPreloading(): void;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RouterState extends Tree<ActivatedRoute> {
snapshot: RouterStateSnapshot;
toString(): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> {
url: string;
toString(): string;
}
2016-07-06 19:19:52 -04:00
/** @stable */
export declare type Routes = Route[];
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class RoutesRecognized {
id: number;
state: RouterStateSnapshot;
url: string;
urlAfterRedirects: string;
2016-09-12 13:02:48 -04:00
constructor(
id: number,
url: string,
urlAfterRedirects: string,
state: RouterStateSnapshot);
toString(): string;
}
/** @experimental */
export declare abstract class UrlHandlingStrategy {
abstract extract(url: UrlTree): UrlTree;
abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree;
abstract shouldProcessUrl(url: UrlTree): boolean;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class UrlSegment {
parameters: {
[name: string]: string;
};
path: string;
2016-09-12 13:02:48 -04:00
constructor(
path: string,
parameters: {
[name: string]: string;
});
toString(): string;
}
/** @stable */
export declare class UrlSegmentGroup {
children: {
[key: string]: UrlSegmentGroup;
};
numberOfChildren: number;
parent: UrlSegmentGroup;
segments: UrlSegment[];
constructor(
segments: UrlSegment[],
children: {
[key: string]: UrlSegmentGroup;
});
hasChildren(): boolean;
toString(): string;
}
/** @stable */
export declare abstract class UrlSerializer {
abstract parse(url: string): UrlTree;
abstract serialize(tree: UrlTree): string;
}
2016-06-28 17:49:29 -04:00
/** @stable */
export declare class UrlTree {
fragment: string;
queryParams: {
[key: string]: string;
};
root: UrlSegmentGroup;
toString(): string;
}
/** @stable */
export declare const VERSION: Version;