@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,65 +0,0 @@
|
|
|
1
|
-
import { ParamTypeDefinition } from "./interface";
|
|
2
|
-
/**
|
|
3
|
-
* An internal class which implements [[ParamTypeDefinition]].
|
|
4
|
-
*
|
|
5
|
-
* A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.
|
|
6
|
-
* When a param type definition is registered, an instance of this class is created internally.
|
|
7
|
-
*
|
|
8
|
-
* This class has naive implementations for all the [[ParamTypeDefinition]] methods.
|
|
9
|
-
*
|
|
10
|
-
* Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.
|
|
11
|
-
*
|
|
12
|
-
* #### Example:
|
|
13
|
-
* ```js
|
|
14
|
-
* var paramTypeDef = {
|
|
15
|
-
* decode: function(val) { return parseInt(val, 10); },
|
|
16
|
-
* encode: function(val) { return val && val.toString(); },
|
|
17
|
-
* equals: function(a, b) { return this.is(a) && a === b; },
|
|
18
|
-
* is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },
|
|
19
|
-
* pattern: /\d+/
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* var paramType = new ParamType(paramTypeDef);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare class ParamType implements ParamTypeDefinition {
|
|
26
|
-
/** @inheritdoc */
|
|
27
|
-
pattern: RegExp;
|
|
28
|
-
/** The name/id of the parameter type */
|
|
29
|
-
name: string;
|
|
30
|
-
/** @inheritdoc */
|
|
31
|
-
raw: boolean;
|
|
32
|
-
/** @inheritdoc */
|
|
33
|
-
dynamic: boolean;
|
|
34
|
-
/** @inheritdoc */
|
|
35
|
-
inherit: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* @param def A configuration object which contains the custom type definition. The object's
|
|
38
|
-
* properties will override the default methods and/or pattern in `ParamType`'s public interface.
|
|
39
|
-
* @returns a new ParamType object
|
|
40
|
-
*/
|
|
41
|
-
constructor(def: ParamTypeDefinition);
|
|
42
|
-
/** @inheritdoc */
|
|
43
|
-
is(val: any, key?: string): boolean;
|
|
44
|
-
/** @inheritdoc */
|
|
45
|
-
encode(val: any, key?: string): string | string[];
|
|
46
|
-
/** @inheritdoc */
|
|
47
|
-
decode(val: string, key?: string): any;
|
|
48
|
-
/** @inheritdoc */
|
|
49
|
-
equals(a: any, b: any): boolean;
|
|
50
|
-
$subPattern(): string;
|
|
51
|
-
toString(): string;
|
|
52
|
-
/** Given an encoded string, or a decoded object, returns a decoded object */
|
|
53
|
-
$normalize(val: any): any;
|
|
54
|
-
/**
|
|
55
|
-
* Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.
|
|
56
|
-
* e.g.:
|
|
57
|
-
* - urlmatcher pattern "/path?{queryParam[]:int}"
|
|
58
|
-
* - url: "/path?queryParam=1&queryParam=2
|
|
59
|
-
* - $stateParams.queryParam will be [1, 2]
|
|
60
|
-
* if `mode` is "auto", then
|
|
61
|
-
* - url: "/path?queryParam=1 will create $stateParams.queryParam: 1
|
|
62
|
-
* - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]
|
|
63
|
-
*/
|
|
64
|
-
$asArray(mode: boolean | "auto", isSearch: boolean): any;
|
|
65
|
-
}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { ParamTypeDefinition } from "./interface";
|
|
2
|
-
/**
|
|
3
|
-
* A registry for parameter types.
|
|
4
|
-
*
|
|
5
|
-
* This registry manages the built-in (and custom) parameter types.
|
|
6
|
-
*
|
|
7
|
-
* The built-in parameter types are:
|
|
8
|
-
*
|
|
9
|
-
* - [[string]]
|
|
10
|
-
* - [[path]]
|
|
11
|
-
* - [[query]]
|
|
12
|
-
* - [[hash]]
|
|
13
|
-
* - [[int]]
|
|
14
|
-
* - [[bool]]
|
|
15
|
-
* - [[date]]
|
|
16
|
-
* - [[json]]
|
|
17
|
-
* - [[any]]
|
|
18
|
-
*
|
|
19
|
-
* To register custom parameter types, use [[UrlConfig.type]], i.e.,
|
|
20
|
-
*
|
|
21
|
-
* ```js
|
|
22
|
-
* router.urlService.config.type(customType)
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare class ParamTypes {
|
|
26
|
-
/**
|
|
27
|
-
* Built-in parameter type: `string`
|
|
28
|
-
*
|
|
29
|
-
* This parameter type coerces values to strings.
|
|
30
|
-
* It matches anything (`new RegExp(".*")`) in the URL
|
|
31
|
-
*/
|
|
32
|
-
static string: ParamTypeDefinition;
|
|
33
|
-
/**
|
|
34
|
-
* Built-in parameter type: `path`
|
|
35
|
-
*
|
|
36
|
-
* This parameter type is the default type for path parameters.
|
|
37
|
-
* A path parameter is any parameter declared in the path portion of a url
|
|
38
|
-
*
|
|
39
|
-
* - `/foo/:param1/:param2`: two path parameters
|
|
40
|
-
*
|
|
41
|
-
* This parameter type behaves exactly like the [[string]] type with one exception.
|
|
42
|
-
* When matching parameter values in the URL, the `path` type does not match forward slashes `/`.
|
|
43
|
-
*
|
|
44
|
-
* #### Angular 1 note:
|
|
45
|
-
* In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.
|
|
46
|
-
* For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598
|
|
47
|
-
*/
|
|
48
|
-
static path: ParamTypeDefinition;
|
|
49
|
-
/**
|
|
50
|
-
* Built-in parameter type: `query`
|
|
51
|
-
*
|
|
52
|
-
* This parameter type is the default type for query/search parameters.
|
|
53
|
-
* It behaves the same as the [[string]] parameter type.
|
|
54
|
-
*
|
|
55
|
-
* A query parameter is any parameter declared in the query/search portion of a url
|
|
56
|
-
*
|
|
57
|
-
* - `/bar?param2`: a query parameter
|
|
58
|
-
*/
|
|
59
|
-
static query: ParamTypeDefinition;
|
|
60
|
-
/**
|
|
61
|
-
* Built-in parameter type: `hash`
|
|
62
|
-
*
|
|
63
|
-
* This parameter type is used for the `#` parameter (the hash)
|
|
64
|
-
* It behaves the same as the [[string]] parameter type.
|
|
65
|
-
*/
|
|
66
|
-
static hash: ParamTypeDefinition;
|
|
67
|
-
/**
|
|
68
|
-
* Built-in parameter type: `int`
|
|
69
|
-
*
|
|
70
|
-
* This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.
|
|
71
|
-
*
|
|
72
|
-
* #### Example:
|
|
73
|
-
* ```js
|
|
74
|
-
* .state({
|
|
75
|
-
* name: 'user',
|
|
76
|
-
* url: '/user/{id:int}'
|
|
77
|
-
* });
|
|
78
|
-
* ```
|
|
79
|
-
* ```js
|
|
80
|
-
* $state.go('user', { id: 1298547 });
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* The URL will serialize to: `/user/1298547`.
|
|
84
|
-
*
|
|
85
|
-
* When the parameter value is read, it will be the `number` `1298547`, not the string `"1298547"`.
|
|
86
|
-
*/
|
|
87
|
-
static int: ParamTypeDefinition;
|
|
88
|
-
/**
|
|
89
|
-
* Built-in parameter type: `bool`
|
|
90
|
-
*
|
|
91
|
-
* This parameter type serializes `true`/`false` as `1`/`0`
|
|
92
|
-
*
|
|
93
|
-
* #### Example:
|
|
94
|
-
* ```js
|
|
95
|
-
* .state({
|
|
96
|
-
* name: 'inbox',
|
|
97
|
-
* url: '/inbox?{unread:bool}'
|
|
98
|
-
* });
|
|
99
|
-
* ```
|
|
100
|
-
* ```js
|
|
101
|
-
* $state.go('inbox', { unread: true });
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* The URL will serialize to: `/inbox?unread=1`.
|
|
105
|
-
*
|
|
106
|
-
* Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.
|
|
107
|
-
*/
|
|
108
|
-
static bool: ParamTypeDefinition;
|
|
109
|
-
/**
|
|
110
|
-
* Built-in parameter type: `date`
|
|
111
|
-
*
|
|
112
|
-
* This parameter type can be used to serialize Javascript dates as parameter values.
|
|
113
|
-
*
|
|
114
|
-
* #### Example:
|
|
115
|
-
* ```js
|
|
116
|
-
* .state({
|
|
117
|
-
* name: 'search',
|
|
118
|
-
* url: '/search?{start:date}'
|
|
119
|
-
* });
|
|
120
|
-
* ```
|
|
121
|
-
* ```js
|
|
122
|
-
* $state.go('search', { start: new Date(2000, 0, 1) });
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* The URL will serialize to: `/search?start=2000-01-01`.
|
|
126
|
-
*
|
|
127
|
-
* Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:
|
|
128
|
-
*
|
|
129
|
-
* - `date.getFullYear() === 2016`
|
|
130
|
-
* - `date.getMonth() === 11` (month is 0-based)
|
|
131
|
-
* - `date.getDate() === 25`
|
|
132
|
-
*/
|
|
133
|
-
static date: ParamTypeDefinition;
|
|
134
|
-
/**
|
|
135
|
-
* Built-in parameter type: `json`
|
|
136
|
-
*
|
|
137
|
-
* This parameter type can be used to serialize javascript objects into the URL using JSON serialization.
|
|
138
|
-
*
|
|
139
|
-
* #### Example:
|
|
140
|
-
* This example serializes an plain javascript object to the URL
|
|
141
|
-
* ```js
|
|
142
|
-
* .state({
|
|
143
|
-
* name: 'map',
|
|
144
|
-
* url: '/map/{coords:json}'
|
|
145
|
-
* });
|
|
146
|
-
* ```
|
|
147
|
-
* ```js
|
|
148
|
-
* $state.go('map', { coords: { x: 10399.2, y: 49071 });
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
151
|
-
* The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`
|
|
152
|
-
*/
|
|
153
|
-
static json: ParamTypeDefinition;
|
|
154
|
-
/**
|
|
155
|
-
* Built-in parameter type: `any`
|
|
156
|
-
*
|
|
157
|
-
* This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).
|
|
158
|
-
* This type does not encode or decode.
|
|
159
|
-
* It is compared using a deep `equals` comparison.
|
|
160
|
-
*
|
|
161
|
-
* #### Example:
|
|
162
|
-
* This example defines a non-url parameter on a [[StateDeclaration]].
|
|
163
|
-
* ```js
|
|
164
|
-
* .state({
|
|
165
|
-
* name: 'new',
|
|
166
|
-
* url: '/new',
|
|
167
|
-
* params: {
|
|
168
|
-
* inrepyto: null
|
|
169
|
-
* }
|
|
170
|
-
* });
|
|
171
|
-
* ```
|
|
172
|
-
* ```js
|
|
173
|
-
* $state.go('new', { inreplyto: currentMessage });
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
static any: ParamTypeDefinition;
|
|
177
|
-
types: any;
|
|
178
|
-
enqueue: boolean;
|
|
179
|
-
typeQueue: any[];
|
|
180
|
-
private defaultTypes;
|
|
181
|
-
constructor();
|
|
182
|
-
/**
|
|
183
|
-
* Registers a parameter type
|
|
184
|
-
*
|
|
185
|
-
* End users should call [[UrlMatcherFactory.type]], which delegates to this method.
|
|
186
|
-
*/
|
|
187
|
-
type(
|
|
188
|
-
name: string,
|
|
189
|
-
definition?: ParamTypeDefinition,
|
|
190
|
-
definitionFn?: () => ParamTypeDefinition,
|
|
191
|
-
): any;
|
|
192
|
-
_flushTypeQueue(): void;
|
|
193
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Obj } from "../common/common";
|
|
2
|
-
import { StateObject } from "../state/stateObject";
|
|
3
|
-
export declare class StateParams {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
constructor(params?: Obj);
|
|
6
|
-
/**
|
|
7
|
-
* Merges a set of parameters with all parameters inherited between the common parents of the
|
|
8
|
-
* current state and a given destination state.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} newParams The set of parameters which will be composited with inherited params.
|
|
11
|
-
* @param {Object} $current Internal definition of object representing the current state.
|
|
12
|
-
* @param {Object} $to Internal definition of object representing state to transition to.
|
|
13
|
-
*/
|
|
14
|
-
$inherit(newParams: Obj, $current: StateObject, $to: StateObject): any;
|
|
15
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { StateObject } from "../state/stateObject";
|
|
2
|
-
import { RawParams } from "../params/interface";
|
|
3
|
-
import { Param } from "../params/param";
|
|
4
|
-
import { Resolvable } from "../resolve/resolvable";
|
|
5
|
-
import { ViewConfig } from "../view/interface";
|
|
6
|
-
/**
|
|
7
|
-
* A node in a [[TreeChanges]] path
|
|
8
|
-
*
|
|
9
|
-
* For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.
|
|
10
|
-
* Each PathNode corresponds to a state being entered, exited, or retained.
|
|
11
|
-
* The stateful information includes parameter values and resolve data.
|
|
12
|
-
*/
|
|
13
|
-
export declare class PathNode {
|
|
14
|
-
/** The state being entered, exited, or retained */
|
|
15
|
-
state: StateObject;
|
|
16
|
-
/** The parameters declared on the state */
|
|
17
|
-
paramSchema: Param[];
|
|
18
|
-
/** The parameter values that belong to the state */
|
|
19
|
-
paramValues: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
};
|
|
22
|
-
/** The individual (stateful) resolvable objects that belong to the state */
|
|
23
|
-
resolvables: Resolvable[];
|
|
24
|
-
/** The state's declared view configuration objects */
|
|
25
|
-
views: ViewConfig[];
|
|
26
|
-
/**
|
|
27
|
-
* Returns a clone of the PathNode
|
|
28
|
-
* @deprecated use instance method `node.clone()`
|
|
29
|
-
*/
|
|
30
|
-
static clone: (node: PathNode) => PathNode;
|
|
31
|
-
/** Creates a copy of a PathNode */
|
|
32
|
-
constructor(node: PathNode);
|
|
33
|
-
/** Creates a new (empty) PathNode for a State */
|
|
34
|
-
constructor(state: StateObject);
|
|
35
|
-
clone(): PathNode;
|
|
36
|
-
/** Sets [[paramValues]] for the node, from the values of an object hash */
|
|
37
|
-
applyRawParams(params: RawParams): PathNode;
|
|
38
|
-
/** Gets a specific [[Param]] metadata that belongs to the node */
|
|
39
|
-
parameter(name: string): Param;
|
|
40
|
-
/**
|
|
41
|
-
* @returns true if the state and parameter values for another PathNode are
|
|
42
|
-
* equal to the state and param values for this PathNode
|
|
43
|
-
*/
|
|
44
|
-
equals(node: PathNode, paramsFn?: GetParamsFn): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Finds Params with different parameter values on another PathNode.
|
|
47
|
-
*
|
|
48
|
-
* Given another node (of the same state), finds the parameter values which differ.
|
|
49
|
-
* Returns the [[Param]] (schema objects) whose parameter values differ.
|
|
50
|
-
*
|
|
51
|
-
* Given another node for a different state, returns `false`
|
|
52
|
-
*
|
|
53
|
-
* @param node The node to compare to
|
|
54
|
-
* @param paramsFn A function that returns which parameters should be compared.
|
|
55
|
-
* @returns The [[Param]]s which differ, or null if the two nodes are for different states
|
|
56
|
-
*/
|
|
57
|
-
diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false;
|
|
58
|
-
}
|
|
59
|
-
/** @internal */
|
|
60
|
-
export declare type GetParamsFn = (pathNode: PathNode) => Param[];
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Predicate } from "../common/common";
|
|
2
|
-
import { TreeChanges } from "../transition/interface";
|
|
3
|
-
import { StateObject } from "../state/stateObject";
|
|
4
|
-
import { TargetState } from "../state/targetState";
|
|
5
|
-
import { GetParamsFn, PathNode } from "./pathNode";
|
|
6
|
-
import { ViewService } from "../view/view";
|
|
7
|
-
import { Param } from "../params/param";
|
|
8
|
-
import { StateRegistry } from "../state";
|
|
9
|
-
/**
|
|
10
|
-
* This class contains functions which convert TargetStates, Nodes and paths from one type to another.
|
|
11
|
-
*/
|
|
12
|
-
export declare class PathUtils {
|
|
13
|
-
/** Given a PathNode[], create an TargetState */
|
|
14
|
-
static makeTargetState(
|
|
15
|
-
registry: StateRegistry,
|
|
16
|
-
path: PathNode[],
|
|
17
|
-
): TargetState;
|
|
18
|
-
static buildPath(targetState: TargetState): PathNode[];
|
|
19
|
-
/** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */
|
|
20
|
-
static buildToPath(
|
|
21
|
-
fromPath: PathNode[],
|
|
22
|
-
targetState: TargetState,
|
|
23
|
-
): PathNode[];
|
|
24
|
-
/**
|
|
25
|
-
* Creates ViewConfig objects and adds to nodes.
|
|
26
|
-
*
|
|
27
|
-
* On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state
|
|
28
|
-
*/
|
|
29
|
-
static applyViewConfigs(
|
|
30
|
-
$view: ViewService,
|
|
31
|
-
path: PathNode[],
|
|
32
|
-
states: StateObject[],
|
|
33
|
-
): void;
|
|
34
|
-
/**
|
|
35
|
-
* Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath
|
|
36
|
-
*
|
|
37
|
-
* For a parameter in a node to be inherited from the from path:
|
|
38
|
-
* - The toPath's node must have a matching node in the fromPath (by state).
|
|
39
|
-
* - The parameter name must not be found in the toKeys parameter array.
|
|
40
|
-
*
|
|
41
|
-
* Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some
|
|
42
|
-
* caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,
|
|
43
|
-
* it is not inherited from the fromPath.
|
|
44
|
-
*/
|
|
45
|
-
static inheritParams(
|
|
46
|
-
fromPath: PathNode[],
|
|
47
|
-
toPath: PathNode[],
|
|
48
|
-
toKeys?: string[],
|
|
49
|
-
): PathNode[];
|
|
50
|
-
static nonDynamicParams: (node: PathNode) => Param[];
|
|
51
|
-
/**
|
|
52
|
-
* Computes the tree changes (entering, exiting) between a fromPath and toPath.
|
|
53
|
-
*/
|
|
54
|
-
static treeChanges(
|
|
55
|
-
fromPath: PathNode[],
|
|
56
|
-
toPath: PathNode[],
|
|
57
|
-
reloadState: StateObject,
|
|
58
|
-
): TreeChanges;
|
|
59
|
-
/**
|
|
60
|
-
* Returns a new path which is: the subpath of the first path which matches the second path.
|
|
61
|
-
*
|
|
62
|
-
* The new path starts from root and contains any nodes that match the nodes in the second path.
|
|
63
|
-
* It stops before the first non-matching node.
|
|
64
|
-
*
|
|
65
|
-
* Nodes are compared using their state property and their parameter values.
|
|
66
|
-
* If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.
|
|
67
|
-
*
|
|
68
|
-
* @param pathA the first path
|
|
69
|
-
* @param pathB the second path
|
|
70
|
-
* @param paramsFn a function which returns the parameters to consider when comparing
|
|
71
|
-
*
|
|
72
|
-
* @returns an array of PathNodes from the first path which match the nodes in the second path
|
|
73
|
-
*/
|
|
74
|
-
static matching(
|
|
75
|
-
pathA: PathNode[],
|
|
76
|
-
pathB: PathNode[],
|
|
77
|
-
paramsFn?: GetParamsFn,
|
|
78
|
-
): PathNode[];
|
|
79
|
-
/**
|
|
80
|
-
* Returns true if two paths are identical.
|
|
81
|
-
*
|
|
82
|
-
* @param pathA
|
|
83
|
-
* @param pathB
|
|
84
|
-
* @param paramsFn a function which returns the parameters to consider when comparing
|
|
85
|
-
* @returns true if the the states and parameter values for both paths are identical
|
|
86
|
-
*/
|
|
87
|
-
static equals(
|
|
88
|
-
pathA: PathNode[],
|
|
89
|
-
pathB: PathNode[],
|
|
90
|
-
paramsFn?: GetParamsFn,
|
|
91
|
-
): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Return a subpath of a path, which stops at the first matching node
|
|
94
|
-
*
|
|
95
|
-
* Given an array of nodes, returns a subset of the array starting from the first node,
|
|
96
|
-
* stopping when the first node matches the predicate.
|
|
97
|
-
*
|
|
98
|
-
* @param path a path of [[PathNode]]s
|
|
99
|
-
* @param predicate a [[Predicate]] fn that matches [[PathNode]]s
|
|
100
|
-
* @returns a subpath up to the matching node, or undefined if no match is found
|
|
101
|
-
*/
|
|
102
|
-
static subPath(path: PathNode[], predicate: Predicate<PathNode>): PathNode[];
|
|
103
|
-
/** Gets the raw parameter values from a path */
|
|
104
|
-
static paramValues: (path: PathNode[]) => any;
|
|
105
|
-
}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # The Resolve subsystem
|
|
3
|
-
*
|
|
4
|
-
* This subsystem is an asynchronous, hierarchical Dependency Injection system.
|
|
5
|
-
*
|
|
6
|
-
* Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* An interface which is similar to an Angular 2 `Provider`
|
|
12
|
-
*/
|
|
13
|
-
export interface ProviderLike {
|
|
14
|
-
provide: any;
|
|
15
|
-
useClass?: any;
|
|
16
|
-
useFactory?: Function;
|
|
17
|
-
useValue?: any;
|
|
18
|
-
useExisting?: any;
|
|
19
|
-
deps?: any[];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* A plain object used to describe a [[Resolvable]]
|
|
23
|
-
*
|
|
24
|
-
* These objects may be used in the [[StateDeclaration.resolve]] array to declare
|
|
25
|
-
* async data that the state or substates require.
|
|
26
|
-
*
|
|
27
|
-
* #### Example:
|
|
28
|
-
* ```js
|
|
29
|
-
*
|
|
30
|
-
* var state = {
|
|
31
|
-
* name: 'main',
|
|
32
|
-
* resolve: [
|
|
33
|
-
* { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },
|
|
34
|
-
* ],
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export interface ResolvableLiteral {
|
|
39
|
-
/**
|
|
40
|
-
* A Dependency Injection token
|
|
41
|
-
*
|
|
42
|
-
* This Resolvable's DI token.
|
|
43
|
-
* The Resolvable will be injectable elsewhere using the token.
|
|
44
|
-
*/
|
|
45
|
-
token: any;
|
|
46
|
-
/**
|
|
47
|
-
* A function which fetches the Resolvable's data
|
|
48
|
-
*
|
|
49
|
-
* A function which returns one of:
|
|
50
|
-
*
|
|
51
|
-
* - The resolved value (synchronously)
|
|
52
|
-
* - A promise for the resolved value
|
|
53
|
-
* - An Observable of the resolved value(s)
|
|
54
|
-
*
|
|
55
|
-
* This function will be provided the dependencies listed in [[deps]] as its arguments.
|
|
56
|
-
* The resolve system will asynchronously fetch the dependencies before invoking this function.
|
|
57
|
-
*/
|
|
58
|
-
resolveFn: Function;
|
|
59
|
-
/**
|
|
60
|
-
* Defines the Resolve Policy
|
|
61
|
-
*
|
|
62
|
-
* A policy that defines when to invoke the resolve,
|
|
63
|
-
* and whether to wait for async and unwrap the data
|
|
64
|
-
*/
|
|
65
|
-
policy?: ResolvePolicy;
|
|
66
|
-
/**
|
|
67
|
-
* The Dependency Injection tokens
|
|
68
|
-
*
|
|
69
|
-
* This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].
|
|
70
|
-
*
|
|
71
|
-
* The DI tokens are references to other `Resolvables`, or to other
|
|
72
|
-
* services from the native DI system.
|
|
73
|
-
*/
|
|
74
|
-
deps?: any[];
|
|
75
|
-
/** Pre-resolved data. */
|
|
76
|
-
data?: any;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Defines how a resolve is processed during a transition
|
|
80
|
-
*
|
|
81
|
-
* This object is the [[StateDeclaration.resolvePolicy]] property.
|
|
82
|
-
*
|
|
83
|
-
* #### Example:
|
|
84
|
-
* ```js
|
|
85
|
-
* // Fetched when the resolve's state is being entered.
|
|
86
|
-
* // Wait for the promise to resolve.
|
|
87
|
-
* var policy1 = { when: "LAZY", async: "WAIT" }
|
|
88
|
-
*
|
|
89
|
-
* // Fetched when the Transition is starting.
|
|
90
|
-
* // Do not wait for the returned promise to resolve.
|
|
91
|
-
* // Inject the raw promise/value
|
|
92
|
-
* var policy2 = { when: "EAGER", async: "NOWAIT" }
|
|
93
|
-
* ```
|
|
94
|
-
*
|
|
95
|
-
* The policy for a given Resolvable is merged from three sources (highest priority first):
|
|
96
|
-
*
|
|
97
|
-
* - 1) Individual resolve definition
|
|
98
|
-
* - 2) State definition
|
|
99
|
-
* - 3) Global default
|
|
100
|
-
*
|
|
101
|
-
* #### Example:
|
|
102
|
-
* ```js
|
|
103
|
-
* // Wait for an Observable to emit one item.
|
|
104
|
-
* // Since `wait` is not specified, it uses the `wait`
|
|
105
|
-
* // policy defined on the state, or the global default
|
|
106
|
-
* // if no `wait` policy is defined on the state
|
|
107
|
-
* import { RXWAIT } from '@uirouter/rx';
|
|
108
|
-
*
|
|
109
|
-
* var myResolvablePolicy = { async: RXWAIT }
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export interface ResolvePolicy {
|
|
113
|
-
/**
|
|
114
|
-
* Defines when a Resolvable is resolved (fetched) during a transition
|
|
115
|
-
*
|
|
116
|
-
* - `LAZY` (default)
|
|
117
|
-
* - Resolved as the resolve's state is being entered
|
|
118
|
-
* - `EAGER`
|
|
119
|
-
* - Resolved as the transition is starting
|
|
120
|
-
*
|
|
121
|
-
* #### Example:
|
|
122
|
-
* Resolves for `main` and `main.home` are fetched when each state is entered.
|
|
123
|
-
* All of `main` resolves are processed before fetching `main.home` resolves.
|
|
124
|
-
* ```js
|
|
125
|
-
* var state = {
|
|
126
|
-
* name: 'main',
|
|
127
|
-
* resolve: mainResolves, // defined elsewhere
|
|
128
|
-
* resolvePolicy: { when: 'LAZY' }, // default
|
|
129
|
-
* }
|
|
130
|
-
*
|
|
131
|
-
* var state = {
|
|
132
|
-
* name: 'main.home',
|
|
133
|
-
* resolve: homeResolves, // defined elsewhere
|
|
134
|
-
* resolvePolicy: { when: 'LAZY' }, // default
|
|
135
|
-
* }
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* #### Example:
|
|
139
|
-
* Resolves for `main` and `main.home` are fetched at the same time when the transition starts.
|
|
140
|
-
* This happens earlier in the lifecycle than when states are entered.
|
|
141
|
-
* All of the `main` and `main.home` resolves are fetched as soon as possible.
|
|
142
|
-
* ```js
|
|
143
|
-
* var mainState = {
|
|
144
|
-
* name: 'main',
|
|
145
|
-
* resolve: mainResolves, // defined elsewhere
|
|
146
|
-
* resolvePolicy: { when: 'EAGER' },
|
|
147
|
-
* }
|
|
148
|
-
*
|
|
149
|
-
* var homeState = {
|
|
150
|
-
* name: 'main.home',
|
|
151
|
-
* resolve: homeResolves, // defined elsewhere
|
|
152
|
-
* resolvePolicy: { when: 'EAGER' },
|
|
153
|
-
* }
|
|
154
|
-
* ```
|
|
155
|
-
*/
|
|
156
|
-
when?: PolicyWhen;
|
|
157
|
-
/**
|
|
158
|
-
* Determines the unwrapping behavior of asynchronous resolve values.
|
|
159
|
-
*
|
|
160
|
-
* - `WAIT` (default)
|
|
161
|
-
* - If a promise is returned from the resolveFn, wait for the promise before proceeding
|
|
162
|
-
* - The unwrapped value from the promise
|
|
163
|
-
* - `NOWAIT`
|
|
164
|
-
* - If a promise is returned from the resolve, do not wait for the promise.
|
|
165
|
-
* - Any other value returned is wrapped in a promise.
|
|
166
|
-
* - The promise will not be unwrapped.
|
|
167
|
-
* - The promise itself will be provided when the resolve is injected or bound elsewhere.
|
|
168
|
-
* - {@link CustomAsyncPolicy}
|
|
169
|
-
* - You can define a custom function that will be called with the resolveFn value.
|
|
170
|
-
* - This function must return a promise.
|
|
171
|
-
* - The transition will wait for this promise before proceeding
|
|
172
|
-
*
|
|
173
|
-
* NOTE: The previous `RXWAIT` policy has become a CustomAsyncPolicy function exported in `@uirouter/rx` package.
|
|
174
|
-
*
|
|
175
|
-
* #### Example:
|
|
176
|
-
* The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.
|
|
177
|
-
* Resolves for `main` will be provided to components wrapped in a `Promise`.
|
|
178
|
-
*
|
|
179
|
-
* The `Transition` will wait for the `main.home` resolve promises.
|
|
180
|
-
* Resolved values will be unwrapped before being provided to components.
|
|
181
|
-
* ```js
|
|
182
|
-
* var mainState = {
|
|
183
|
-
* name: 'main',
|
|
184
|
-
* resolve: mainResolves, // defined elsewhere
|
|
185
|
-
* resolvePolicy: { async: 'NOWAIT' },
|
|
186
|
-
* }
|
|
187
|
-
* var homeState = {
|
|
188
|
-
* name: 'main.home',
|
|
189
|
-
* resolve: homeResolves, // defined elsewhere
|
|
190
|
-
* resolvePolicy: { async: 'WAIT' }, // default
|
|
191
|
-
* }
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
async?: PolicyAsync;
|
|
195
|
-
}
|
|
196
|
-
export declare type PolicyWhen = "LAZY" | "EAGER";
|
|
197
|
-
export declare type PolicyAsync = "WAIT" | "NOWAIT" | CustomAsyncPolicy;
|
|
198
|
-
export interface CustomAsyncPolicy {
|
|
199
|
-
(data: any): Promise<any>;
|
|
200
|
-
}
|
|
201
|
-
export declare let resolvePolicies: {
|
|
202
|
-
when: {
|
|
203
|
-
LAZY: string;
|
|
204
|
-
EAGER: string;
|
|
205
|
-
};
|
|
206
|
-
async: {
|
|
207
|
-
WAIT: string;
|
|
208
|
-
NOWAIT: string;
|
|
209
|
-
};
|
|
210
|
-
};
|