@angular-wave/angular.ts 0.0.21 → 0.0.23
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/Makefile +1 -1
- package/TODO.md +14 -0
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +8 -2
- package/package.json +1 -1
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +15 -6
- package/src/animations/animate-js.js +1 -1
- package/src/animations/animate-queue.js +1 -1
- package/src/animations/shared.js +0 -14
- package/src/core/compile.js +6 -3
- package/src/directive/if.js +0 -79
- package/src/directive/if.md +80 -0
- package/src/directive/include.js +0 -82
- package/src/directive/include.md +86 -0
- package/src/directive/repeat.js +0 -1
- package/src/filters/order-by.js +8 -8
- package/src/loader.js +0 -1
- package/src/router/common/trace.js +1 -1
- package/src/router/directives/stateDirectives.js +16 -14
- package/src/router/directives/viewDirective.js +5 -13
- package/src/router/hooks/resolve.js +3 -4
- package/src/router/hooks/views.js +3 -2
- package/src/router/state/stateService.js +1 -2
- package/src/router/stateProvider.js +8 -0
- package/src/router/templateFactory.js +13 -7
- package/src/router/transition/interface.js +14 -14
- package/src/router/transition/rejectFactory.js +29 -20
- package/src/router/transition/transition.js +5 -1
- package/src/router/transition/transitionHook.js +5 -5
- package/src/router/url/urlMatcher.js +1 -2
- package/src/router/url/urlRule.js +10 -2
- package/src/router/url/urlRules.js +1 -1
- package/src/services/browser.js +3 -18
- package/src/shared/common.js +0 -1
- package/test/module-test.html +44 -12
- package/test/router/ng-state-builder.spec.js +81 -0
- package/test/router/services.spec.js +70 -0
- package/test/router/state-directives.spec.js +1182 -0
- package/test/router/template-factory.spec.js +146 -0
- package/test/router/url-matcher-factory.spec.js +1313 -0
- package/test/router/view-directive.spec.js +2013 -0
- package/test/router/view-hook.spec.js +217 -0
- package/test/router/view-scroll.spec.js +77 -0
- package/test/router/view.spec.js +117 -0
- package/types/angular.d.ts +132 -124
- package/types/index.d.ts +2350 -2187
- package/types/jqlite.d.ts +463 -418
- package/types/router/core/common/common.d.ts +70 -24
- package/types/router/core/common/coreservices.d.ts +30 -32
- package/types/router/core/common/glob.d.ts +9 -9
- package/types/router/core/common/hof.d.ts +12 -4
- package/types/router/core/common/index.d.ts +8 -8
- package/types/router/core/common/predicates.d.ts +1 -1
- package/types/router/core/common/queue.d.ts +13 -13
- package/types/router/core/common/safeConsole.d.ts +3 -3
- package/types/router/core/common/strings.d.ts +4 -2
- package/types/router/core/common/trace.d.ts +94 -82
- package/types/router/core/globals.d.ts +37 -37
- package/types/router/core/hooks/coreResolvables.d.ts +5 -3
- package/types/router/core/hooks/ignoredTransition.d.ts +4 -2
- package/types/router/core/hooks/invalidTransition.d.ts +4 -2
- package/types/router/core/hooks/lazyLoad.d.ts +10 -5
- package/types/router/core/hooks/onEnterExitRetain.d.ts +10 -4
- package/types/router/core/hooks/redirectTo.d.ts +4 -2
- package/types/router/core/hooks/resolve.d.ts +10 -4
- package/types/router/core/hooks/updateGlobals.d.ts +4 -2
- package/types/router/core/hooks/url.d.ts +4 -2
- package/types/router/core/hooks/views.d.ts +7 -3
- package/types/router/core/index.d.ts +11 -12
- package/types/router/core/interface.d.ts +83 -81
- package/types/router/core/params/index.d.ts +5 -5
- package/types/router/core/params/interface.d.ts +439 -439
- package/types/router/core/params/param.d.ts +72 -60
- package/types/router/core/params/paramType.d.ts +40 -40
- package/types/router/core/params/paramTypes.d.ts +169 -165
- package/types/router/core/params/stateParams.d.ts +13 -13
- package/types/router/core/path/index.d.ts +2 -2
- package/types/router/core/path/pathNode.d.ts +49 -49
- package/types/router/core/path/pathUtils.d.ts +100 -74
- package/types/router/core/resolve/index.d.ts +3 -3
- package/types/router/core/resolve/interface.d.ts +137 -137
- package/types/router/core/resolve/resolvable.d.ts +60 -54
- package/types/router/core/resolve/resolveContext.d.ts +84 -79
- package/types/router/core/router.d.ts +95 -86
- package/types/router/core/state/index.d.ts +8 -8
- package/types/router/core/state/interface.d.ts +667 -643
- package/types/router/core/state/stateBuilder.d.ts +41 -38
- package/types/router/core/state/stateMatcher.d.ts +11 -9
- package/types/router/core/state/stateObject.d.ts +154 -139
- package/types/router/core/state/stateQueueManager.d.ts +26 -21
- package/types/router/core/state/stateRegistry.d.ts +124 -121
- package/types/router/core/state/stateService.d.ts +380 -343
- package/types/router/core/state/targetState.d.ts +74 -69
- package/types/router/core/transition/hookBuilder.d.ts +34 -30
- package/types/router/core/transition/hookRegistry.d.ts +96 -74
- package/types/router/core/transition/index.d.ts +8 -8
- package/types/router/core/transition/interface.d.ts +652 -609
- package/types/router/core/transition/rejectFactory.d.ts +97 -97
- package/types/router/core/transition/transition.d.ts +565 -517
- package/types/router/core/transition/transitionEventType.d.ts +20 -11
- package/types/router/core/transition/transitionHook.d.ts +90 -82
- package/types/router/core/transition/transitionService.d.ts +228 -161
- package/types/router/core/url/index.d.ts +8 -8
- package/types/router/core/url/interface.d.ts +100 -87
- package/types/router/core/url/urlConfig.d.ts +130 -126
- package/types/router/core/url/urlMatcher.d.ts +132 -127
- package/types/router/core/url/urlMatcherFactory.d.ts +46 -42
- package/types/router/core/url/urlRouter.d.ts +91 -75
- package/types/router/core/url/urlRule.d.ts +123 -100
- package/types/router/core/url/urlRules.d.ts +240 -232
- package/types/router/core/url/urlService.d.ts +201 -201
- package/types/router/core/view/index.d.ts +2 -2
- package/types/router/core/view/interface.d.ts +26 -26
- package/types/router/core/view/view.d.ts +152 -143
- package/types/router/directives/viewDirective.d.ts +12 -11
- package/types/router/index.d.ts +11 -12
- package/types/router/interface.d.ts +361 -351
- package/types/router/legacy/resolveService.d.ts +44 -40
- package/types/router/legacy/stateEvents.d.ts +1 -1
- package/types/router/locationServices.d.ts +45 -37
- package/types/router/services.d.ts +9 -9
- package/types/router/stateFilters.d.ts +3 -3
- package/types/router/stateProvider.d.ts +240 -235
- package/types/router/statebuilders/onEnterExitRetain.d.ts +4 -2
- package/types/router/statebuilders/views.d.ts +35 -22
- package/types/router/templateFactory.d.ts +99 -79
- package/types/router/viewScroll.d.ts +7 -7
- package/src/directive/a.js +0 -37
- package/types/router/angular.d.ts +0 -1
- package/types/router/core/vanilla.d.ts +0 -1
- package/types/router/directives/stateDirectives.d.ts +0 -3
- package/types/router/injectables.d.ts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParamType } from
|
|
1
|
+
import { ParamType } from "./paramType";
|
|
2
2
|
/**
|
|
3
3
|
* Parameter values
|
|
4
4
|
*
|
|
@@ -13,7 +13,7 @@ import { ParamType } from './paramType';
|
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
export interface RawParams {
|
|
16
|
-
|
|
16
|
+
[key: string]: any;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Configuration for a single Parameter
|
|
@@ -47,290 +47,290 @@ export interface RawParams {
|
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
export interface ParamDeclaration {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The default value for this parameter.
|
|
52
|
+
*
|
|
53
|
+
* Specifies the default value for this parameter.
|
|
54
|
+
* This implicitly sets this parameter as optional.
|
|
55
|
+
*
|
|
56
|
+
* When UI-Router routes to a state and no value is specified for this parameter in the URL or transition,
|
|
57
|
+
* the default value will be used instead.
|
|
58
|
+
* If value is a function, it will be injected and invoked, and the return value used.
|
|
59
|
+
*
|
|
60
|
+
* Note: `value: undefined` is treated as though **no default value was specified**, while `value: null` is treated
|
|
61
|
+
* as **"the default value is null"**.
|
|
62
|
+
*
|
|
63
|
+
* ```
|
|
64
|
+
* // define default values for param1 and param2
|
|
65
|
+
* params: {
|
|
66
|
+
* param1: {
|
|
67
|
+
* value: "defaultValue"
|
|
68
|
+
* },
|
|
69
|
+
* param2: {
|
|
70
|
+
* value: "param2Default;
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* ### Shorthand Declaration
|
|
76
|
+
*
|
|
77
|
+
* If you only want to set the default value of the parameter, you may use a shorthand syntax.
|
|
78
|
+
* In the params map, instead mapping the param name to a full parameter configuration object, simply set map it
|
|
79
|
+
* to the default parameter value, e.g.:
|
|
80
|
+
* ```
|
|
81
|
+
* // Normal (non-shorthand) default value syntax
|
|
82
|
+
* params: {
|
|
83
|
+
* param1: {
|
|
84
|
+
* value: "defaultValue"
|
|
85
|
+
* },
|
|
86
|
+
* param2: {
|
|
87
|
+
* value: "param2Default"
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
*
|
|
91
|
+
* // Shorthand default value syntax
|
|
92
|
+
* params: {
|
|
93
|
+
* param1: "defaultValue",
|
|
94
|
+
* param2: "param2Default"
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* This defines a default value for the parameter.
|
|
99
|
+
* If a parameter value is `undefined`, this default value will be used instead
|
|
100
|
+
*
|
|
101
|
+
* ---
|
|
102
|
+
*
|
|
103
|
+
* Default: `undefined`
|
|
104
|
+
*/
|
|
105
|
+
value?: any;
|
|
106
|
+
/**
|
|
107
|
+
* The parameter's type
|
|
108
|
+
*
|
|
109
|
+
* Specifies the [[ParamType]] of the parameter.
|
|
110
|
+
* Parameter types can be used to customize the encoding/decoding of parameter values.
|
|
111
|
+
*
|
|
112
|
+
* Set this property to the name of parameter's type.
|
|
113
|
+
* The type may be either one of the built in types, or a custom type that has been registered with the [[UrlMatcherFactory]].
|
|
114
|
+
*
|
|
115
|
+
* See [[ParamTypes]] for the list of built in types.
|
|
116
|
+
*
|
|
117
|
+
* ---
|
|
118
|
+
*
|
|
119
|
+
* Default:
|
|
120
|
+
* - Path parameters (`/:fooParam`): `path`
|
|
121
|
+
* - Query parameters (`?queryParam`): `query`
|
|
122
|
+
* - Non-url parameters (`param: { foo: null }`): `any`
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
125
|
+
type?: string | ParamType;
|
|
126
|
+
/**
|
|
127
|
+
* The parameter's `array` mode
|
|
128
|
+
*
|
|
129
|
+
* Explicitly specifies the array mode of a URL parameter
|
|
130
|
+
*
|
|
131
|
+
* - If `false`, the parameter value will be treated (encoded/decoded) as a single value
|
|
132
|
+
* - If `true`, the parameter value will be treated (encoded/decoded) as an array of values.
|
|
133
|
+
* - If `auto` (for query parameters only), if multiple values for a single parameter are present
|
|
134
|
+
* in the URL (e.g.: /foo?bar=1&bar=2&bar=3) then the values are mapped to an array (e.g.:
|
|
135
|
+
* `{ foo: [ '1', '2', '3' ] }`). However, if only one value is present (e.g.: /foo?bar=1)
|
|
136
|
+
* then the value is treated as single value (e.g.: { foo: '1' }).
|
|
137
|
+
*
|
|
138
|
+
* If you specified a [[type]] for the parameter, the value will be treated as an array
|
|
139
|
+
* of the specified [[ParamType]].
|
|
140
|
+
*
|
|
141
|
+
* #### Example:
|
|
142
|
+
* ```js
|
|
143
|
+
* {
|
|
144
|
+
* name: 'foo',
|
|
145
|
+
* url: '/foo/{arrayParam:int}`,
|
|
146
|
+
* params: {
|
|
147
|
+
* arrayParam: { array: true }
|
|
148
|
+
* }
|
|
149
|
+
* }
|
|
150
|
+
*
|
|
151
|
+
* // After the transition, URL should be '/foo/1-2-3'
|
|
152
|
+
* $state.go("foo", { arrayParam: [ 1, 2, 3 ] });
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @default `false` for path parameters, such as `url: '/foo/:pathParam'`
|
|
156
|
+
* @default `auto` for query parameters, such as `url: '/foo?queryParam'`
|
|
157
|
+
* @default `true` if the parameter name ends in `[]`, such as `url: '/foo/{implicitArrayParam:int[]}'`
|
|
158
|
+
*/
|
|
159
|
+
array?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Squash mode: omit default parameter values in URL
|
|
162
|
+
*
|
|
163
|
+
* Configures how a default parameter value is represented in the URL when the current parameter value
|
|
164
|
+
* is the same as the default value.
|
|
165
|
+
*
|
|
166
|
+
* There are three squash settings:
|
|
167
|
+
*
|
|
168
|
+
* - `false`: The parameter's default value is not squashed. It is encoded and included in the URL
|
|
169
|
+
* - `true`: The parameter's default value is omitted from the URL.
|
|
170
|
+
* If the parameter is preceeded and followed by slashes in the state's url declaration, then one of those slashes are omitted.
|
|
171
|
+
* This can allow for cleaner looking URLs.
|
|
172
|
+
* - `"<arbitrary string>"`: The parameter's default value is replaced with an arbitrary
|
|
173
|
+
* placeholder of your choice.
|
|
174
|
+
*
|
|
175
|
+
* #### Example:
|
|
176
|
+
* ```js
|
|
177
|
+
* {
|
|
178
|
+
* name: 'mystate',
|
|
179
|
+
* url: '/mystate/:myparam',
|
|
180
|
+
* params: {
|
|
181
|
+
* myparam: 'defaultParamValue'
|
|
182
|
+
* squash: true
|
|
183
|
+
* }
|
|
184
|
+
* }
|
|
185
|
+
*
|
|
186
|
+
* // URL will be `/mystate/`
|
|
187
|
+
* $state.go('mystate', { myparam: 'defaultParamValue' });
|
|
188
|
+
*
|
|
189
|
+
* // URL will be `/mystate/someOtherValue`
|
|
190
|
+
* $state.go('mystate', { myparam: 'someOtherValue' });
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* #### Example:
|
|
194
|
+
* ```js
|
|
195
|
+
* {
|
|
196
|
+
* name: 'mystate2',
|
|
197
|
+
* url: '/mystate2/:myparam2',
|
|
198
|
+
* params: {
|
|
199
|
+
* myparam2: 'defaultParamValue'
|
|
200
|
+
* squash: "~"
|
|
201
|
+
* }
|
|
202
|
+
* }
|
|
203
|
+
*
|
|
204
|
+
* // URL will be `/mystate/~`
|
|
205
|
+
* $state.go('mystate', { myparam2: 'defaultParamValue' });
|
|
206
|
+
*
|
|
207
|
+
* // URL will be `/mystate/someOtherValue`
|
|
208
|
+
* $state.go('mystate', { myparam2: 'someOtherValue' });
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* Default: If squash is not set, it uses the configured default squash policy. (See [[defaultSquashPolicy]]())
|
|
212
|
+
*/
|
|
213
|
+
squash?: boolean | string;
|
|
214
|
+
/**
|
|
215
|
+
* @internal
|
|
216
|
+
*
|
|
217
|
+
* An array of [[Replace]] objects.
|
|
218
|
+
*
|
|
219
|
+
* When creating a Transition, defines how to handle certain special values, such as `undefined`, `null`,
|
|
220
|
+
* or empty string `""`. If the transition is started, and the parameter value is equal to one of the "to"
|
|
221
|
+
* values, then the parameter value is replaced with the "from" value.
|
|
222
|
+
*
|
|
223
|
+
* #### Example:
|
|
224
|
+
* ```js
|
|
225
|
+
* replace: [
|
|
226
|
+
* { from: undefined, to: null },
|
|
227
|
+
* { from: "", to: null }
|
|
228
|
+
* ]
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
replace?: Replace[];
|
|
232
|
+
/**
|
|
233
|
+
* @internal
|
|
234
|
+
* @internal
|
|
235
|
+
*
|
|
236
|
+
* This is not part of the declaration; it is a calculated value depending on if a default value was specified or not.
|
|
237
|
+
*/
|
|
238
|
+
isOptional?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Dynamic flag
|
|
241
|
+
*
|
|
242
|
+
* When `dynamic` is `true`, changes to the parameter value will not cause the state to be entered/exited.
|
|
243
|
+
* The resolves will not be re-fetched, nor will views be reloaded.
|
|
244
|
+
*
|
|
245
|
+
* Normally, if a parameter value changes, the state which declared that the parameter will be reloaded (entered/exited).
|
|
246
|
+
* When a parameter is `dynamic`, a transition still occurs, but it does not cause the state to exit/enter.
|
|
247
|
+
*
|
|
248
|
+
* This can be useful to build UI where the component updates itself when the param values change.
|
|
249
|
+
* A common scenario where this is useful is searching/paging/sorting.
|
|
250
|
+
*
|
|
251
|
+
* ---
|
|
252
|
+
*
|
|
253
|
+
* Note: this value overrides the `dynamic` value on a custom parameter type ([[ParamTypeDefinition.dynamic]]).
|
|
254
|
+
*
|
|
255
|
+
* ---
|
|
256
|
+
*
|
|
257
|
+
* Default: `false`
|
|
258
|
+
*/
|
|
259
|
+
dynamic?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Disables url-encoding of parameter values
|
|
262
|
+
*
|
|
263
|
+
* When `true`, parameter values are not url-encoded.
|
|
264
|
+
* This is commonly used to allow "slug" urls, with a parameter value including non-semantic slashes.
|
|
265
|
+
*
|
|
266
|
+
* #### Example:
|
|
267
|
+
* ```js
|
|
268
|
+
* url: '/product/:slug',
|
|
269
|
+
* params: {
|
|
270
|
+
* slug: { type: 'string', raw: true }
|
|
271
|
+
* }
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* This allows a URL parameter of `{ slug: 'camping/tents/awesome_tent' }`
|
|
275
|
+
* to serialize to `/product/camping/tents/awesome_tent`
|
|
276
|
+
* instead of `/product/camping%2Ftents%2Fawesome_tent`.
|
|
277
|
+
*
|
|
278
|
+
* ---
|
|
279
|
+
*
|
|
280
|
+
* Note: this value overrides the `raw` value on a custom parameter type ([[ParamTypeDefinition.raw]]).
|
|
281
|
+
*
|
|
282
|
+
* ### Decoding warning
|
|
283
|
+
*
|
|
284
|
+
* The decoding behavior of raw parameters is not defined.
|
|
285
|
+
* For example, given a url template such as `/:raw1/:raw2`
|
|
286
|
+
* the url `/foo/bar/baz/qux/`, there is no way to determine which slashes belong to which params.
|
|
287
|
+
*
|
|
288
|
+
* It's generally safe to use a raw parameter at the end of a path, like '/product/:slug'.
|
|
289
|
+
* However, beware of the characters you allow in your raw parameter values.
|
|
290
|
+
* Avoid unencoded characters that could disrupt normal URL parsing, such as `?` and `#`.
|
|
291
|
+
*
|
|
292
|
+
* ---
|
|
293
|
+
*
|
|
294
|
+
* Default: `false`
|
|
295
|
+
*/
|
|
296
|
+
raw?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Enables/disables inheriting of this parameter's value
|
|
299
|
+
*
|
|
300
|
+
* When a transition is run with [[TransitionOptions.inherit]] set to
|
|
301
|
+
* `true`, the current param values are inherited in the new transition.
|
|
302
|
+
* However, parameters values which have `inherit: false` set will *not be inherited*.
|
|
303
|
+
*
|
|
304
|
+
* #### Example state :
|
|
305
|
+
* ```js
|
|
306
|
+
* var fooState = {
|
|
307
|
+
* name: 'foo',
|
|
308
|
+
* url: '/:fooId?mode&refresh',
|
|
309
|
+
* params: {
|
|
310
|
+
* refresh: { inherit: false }
|
|
311
|
+
* }
|
|
312
|
+
* }
|
|
313
|
+
*
|
|
314
|
+
* // Set fooId to 123
|
|
315
|
+
* $state.go('fooState', { fooId: 1234, mode: 'list', refresh: true });
|
|
316
|
+
* ```
|
|
317
|
+
*
|
|
318
|
+
* In the component:
|
|
319
|
+
* `mode: 'list' is inherited, but refresh: true is not inherited.
|
|
320
|
+
* // The param values are thus: `{ fooId: 4567, mode: 'list' }`
|
|
321
|
+
* ```
|
|
322
|
+
* <ui-sref="foo({ fooId: 4567 })">4567</ui-sref>
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* ---
|
|
326
|
+
*
|
|
327
|
+
* See also [[TransitionOptions.inherit]] and [[ParamTypeDefinition.inherit]]
|
|
328
|
+
*
|
|
329
|
+
* ---
|
|
330
|
+
*
|
|
331
|
+
* Default: `true`
|
|
332
|
+
*/
|
|
333
|
+
inherit?: boolean;
|
|
334
334
|
}
|
|
335
335
|
/**
|
|
336
336
|
* String replacement
|
|
@@ -340,20 +340,20 @@ export interface ParamDeclaration {
|
|
|
340
340
|
* Note: `to` or `from` may be null or undefined, and will be tested using `===`.
|
|
341
341
|
*/
|
|
342
342
|
export interface Replace {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
343
|
+
/**
|
|
344
|
+
* The value to replace.
|
|
345
|
+
*
|
|
346
|
+
* May be `null` or `undefined`.
|
|
347
|
+
* The entire value must match using `===`.
|
|
348
|
+
* When found, the [[to]] value is used instead.
|
|
349
|
+
*/
|
|
350
|
+
from: string;
|
|
351
|
+
/**
|
|
352
|
+
* The new value
|
|
353
|
+
*
|
|
354
|
+
* Used instead of the [[from]] value.
|
|
355
|
+
*/
|
|
356
|
+
to: string;
|
|
357
357
|
}
|
|
358
358
|
/**
|
|
359
359
|
* Describes a custom [[ParamType]]
|
|
@@ -464,143 +464,143 @@ export interface Replace {
|
|
|
464
464
|
* See: [[UrlConfig.type]]
|
|
465
465
|
*/
|
|
466
466
|
export interface ParamTypeDefinition {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
467
|
+
/**
|
|
468
|
+
* A regular expression that matches the encoded parameter type
|
|
469
|
+
*
|
|
470
|
+
* This regular expression is used to match an encoded parameter value **in the URL**.
|
|
471
|
+
*
|
|
472
|
+
* For example, if your type encodes as a dash-separated numbers, match that here:
|
|
473
|
+
* `new RegExp("[0-9]+(?:-[0-9]+)*")`.
|
|
474
|
+
*
|
|
475
|
+
* There are some limitations to these regexps:
|
|
476
|
+
*
|
|
477
|
+
* - No capturing groups are allowed (use non-capturing groups: `(?: )`)
|
|
478
|
+
* - No pattern modifiers like case insensitive
|
|
479
|
+
* - No start-of-string or end-of-string: `/^foo$/`
|
|
480
|
+
*/
|
|
481
|
+
pattern?: RegExp;
|
|
482
|
+
/**
|
|
483
|
+
* Disables url-encoding of parameter values
|
|
484
|
+
*
|
|
485
|
+
* If a parameter type is declared `raw`, it will not be url-encoded.
|
|
486
|
+
* Custom encoding can still be applied in the [[encode]] function.
|
|
487
|
+
*
|
|
488
|
+
* ### Decoding warning
|
|
489
|
+
*
|
|
490
|
+
* The decoding behavior of raw parameters is not defined.
|
|
491
|
+
* See: [[ParamDeclaration.raw]] for details
|
|
492
|
+
*/
|
|
493
|
+
raw?: boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Enables/disables inheriting of parameter values (of this type)
|
|
496
|
+
*
|
|
497
|
+
* When a transition is run with [[TransitionOptions.inherit]] set to
|
|
498
|
+
* `true`, the current param values are inherited in the new transition.
|
|
499
|
+
* However, parameters whose type has `inherit: false` set will *not be inherited*.
|
|
500
|
+
*
|
|
501
|
+
* The internal parameter type of `hash` has `inherit: false`.
|
|
502
|
+
* This is used to disable inheriting of the hash value (`#`) on subsequent transitions.
|
|
503
|
+
*
|
|
504
|
+
* #### Example:
|
|
505
|
+
* ```js
|
|
506
|
+
* $state.go('home', { '#': 'inboxAnchor' });
|
|
507
|
+
* ...
|
|
508
|
+
* // "#" is not inherited.
|
|
509
|
+
* // The value of the "#" parameter will be `null`
|
|
510
|
+
* // The url's hash will be cleared.
|
|
511
|
+
* $state.go('home.nest');
|
|
512
|
+
* ```
|
|
513
|
+
*
|
|
514
|
+
* ---
|
|
515
|
+
*
|
|
516
|
+
* See also [[TransitionOptions.inherit]] and [[ParamDeclaration.inherit]]
|
|
517
|
+
*
|
|
518
|
+
*/
|
|
519
|
+
inherit?: boolean;
|
|
520
|
+
/**
|
|
521
|
+
* Dynamic flag
|
|
522
|
+
*
|
|
523
|
+
* When `dynamic` is `true`, changes to the parameter value will not cause the state to be entered/exited.
|
|
524
|
+
*
|
|
525
|
+
* Normally, if a parameter value changes, the state which declared that the parameter will be reloaded (entered/exited).
|
|
526
|
+
* When a parameter is `dynamic`, a transition still occurs, but it does not cause the state to exit/enter.
|
|
527
|
+
*
|
|
528
|
+
* Default: `false`
|
|
529
|
+
*/
|
|
530
|
+
dynamic?: boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Tests if some object type is compatible with this parameter type
|
|
533
|
+
*
|
|
534
|
+
* Detects whether some value is of this particular type.
|
|
535
|
+
* Accepts a decoded value and determines whether it matches this `ParamType` object.
|
|
536
|
+
*
|
|
537
|
+
* If your custom type encodes the parameter to a specific type, check for that type here.
|
|
538
|
+
* For example, if your custom type decodes the URL parameter value as an array of ints, return true if the
|
|
539
|
+
* input is an array of ints:
|
|
540
|
+
*
|
|
541
|
+
* ```
|
|
542
|
+
* is: (val) => Array.isArray(val) && array.reduce((acc, x) => acc && parseInt(val, 10) === val, true)
|
|
543
|
+
* ```
|
|
544
|
+
*
|
|
545
|
+
* If your type decodes the URL parameter value to a custom string, check that the string matches
|
|
546
|
+
* the pattern (don't use an arrow fn if you need `this`): `function (val) { return !!this.pattern.exec(val) }`
|
|
547
|
+
*
|
|
548
|
+
* Note: This method is _not used to check if the URL matches_.
|
|
549
|
+
* It's used to check if a _decoded value *is* this type_.
|
|
550
|
+
* Use [[pattern]] to check the encoded value in the URL.
|
|
551
|
+
*
|
|
552
|
+
* @param val The value to check.
|
|
553
|
+
* @param key If the type check is happening in the context of a specific [[UrlMatcher]] object,
|
|
554
|
+
* this is the name of the parameter in which `val` is stored. Can be used for
|
|
555
|
+
* meta-programming of `ParamType` objects.
|
|
556
|
+
* @returns `true` if the value matches the type, otherwise `false`.
|
|
557
|
+
*/
|
|
558
|
+
is(val: any, key?: string): boolean;
|
|
559
|
+
/**
|
|
560
|
+
* Encodes a custom/native type value to a string that can be embedded in a URL.
|
|
561
|
+
*
|
|
562
|
+
* Note that the return value does *not* need to be URL-safe (i.e. passed through `encodeURIComponent()`).
|
|
563
|
+
* It only needs to be a representation of `val` that has been encoded as a string.
|
|
564
|
+
*
|
|
565
|
+
* For example, if your custom type decodes to an array of ints, then encode the array of ints to a string here:
|
|
566
|
+
*
|
|
567
|
+
* ```js
|
|
568
|
+
* encode: (intarray) => intarray.join("-")
|
|
569
|
+
* ```
|
|
570
|
+
*
|
|
571
|
+
* Note: in general, [[encode]] and [[decode]] should be symmetrical. That is, `encode(decode(str)) === str`
|
|
572
|
+
*
|
|
573
|
+
* @param val The value to encode.
|
|
574
|
+
* @param key The name of the parameter in which `val` is stored. Can be used for meta-programming of `ParamType` objects.
|
|
575
|
+
* @returns a string representation of `val` that can be encoded in a URL.
|
|
576
|
+
*/
|
|
577
|
+
encode(val: any, key?: string): string | string[];
|
|
578
|
+
/**
|
|
579
|
+
* Decodes a parameter value string (from URL string or transition param) to a custom/native value.
|
|
580
|
+
*
|
|
581
|
+
* For example, if your type decodes to an array of ints, then decode the string as an array of ints here:
|
|
582
|
+
* ```js
|
|
583
|
+
* decode: (str) => str.split("-").map(str => parseInt(str, 10))
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
* Note: in general, [[encode]] and [[decode]] should be symmetrical. That is, `encode(decode(str)) === str`
|
|
587
|
+
*
|
|
588
|
+
* @param val The URL parameter value to decode.
|
|
589
|
+
* @param key The name of the parameter in which `val` is stored. Can be used for meta-programming of `ParamType` objects.
|
|
590
|
+
* @returns a custom representation of the URL parameter value.
|
|
591
|
+
*/
|
|
592
|
+
decode(val: string, key?: string): any;
|
|
593
|
+
/**
|
|
594
|
+
* Determines whether two decoded values are equivalent.
|
|
595
|
+
*
|
|
596
|
+
* For example, if your type decodes to an array of ints, then check if the arrays are equal:
|
|
597
|
+
* ```js
|
|
598
|
+
* equals: (a, b) => a.length === b.length && a.reduce((acc, x, idx) => acc && x === b[idx], true)
|
|
599
|
+
* ```
|
|
600
|
+
*
|
|
601
|
+
* @param a A value to compare against.
|
|
602
|
+
* @param b A value to compare against.
|
|
603
|
+
* @returns `true` if the values are equivalent/equal, otherwise `false`.
|
|
604
|
+
*/
|
|
605
|
+
equals(a: any, b: any): boolean;
|
|
606
606
|
}
|