add web portal framework for TestAPI
[releng.git] / utils / test / testapi / 3rd_party / static / testapi-ui / assets / lib / angular-ui-router / api / angular-ui-router.d.ts
1 // Type definitions for Angular JS 1.1.5+ (ui.router module)
2 // Project: https://github.com/angular-ui/ui-router
3 // Definitions by: Michel Salib <https://github.com/michelsalib>
4 // Definitions: https://github.com/borisyankov/DefinitelyTyped
5
6 declare module ng.ui {
7
8     interface IState {
9         name?: string;
10         template?: string;
11         templateUrl?: any; // string || () => string
12         templateProvider?: any; // () => string || IPromise<string>
13         controller?: any;
14         controllerAs?: string;    
15         controllerProvider?: any;
16         resolve?: {};
17         url?: string;
18         params?: any;
19         views?: {};
20         abstract?: boolean;
21         onEnter?: (...args: any[]) => void;
22         onExit?: (...args: any[]) => void;
23         data?: any;
24         reloadOnSearch?: boolean;
25     }
26
27     interface ITypedState<T> extends IState {
28         data?: T;
29     }
30
31     interface IStateProvider extends IServiceProvider {
32         state(name: string, config: IState): IStateProvider;
33         state(config: IState): IStateProvider;
34         decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
35     }
36
37     interface IUrlMatcher {
38         concat(pattern: string): IUrlMatcher;
39         exec(path: string, searchParams: {}): {};
40         parameters(): string[];
41         format(values: {}): string;
42     }
43
44     interface IUrlMatcherFactory {
45         compile(pattern: string): IUrlMatcher;
46         isMatcher(o: any): boolean;
47     }
48
49     interface IUrlRouterProvider extends IServiceProvider {
50         when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
51         when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
52         when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
53         when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;
54         when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;
55         when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;
56         when(whenPath: string, handler: Function): IUrlRouterProvider;
57         when(whenPath: string, handler: any[]): IUrlRouterProvider;
58         when(whenPath: string, toPath: string): IUrlRouterProvider;
59         otherwise(handler: Function): IUrlRouterProvider;
60         otherwise(handler: any[]): IUrlRouterProvider;
61         otherwise(path: string): IUrlRouterProvider;
62         rule(handler: Function): IUrlRouterProvider;
63         rule(handler: any[]): IUrlRouterProvider;
64     }
65
66     interface IStateOptions {
67         location?: any;
68         inherit?: boolean;
69         relative?: IState;
70         notify?: boolean;
71         reload?: boolean;
72     }
73
74     interface IHrefOptions {
75         lossy?: boolean;
76         inherit?: boolean;
77         relative?: IState;
78         absolute?: boolean;
79     }
80
81     interface IStateService {
82         go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;
83         transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
84         transitionTo(state: string, params?: {}, options?: IStateOptions): void;
85         includes(state: string, params?: {}): boolean;
86         is(state:string, params?: {}): boolean;
87         is(state: IState, params?: {}): boolean;
88         href(state: IState, params?: {}, options?: IHrefOptions): string;
89         href(state: string, params?: {}, options?: IHrefOptions): string;
90         get(state: string): IState;
91         get(): IState[];
92         current: IState;
93         params: any;
94         reload(): void;
95     }
96
97     interface IStateParamsService {
98         [key: string]: any;
99     }
100
101     interface IStateParams {
102         [key: string]: any;
103     }
104
105     interface IUrlRouterService {
106         /*
107          * Triggers an update; the same update that happens when the address bar
108          * url changes, aka $locationChangeSuccess.
109          *
110          * This method is useful when you need to use preventDefault() on the
111          * $locationChangeSuccess event, perform some custom logic (route protection,
112          * auth, config, redirection, etc) and then finally proceed with the transition
113          * by calling $urlRouter.sync().
114          *
115          */
116         sync(): void;
117     }
118
119     interface IUiViewScrollProvider {
120         /*
121          * Reverts back to using the core $anchorScroll service for scrolling 
122          * based on the url anchor.
123          */
124         useAnchorScroll(): void;
125     }
126 }