@angular-wave/angular.ts 0.0.60 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +2 -1
- package/src/angular.spec.js +2 -2
- package/src/core/parser/parse.js +14 -0
- package/src/core/parser/parse.spec.js +7 -5
- package/src/core/parser/parser.js +1 -1
- package/src/core/q/q.js +46 -289
- package/src/core/q/q.md +229 -0
- package/src/core/sanitize/sanitize-uri.js +2 -3
- package/src/core/scope/scope.js +18 -8
- package/src/directive/if/if.js +6 -1
- package/src/filters/limit-to.js +5 -2
- package/src/filters/order-by.js +1 -2
- package/src/index.js +1 -1
- package/src/loader.js +1 -55
- package/src/router/params/param-type.js +2 -1
- package/src/router/state/views.js +3 -0
- package/src/router/state-provider.js +1 -1
- package/src/router/transition/reject-factory.js +1 -0
- package/src/router/url/url-rule.js +1 -1
- package/src/router/url/url-service.js +4 -4
- package/src/router/url/url-service.spec.js +4 -3
- package/src/services/http/http.js +7 -5
- package/src/services/template-request.js +2 -7
- package/src/shared/common.js +1 -1
- package/src/shared/utils.js +2 -11
- package/src/types.js +9 -1
- package/types/core/parser/parse.d.ts +3 -4
- package/types/core/parser/parser.d.ts +1 -1
- package/types/core/q/q.d.ts +2 -2
- package/types/core/sanitize/sanitize-uri.d.ts +4 -5
- package/types/core/scope/scope.d.ts +19 -7
- package/types/index.d.ts +5 -1
- package/types/loader.d.ts +0 -52
- package/types/router/params/param-type.d.ts +2 -1
- package/types/router/state/views.d.ts +2 -0
- package/types/router/state-provider.d.ts +1 -1
- package/types/router/transition/reject-factory.d.ts +1 -0
- package/types/router/url/url-rule.d.ts +0 -1
- package/types/router/url/url-service.d.ts +7 -7
- package/types/services/template-request.d.ts +4 -9
- package/types/shared/utils.d.ts +1 -7
- package/types/types.d.ts +6 -1
- package/types-back/README.md +0 -2
- package/types-back/angular.d.ts +0 -146
- package/types-back/index.d.ts +0 -2126
- package/types-back/jqlite.d.ts +0 -374
- package/types-back/router/core/common/common.d.ts +0 -416
- package/types-back/router/core/common/coreservices.d.ts +0 -77
- package/types-back/router/core/common/glob.d.ts +0 -60
- package/types-back/router/core/common/hof.d.ts +0 -168
- package/types-back/router/core/common/index.d.ts +0 -8
- package/types-back/router/core/common/predicates.d.ts +0 -25
- package/types-back/router/core/common/queue.d.ts +0 -15
- package/types-back/router/core/common/safeConsole.d.ts +0 -5
- package/types-back/router/core/common/strings.d.ts +0 -66
- package/types-back/router/core/common/trace.d.ts +0 -126
- package/types-back/router/core/globals.d.ts +0 -43
- package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
- package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
- package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
- package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
- package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
- package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
- package/types-back/router/core/hooks/resolve.d.ts +0 -11
- package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
- package/types-back/router/core/hooks/url.d.ts +0 -4
- package/types-back/router/core/hooks/views.d.ts +0 -7
- package/types-back/router/core/index.d.ts +0 -11
- package/types-back/router/core/interface.d.ts +0 -91
- package/types-back/router/core/params/index.d.ts +0 -12
- package/types-back/router/core/params/interface.d.ts +0 -606
- package/types-back/router/core/params/param.d.ts +0 -77
- package/types-back/router/core/params/paramType.d.ts +0 -65
- package/types-back/router/core/params/paramTypes.d.ts +0 -193
- package/types-back/router/core/params/stateParams.d.ts +0 -15
- package/types-back/router/core/path/index.d.ts +0 -2
- package/types-back/router/core/path/pathNode.d.ts +0 -60
- package/types-back/router/core/path/pathUtils.d.ts +0 -105
- package/types-back/router/core/resolve/index.d.ts +0 -3
- package/types-back/router/core/resolve/interface.d.ts +0 -210
- package/types-back/router/core/resolve/resolvable.d.ts +0 -75
- package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
- package/types-back/router/core/router.d.ts +0 -57
- package/types-back/router/core/state/index.d.ts +0 -28
- package/types-back/router/core/state/interface.d.ts +0 -732
- package/types-back/router/core/state/stateBuilder.d.ts +0 -107
- package/types-back/router/core/state/stateMatcher.d.ts +0 -13
- package/types-back/router/core/state/stateObject.d.ts +0 -170
- package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
- package/types-back/router/core/state/stateRegistry.d.ts +0 -138
- package/types-back/router/core/state/stateService.d.ts +0 -386
- package/types-back/router/core/state/targetState.d.ts +0 -105
- package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
- package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
- package/types-back/router/core/transition/index.d.ts +0 -20
- package/types-back/router/core/transition/interface.d.ts +0 -862
- package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
- package/types-back/router/core/transition/transition.d.ts +0 -575
- package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
- package/types-back/router/core/transition/transitionHook.d.ts +0 -96
- package/types-back/router/core/transition/transitionService.d.ts +0 -253
- package/types-back/router/core/url/index.d.ts +0 -8
- package/types-back/router/core/url/interface.d.ts +0 -169
- package/types-back/router/core/url/urlConfig.d.ts +0 -144
- package/types-back/router/core/url/urlMatcher.d.ts +0 -185
- package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
- package/types-back/router/core/url/urlRouter.d.ts +0 -101
- package/types-back/router/core/url/urlRule.d.ts +0 -143
- package/types-back/router/core/url/urlRules.d.ts +0 -251
- package/types-back/router/core/url/urlService.d.ts +0 -205
- package/types-back/router/core/view/index.d.ts +0 -2
- package/types-back/router/core/view/interface.d.ts +0 -46
- package/types-back/router/core/view/view.d.ts +0 -176
- package/types-back/router/directives/viewDirective.d.ts +0 -144
- package/types-back/router/index.d.ts +0 -17
- package/types-back/router/interface.d.ts +0 -500
- package/types-back/router/legacy/resolveService.d.ts +0 -47
- package/types-back/router/legacy/stateEvents.d.ts +0 -124
- package/types-back/router/services.d.ts +0 -15
- package/types-back/router/stateFilters.d.ts +0 -10
- package/types-back/router/stateProvider.d.ts +0 -258
- package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
- package/types-back/router/statebuilders/views.d.ts +0 -53
- package/types-back/router/templateFactory.d.ts +0 -104
- package/types-back/router/viewScroll.d.ts +0 -9
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/** An enum for Transition Rejection reasons */
|
|
2
|
-
declare enum RejectType {
|
|
3
|
-
/**
|
|
4
|
-
* A new transition superseded this one.
|
|
5
|
-
*
|
|
6
|
-
* While this transition was running, a new transition started.
|
|
7
|
-
* This transition is cancelled because it was superseded by new transition.
|
|
8
|
-
*/
|
|
9
|
-
SUPERSEDED = 2,
|
|
10
|
-
/**
|
|
11
|
-
* The transition was aborted
|
|
12
|
-
*
|
|
13
|
-
* The transition was aborted by a hook which returned `false`
|
|
14
|
-
*/
|
|
15
|
-
ABORTED = 3,
|
|
16
|
-
/**
|
|
17
|
-
* The transition was invalid
|
|
18
|
-
*
|
|
19
|
-
* The transition was never started because it was invalid
|
|
20
|
-
*/
|
|
21
|
-
INVALID = 4,
|
|
22
|
-
/**
|
|
23
|
-
* The transition was ignored
|
|
24
|
-
*
|
|
25
|
-
* The transition was ignored because it would have no effect.
|
|
26
|
-
*
|
|
27
|
-
* Either:
|
|
28
|
-
*
|
|
29
|
-
* - The transition is targeting the current state and parameter values
|
|
30
|
-
* - The transition is targeting the same state and parameter values as the currently running transition.
|
|
31
|
-
*/
|
|
32
|
-
IGNORED = 5,
|
|
33
|
-
/**
|
|
34
|
-
* The transition errored.
|
|
35
|
-
*
|
|
36
|
-
* This generally means a hook threw an error or returned a rejected promise
|
|
37
|
-
*/
|
|
38
|
-
ERROR = 6,
|
|
39
|
-
}
|
|
40
|
-
export { RejectType };
|
|
41
|
-
export declare class Rejection {
|
|
42
|
-
/** @internal */
|
|
43
|
-
$id: number;
|
|
44
|
-
/**
|
|
45
|
-
* The type of the rejection.
|
|
46
|
-
*
|
|
47
|
-
* This value is an number representing the type of transition rejection.
|
|
48
|
-
* If using Typescript, this is a Typescript enum.
|
|
49
|
-
*
|
|
50
|
-
* - [[RejectType.SUPERSEDED]] (`2`)
|
|
51
|
-
* - [[RejectType.ABORTED]] (`3`)
|
|
52
|
-
* - [[RejectType.INVALID]] (`4`)
|
|
53
|
-
* - [[RejectType.IGNORED]] (`5`)
|
|
54
|
-
* - [[RejectType.ERROR]] (`6`)
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
type: RejectType;
|
|
58
|
-
/**
|
|
59
|
-
* A message describing the rejection
|
|
60
|
-
*/
|
|
61
|
-
message: string;
|
|
62
|
-
/**
|
|
63
|
-
* A detail object
|
|
64
|
-
*
|
|
65
|
-
* This value varies based on the mechanism for rejecting the transition.
|
|
66
|
-
* For example, if an error was thrown from a hook, the `detail` will be the `Error` object.
|
|
67
|
-
* If a hook returned a rejected promise, the `detail` will be the rejected value.
|
|
68
|
-
*/
|
|
69
|
-
detail: any;
|
|
70
|
-
/**
|
|
71
|
-
* Indicates if the transition was redirected.
|
|
72
|
-
*
|
|
73
|
-
* When a transition is redirected, the rejection [[type]] will be [[RejectType.SUPERSEDED]] and this flag will be true.
|
|
74
|
-
*/
|
|
75
|
-
redirected: boolean;
|
|
76
|
-
/** Returns true if the obj is a rejected promise created from the `asPromise` factory */
|
|
77
|
-
static isRejectionPromise(obj: any): boolean;
|
|
78
|
-
/** Returns a Rejection due to transition superseded */
|
|
79
|
-
static superseded(detail?: any, options?: any): Rejection;
|
|
80
|
-
/** Returns a Rejection due to redirected transition */
|
|
81
|
-
static redirected(detail?: any): Rejection;
|
|
82
|
-
/** Returns a Rejection due to invalid transition */
|
|
83
|
-
static invalid(detail?: any): Rejection;
|
|
84
|
-
/** Returns a Rejection due to ignored transition */
|
|
85
|
-
static ignored(detail?: any): Rejection;
|
|
86
|
-
/** Returns a Rejection due to aborted transition */
|
|
87
|
-
static aborted(detail?: any): Rejection;
|
|
88
|
-
/** Returns a Rejection due to aborted transition */
|
|
89
|
-
static errored(detail?: any): Rejection;
|
|
90
|
-
/**
|
|
91
|
-
* Returns a Rejection
|
|
92
|
-
*
|
|
93
|
-
* Normalizes a value as a Rejection.
|
|
94
|
-
* If the value is already a Rejection, returns it.
|
|
95
|
-
* Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).
|
|
96
|
-
*
|
|
97
|
-
* @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.
|
|
98
|
-
*/
|
|
99
|
-
static normalize(detail?: Rejection | Error | any): Rejection;
|
|
100
|
-
constructor(type: number, message?: string, detail?: any);
|
|
101
|
-
toString(): string;
|
|
102
|
-
toPromise(): Promise<any>;
|
|
103
|
-
}
|
|
@@ -1,575 +0,0 @@
|
|
|
1
|
-
import { StateDeclaration, StateOrName } from "../state/interface";
|
|
2
|
-
import {
|
|
3
|
-
TransitionOptions,
|
|
4
|
-
TreeChanges,
|
|
5
|
-
IHookRegistry,
|
|
6
|
-
RegisteredHooks,
|
|
7
|
-
HookRegOptions,
|
|
8
|
-
HookMatchCriteria,
|
|
9
|
-
TransitionStateHookFn,
|
|
10
|
-
TransitionHookFn,
|
|
11
|
-
} from "./interface";
|
|
12
|
-
import { RegisteredHook } from "./hookRegistry";
|
|
13
|
-
import { PathNode } from "../path/pathNode";
|
|
14
|
-
import { StateObject } from "../state/stateObject";
|
|
15
|
-
import { TargetState } from "../state/targetState";
|
|
16
|
-
import { Resolvable } from "../resolve/resolvable";
|
|
17
|
-
import { ViewConfig } from "../view/interface";
|
|
18
|
-
import { Router } from "../router";
|
|
19
|
-
import { NGInjector } from "../interface";
|
|
20
|
-
import { ResolvableLiteral } from "../resolve/interface";
|
|
21
|
-
import { Rejection } from "./rejectFactory";
|
|
22
|
-
/**
|
|
23
|
-
* Represents a transition between two states.
|
|
24
|
-
*
|
|
25
|
-
* When navigating to a state, we are transitioning **from** the current state **to** the new state.
|
|
26
|
-
*
|
|
27
|
-
* This object contains all contextual information about the to/from states, parameters, resolves.
|
|
28
|
-
* It has information about all states being entered and exited as a result of the transition.
|
|
29
|
-
*/
|
|
30
|
-
export declare class Transition implements IHookRegistry {
|
|
31
|
-
/** @internal */
|
|
32
|
-
static diToken: typeof Transition;
|
|
33
|
-
/**
|
|
34
|
-
* A unique identifier for the transition.
|
|
35
|
-
*
|
|
36
|
-
* This is an auto incrementing integer, starting from `0`.
|
|
37
|
-
*/
|
|
38
|
-
$id: number;
|
|
39
|
-
/**
|
|
40
|
-
* A reference to the [[Router]] instance
|
|
41
|
-
*
|
|
42
|
-
* This reference can be used to access the router services, such as the [[StateService]]
|
|
43
|
-
*/
|
|
44
|
-
router: Router;
|
|
45
|
-
/** @internal */
|
|
46
|
-
private _deferred;
|
|
47
|
-
/**
|
|
48
|
-
* This promise is resolved or rejected based on the outcome of the Transition.
|
|
49
|
-
*
|
|
50
|
-
* When the transition is successful, the promise is resolved
|
|
51
|
-
* When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error
|
|
52
|
-
*/
|
|
53
|
-
promise: Promise<any>;
|
|
54
|
-
/**
|
|
55
|
-
* A boolean which indicates if the transition was successful
|
|
56
|
-
*
|
|
57
|
-
* After a successful transition, this value is set to true.
|
|
58
|
-
* After an unsuccessful transition, this value is set to false.
|
|
59
|
-
*
|
|
60
|
-
* The value will be undefined if the transition is not complete
|
|
61
|
-
*/
|
|
62
|
-
success: boolean;
|
|
63
|
-
/** @internal */
|
|
64
|
-
_aborted: boolean;
|
|
65
|
-
/** @internal */
|
|
66
|
-
private _error;
|
|
67
|
-
/** @internal Holds the hook registration functions such as those passed to Transition.onStart() */
|
|
68
|
-
_registeredHooks: RegisteredHooks;
|
|
69
|
-
/** @internal */
|
|
70
|
-
private _options;
|
|
71
|
-
/** @internal */
|
|
72
|
-
private _treeChanges;
|
|
73
|
-
/** @internal */
|
|
74
|
-
private _targetState;
|
|
75
|
-
/** @internal */
|
|
76
|
-
private _hookBuilder;
|
|
77
|
-
/** @internal */
|
|
78
|
-
onBefore(
|
|
79
|
-
criteria: HookMatchCriteria,
|
|
80
|
-
callback: TransitionHookFn,
|
|
81
|
-
options?: HookRegOptions,
|
|
82
|
-
): Function;
|
|
83
|
-
/** @inheritdoc */
|
|
84
|
-
onStart(
|
|
85
|
-
criteria: HookMatchCriteria,
|
|
86
|
-
callback: TransitionHookFn,
|
|
87
|
-
options?: HookRegOptions,
|
|
88
|
-
): Function;
|
|
89
|
-
/** @inheritdoc */
|
|
90
|
-
onExit(
|
|
91
|
-
criteria: HookMatchCriteria,
|
|
92
|
-
callback: TransitionStateHookFn,
|
|
93
|
-
options?: HookRegOptions,
|
|
94
|
-
): Function;
|
|
95
|
-
/** @inheritdoc */
|
|
96
|
-
onRetain(
|
|
97
|
-
criteria: HookMatchCriteria,
|
|
98
|
-
callback: TransitionStateHookFn,
|
|
99
|
-
options?: HookRegOptions,
|
|
100
|
-
): Function;
|
|
101
|
-
/** @inheritdoc */
|
|
102
|
-
onEnter(
|
|
103
|
-
criteria: HookMatchCriteria,
|
|
104
|
-
callback: TransitionStateHookFn,
|
|
105
|
-
options?: HookRegOptions,
|
|
106
|
-
): Function;
|
|
107
|
-
/** @inheritdoc */
|
|
108
|
-
onFinish(
|
|
109
|
-
criteria: HookMatchCriteria,
|
|
110
|
-
callback: TransitionHookFn,
|
|
111
|
-
options?: HookRegOptions,
|
|
112
|
-
): Function;
|
|
113
|
-
/** @inheritdoc */
|
|
114
|
-
onSuccess(
|
|
115
|
-
criteria: HookMatchCriteria,
|
|
116
|
-
callback: TransitionHookFn,
|
|
117
|
-
options?: HookRegOptions,
|
|
118
|
-
): Function;
|
|
119
|
-
/** @inheritdoc */
|
|
120
|
-
onError(
|
|
121
|
-
criteria: HookMatchCriteria,
|
|
122
|
-
callback: TransitionHookFn,
|
|
123
|
-
options?: HookRegOptions,
|
|
124
|
-
): Function;
|
|
125
|
-
/** @internal
|
|
126
|
-
* Creates the transition-level hook registration functions
|
|
127
|
-
* (which can then be used to register hooks)
|
|
128
|
-
*/
|
|
129
|
-
private createTransitionHookRegFns;
|
|
130
|
-
/** @internal */
|
|
131
|
-
getHooks(hookName: string): RegisteredHook[];
|
|
132
|
-
/**
|
|
133
|
-
* Creates a new Transition object.
|
|
134
|
-
*
|
|
135
|
-
* If the target state is not valid, an error is thrown.
|
|
136
|
-
*
|
|
137
|
-
* @internal
|
|
138
|
-
*
|
|
139
|
-
* @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
|
|
140
|
-
* encapsulates the "from state".
|
|
141
|
-
* @param targetState The target state and parameters being transitioned to (also, the transition options)
|
|
142
|
-
* @param router The [[Router]] instance
|
|
143
|
-
* @internal
|
|
144
|
-
*/
|
|
145
|
-
constructor(fromPath: PathNode[], targetState: TargetState, router: Router);
|
|
146
|
-
private applyViewConfigs;
|
|
147
|
-
/**
|
|
148
|
-
* @internal
|
|
149
|
-
* @returns the internal from [State] object
|
|
150
|
-
*/
|
|
151
|
-
$from(): StateObject;
|
|
152
|
-
/**
|
|
153
|
-
* @internal
|
|
154
|
-
* @returns the internal to [State] object
|
|
155
|
-
*/
|
|
156
|
-
$to(): StateObject;
|
|
157
|
-
/**
|
|
158
|
-
* Returns the "from state"
|
|
159
|
-
*
|
|
160
|
-
* Returns the state that the transition is coming *from*.
|
|
161
|
-
*
|
|
162
|
-
* @returns The state declaration object for the Transition's ("from state").
|
|
163
|
-
*/
|
|
164
|
-
from(): StateDeclaration;
|
|
165
|
-
/**
|
|
166
|
-
* Returns the "to state"
|
|
167
|
-
*
|
|
168
|
-
* Returns the state that the transition is going *to*.
|
|
169
|
-
*
|
|
170
|
-
* @returns The state declaration object for the Transition's target state ("to state").
|
|
171
|
-
*/
|
|
172
|
-
to(): StateDeclaration;
|
|
173
|
-
/**
|
|
174
|
-
* Gets the Target State
|
|
175
|
-
*
|
|
176
|
-
* A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.
|
|
177
|
-
*
|
|
178
|
-
* @returns the [[TargetState]] of this Transition
|
|
179
|
-
*/
|
|
180
|
-
targetState(): TargetState;
|
|
181
|
-
/**
|
|
182
|
-
* Determines whether two transitions are equivalent.
|
|
183
|
-
* @deprecated
|
|
184
|
-
*/
|
|
185
|
-
is(
|
|
186
|
-
compare:
|
|
187
|
-
| Transition
|
|
188
|
-
| {
|
|
189
|
-
to?: any;
|
|
190
|
-
from?: any;
|
|
191
|
-
},
|
|
192
|
-
): boolean;
|
|
193
|
-
/**
|
|
194
|
-
* Gets transition parameter values
|
|
195
|
-
*
|
|
196
|
-
* Returns the parameter values for a transition as key/value pairs.
|
|
197
|
-
* This object is immutable.
|
|
198
|
-
*
|
|
199
|
-
* By default, returns the new parameter values (for the "to state").
|
|
200
|
-
*
|
|
201
|
-
* #### Example:
|
|
202
|
-
* ```js
|
|
203
|
-
* var toParams = transition.params();
|
|
204
|
-
* ```
|
|
205
|
-
*
|
|
206
|
-
* To return the previous parameter values, supply `'from'` as the `pathname` argument.
|
|
207
|
-
*
|
|
208
|
-
* #### Example:
|
|
209
|
-
* ```js
|
|
210
|
-
* var fromParams = transition.params('from');
|
|
211
|
-
* ```
|
|
212
|
-
*
|
|
213
|
-
* @param pathname the name of the treeChanges path to get parameter values for:
|
|
214
|
-
* (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)
|
|
215
|
-
*
|
|
216
|
-
* @returns transition parameter values for the desired path.
|
|
217
|
-
*/
|
|
218
|
-
params(pathname?: string): {
|
|
219
|
-
[paramName: string]: any;
|
|
220
|
-
};
|
|
221
|
-
params<T>(pathname?: string): T;
|
|
222
|
-
/**
|
|
223
|
-
* Gets the new values of any parameters that changed during this transition.
|
|
224
|
-
*
|
|
225
|
-
* Returns any parameter values that have changed during a transition, as key/value pairs.
|
|
226
|
-
*
|
|
227
|
-
* - Any parameter values that have changed will be present on the returned object reflecting the new value.
|
|
228
|
-
* - Any parameters that *not* have changed will not be present on the returned object.
|
|
229
|
-
* - Any new parameters that weren't present in the "from" state, but are now present in the "to" state will be present on the returned object.
|
|
230
|
-
* - Any previous parameters that are no longer present (because the "to" state doesn't have them) will be included with a value of `undefined`.
|
|
231
|
-
*
|
|
232
|
-
* The returned object is immutable.
|
|
233
|
-
*
|
|
234
|
-
* #### Examples:
|
|
235
|
-
*
|
|
236
|
-
* Given:
|
|
237
|
-
* ```js
|
|
238
|
-
* var stateA = { name: 'stateA', url: '/stateA/:param1/param2' }
|
|
239
|
-
* var stateB = { name: 'stateB', url: '/stateB/:param3' }
|
|
240
|
-
* var stateC = { name: 'stateB.nest', url: '/nest/:param4' }
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* #### Example 1
|
|
244
|
-
*
|
|
245
|
-
* From `/stateA/abc/def` to `/stateA/abc/xyz`
|
|
246
|
-
*
|
|
247
|
-
* ```js
|
|
248
|
-
* var changed = transition.paramsChanged()
|
|
249
|
-
* // changed is { param2: 'xyz' }
|
|
250
|
-
* ```
|
|
251
|
-
*
|
|
252
|
-
* The value of `param2` changed to `xyz`.
|
|
253
|
-
* The value of `param1` stayed the same so its value is not present.
|
|
254
|
-
*
|
|
255
|
-
* #### Example 2
|
|
256
|
-
*
|
|
257
|
-
* From `/stateA/abc/def` to `/stateB/123`
|
|
258
|
-
*
|
|
259
|
-
* ```js
|
|
260
|
-
* var changed = transition.paramsChanged()
|
|
261
|
-
* // changed is { param1: undefined, param2: undefined, param3: '123' }
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* The value `param3` is present because it is a new param.
|
|
265
|
-
* Both `param1` and `param2` are no longer present so their value is undefined.
|
|
266
|
-
*
|
|
267
|
-
* #### Example 3
|
|
268
|
-
*
|
|
269
|
-
* From `/stateB/123` to `/stateB/123/nest/456`
|
|
270
|
-
*
|
|
271
|
-
* ```js
|
|
272
|
-
* var changed = transition.paramsChanged()
|
|
273
|
-
* // changed is { param4: '456' }
|
|
274
|
-
* ```
|
|
275
|
-
*
|
|
276
|
-
* The value `param4` is present because it is a new param.
|
|
277
|
-
* The value of `param3` did not change, so its value is not present.
|
|
278
|
-
*
|
|
279
|
-
* @returns an immutable object with changed parameter keys/values.
|
|
280
|
-
*/
|
|
281
|
-
paramsChanged(): {
|
|
282
|
-
[paramName: string]: any;
|
|
283
|
-
};
|
|
284
|
-
paramsChanged<T>(): T;
|
|
285
|
-
/**
|
|
286
|
-
* Creates a [[NGInjector]] Dependency Injector
|
|
287
|
-
*
|
|
288
|
-
* Returns a Dependency Injector for the Transition's target state (to state).
|
|
289
|
-
* The injector provides resolve values which the target state has access to.
|
|
290
|
-
*
|
|
291
|
-
* The `NGInjector` can also provide values from the native root/global injector (ng1/ng2).
|
|
292
|
-
*
|
|
293
|
-
* #### Example:
|
|
294
|
-
* ```js
|
|
295
|
-
* .onEnter({ entering: 'myState' }, trans => {
|
|
296
|
-
* var myResolveValue = trans.injector().get('myResolve');
|
|
297
|
-
* // Inject a global service from the global/native injector (if it exists)
|
|
298
|
-
* var MyService = trans.injector().get('MyService');
|
|
299
|
-
* })
|
|
300
|
-
* ```
|
|
301
|
-
*
|
|
302
|
-
* In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.
|
|
303
|
-
* You can use [[NGInjector.getAsync]] to get a promise for the data.
|
|
304
|
-
* #### Example:
|
|
305
|
-
* ```js
|
|
306
|
-
* .onBefore({}, trans => {
|
|
307
|
-
* return trans.injector().getAsync('myResolve').then(myResolveValue =>
|
|
308
|
-
* return myResolveValue !== 'ABORT';
|
|
309
|
-
* });
|
|
310
|
-
* });
|
|
311
|
-
* ```
|
|
312
|
-
*
|
|
313
|
-
* If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.
|
|
314
|
-
* This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.
|
|
315
|
-
* #### Example:
|
|
316
|
-
* ```js
|
|
317
|
-
* .onEnter({ to: 'foo.bar' }, trans => {
|
|
318
|
-
* // returns result of `foo` state's `myResolve` resolve
|
|
319
|
-
* // even though `foo.bar` also has a `myResolve` resolve
|
|
320
|
-
* var fooData = trans.injector('foo').get('myResolve');
|
|
321
|
-
* });
|
|
322
|
-
* ```
|
|
323
|
-
*
|
|
324
|
-
* If you need resolve data from the exiting states, pass `'from'` as `pathName`.
|
|
325
|
-
* The resolve data from the `from` path will be returned.
|
|
326
|
-
* #### Example:
|
|
327
|
-
* ```js
|
|
328
|
-
* .onExit({ exiting: 'foo.bar' }, trans => {
|
|
329
|
-
* // Gets the resolve value of `myResolve` from the state being exited
|
|
330
|
-
* var fooData = trans.injector(null, 'from').get('myResolve');
|
|
331
|
-
* });
|
|
332
|
-
* ```
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* @param state Limits the resolves provided to only the resolves the provided state has access to.
|
|
336
|
-
* @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.
|
|
337
|
-
*
|
|
338
|
-
* @returns a [[NGInjector]]
|
|
339
|
-
*/
|
|
340
|
-
injector(state?: StateOrName, pathName?: string): NGInjector;
|
|
341
|
-
/**
|
|
342
|
-
* Gets all available resolve tokens (keys)
|
|
343
|
-
*
|
|
344
|
-
* This method can be used in conjunction with [[injector]] to inspect the resolve values
|
|
345
|
-
* available to the Transition.
|
|
346
|
-
*
|
|
347
|
-
* This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states
|
|
348
|
-
* in the Transition's [[TreeChanges.to]] path.
|
|
349
|
-
*
|
|
350
|
-
* #### Example:
|
|
351
|
-
* This example logs all resolve values
|
|
352
|
-
* ```js
|
|
353
|
-
* let tokens = trans.getResolveTokens();
|
|
354
|
-
* tokens.forEach(token => console.log(token + " = " + trans.injector().get(token)));
|
|
355
|
-
* ```
|
|
356
|
-
*
|
|
357
|
-
* #### Example:
|
|
358
|
-
* This example creates promises for each resolve value.
|
|
359
|
-
* This triggers fetches of resolves (if any have not yet been fetched).
|
|
360
|
-
* When all promises have all settled, it logs the resolve values.
|
|
361
|
-
* ```js
|
|
362
|
-
* let tokens = trans.getResolveTokens();
|
|
363
|
-
* let promise = tokens.map(token => trans.injector().getAsync(token));
|
|
364
|
-
* Promise.all(promises).then(values => console.log("Resolved values: " + values));
|
|
365
|
-
* ```
|
|
366
|
-
*
|
|
367
|
-
* Note: Angular 1 users whould use `$q.all()`
|
|
368
|
-
*
|
|
369
|
-
* @param pathname resolve context's path name (e.g., `to` or `from`)
|
|
370
|
-
*
|
|
371
|
-
* @returns an array of resolve tokens (keys)
|
|
372
|
-
*/
|
|
373
|
-
getResolveTokens(pathname?: string): any[];
|
|
374
|
-
/**
|
|
375
|
-
* Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.
|
|
376
|
-
*
|
|
377
|
-
* Allows a transition hook to dynamically add a Resolvable to this Transition.
|
|
378
|
-
*
|
|
379
|
-
* Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[NGInjector.get]]).
|
|
380
|
-
*
|
|
381
|
-
* If a `state` argument is provided, the Resolvable is processed when that state is being entered.
|
|
382
|
-
* If no `state` is provided then the root state is used.
|
|
383
|
-
* If the given `state` has already been entered, the Resolvable is processed when any child state is entered.
|
|
384
|
-
* If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.
|
|
385
|
-
*
|
|
386
|
-
* The `state` argument also scopes the resolved data.
|
|
387
|
-
* The resolved data is available from the injector for that `state` and any children states.
|
|
388
|
-
*
|
|
389
|
-
* #### Example:
|
|
390
|
-
* ```js
|
|
391
|
-
* transitionService.onBefore({}, transition => {
|
|
392
|
-
* transition.addResolvable({
|
|
393
|
-
* token: 'myResolve',
|
|
394
|
-
* deps: ['MyService'],
|
|
395
|
-
* resolveFn: myService => myService.getData()
|
|
396
|
-
* });
|
|
397
|
-
* });
|
|
398
|
-
* ```
|
|
399
|
-
*
|
|
400
|
-
* @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])
|
|
401
|
-
* @param state the state in the "to path" which should receive the new resolve (otherwise, the root state)
|
|
402
|
-
*/
|
|
403
|
-
addResolvable(
|
|
404
|
-
resolvable: Resolvable | ResolvableLiteral,
|
|
405
|
-
state?: StateOrName,
|
|
406
|
-
): void;
|
|
407
|
-
/**
|
|
408
|
-
* Gets the transition from which this transition was redirected.
|
|
409
|
-
*
|
|
410
|
-
* If the current transition is a redirect, this method returns the transition that was redirected.
|
|
411
|
-
*
|
|
412
|
-
* #### Example:
|
|
413
|
-
* ```js
|
|
414
|
-
* let transitionA = $state.go('A').transition
|
|
415
|
-
* transitionA.onStart({}, () => $state.target('B'));
|
|
416
|
-
* $transitions.onSuccess({ to: 'B' }, (trans) => {
|
|
417
|
-
* trans.to().name === 'B'; // true
|
|
418
|
-
* trans.redirectedFrom() === transitionA; // true
|
|
419
|
-
* });
|
|
420
|
-
* ```
|
|
421
|
-
*
|
|
422
|
-
* @returns The previous Transition, or null if this Transition is not the result of a redirection
|
|
423
|
-
*/
|
|
424
|
-
redirectedFrom(): Transition;
|
|
425
|
-
/**
|
|
426
|
-
* Gets the original transition in a redirect chain
|
|
427
|
-
*
|
|
428
|
-
* A transition might belong to a long chain of multiple redirects.
|
|
429
|
-
* This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.
|
|
430
|
-
*
|
|
431
|
-
* #### Example:
|
|
432
|
-
* ```js
|
|
433
|
-
* // states
|
|
434
|
-
* registry.register({ name: 'A', redirectTo: 'B' });
|
|
435
|
-
* registry.register({ name: 'B', redirectTo: 'C' });
|
|
436
|
-
* registry.register({ name: 'C', redirectTo: 'D' });
|
|
437
|
-
* registry.register({ name: 'D' });
|
|
438
|
-
*
|
|
439
|
-
* let transitionA = $state.go('A').transition
|
|
440
|
-
*
|
|
441
|
-
* $transitions.onSuccess({ to: 'D' }, (trans) => {
|
|
442
|
-
* trans.to().name === 'D'; // true
|
|
443
|
-
* trans.redirectedFrom().to().name === 'C'; // true
|
|
444
|
-
* trans.originalTransition() === transitionA; // true
|
|
445
|
-
* trans.originalTransition().to().name === 'A'; // true
|
|
446
|
-
* });
|
|
447
|
-
* ```
|
|
448
|
-
*
|
|
449
|
-
* @returns The original Transition that started a redirect chain
|
|
450
|
-
*/
|
|
451
|
-
originalTransition(): Transition;
|
|
452
|
-
/**
|
|
453
|
-
* Get the transition options
|
|
454
|
-
*
|
|
455
|
-
* @returns the options for this Transition.
|
|
456
|
-
*/
|
|
457
|
-
options(): TransitionOptions;
|
|
458
|
-
/**
|
|
459
|
-
* Gets the states being entered.
|
|
460
|
-
*
|
|
461
|
-
* @returns an array of states that will be entered during this transition.
|
|
462
|
-
*/
|
|
463
|
-
entering(): StateDeclaration[];
|
|
464
|
-
/**
|
|
465
|
-
* Gets the states being exited.
|
|
466
|
-
*
|
|
467
|
-
* @returns an array of states that will be exited during this transition.
|
|
468
|
-
*/
|
|
469
|
-
exiting(): StateDeclaration[];
|
|
470
|
-
/**
|
|
471
|
-
* Gets the states being retained.
|
|
472
|
-
*
|
|
473
|
-
* @returns an array of states that are already entered from a previous Transition, that will not be
|
|
474
|
-
* exited during this Transition
|
|
475
|
-
*/
|
|
476
|
-
retained(): StateDeclaration[];
|
|
477
|
-
/**
|
|
478
|
-
* Get the [[ViewConfig]]s associated with this Transition
|
|
479
|
-
*
|
|
480
|
-
* Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.
|
|
481
|
-
* This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering").
|
|
482
|
-
*
|
|
483
|
-
* @param pathname the name of the path to fetch views for:
|
|
484
|
-
* (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)
|
|
485
|
-
* @param state If provided, only returns the `ViewConfig`s for a single state in the path
|
|
486
|
-
*
|
|
487
|
-
* @returns a list of ViewConfig objects for the given path.
|
|
488
|
-
*/
|
|
489
|
-
views(pathname?: string, state?: StateObject): ViewConfig[];
|
|
490
|
-
/**
|
|
491
|
-
* Return the transition's tree changes
|
|
492
|
-
*
|
|
493
|
-
* A transition goes from one state/parameters to another state/parameters.
|
|
494
|
-
* During a transition, states are entered and/or exited.
|
|
495
|
-
*
|
|
496
|
-
* This function returns various branches (paths) which represent the changes to the
|
|
497
|
-
* active state tree that are caused by the transition.
|
|
498
|
-
*
|
|
499
|
-
* @param pathname The name of the tree changes path to get:
|
|
500
|
-
* (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)
|
|
501
|
-
*/
|
|
502
|
-
treeChanges(pathname: string): PathNode[];
|
|
503
|
-
treeChanges(): TreeChanges;
|
|
504
|
-
/**
|
|
505
|
-
* Creates a new transition that is a redirection of the current one.
|
|
506
|
-
*
|
|
507
|
-
* This transition can be returned from a [[TransitionService]] hook to
|
|
508
|
-
* redirect a transition to a new state and/or set of parameters.
|
|
509
|
-
*
|
|
510
|
-
* @internal
|
|
511
|
-
*
|
|
512
|
-
* @returns Returns a new [[Transition]] instance.
|
|
513
|
-
*/
|
|
514
|
-
redirect(targetState: TargetState): Transition;
|
|
515
|
-
/** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */
|
|
516
|
-
private _changedParams;
|
|
517
|
-
/**
|
|
518
|
-
* Returns true if the transition is dynamic.
|
|
519
|
-
*
|
|
520
|
-
* A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.
|
|
521
|
-
*
|
|
522
|
-
* @returns true if the Transition is dynamic
|
|
523
|
-
*/
|
|
524
|
-
dynamic(): boolean;
|
|
525
|
-
/**
|
|
526
|
-
* Returns true if the transition is ignored.
|
|
527
|
-
*
|
|
528
|
-
* A transition is ignored if no states are entered nor exited, and no parameter values have changed.
|
|
529
|
-
*
|
|
530
|
-
* @returns true if the Transition is ignored.
|
|
531
|
-
*/
|
|
532
|
-
ignored(): boolean;
|
|
533
|
-
/** @internal */
|
|
534
|
-
_ignoredReason(): "SameAsCurrent" | "SameAsPending" | undefined;
|
|
535
|
-
/**
|
|
536
|
-
* Runs the transition
|
|
537
|
-
*
|
|
538
|
-
* This method is generally called from the [[StateService.transitionTo]]
|
|
539
|
-
*
|
|
540
|
-
* @internal
|
|
541
|
-
*
|
|
542
|
-
* @returns a promise for a successful transition.
|
|
543
|
-
*/
|
|
544
|
-
run(): Promise<any>;
|
|
545
|
-
/** Checks if this transition is currently active/running. */
|
|
546
|
-
isActive: () => boolean;
|
|
547
|
-
/**
|
|
548
|
-
* Checks if the Transition is valid
|
|
549
|
-
*
|
|
550
|
-
* @returns true if the Transition is valid
|
|
551
|
-
*/
|
|
552
|
-
valid(): boolean;
|
|
553
|
-
/**
|
|
554
|
-
* Aborts this transition
|
|
555
|
-
*
|
|
556
|
-
* Imperative API to abort a Transition.
|
|
557
|
-
* This only applies to Transitions that are not yet complete.
|
|
558
|
-
*/
|
|
559
|
-
abort(): void;
|
|
560
|
-
/**
|
|
561
|
-
* The Transition error reason.
|
|
562
|
-
*
|
|
563
|
-
* If the transition is invalid (and could not be run), returns the reason the transition is invalid.
|
|
564
|
-
* If the transition was valid and ran, but was not successful, returns the reason the transition failed.
|
|
565
|
-
*
|
|
566
|
-
* @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed.
|
|
567
|
-
*/
|
|
568
|
-
error(): Rejection;
|
|
569
|
-
/**
|
|
570
|
-
* A string representation of the Transition
|
|
571
|
-
*
|
|
572
|
-
* @returns A string representation of the Transition
|
|
573
|
-
*/
|
|
574
|
-
toString(): string;
|
|
575
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { TransitionHookPhase, PathType } from "./interface";
|
|
2
|
-
import { GetErrorHandler, GetResultHandler } from "./transitionHook";
|
|
3
|
-
/**
|
|
4
|
-
* This class defines a type of hook, such as `onBefore` or `onEnter`.
|
|
5
|
-
* Plugins can define custom hook types, such as sticky states does for `onInactive`.
|
|
6
|
-
*/
|
|
7
|
-
export declare class TransitionEventType {
|
|
8
|
-
name: string;
|
|
9
|
-
hookPhase: TransitionHookPhase;
|
|
10
|
-
hookOrder: number;
|
|
11
|
-
criteriaMatchPath: PathType;
|
|
12
|
-
reverseSort: boolean;
|
|
13
|
-
getResultHandler: GetResultHandler;
|
|
14
|
-
getErrorHandler: GetErrorHandler;
|
|
15
|
-
synchronous: boolean;
|
|
16
|
-
constructor(
|
|
17
|
-
name: string,
|
|
18
|
-
hookPhase: TransitionHookPhase,
|
|
19
|
-
hookOrder: number,
|
|
20
|
-
criteriaMatchPath: PathType,
|
|
21
|
-
reverseSort?: boolean,
|
|
22
|
-
getResultHandler?: GetResultHandler,
|
|
23
|
-
getErrorHandler?: GetErrorHandler,
|
|
24
|
-
synchronous?: boolean,
|
|
25
|
-
);
|
|
26
|
-
}
|