@angular-wave/angular.ts 0.9.1 → 0.9.3
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/@types/angular.d.ts +150 -0
- package/@types/animations/animate-cache.d.ts +50 -0
- package/@types/animations/animate-children-directive.d.ts +10 -0
- package/@types/animations/animate-css-driver.d.ts +18 -0
- package/@types/animations/animate-css.d.ts +18 -0
- package/@types/animations/animate-js-driver.d.ts +14 -0
- package/@types/animations/animate-js.d.ts +23 -0
- package/@types/animations/animate-queue.d.ts +28 -0
- package/@types/animations/animate-runner.d.ts +31 -0
- package/@types/animations/animate-swap.d.ts +9 -0
- package/@types/animations/animate.d.ts +450 -0
- package/@types/animations/animation.d.ts +14 -0
- package/@types/animations/interface.d.ts +17 -0
- package/@types/animations/raf-scheduler.d.ts +37 -0
- package/@types/animations/shared.d.ts +74 -0
- package/@types/core/compile/compile.d.ts +201 -0
- package/@types/core/controller/controller.d.ts +54 -0
- package/@types/core/di/injector.d.ts +22 -0
- package/@types/core/filter/filter.d.ts +23 -0
- package/@types/core/interpolate/interpolate.d.ts +38 -0
- package/@types/core/parse/ast/ast-node.d.ts +56 -0
- package/@types/core/parse/ast/ast.d.ts +164 -0
- package/@types/core/parse/lexer/lexer.d.ts +119 -0
- package/@types/core/parse/lexer/token.d.ts +17 -0
- package/@types/core/parse/parse.d.ts +33 -0
- package/@types/core/parse/parser/parser.d.ts +41 -0
- package/@types/core/sanitize/sanitize-uri.d.ts +40 -0
- package/@types/directive/aria/aria.d.ts +104 -0
- package/@types/directive/attrs/attrs.d.ts +8 -0
- package/@types/directive/bind/bind.d.ts +18 -0
- package/@types/directive/channel/channel.d.ts +10 -0
- package/@types/directive/class/class.d.ts +3 -0
- package/@types/directive/cloak/cloak.d.ts +4 -0
- package/@types/directive/controller/controller.d.ts +4 -0
- package/@types/directive/events/events.d.ts +21 -0
- package/@types/directive/form/form.d.ts +264 -0
- package/@types/directive/http/http.d.ts +46 -0
- package/@types/directive/if/if.d.ts +10 -0
- package/@types/directive/include/include.d.ts +28 -0
- package/@types/directive/init/init.d.ts +4 -0
- package/@types/directive/input/input.d.ts +70 -0
- package/@types/directive/messages/messages.d.ts +63 -0
- package/@types/directive/model/model.d.ts +515 -0
- package/@types/directive/model-options/model-options.d.ts +56 -0
- package/@types/directive/non-bindable/non-bindable.d.ts +4 -0
- package/@types/directive/observe/observe.d.ts +9 -0
- package/@types/directive/options/options.d.ts +13 -0
- package/@types/directive/ref/ref.d.ts +11 -0
- package/@types/directive/repeat/repeat.d.ts +11 -0
- package/@types/directive/script/script.d.ts +10 -0
- package/@types/directive/select/select.d.ts +15 -0
- package/@types/directive/setter/setter.d.ts +12 -0
- package/@types/directive/show-hide/show-hide.d.ts +19 -0
- package/@types/directive/style/style.d.ts +4 -0
- package/@types/directive/switch/switch.d.ts +18 -0
- package/@types/directive/transclude/transclude.d.ts +10 -0
- package/@types/directive/validators/validators.d.ts +149 -0
- package/@types/filters/filter.d.ts +4 -0
- package/@types/filters/filters.d.ts +38 -0
- package/@types/filters/limit-to.d.ts +4 -0
- package/@types/filters/order-by.d.ts +7 -0
- package/@types/index.d.ts +2 -0
- package/@types/interface.d.ts +5 -4
- package/@types/ng.d.ts +8 -0
- package/@types/router/common/trace.d.ts +66 -0
- package/@types/router/directives/state-directives.d.ts +46 -0
- package/@types/router/directives/view-directive.d.ts +138 -0
- package/@types/router/glob/glob.d.ts +81 -0
- package/@types/router/hooks/core-resolvables.d.ts +2 -0
- package/@types/router/hooks/ignored-transition.d.ts +1 -0
- package/@types/router/hooks/invalid-transition.d.ts +1 -0
- package/@types/router/hooks/lazy-load.d.ts +42 -0
- package/@types/router/hooks/on-enter-exit-retain.d.ts +3 -0
- package/@types/router/hooks/redirect-to.d.ts +4 -0
- package/@types/router/hooks/resolve.d.ts +4 -0
- package/@types/router/hooks/update-globals.d.ts +1 -0
- package/@types/router/hooks/url.d.ts +5 -0
- package/@types/router/hooks/views.d.ts +5 -0
- package/@types/router/params/interface.d.ts +606 -0
- package/@types/router/params/param-factory.d.ts +16 -0
- package/@types/router/params/param-type.d.ts +59 -0
- package/@types/router/params/param.d.ts +71 -0
- package/@types/router/params/state-params.d.ts +12 -0
- package/@types/router/path/path-node.d.ts +38 -0
- package/@types/router/path/path-utils.d.ts +88 -0
- package/@types/router/resolve/interface.d.ts +200 -0
- package/@types/router/resolve/resolvable.d.ts +50 -0
- package/@types/router/resolve/resolve-context.d.ts +93 -0
- package/@types/router/router.d.ts +47 -0
- package/@types/router/state/interface.d.ts +983 -0
- package/@types/router/state/state-builder.d.ts +95 -0
- package/@types/router/state/state-matcher.d.ts +7 -0
- package/@types/router/state/state-object.d.ts +83 -0
- package/@types/router/state/state-queue-manager.d.ts +29 -0
- package/@types/router/state/state-registry.d.ts +133 -0
- package/@types/router/state/state-service.d.ts +425 -0
- package/@types/router/state/target-state.d.ts +102 -0
- package/@types/router/state/views.d.ts +58 -0
- package/@types/router/state-filters.d.ts +39 -0
- package/@types/router/template-factory.d.ts +117 -0
- package/@types/router/transition/hook-builder.d.ts +45 -0
- package/@types/router/transition/hook-registry.d.ts +102 -0
- package/@types/router/transition/interface.d.ts +880 -0
- package/@types/router/transition/reject-factory.d.ts +43 -0
- package/@types/router/transition/transition-event-type.d.ts +24 -0
- package/@types/router/transition/transition-hook.d.ts +86 -0
- package/@types/router/transition/transition-service.d.ts +116 -0
- package/@types/router/transition/transition.d.ts +331 -0
- package/@types/router/url/url-config.d.ts +99 -0
- package/@types/router/url/url-matcher.d.ts +174 -0
- package/@types/router/url/url-rule.d.ts +161 -0
- package/@types/router/url/url-rules.d.ts +249 -0
- package/@types/router/url/url-service.d.ts +254 -0
- package/@types/router/view/interface.d.ts +44 -0
- package/@types/router/view/view.d.ts +149 -0
- package/@types/router/view-scroll.d.ts +10 -0
- package/@types/services/anchor-scroll.d.ts +25 -0
- package/@types/services/cookie-reader.d.ts +4 -0
- package/@types/services/http/http.d.ts +134 -0
- package/@types/services/http-backend/http-backend.d.ts +58 -0
- package/@types/services/sce/sce.d.ts +238 -0
- package/@types/services/template-request.d.ts +55 -0
- package/@types/shared/common.d.ts +197 -0
- package/@types/shared/hof.d.ts +108 -0
- package/@types/shared/predicates.d.ts +17 -0
- package/@types/shared/queue.d.ts +64 -0
- package/@types/shared/strings.d.ts +58 -0
- package/dist/angular-ts.esm.js +2 -3
- package/dist/angular-ts.umd.js +2 -3
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/layouts/shortcodes/version.html +1 -1
- package/package.json +1 -1
- package/src/interface.ts +5 -4
- package/src/services/pubsub/pubsub.js +0 -1
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides services related to ng-router states.
|
|
3
|
+
*
|
|
4
|
+
* This API is located at `router.stateService` ([[UIRouter.stateService]])
|
|
5
|
+
*/
|
|
6
|
+
export class StateProvider {
|
|
7
|
+
static $inject: string[];
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {import('../router.js').Router} globals
|
|
11
|
+
* @param {*} transitionService
|
|
12
|
+
* @param {import('../../core/di/internal-injector.js').InjectorService} $injector
|
|
13
|
+
*/
|
|
14
|
+
constructor(
|
|
15
|
+
globals: import("../router.js").Router,
|
|
16
|
+
transitionService: any,
|
|
17
|
+
$injector: import("../../core/di/internal-injector.js").InjectorService,
|
|
18
|
+
);
|
|
19
|
+
/**
|
|
20
|
+
* The latest successful state parameters
|
|
21
|
+
*
|
|
22
|
+
* @deprecated This is a passthrough through to [[Router.params]]
|
|
23
|
+
*/
|
|
24
|
+
get params(): import("../params/state-params.js").StateParams;
|
|
25
|
+
/**
|
|
26
|
+
* The current [[StateDeclaration]]
|
|
27
|
+
*
|
|
28
|
+
* @deprecated This is a passthrough through to [[Router.current]]
|
|
29
|
+
*/
|
|
30
|
+
get current(): import("./interface.js").StateDeclaration;
|
|
31
|
+
/**
|
|
32
|
+
* The current [[StateObject]] (an internal API)
|
|
33
|
+
*
|
|
34
|
+
* @deprecated This is a passthrough through to [[Router.$current]]
|
|
35
|
+
*/
|
|
36
|
+
get $current(): import("./state-object.js").StateObject;
|
|
37
|
+
stateRegistry: any;
|
|
38
|
+
urlService: any;
|
|
39
|
+
globals: import("../router.js").Router;
|
|
40
|
+
transitionService: any;
|
|
41
|
+
$injector: import("../../core/di/internal-injector.js").InjectorService;
|
|
42
|
+
invalidCallbacks: any[];
|
|
43
|
+
_defaultErrorHandler: ($error$: any) => never;
|
|
44
|
+
$get: () => this;
|
|
45
|
+
/**
|
|
46
|
+
* Decorates states when they are registered
|
|
47
|
+
*
|
|
48
|
+
* Allows you to extend (carefully) or override (at your own peril) the
|
|
49
|
+
* `stateBuilder` object used internally by [[StateRegistry]].
|
|
50
|
+
* This can be used to add custom functionality to ng-router,
|
|
51
|
+
* for example inferring templateUrl based on the state name.
|
|
52
|
+
*
|
|
53
|
+
* When passing only a name, it returns the current (original or decorated) builder
|
|
54
|
+
* function that matches `name`.
|
|
55
|
+
*
|
|
56
|
+
* The builder functions that can be decorated are listed below. Though not all
|
|
57
|
+
* necessarily have a good use case for decoration, that is up to you to decide.
|
|
58
|
+
*
|
|
59
|
+
* In addition, users can attach custom decorators, which will generate new
|
|
60
|
+
* properties within the state's internal definition. There is currently no clear
|
|
61
|
+
* use-case for this beyond accessing internal states (i.e. $state.$current),
|
|
62
|
+
* however, expect this to become increasingly relevant as we introduce additional
|
|
63
|
+
* meta-programming features.
|
|
64
|
+
*
|
|
65
|
+
* **Warning**: Decorators should not be interdependent because the order of
|
|
66
|
+
* execution of the builder functions in non-deterministic. Builder functions
|
|
67
|
+
* should only be dependent on the state definition object and super function.
|
|
68
|
+
*
|
|
69
|
+
*
|
|
70
|
+
* Existing builder functions and current return values:
|
|
71
|
+
*
|
|
72
|
+
* - **parent** `{object}` - returns the parent state object.
|
|
73
|
+
* - **data** `{object}` - returns state data, including any inherited data that is not
|
|
74
|
+
* overridden by own values (if any).
|
|
75
|
+
* - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}
|
|
76
|
+
* or `null`.
|
|
77
|
+
* - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is
|
|
78
|
+
* navigable).
|
|
79
|
+
* - **params** `{object}` - returns an array of state params that are ensured to
|
|
80
|
+
* be a super-set of parent's params.
|
|
81
|
+
* - **views** `{object}` - returns a views object where each key is an absolute view
|
|
82
|
+
* name (i.e. "viewName@stateName") and each value is the urlConfig object
|
|
83
|
+
* (template, controller) for the view. Even when you don't use the views object
|
|
84
|
+
* explicitly on a state urlConfig, one is still created for you internally.
|
|
85
|
+
* So by decorating this builder function you have access to decorating template
|
|
86
|
+
* and controller properties.
|
|
87
|
+
* - **ownParams** `{object}` - returns an array of params that belong to the state,
|
|
88
|
+
* not including any params defined by ancestor states.
|
|
89
|
+
* - **path** `{string}` - returns the full path from the root down to this state.
|
|
90
|
+
* Needed for state activation.
|
|
91
|
+
* - **includes** `{object}` - returns an object that includes every state that
|
|
92
|
+
* would pass a `$state.includes()` test.
|
|
93
|
+
*
|
|
94
|
+
* #### Example:
|
|
95
|
+
* Override the internal 'views' builder with a function that takes the state
|
|
96
|
+
* definition, and a reference to the internal function being overridden:
|
|
97
|
+
* ```js
|
|
98
|
+
* $stateProvider.decorator('views', function (state, parent) {
|
|
99
|
+
* let result = {},
|
|
100
|
+
* views = parent(state);
|
|
101
|
+
*
|
|
102
|
+
* angular.forEach(views, function (urlConfig, name) {
|
|
103
|
+
* let autoName = (state.name + '.' + name).replace('.', '/');
|
|
104
|
+
* urlConfig.templateUrl = urlConfig.templateUrl || '/partials/' + autoName + '.html';
|
|
105
|
+
* result[name] = urlConfig;
|
|
106
|
+
* });
|
|
107
|
+
* return result;
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* $stateProvider.state('home', {
|
|
111
|
+
* views: {
|
|
112
|
+
* 'contact.list': { controller: 'ListController' },
|
|
113
|
+
* 'contact.item': { controller: 'ItemController' }
|
|
114
|
+
* }
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
*
|
|
119
|
+
* ```js
|
|
120
|
+
* // Auto-populates list and item views with /partials/home/contact/list.html,
|
|
121
|
+
* // and /partials/home/contact/item.html, respectively.
|
|
122
|
+
* $state.go('home');
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @param {string} name The name of the builder function to decorate.
|
|
126
|
+
* @param {object} func A function that is responsible for decorating the original
|
|
127
|
+
* builder function. The function receives two parameters:
|
|
128
|
+
*
|
|
129
|
+
* - `{object}` - state - The state urlConfig object.
|
|
130
|
+
* - `{object}` - super - The original builder function.
|
|
131
|
+
*
|
|
132
|
+
* @return {object} $stateProvider - $stateProvider instance
|
|
133
|
+
*/
|
|
134
|
+
decorator(name: string, func: object): object;
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* @param {import("./interface.js").StateDeclaration} definition
|
|
138
|
+
*/
|
|
139
|
+
state(definition: import("./interface.js").StateDeclaration): this;
|
|
140
|
+
/**
|
|
141
|
+
* Handler for when [[transitionTo]] is called with an invalid state.
|
|
142
|
+
*
|
|
143
|
+
* Invokes the [[onInvalid]] callbacks, in natural order.
|
|
144
|
+
* Each callback's return value is checked in sequence until one of them returns an instance of TargetState.
|
|
145
|
+
* The results of the callbacks are wrapped in Promise.resolve(), so the callbacks may return promises.
|
|
146
|
+
*
|
|
147
|
+
* If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.
|
|
148
|
+
*
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
_handleInvalidTargetState(fromPath: any, toState: any): any;
|
|
152
|
+
/**
|
|
153
|
+
* Registers an Invalid State handler
|
|
154
|
+
*
|
|
155
|
+
* Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]
|
|
156
|
+
* has been called with an invalid state reference parameter
|
|
157
|
+
*
|
|
158
|
+
* Example:
|
|
159
|
+
* ```js
|
|
160
|
+
* stateService.onInvalid(function(to, from, injector) {
|
|
161
|
+
* if (to.name() === 'foo') {
|
|
162
|
+
* let lazyLoader = injector.get('LazyLoadService');
|
|
163
|
+
* return lazyLoader.load('foo')
|
|
164
|
+
* .then(() => stateService.target('foo'));
|
|
165
|
+
* }
|
|
166
|
+
* });
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @param {function} callback invoked when the toState is invalid
|
|
170
|
+
* This function receives the (invalid) toState, the fromState, and an injector.
|
|
171
|
+
* The function may optionally return a [[TargetState]] or a Promise for a TargetState.
|
|
172
|
+
* If one is returned, it is treated as a redirect.
|
|
173
|
+
*
|
|
174
|
+
* @returns a function which deregisters the callback
|
|
175
|
+
*/
|
|
176
|
+
onInvalid(callback: Function): any;
|
|
177
|
+
/**
|
|
178
|
+
* Reloads the current state
|
|
179
|
+
*
|
|
180
|
+
* A method that force reloads the current state, or a partial state hierarchy.
|
|
181
|
+
* All resolves are re-resolved, and components reinstantiated.
|
|
182
|
+
*
|
|
183
|
+
* #### Example:
|
|
184
|
+
* ```js
|
|
185
|
+
* let app angular.module('app', ['ui.router']);
|
|
186
|
+
*
|
|
187
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
188
|
+
* $scope.reload = function(){
|
|
189
|
+
* $state.reload();
|
|
190
|
+
* }
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* Note: `reload()` is just an alias for:
|
|
195
|
+
*
|
|
196
|
+
* ```js
|
|
197
|
+
* $state.transitionTo($state.current, $state.params, {
|
|
198
|
+
* reload: true, inherit: false
|
|
199
|
+
* });
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @param reloadState A state name or a state object.
|
|
203
|
+
* If present, this state and all its children will be reloaded, but ancestors will not reload.
|
|
204
|
+
*
|
|
205
|
+
* #### Example:
|
|
206
|
+
* ```js
|
|
207
|
+
* //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'
|
|
208
|
+
* //and current state is 'contacts.detail.item'
|
|
209
|
+
* let app angular.module('app', ['ui.router']);
|
|
210
|
+
*
|
|
211
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
212
|
+
* $scope.reload = function(){
|
|
213
|
+
* //will reload 'contact.detail' and nested 'contact.detail.item' states
|
|
214
|
+
* $state.reload('contact.detail');
|
|
215
|
+
* }
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* @returns A promise representing the state of the new transition. See [[StateService.go]]
|
|
220
|
+
*/
|
|
221
|
+
reload(reloadState: any): any;
|
|
222
|
+
/**
|
|
223
|
+
* Transition to a different state and/or parameters
|
|
224
|
+
*
|
|
225
|
+
* Convenience method for transitioning to a new state.
|
|
226
|
+
*
|
|
227
|
+
* `$state.go` calls `$state.transitionTo` internally but automatically sets options to
|
|
228
|
+
* `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.
|
|
229
|
+
* This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).
|
|
230
|
+
* It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters
|
|
231
|
+
* inherit from the current parameter values (because of `inherit: true`).
|
|
232
|
+
*
|
|
233
|
+
* #### Example:
|
|
234
|
+
* ```js
|
|
235
|
+
* let app = angular.module('app', ['ui.router']);
|
|
236
|
+
*
|
|
237
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
238
|
+
* $scope.changeState = function () {
|
|
239
|
+
* $state.go('contact.detail');
|
|
240
|
+
* };
|
|
241
|
+
* });
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* @param to Absolute state name, state object, or relative state path (relative to current state).
|
|
245
|
+
*
|
|
246
|
+
* Some examples:
|
|
247
|
+
*
|
|
248
|
+
* - `$state.go('contact.detail')` - will go to the `contact.detail` state
|
|
249
|
+
* - `$state.go('^')` - will go to the parent state
|
|
250
|
+
* - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state
|
|
251
|
+
* - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state
|
|
252
|
+
*
|
|
253
|
+
* @param params A map of the parameters that will be sent to the state, will populate $stateParams.
|
|
254
|
+
*
|
|
255
|
+
* Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).
|
|
256
|
+
* This allows, for example, going to a sibling state that shares parameters defined by a parent state.
|
|
257
|
+
*
|
|
258
|
+
* @param options Transition options
|
|
259
|
+
*
|
|
260
|
+
* @returns {promise} A promise representing the state of the new transition.
|
|
261
|
+
*/
|
|
262
|
+
go(to: any, params: any, options: any): Promise<any>;
|
|
263
|
+
/**
|
|
264
|
+
* Creates a [[TargetState]]
|
|
265
|
+
*
|
|
266
|
+
* This is a factory method for creating a TargetState
|
|
267
|
+
*
|
|
268
|
+
* This may be returned from a Transition Hook to redirect a transition, for example.
|
|
269
|
+
*/
|
|
270
|
+
target(identifier: any, params: any, options?: {}): TargetState;
|
|
271
|
+
getCurrentPath(): PathNode[];
|
|
272
|
+
/**
|
|
273
|
+
* Low-level method for transitioning to a new state.
|
|
274
|
+
*
|
|
275
|
+
* The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.
|
|
276
|
+
*
|
|
277
|
+
* #### Example:
|
|
278
|
+
* ```js
|
|
279
|
+
* let app = angular.module('app', ['ui.router']);
|
|
280
|
+
*
|
|
281
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
282
|
+
* $scope.changeState = function () {
|
|
283
|
+
* $state.transitionTo('contact.detail');
|
|
284
|
+
* };
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* @param to State name or state object.
|
|
289
|
+
* @param toParams A map of the parameters that will be sent to the state,
|
|
290
|
+
* will populate $stateParams.
|
|
291
|
+
* @param options Transition options
|
|
292
|
+
*
|
|
293
|
+
* @returns A promise representing the state of the new transition. See [[go]]
|
|
294
|
+
*/
|
|
295
|
+
transitionTo(to: any, toParams?: {}, options?: {}): any;
|
|
296
|
+
/**
|
|
297
|
+
* Checks if the current state *is* the provided state
|
|
298
|
+
*
|
|
299
|
+
* Similar to [[includes]] but only checks for the full state name.
|
|
300
|
+
* If params is supplied then it will be tested for strict equality against the current
|
|
301
|
+
* active params object, so all params must match with none missing and no extras.
|
|
302
|
+
*
|
|
303
|
+
* #### Example:
|
|
304
|
+
* ```js
|
|
305
|
+
* $state.$current.name = 'contacts.details.item';
|
|
306
|
+
*
|
|
307
|
+
* // absolute name
|
|
308
|
+
* $state.is('contact.details.item'); // returns true
|
|
309
|
+
* $state.is(contactDetailItemStateObject); // returns true
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* // relative name (. and ^), typically from a template
|
|
313
|
+
* // E.g. from the 'contacts.details' template
|
|
314
|
+
* ```html
|
|
315
|
+
* <div ng-class="{highlighted: $state.is('.item')}">Item</div>
|
|
316
|
+
* ```
|
|
317
|
+
*
|
|
318
|
+
* @param stateOrName The state name (absolute or relative) or state object you'd like to check.
|
|
319
|
+
* @param params A param object, e.g. `{sectionId: section.id}`, that you'd like
|
|
320
|
+
* to test against the current active state.
|
|
321
|
+
* @param options An options object. The options are:
|
|
322
|
+
* - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will
|
|
323
|
+
* test relative to `options.relative` state (or name).
|
|
324
|
+
*
|
|
325
|
+
* @returns Returns true if it is the state.
|
|
326
|
+
*/
|
|
327
|
+
is(stateOrName: any, params: any, options: any): boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Checks if the current state *includes* the provided state
|
|
330
|
+
*
|
|
331
|
+
* A method to determine if the current active state is equal to or is the child of the
|
|
332
|
+
* state stateName. If any params are passed then they will be tested for a match as well.
|
|
333
|
+
* Not all the parameters need to be passed, just the ones you'd like to test for equality.
|
|
334
|
+
*
|
|
335
|
+
* #### Example when `$state.$current.name === 'contacts.details.item'`
|
|
336
|
+
* ```js
|
|
337
|
+
* // Using partial names
|
|
338
|
+
* $state.includes("contacts"); // returns true
|
|
339
|
+
* $state.includes("contacts.details"); // returns true
|
|
340
|
+
* $state.includes("contacts.details.item"); // returns true
|
|
341
|
+
* $state.includes("contacts.list"); // returns false
|
|
342
|
+
* $state.includes("about"); // returns false
|
|
343
|
+
* ```
|
|
344
|
+
*
|
|
345
|
+
* #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:
|
|
346
|
+
* ```js
|
|
347
|
+
* $state.includes("*.details.*.*"); // returns true
|
|
348
|
+
* $state.includes("*.details.**"); // returns true
|
|
349
|
+
* $state.includes("**.item.**"); // returns true
|
|
350
|
+
* $state.includes("*.details.item.url"); // returns true
|
|
351
|
+
* $state.includes("*.details.*.url"); // returns true
|
|
352
|
+
* $state.includes("*.details.*"); // returns false
|
|
353
|
+
* $state.includes("item.**"); // returns false
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* @param stateOrName A partial name, relative name, glob pattern,
|
|
357
|
+
* or state object to be searched for within the current state name.
|
|
358
|
+
* @param params A param object, e.g. `{sectionId: section.id}`,
|
|
359
|
+
* that you'd like to test against the current active state.
|
|
360
|
+
* @param options An options object. The options are:
|
|
361
|
+
* - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will
|
|
362
|
+
* test relative to `options.relative` state (or name).
|
|
363
|
+
*
|
|
364
|
+
* @returns {boolean} Returns true if it does include the state
|
|
365
|
+
*/
|
|
366
|
+
includes(stateOrName: any, params: any, options: any): boolean;
|
|
367
|
+
/**
|
|
368
|
+
* Generates a URL for a state and parameters
|
|
369
|
+
*
|
|
370
|
+
* Returns the url for the given state populated with the given params.
|
|
371
|
+
*
|
|
372
|
+
* #### Example:
|
|
373
|
+
* ```js
|
|
374
|
+
* expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob");
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* @param stateOrName The state name or state object you'd like to generate a url from.
|
|
378
|
+
* @param params An object of parameter values to fill the state's required parameters.
|
|
379
|
+
* @param options Options object. The options are:
|
|
380
|
+
*
|
|
381
|
+
* @returns {string} compiled state url
|
|
382
|
+
*/
|
|
383
|
+
href(stateOrName: any, params: any, options: any): string;
|
|
384
|
+
/**
|
|
385
|
+
* Sets or gets the default [[transitionTo]] error handler.
|
|
386
|
+
*
|
|
387
|
+
* The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.
|
|
388
|
+
* This includes errors caused by resolves and transition hooks.
|
|
389
|
+
*
|
|
390
|
+
* Note:
|
|
391
|
+
* This handler does not receive certain Transition rejections.
|
|
392
|
+
* Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].
|
|
393
|
+
*
|
|
394
|
+
* The built-in default error handler logs the error to the console.
|
|
395
|
+
*
|
|
396
|
+
* You can provide your own custom handler.
|
|
397
|
+
*
|
|
398
|
+
* #### Example:
|
|
399
|
+
* ```js
|
|
400
|
+
* stateService.defaultErrorHandler(function() {
|
|
401
|
+
* // Do not log transitionTo errors
|
|
402
|
+
* });
|
|
403
|
+
* ```
|
|
404
|
+
*
|
|
405
|
+
* @param handler a global error handler function
|
|
406
|
+
* @returns the current global error handler
|
|
407
|
+
*/
|
|
408
|
+
defaultErrorHandler(handler: any): any;
|
|
409
|
+
get(stateOrName: any, base: any, ...args: any[]): any;
|
|
410
|
+
/**
|
|
411
|
+
* Lazy loads a state
|
|
412
|
+
*
|
|
413
|
+
* Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.
|
|
414
|
+
*
|
|
415
|
+
* @param stateOrName the state that should be lazy loaded
|
|
416
|
+
* @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)
|
|
417
|
+
* Note: If no transition is provided, a noop transition is created using the from the current state to the current state.
|
|
418
|
+
* This noop transition is not actually run.
|
|
419
|
+
*
|
|
420
|
+
* @returns a promise to lazy load
|
|
421
|
+
*/
|
|
422
|
+
lazyLoad(stateOrName: any, transition: any): any;
|
|
423
|
+
}
|
|
424
|
+
import { TargetState } from "./target-state.js";
|
|
425
|
+
import { PathNode } from "../path/path-node.js";
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encapsulate the target (destination) state/params/options of a [[Transition]].
|
|
3
|
+
*
|
|
4
|
+
* This class is frequently used to redirect a transition to a new destination.
|
|
5
|
+
*
|
|
6
|
+
* See:
|
|
7
|
+
*
|
|
8
|
+
* - [[HookResult]]
|
|
9
|
+
* - [[TransitionHookFn]]
|
|
10
|
+
* - [[TransitionService.onStart]]
|
|
11
|
+
*
|
|
12
|
+
* To create a `TargetState`, use [[StateService.target]].
|
|
13
|
+
*
|
|
14
|
+
* ---
|
|
15
|
+
*
|
|
16
|
+
* This class wraps:
|
|
17
|
+
*
|
|
18
|
+
* 1) an identifier for a state
|
|
19
|
+
* 2) a set of parameters
|
|
20
|
+
* 3) and transition options
|
|
21
|
+
* 4) the registered state object (the [[StateDeclaration]])
|
|
22
|
+
*
|
|
23
|
+
* Many ng-router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can
|
|
24
|
+
* either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).
|
|
25
|
+
* The `TargetState` class normalizes those options.
|
|
26
|
+
*
|
|
27
|
+
* A `TargetState` may be valid (the state being targeted exists in the registry)
|
|
28
|
+
* or invalid (the state being targeted is not registered).
|
|
29
|
+
*/
|
|
30
|
+
export class TargetState {
|
|
31
|
+
/**
|
|
32
|
+
* The TargetState constructor
|
|
33
|
+
*
|
|
34
|
+
* Note: Do not construct a `TargetState` manually.
|
|
35
|
+
* To create a `TargetState`, use the [[StateService.target]] factory method.
|
|
36
|
+
*
|
|
37
|
+
* @param _stateRegistry The StateRegistry to use to look up the _definition
|
|
38
|
+
* @param _identifier An identifier for a state.
|
|
39
|
+
* Either a fully-qualified state name, or the object used to define the state.
|
|
40
|
+
* @param _params Parameters for the target state
|
|
41
|
+
* @param _options Transition options.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
constructor(
|
|
46
|
+
_stateRegistry: any,
|
|
47
|
+
_identifier: any,
|
|
48
|
+
_params: any,
|
|
49
|
+
_options: any,
|
|
50
|
+
);
|
|
51
|
+
_stateRegistry: any;
|
|
52
|
+
_identifier: any;
|
|
53
|
+
_params: any;
|
|
54
|
+
_options: any;
|
|
55
|
+
_definition: any;
|
|
56
|
+
/** The name of the state this object targets */
|
|
57
|
+
name(): any;
|
|
58
|
+
/** The identifier used when creating this TargetState */
|
|
59
|
+
identifier(): any;
|
|
60
|
+
/** The target parameter values */
|
|
61
|
+
params(): any;
|
|
62
|
+
/** The internal state object (if it was found) */
|
|
63
|
+
$state(): any;
|
|
64
|
+
/** The internal state declaration (if it was found) */
|
|
65
|
+
state(): any;
|
|
66
|
+
/** The target options */
|
|
67
|
+
options(): any;
|
|
68
|
+
/** True if the target state was found */
|
|
69
|
+
exists(): boolean;
|
|
70
|
+
/** True if the object is valid */
|
|
71
|
+
valid(): boolean;
|
|
72
|
+
/** If the object is invalid, returns the reason why */
|
|
73
|
+
error(): string;
|
|
74
|
+
toString(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a copy of this TargetState which targets a different state.
|
|
77
|
+
* The new TargetState has the same parameter values and transition options.
|
|
78
|
+
*
|
|
79
|
+
* @param state The new state that should be targeted
|
|
80
|
+
*/
|
|
81
|
+
withState(state: any): TargetState;
|
|
82
|
+
/**
|
|
83
|
+
* Returns a copy of this TargetState, using the specified parameter values.
|
|
84
|
+
*
|
|
85
|
+
* @param params the new parameter values to use
|
|
86
|
+
* @param replace When false (default) the new parameter values will be merged with the current values.
|
|
87
|
+
* When true the parameter values will be used instead of the current values.
|
|
88
|
+
*/
|
|
89
|
+
withParams(params: any, replace?: boolean): TargetState;
|
|
90
|
+
/**
|
|
91
|
+
* Returns a copy of this TargetState, using the specified Transition Options.
|
|
92
|
+
*
|
|
93
|
+
* @param options the new options to use
|
|
94
|
+
* @param replace When false (default) the new options will be merged with the current options.
|
|
95
|
+
* When true the options will be used instead of the current options.
|
|
96
|
+
*/
|
|
97
|
+
withOptions(options: any, replace?: boolean): TargetState;
|
|
98
|
+
}
|
|
99
|
+
export namespace TargetState {
|
|
100
|
+
/** Returns true if the object has a state property that might be a state or state name */
|
|
101
|
+
function isDef(obj: any): boolean;
|
|
102
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function getViewConfigFactory(): (path: any, view: any) => ViewConfig;
|
|
2
|
+
/**
|
|
3
|
+
* This is a [[StateBuilder.builder]] function for angular1 `views`.
|
|
4
|
+
*
|
|
5
|
+
* When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder
|
|
6
|
+
* handles the `views` property with logic specific to @uirouter/angularjs (ng1).
|
|
7
|
+
*
|
|
8
|
+
* If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object
|
|
9
|
+
* and applies the state-level configuration to a view named `$default`.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export function ng1ViewsBuilder(state: any): {};
|
|
13
|
+
export class ViewConfig {
|
|
14
|
+
/**
|
|
15
|
+
* Normalizes a view's name from a state.views configuration block.
|
|
16
|
+
*
|
|
17
|
+
* This should be used by a framework implementation to calculate the values for
|
|
18
|
+
* [[_ViewDeclaration.$ngViewName]] and [[_ViewDeclaration.$ngViewContextAnchor]].
|
|
19
|
+
*
|
|
20
|
+
* @param context the context object (state declaration) that the view belongs to
|
|
21
|
+
* @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]
|
|
22
|
+
*
|
|
23
|
+
* @returns the normalized ngViewName and ngViewContextAnchor that the view targets
|
|
24
|
+
*/
|
|
25
|
+
static normalizeUIViewTarget(
|
|
26
|
+
context: any,
|
|
27
|
+
rawViewName?: string,
|
|
28
|
+
): {
|
|
29
|
+
ngViewName: string;
|
|
30
|
+
ngViewContextAnchor: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @param {Array<import('../path/path-node.js').PathNode>} path
|
|
34
|
+
* @param viewDecl
|
|
35
|
+
* @param {import('../template-factory.js').TemplateFactoryProvider} factory
|
|
36
|
+
*/
|
|
37
|
+
constructor(
|
|
38
|
+
path: Array<import("../path/path-node.js").PathNode>,
|
|
39
|
+
viewDecl: any,
|
|
40
|
+
factory: import("../template-factory.js").TemplateFactoryProvider,
|
|
41
|
+
);
|
|
42
|
+
path: import("../path/path-node.js").PathNode[];
|
|
43
|
+
viewDecl: any;
|
|
44
|
+
factory: import("../template-factory.js").TemplateFactoryProvider;
|
|
45
|
+
component: any;
|
|
46
|
+
template: any;
|
|
47
|
+
/** @type {Number} */ $id: number;
|
|
48
|
+
loaded: boolean;
|
|
49
|
+
getTemplate: (ngView: any, context: any) => any;
|
|
50
|
+
load(): Promise<this>;
|
|
51
|
+
controller: any;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the controller for a view configuration.
|
|
54
|
+
*
|
|
55
|
+
* @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller.
|
|
56
|
+
*/
|
|
57
|
+
getController(context: any): Function | Promise<Function>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `isState` Filter: truthy if the current state is the parameter
|
|
3
|
+
*
|
|
4
|
+
* Translates to [[StateService.is]] `$state.is("stateName")`.
|
|
5
|
+
*
|
|
6
|
+
* #### Example:
|
|
7
|
+
* ```html
|
|
8
|
+
* <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @param {import('./state/state-service.js').StateProvider} $state
|
|
12
|
+
* @returns {import('../interface.ts').FilterFn}
|
|
13
|
+
*/
|
|
14
|
+
export function $IsStateFilter(
|
|
15
|
+
$state: import("./state/state-service.js").StateProvider,
|
|
16
|
+
): import("../interface.ts").FilterFn;
|
|
17
|
+
export namespace $IsStateFilter {
|
|
18
|
+
let $inject: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* `includedByState` Filter: truthy if the current state includes the parameter
|
|
22
|
+
*
|
|
23
|
+
* Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`.
|
|
24
|
+
*
|
|
25
|
+
* #### Example:
|
|
26
|
+
* ```html
|
|
27
|
+
* <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param {import('./state/state-service.js').StateProvider} $state
|
|
31
|
+
* @returns {import('../interface.ts').FilterFn}
|
|
32
|
+
*/
|
|
33
|
+
export function $IncludedByStateFilter(
|
|
34
|
+
$state: import("./state/state-service.js").StateProvider,
|
|
35
|
+
): import("../interface.ts").FilterFn;
|
|
36
|
+
export namespace $IncludedByStateFilter {
|
|
37
|
+
let $inject_1: string[];
|
|
38
|
+
export { $inject_1 as $inject };
|
|
39
|
+
}
|