@angular-wave/angular.ts 0.0.27 → 0.0.29
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 -2
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/e2e/unit.spec.ts +2 -1
- package/index.html +6 -6
- package/package.json +1 -1
- package/src/core/pubsub.js +329 -0
- package/src/router/common/trace.js +6 -6
- package/src/router/directives/state-directives.js +74 -74
- package/src/router/directives/view-directive.js +21 -21
- package/src/router/hooks/core-resolvables.js +12 -11
- package/src/router/hooks/ignored-transition.js +1 -1
- package/src/router/hooks/lazy-load.js +40 -41
- package/src/router/hooks/redirect-to.js +32 -29
- package/src/router/hooks/update-globals.js +1 -1
- package/src/router/hooks/url.js +33 -24
- package/src/router/hooks/views.js +21 -20
- package/src/router/index.js +12 -12
- package/src/router/injectables.js +3 -3
- package/src/router/params/param-factory.js +17 -0
- package/src/router/router.js +75 -10
- package/src/router/services.js +4 -8
- package/src/router/state/state-builder.js +1 -0
- package/src/router/state/state-queue-manager.js +5 -4
- package/src/router/state/state-registry.js +63 -7
- package/src/router/state/state-service.js +47 -51
- package/src/router/state/views.js +4 -4
- package/src/router/state-filters.js +0 -2
- package/src/router/state-provider.js +0 -2
- package/src/router/template-factory.js +4 -4
- package/src/router/transition/hook-builder.js +2 -2
- package/src/router/transition/transition-hook.js +2 -1
- package/src/router/transition/transition-service.js +11 -18
- package/src/router/transition/transition.js +28 -25
- package/src/router/url/url-config.js +1 -49
- package/src/router/url/url-matcher-factory.js +10 -51
- package/src/router/url/url-router.js +31 -17
- package/src/router/url/url-rule.js +9 -13
- package/src/router/url/url-rules.js +3 -3
- package/src/router/url/url-service.js +22 -18
- package/src/router/view/view.js +67 -67
- package/src/services/browser.js +1 -5
- package/src/shared/hof.js +1 -1
- package/test/angular.spec.js +1 -0
- package/test/aria/aria.spec.js +2 -1
- package/test/core/pubsub.spec.js +387 -0
- package/test/directive/bind.spec.js +2 -1
- package/test/directive/boolean.spec.js +4 -2
- package/test/directive/change.spec.js +1 -1
- package/test/directive/class.spec.js +1 -0
- package/test/directive/click.spec.js +2 -1
- package/test/directive/cloak.spec.js +1 -2
- package/test/directive/{constoller.spec.js → controller.spec.js} +1 -0
- package/test/directive/element-style.spec.js +1 -0
- package/test/directive/event.spec.js +1 -1
- package/test/directive/href.spec.js +2 -1
- package/test/directive/init.spec.js +1 -0
- package/test/directive/input.spec.js +200 -285
- package/test/directive/list.spec.js +2 -1
- package/test/directive/model.spec.js +1 -0
- package/test/directive/non-bindable.spec.js +2 -1
- package/test/directive/script.spec.js +1 -0
- package/test/directive/scrset.spec.js +2 -1
- package/test/directive/show-hide.spec.js +1 -0
- package/test/directive/src.spec.js +2 -1
- package/test/directive/style.spec.js +1 -0
- package/test/directive/switch.spec.js +2 -1
- package/test/directive/validators.spec.js +1 -1
- package/test/module-test.html +5 -5
- package/test/original-test.html +3 -3
- package/test/router/services.spec.js +1 -1
- package/test/router/state-directives.spec.js +72 -80
- package/test/router/state-filter.spec.js +6 -4
- package/test/router/state.spec.js +15 -13
- package/test/router/template-factory.spec.js +4 -4
- package/test/router/url-matcher-factory.spec.js +2 -2
- package/test/router/view-directive.spec.js +165 -163
- package/test/router/view-hook.spec.js +4 -4
- package/test/router/view-scroll.spec.js +15 -15
- package/test/router/view.spec.js +3 -3
- package/types/router/core/common/coreservices.d.ts +2 -3
- package/types/router/core/globals.d.ts +1 -4
- package/types/router/core/interface.d.ts +2 -8
- package/types/router/core/params/paramTypes.d.ts +0 -1
- package/types/router/core/router.d.ts +2 -3
- package/types/router/core/state/interface.d.ts +6 -6
- package/types/router/core/state/stateQueueManager.d.ts +1 -3
- package/types/router/core/state/stateRegistry.d.ts +1 -2
- package/types/router/core/state/stateService.d.ts +5 -6
- package/types/router/core/transition/interface.d.ts +4 -4
- package/types/router/core/transition/transitionService.d.ts +1 -2
- package/types/router/core/url/urlConfig.d.ts +1 -2
- package/types/router/core/url/urlRules.d.ts +1 -2
- package/types/router/core/url/urlService.d.ts +1 -2
- package/types/router/core/view/interface.d.ts +2 -2
- package/types/router/core/view/view.d.ts +16 -16
- package/types/router/directives/viewDirective.d.ts +3 -3
- package/types/router/interface.d.ts +4 -4
- package/types/router/locationServices.d.ts +0 -1
- package/types/router/stateProvider.d.ts +3 -3
- package/types/router/statebuilders/views.d.ts +1 -1
- package/types/router/templateFactory.d.ts +2 -2
- package/types/router/viewScroll.d.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dealoc } from "../../src/jqLite";
|
|
1
|
+
import { dealoc, jqLite } from "../../src/jqLite";
|
|
2
2
|
import { Angular } from "../../src/loader";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { wait } from "../test-utils";
|
|
@@ -25,7 +25,7 @@ describe("view hooks", () => {
|
|
|
25
25
|
window.angular = new Angular();
|
|
26
26
|
publishExternalAPI();
|
|
27
27
|
app = window.angular
|
|
28
|
-
.module("defaultModule", ["
|
|
28
|
+
.module("defaultModule", ["ng.router"])
|
|
29
29
|
.config(($stateProvider) => {
|
|
30
30
|
$stateProvider.state({ name: "foo", url: "/foo", component: "foo" });
|
|
31
31
|
$stateProvider.state({ name: "bar", url: "/bar", component: "bar" });
|
|
@@ -47,7 +47,7 @@ describe("view hooks", () => {
|
|
|
47
47
|
$state = _$state_;
|
|
48
48
|
$q = _$q_;
|
|
49
49
|
$timeout = _$timeout_;
|
|
50
|
-
$compile("<div><
|
|
50
|
+
$compile("<div><ng-view></ng-view></div>")($rootScope.$new());
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
|
|
@@ -103,7 +103,7 @@ describe("view hooks", () => {
|
|
|
103
103
|
it("can redirect the transition", async () => {
|
|
104
104
|
ctrl.prototype.uiCanExit = function (trans) {
|
|
105
105
|
log += "canexit;";
|
|
106
|
-
return
|
|
106
|
+
return $state.target("baz");
|
|
107
107
|
};
|
|
108
108
|
await initial();
|
|
109
109
|
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { dealoc } from "../../src/jqLite";
|
|
1
|
+
import { dealoc, jqLite } from "../../src/jqLite";
|
|
2
2
|
import { Angular } from "../../src/loader";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { wait } from "../test-utils";
|
|
5
5
|
|
|
6
|
-
describe("
|
|
6
|
+
describe("ngView", () => {
|
|
7
7
|
describe("scrollIntoView", () => {
|
|
8
|
-
let elem, $anchorScroll, $
|
|
8
|
+
let elem, $anchorScroll, $ngViewScroll, $timeout;
|
|
9
9
|
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
dealoc(document.getElementById("dummy"));
|
|
12
12
|
window.angular = new Angular();
|
|
13
13
|
publishExternalAPI();
|
|
14
|
-
window.angular.module("defaultModule", ["
|
|
14
|
+
window.angular.module("defaultModule", ["ng.router"]);
|
|
15
15
|
let $injector = window.angular.bootstrap(
|
|
16
16
|
document.getElementById("dummy"),
|
|
17
17
|
["defaultModule"],
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
$injector.invoke((_$
|
|
20
|
+
$injector.invoke((_$ngViewScroll_, _$timeout_, _$anchorScroll_) => {
|
|
21
21
|
$anchorScroll = _$anchorScroll_;
|
|
22
|
-
$
|
|
22
|
+
$ngViewScroll = _$ngViewScroll_;
|
|
23
23
|
$timeout = _$timeout_;
|
|
24
24
|
});
|
|
25
25
|
elem = [{ scrollIntoView: jasmine.createSpy("scrollIntoView") }];
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it("should scroll element into view after timeout", async () => {
|
|
29
|
-
$
|
|
29
|
+
$ngViewScroll(elem);
|
|
30
30
|
expect(elem[0].scrollIntoView).not.toHaveBeenCalled();
|
|
31
31
|
|
|
32
32
|
await wait(100);
|
|
@@ -34,7 +34,7 @@ describe("uiView", () => {
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it("should return the promise from the timeout", async () => {
|
|
37
|
-
const promise = $
|
|
37
|
+
const promise = $ngViewScroll(elem);
|
|
38
38
|
|
|
39
39
|
await wait(100);
|
|
40
40
|
expect(elem[0].scrollIntoView).toHaveBeenCalled();
|
|
@@ -43,18 +43,18 @@ describe("uiView", () => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
describe("useAnchorScroll", () => {
|
|
46
|
-
let elem, $anchorScroll, $
|
|
46
|
+
let elem, $anchorScroll, $ngViewScroll;
|
|
47
47
|
|
|
48
48
|
beforeEach(() => {
|
|
49
49
|
dealoc(document.getElementById("dummy"));
|
|
50
50
|
window.angular = new Angular();
|
|
51
51
|
publishExternalAPI();
|
|
52
|
-
let module = window.angular.module("defaultModule", ["
|
|
53
|
-
module.config(($provide, $
|
|
52
|
+
let module = window.angular.module("defaultModule", ["ng.router"]);
|
|
53
|
+
module.config(($provide, $ngViewScrollProvider) => {
|
|
54
54
|
$provide.decorator("$anchorScroll", function ($delegate) {
|
|
55
55
|
return jasmine.createSpy("$anchorScroll");
|
|
56
56
|
});
|
|
57
|
-
$
|
|
57
|
+
$ngViewScrollProvider.useAnchorScroll();
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
let $injector = window.angular.bootstrap(
|
|
@@ -62,15 +62,15 @@ describe("uiView", () => {
|
|
|
62
62
|
["defaultModule"],
|
|
63
63
|
);
|
|
64
64
|
|
|
65
|
-
$injector.invoke((_$
|
|
65
|
+
$injector.invoke((_$ngViewScroll_, _$anchorScroll_) => {
|
|
66
66
|
$anchorScroll = _$anchorScroll_;
|
|
67
|
-
$
|
|
67
|
+
$ngViewScroll = _$ngViewScroll_;
|
|
68
68
|
});
|
|
69
69
|
elem = [{ scrollIntoView: jasmine.createSpy("scrollIntoView") }];
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it("should call $anchorScroll", () => {
|
|
73
|
-
$
|
|
73
|
+
$ngViewScroll();
|
|
74
74
|
expect($anchorScroll).toHaveBeenCalled();
|
|
75
75
|
});
|
|
76
76
|
});
|
package/test/router/view.spec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dealoc } from "../../src/jqLite";
|
|
1
|
+
import { dealoc, jqLite } from "../../src/jqLite";
|
|
2
2
|
import { Angular } from "../../src/loader";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { curry } from "../../src/shared/hof";
|
|
@@ -32,7 +32,7 @@ describe("view", () => {
|
|
|
32
32
|
publishExternalAPI();
|
|
33
33
|
|
|
34
34
|
window.angular
|
|
35
|
-
.module("defaultModule", ["
|
|
35
|
+
.module("defaultModule", ["ng.router"])
|
|
36
36
|
.config(
|
|
37
37
|
function (
|
|
38
38
|
_$provide_,
|
|
@@ -106,7 +106,7 @@ describe("view", () => {
|
|
|
106
106
|
|
|
107
107
|
it("uses the controllerProvider to get controller dynamically", async () => {
|
|
108
108
|
$controllerProvider.register("AcmeFooController", () => {});
|
|
109
|
-
elem.append($compile("<div><
|
|
109
|
+
elem.append($compile("<div><ng-view></ng-view></div>")(scope));
|
|
110
110
|
|
|
111
111
|
const view = tail(path).views[0];
|
|
112
112
|
view.load();
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
7
|
import { IInjectable, Obj } from "./common";
|
|
8
|
-
import { Disposable } from "../interface";
|
|
9
8
|
import { UrlConfig, UrlService } from "../url";
|
|
10
9
|
export declare const makeStub: <T>(service: string, methods: (keyof T)[]) => T;
|
|
11
10
|
declare const services: CoreServices;
|
|
@@ -46,7 +45,7 @@ export interface CoreServices {
|
|
|
46
45
|
* - [[HashLocationService]]
|
|
47
46
|
* - [[MemoryLocationService]]
|
|
48
47
|
*/
|
|
49
|
-
export interface LocationServices
|
|
48
|
+
export interface LocationServices {
|
|
50
49
|
/** See: [[UrlService.url]] */ url: UrlService["url"];
|
|
51
50
|
/** See: [[UrlService.path]] */ path: UrlService["path"];
|
|
52
51
|
/** See: [[UrlService.search]] */ search: UrlService["search"];
|
|
@@ -67,7 +66,7 @@ export interface LocationServices extends Disposable {
|
|
|
67
66
|
* - [[BrowserLocationConfig]]
|
|
68
67
|
* - [[MemoryLocationConfig]]
|
|
69
68
|
*/
|
|
70
|
-
export interface LocationConfig
|
|
69
|
+
export interface LocationConfig {
|
|
71
70
|
/** See: [[UrlConfig.port]] */ port: UrlConfig["port"];
|
|
72
71
|
/** See: [[UrlConfig.protocol]] */ protocol: UrlConfig["protocol"];
|
|
73
72
|
/** See: [[UrlConfig.host]] */ host: UrlConfig["host"];
|
|
@@ -3,14 +3,12 @@ import { StateDeclaration } from "./state/interface";
|
|
|
3
3
|
import { StateObject } from "./state/stateObject";
|
|
4
4
|
import { Transition } from "./transition/transition";
|
|
5
5
|
import { Queue } from "./common/queue";
|
|
6
|
-
import { Disposable } from "./interface";
|
|
7
|
-
/**
|
|
8
6
|
* Global router state
|
|
9
7
|
*
|
|
10
8
|
* This is where we hold the global mutable state such as current state, current
|
|
11
9
|
* params, current transition, etc.
|
|
12
10
|
*/
|
|
13
|
-
export declare class UIRouterGlobals
|
|
11
|
+
export declare class UIRouterGlobals {
|
|
14
12
|
/**
|
|
15
13
|
* Current parameter values
|
|
16
14
|
*
|
|
@@ -41,5 +39,4 @@ export declare class UIRouterGlobals implements Disposable {
|
|
|
41
39
|
transitionHistory: Queue<Transition>;
|
|
42
40
|
/** @internal */
|
|
43
41
|
successfulTransitions: Queue<Transition>;
|
|
44
|
-
dispose(): void;
|
|
45
42
|
}
|
|
@@ -89,16 +89,10 @@ export interface UIInjector {
|
|
|
89
89
|
getNative(token: any): any;
|
|
90
90
|
getNative<T>(token: any): T;
|
|
91
91
|
}
|
|
92
|
-
export interface UIRouterPlugin
|
|
92
|
+
export interface UIRouterPlugin {
|
|
93
93
|
name: string;
|
|
94
94
|
}
|
|
95
|
-
export declare abstract class UIRouterPluginBase
|
|
96
|
-
implements UIRouterPlugin, Disposable
|
|
97
|
-
{
|
|
95
|
+
export declare abstract class UIRouterPluginBase implements UIRouterPlugin {
|
|
98
96
|
abstract name: string;
|
|
99
97
|
dispose(router: UIRouter): void;
|
|
100
98
|
}
|
|
101
|
-
export interface Disposable {
|
|
102
|
-
/** Instructs the Disposable to clean up any resources */
|
|
103
|
-
dispose(router?: UIRouter): any;
|
|
104
|
-
}
|
|
@@ -5,7 +5,7 @@ import { ViewService } from "./view/view";
|
|
|
5
5
|
import { StateRegistry } from "./state/stateRegistry";
|
|
6
6
|
import { StateService } from "./state/stateService";
|
|
7
7
|
import { UIRouterGlobals } from "./globals";
|
|
8
|
-
import { UIRouterPlugin
|
|
8
|
+
import { UIRouterPlugin } from "./interface";
|
|
9
9
|
import { UrlService } from "./url/urlService";
|
|
10
10
|
import { LocationServices, LocationConfig } from "./common/coreservices";
|
|
11
11
|
import { Trace } from "./common/trace";
|
|
@@ -46,8 +46,7 @@ export declare class UIRouter {
|
|
|
46
46
|
stateService: StateService;
|
|
47
47
|
/** @internal plugin instances are registered here */
|
|
48
48
|
private _plugins;
|
|
49
|
-
|
|
50
|
-
disposable(disposable: Disposable): void;
|
|
49
|
+
|
|
51
50
|
/**
|
|
52
51
|
* Disposes this router instance
|
|
53
52
|
*
|
|
@@ -42,20 +42,20 @@ export interface _ViewDeclaration {
|
|
|
42
42
|
/**
|
|
43
43
|
* The normalized address for the `ui-view` which this ViewConfig targets.
|
|
44
44
|
*
|
|
45
|
-
* A ViewConfig targets a `ui-view` in the DOM (relative to the `
|
|
45
|
+
* A ViewConfig targets a `ui-view` in the DOM (relative to the `ngViewContextAnchor`) which has
|
|
46
46
|
* a specific name.
|
|
47
47
|
* @example `header` or `$default`
|
|
48
48
|
*
|
|
49
|
-
* The `
|
|
49
|
+
* The `ngViewName` can also target a _nested view_ by providing a dot-notation address
|
|
50
50
|
* @example `foo.bar` or `foo.$default.bar`
|
|
51
51
|
*/
|
|
52
|
-
$
|
|
52
|
+
$ngViewName?: string;
|
|
53
53
|
/**
|
|
54
|
-
* The normalized context anchor (state name) for the `
|
|
54
|
+
* The normalized context anchor (state name) for the `ngViewName`
|
|
55
55
|
*
|
|
56
|
-
* When targeting a `ui-view`, the `
|
|
56
|
+
* When targeting a `ui-view`, the `ngViewName` address is anchored to a context name (state name).
|
|
57
57
|
*/
|
|
58
|
-
$
|
|
58
|
+
$ngViewContextAnchor?: string;
|
|
59
59
|
/**
|
|
60
60
|
* A type identifier for the View
|
|
61
61
|
*
|
|
@@ -2,9 +2,8 @@ import { _StateDeclaration } from "./interface";
|
|
|
2
2
|
import { StateObject } from "./stateObject";
|
|
3
3
|
import { StateBuilder } from "./stateBuilder";
|
|
4
4
|
import { StateRegistryListener } from "./stateRegistry";
|
|
5
|
-
import { Disposable } from "../interface";
|
|
6
5
|
import { UIRouter } from "../router";
|
|
7
|
-
export declare class StateQueueManager
|
|
6
|
+
export declare class StateQueueManager {
|
|
8
7
|
private router;
|
|
9
8
|
states: {
|
|
10
9
|
[key: string]: StateObject;
|
|
@@ -20,7 +19,6 @@ export declare class StateQueueManager implements Disposable {
|
|
|
20
19
|
builder: StateBuilder,
|
|
21
20
|
listeners: StateRegistryListener[],
|
|
22
21
|
);
|
|
23
|
-
dispose(): void;
|
|
24
22
|
register(stateDecl: _StateDeclaration): StateObject;
|
|
25
23
|
flush(): {
|
|
26
24
|
[key: string]: StateObject;
|
|
@@ -23,6 +23,7 @@ export declare type StateRegistryListener = (
|
|
|
23
23
|
* This API is found at `router.stateRegistry` ([[UIRouter.stateRegistry]])
|
|
24
24
|
*/
|
|
25
25
|
export declare class StateRegistry {
|
|
26
|
+
init($injector: any): void;
|
|
26
27
|
private router;
|
|
27
28
|
private _root;
|
|
28
29
|
private states;
|
|
@@ -37,8 +38,6 @@ export declare class StateRegistry {
|
|
|
37
38
|
constructor(router: UIRouter);
|
|
38
39
|
/** @internal */
|
|
39
40
|
private _registerRoot;
|
|
40
|
-
/** @internal */
|
|
41
|
-
dispose(): void;
|
|
42
41
|
/**
|
|
43
42
|
* Listen for a State Registry events
|
|
44
43
|
*
|
|
@@ -53,8 +53,7 @@ export declare class StateService {
|
|
|
53
53
|
$current: StateObject;
|
|
54
54
|
/** @internal */
|
|
55
55
|
constructor(/** @internal */ router: UIRouter);
|
|
56
|
-
|
|
57
|
-
dispose(): void;
|
|
56
|
+
|
|
58
57
|
/**
|
|
59
58
|
* Handler for when [[transitionTo]] is called with an invalid state.
|
|
60
59
|
*
|
|
@@ -100,7 +99,7 @@ export declare class StateService {
|
|
|
100
99
|
*
|
|
101
100
|
* #### Example:
|
|
102
101
|
* ```js
|
|
103
|
-
* let app angular.module('app', ['
|
|
102
|
+
* let app angular.module('app', ['ng.router']);
|
|
104
103
|
*
|
|
105
104
|
* app.controller('ctrl', function ($scope, $state) {
|
|
106
105
|
* $scope.reload = function(){
|
|
@@ -124,7 +123,7 @@ export declare class StateService {
|
|
|
124
123
|
* ```js
|
|
125
124
|
* //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'
|
|
126
125
|
* //and current state is 'contacts.detail.item'
|
|
127
|
-
* let app angular.module('app', ['
|
|
126
|
+
* let app angular.module('app', ['ng.router']);
|
|
128
127
|
*
|
|
129
128
|
* app.controller('ctrl', function ($scope, $state) {
|
|
130
129
|
* $scope.reload = function(){
|
|
@@ -150,7 +149,7 @@ export declare class StateService {
|
|
|
150
149
|
*
|
|
151
150
|
* #### Example:
|
|
152
151
|
* ```js
|
|
153
|
-
* let app = angular.module('app', ['
|
|
152
|
+
* let app = angular.module('app', ['ng.router']);
|
|
154
153
|
*
|
|
155
154
|
* app.controller('ctrl', function ($scope, $state) {
|
|
156
155
|
* $scope.changeState = function () {
|
|
@@ -203,7 +202,7 @@ export declare class StateService {
|
|
|
203
202
|
*
|
|
204
203
|
* #### Example:
|
|
205
204
|
* ```js
|
|
206
|
-
* let app = angular.module('app', ['
|
|
205
|
+
* let app = angular.module('app', ['ng.router']);
|
|
207
206
|
*
|
|
208
207
|
* app.controller('ctrl', function ($scope, $state) {
|
|
209
208
|
* $scope.changeState = function () {
|
|
@@ -9,7 +9,7 @@ import { RegisteredHook } from "./hookRegistry";
|
|
|
9
9
|
* The TransitionOptions object can be used to change the behavior of a transition.
|
|
10
10
|
*
|
|
11
11
|
* It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].
|
|
12
|
-
* It can also be used with a `
|
|
12
|
+
* It can also be used with a `ngSref`.
|
|
13
13
|
*/
|
|
14
14
|
export interface TransitionOptions {
|
|
15
15
|
/**
|
|
@@ -327,7 +327,7 @@ export interface IHookRegistry {
|
|
|
327
327
|
* ```js
|
|
328
328
|
* // ng2
|
|
329
329
|
* transitionService.onBefore({ to: 'home' }, (trans: Transition) =>
|
|
330
|
-
*
|
|
330
|
+
* stateService.target("home.dashboard"));
|
|
331
331
|
* ```
|
|
332
332
|
*
|
|
333
333
|
* #### Data Driven Default Substate
|
|
@@ -354,7 +354,7 @@ export interface IHookRegistry {
|
|
|
354
354
|
*
|
|
355
355
|
* $transitions.onBefore(criteria, function(trans: Transition) {
|
|
356
356
|
* var substate = trans.to().defaultSubstate;
|
|
357
|
-
* return
|
|
357
|
+
* return stateService.target(substate);
|
|
358
358
|
* });
|
|
359
359
|
* ```
|
|
360
360
|
*
|
|
@@ -429,7 +429,7 @@ export interface IHookRegistry {
|
|
|
429
429
|
* ```js
|
|
430
430
|
* // ng1
|
|
431
431
|
* $transitions.onStart( { to: 'auth.**' }, function(trans) {
|
|
432
|
-
* var $state =
|
|
432
|
+
* var $state = stateService;
|
|
433
433
|
* var MyAuthService = trans.injector().get('MyAuthService');
|
|
434
434
|
*
|
|
435
435
|
* // If the user is not authenticated
|
|
@@ -20,7 +20,6 @@ import { ViewService } from "../view/view";
|
|
|
20
20
|
import { UIRouter } from "../router";
|
|
21
21
|
import { TransitionEventType } from "./transitionEventType";
|
|
22
22
|
import { GetResultHandler, GetErrorHandler } from "./transitionHook";
|
|
23
|
-
import { Disposable } from "../interface";
|
|
24
23
|
/**
|
|
25
24
|
* The default [[Transition]] options.
|
|
26
25
|
*
|
|
@@ -82,7 +81,7 @@ export interface TransitionServicePluginAPI {
|
|
|
82
81
|
*
|
|
83
82
|
* This API is located at `router.transitionService` ([[UIRouter.transitionService]])
|
|
84
83
|
*/
|
|
85
|
-
export declare class TransitionService implements IHookRegistry
|
|
84
|
+
export declare class TransitionService implements IHookRegistry {
|
|
86
85
|
/** @internal */
|
|
87
86
|
_transitionCount: number;
|
|
88
87
|
/** @internal */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Disposable } from "../interface";
|
|
2
1
|
import { UIRouter } from "../router";
|
|
3
2
|
import { ParamTypeDefinition, ParamTypes } from "../params";
|
|
4
3
|
/**
|
|
@@ -14,7 +13,7 @@ import { ParamTypeDefinition, ParamTypes } from "../params";
|
|
|
14
13
|
*
|
|
15
14
|
* This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]])
|
|
16
15
|
*/
|
|
17
|
-
export declare class UrlConfig
|
|
16
|
+
export declare class UrlConfig {
|
|
18
17
|
private router;
|
|
19
18
|
/** @internal */ paramTypes: ParamTypes;
|
|
20
19
|
/** @internal */ _decodeParams: boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UIRouter } from "../router";
|
|
2
|
-
import { Disposable } from "../interface";
|
|
3
2
|
import { UrlRule, UrlRuleHandlerFn } from "./interface";
|
|
4
3
|
import { TargetState, TargetStateDef } from "../state";
|
|
5
4
|
import { UrlMatcher } from "./urlMatcher";
|
|
@@ -14,7 +13,7 @@ import { UrlRuleFactory } from "./urlRule";
|
|
|
14
13
|
*
|
|
15
14
|
* This API is found at `router.urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
|
|
16
15
|
*/
|
|
17
|
-
export declare class UrlRules
|
|
16
|
+
export declare class UrlRules {
|
|
18
17
|
private router;
|
|
19
18
|
/** used to create [[UrlRule]] objects for common cases */
|
|
20
19
|
urlRuleFactory: UrlRuleFactory;
|
|
@@ -31,8 +31,8 @@ export interface ActiveUIView {
|
|
|
31
31
|
* with the `ViewConfig`. The `ui-view` then loads itself using the information found in the `ViewConfig`.
|
|
32
32
|
*
|
|
33
33
|
* A `ViewConfig` if matched with a `ui-view` by finding all `ui-view`s which were created in the
|
|
34
|
-
* context named by the `
|
|
35
|
-
* the `
|
|
34
|
+
* context named by the `ngViewContextAnchor`, and finding the `ui-view` or child `ui-view` that matches
|
|
35
|
+
* the `ngViewName` address.
|
|
36
36
|
*/
|
|
37
37
|
export interface ViewConfig {
|
|
38
38
|
$id: number;
|
|
@@ -10,14 +10,14 @@ export declare type ViewConfigFactory = (
|
|
|
10
10
|
export interface ViewServicePluginAPI {
|
|
11
11
|
_rootViewContext(context?: ViewContext): ViewContext;
|
|
12
12
|
_viewConfigFactory(viewType: string, factory: ViewConfigFactory): any;
|
|
13
|
-
/** @param id router.$id + "." +
|
|
13
|
+
/** @param id router.$id + "." + ngView.id */
|
|
14
14
|
_registeredUIView(id: string): ActiveUIView;
|
|
15
15
|
_registeredUIViews(): ActiveUIView[];
|
|
16
16
|
_activeViewConfigs(): ViewConfig[];
|
|
17
17
|
_onSync(listener: ViewSyncListener): Function;
|
|
18
18
|
}
|
|
19
19
|
export interface ViewTuple {
|
|
20
|
-
|
|
20
|
+
ngView: ActiveUIView;
|
|
21
21
|
viewConfig: ViewConfig;
|
|
22
22
|
}
|
|
23
23
|
export interface ViewSyncListener {
|
|
@@ -41,7 +41,7 @@ export interface ViewSyncListener {
|
|
|
41
41
|
*/
|
|
42
42
|
export declare class ViewService {
|
|
43
43
|
private router;
|
|
44
|
-
/** @internal */ private
|
|
44
|
+
/** @internal */ private _ngViews;
|
|
45
45
|
/** @internal */ private _viewConfigs;
|
|
46
46
|
/** @internal */ private _rootContext;
|
|
47
47
|
/** @internal */ private _viewConfigFactories;
|
|
@@ -81,7 +81,7 @@ export declare class ViewService {
|
|
|
81
81
|
* </ui-view>
|
|
82
82
|
* </ui-view>
|
|
83
83
|
*
|
|
84
|
-
*
|
|
84
|
+
* ngViews: [
|
|
85
85
|
* { fqn: "$default", creationContext: { name: "" } },
|
|
86
86
|
* { fqn: "$default.foo", creationContext: { name: "A" } },
|
|
87
87
|
* { fqn: "$default.foo.$default", creationContext: { name: "A.B" } }
|
|
@@ -90,10 +90,10 @@ export declare class ViewService {
|
|
|
90
90
|
*
|
|
91
91
|
* These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar":
|
|
92
92
|
*
|
|
93
|
-
* - ViewConfig1: {
|
|
94
|
-
* - ViewConfig2: {
|
|
95
|
-
* - ViewConfig3: {
|
|
96
|
-
* - ViewConfig4: {
|
|
93
|
+
* - ViewConfig1: { ngViewName: "bar", ngViewContextAnchor: "A.B.C" }
|
|
94
|
+
* - ViewConfig2: { ngViewName: "$default.bar", ngViewContextAnchor: "A.B" }
|
|
95
|
+
* - ViewConfig3: { ngViewName: "foo.$default.bar", ngViewContextAnchor: "A" }
|
|
96
|
+
* - ViewConfig4: { ngViewName: "$default.foo.$default.bar", ngViewContextAnchor: "" }
|
|
97
97
|
*
|
|
98
98
|
* Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because:
|
|
99
99
|
* - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ]
|
|
@@ -106,26 +106,26 @@ export declare class ViewService {
|
|
|
106
106
|
* @internal
|
|
107
107
|
*/
|
|
108
108
|
static matches: (
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
ngViewsByFqn: TypedMap<ActiveUIView>,
|
|
110
|
+
ngView: ActiveUIView,
|
|
111
111
|
) => (viewConfig: ViewConfig) => boolean;
|
|
112
112
|
/**
|
|
113
113
|
* Normalizes a view's name from a state.views configuration block.
|
|
114
114
|
*
|
|
115
115
|
* This should be used by a framework implementation to calculate the values for
|
|
116
|
-
* [[_ViewDeclaration.$
|
|
116
|
+
* [[_ViewDeclaration.$ngViewName]] and [[_ViewDeclaration.$ngViewContextAnchor]].
|
|
117
117
|
*
|
|
118
118
|
* @param context the context object (state declaration) that the view belongs to
|
|
119
119
|
* @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]
|
|
120
120
|
*
|
|
121
|
-
* @returns the normalized
|
|
121
|
+
* @returns the normalized ngViewName and ngViewContextAnchor that the view targets
|
|
122
122
|
*/
|
|
123
123
|
static normalizeUIViewTarget(
|
|
124
124
|
context: ViewContext,
|
|
125
125
|
rawViewName?: string,
|
|
126
126
|
): {
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
ngViewName: string;
|
|
128
|
+
ngViewContextAnchor: string;
|
|
129
129
|
};
|
|
130
130
|
/** @internal */
|
|
131
131
|
constructor(/** @internal */ router: UIRouter);
|
|
@@ -157,10 +157,10 @@ export declare class ViewService {
|
|
|
157
157
|
* Note: There is no corresponding `deregisterUIView`.
|
|
158
158
|
* A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.
|
|
159
159
|
*
|
|
160
|
-
* @param
|
|
160
|
+
* @param ngView The metadata for a UIView
|
|
161
161
|
* @return a de-registration function used when the view is destroyed.
|
|
162
162
|
*/
|
|
163
|
-
registerUIView(
|
|
163
|
+
registerUIView(ngView: ActiveUIView): () => void;
|
|
164
164
|
/**
|
|
165
165
|
* Returns the list of views currently available on the page, by fully-qualified name.
|
|
166
166
|
*
|
|
@@ -6,7 +6,7 @@ import { Ng1ViewConfig } from "../statebuilders/views";
|
|
|
6
6
|
/** @hidden */
|
|
7
7
|
export declare type UIViewData = {
|
|
8
8
|
$cfg: Ng1ViewConfig;
|
|
9
|
-
$
|
|
9
|
+
$ngView: ActiveUIView;
|
|
10
10
|
};
|
|
11
11
|
/** @hidden */
|
|
12
12
|
export declare type UIViewAnimData = {
|
|
@@ -27,7 +27,7 @@ export declare type UIViewAnimData = {
|
|
|
27
27
|
* The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).
|
|
28
28
|
*
|
|
29
29
|
* - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.
|
|
30
|
-
* Uses [[$
|
|
30
|
+
* Uses [[$ngViewScroll]] to do the scrolling.
|
|
31
31
|
*
|
|
32
32
|
* - `onload`: Expression to evaluate whenever the view updates.
|
|
33
33
|
*
|
|
@@ -141,4 +141,4 @@ export declare type UIViewAnimData = {
|
|
|
141
141
|
* });
|
|
142
142
|
* ```
|
|
143
143
|
*/
|
|
144
|
-
export declare let
|
|
144
|
+
export declare let ngView: IDirective;
|
|
@@ -251,7 +251,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
|
|
|
251
251
|
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
252
252
|
*
|
|
253
253
|
* The controller function, or the name of a registered controller. The controller function will be used
|
|
254
|
-
* to control the contents of the [[directives.
|
|
254
|
+
* to control the contents of the [[directives.ngView]] directive.
|
|
255
255
|
*
|
|
256
256
|
* If specified as a string, controllerAs can be declared here, i.e., "FooController as foo" instead of in
|
|
257
257
|
* a separate [[controllerAs]] property.
|
|
@@ -310,7 +310,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
|
|
|
310
310
|
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
311
311
|
*
|
|
312
312
|
* HTML template as a string, or a function which returns an html template as a string.
|
|
313
|
-
* This template will be used to render the corresponding [[directives.
|
|
313
|
+
* This template will be used to render the corresponding [[directives.ngView]] directive.
|
|
314
314
|
*
|
|
315
315
|
* This property takes precedence over templateUrl.
|
|
316
316
|
*
|
|
@@ -335,7 +335,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
|
|
|
335
335
|
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
336
336
|
*
|
|
337
337
|
* A path or a function that returns a path to an html template.
|
|
338
|
-
* The template will be fetched and used to render the corresponding [[directives.
|
|
338
|
+
* The template will be fetched and used to render the corresponding [[directives.ngView]] directive.
|
|
339
339
|
*
|
|
340
340
|
* If `templateUrl` is a function, it will be called with the Transition parameters as the first argument.
|
|
341
341
|
*
|
|
@@ -358,7 +358,7 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
|
|
|
358
358
|
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
359
359
|
*
|
|
360
360
|
* Injected function which returns the HTML template.
|
|
361
|
-
* The template will be used to render the corresponding [[directives.
|
|
361
|
+
* The template will be used to render the corresponding [[directives.ngView]] directive.
|
|
362
362
|
*
|
|
363
363
|
* #### Example:
|
|
364
364
|
* ```js
|
|
@@ -35,7 +35,6 @@ export declare class Ng1LocationServices
|
|
|
35
35
|
* @param router
|
|
36
36
|
*/
|
|
37
37
|
static monkeyPatchPathParameterType(router: UIRouter): void;
|
|
38
|
-
dispose(): void;
|
|
39
38
|
constructor($locationProvider: ILocationProvider);
|
|
40
39
|
onChange(callback: Function): () => Function[];
|
|
41
40
|
html5Mode(): any;
|
|
@@ -56,7 +56,7 @@ export declare class StateProvider {
|
|
|
56
56
|
* - **parent** `{object}` - returns the parent state object.
|
|
57
57
|
* - **data** `{object}` - returns state data, including any inherited data that is not
|
|
58
58
|
* overridden by own values (if any).
|
|
59
|
-
* - **url** `{object}` - returns a {@link
|
|
59
|
+
* - **url** `{object}` - returns a {@link ng.router.util.type:UrlMatcher UrlMatcher}
|
|
60
60
|
* or `null`.
|
|
61
61
|
* - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is
|
|
62
62
|
* navigable).
|
|
@@ -127,7 +127,7 @@ export declare class StateProvider {
|
|
|
127
127
|
* <a id='template'></a>
|
|
128
128
|
*
|
|
129
129
|
* - **`template`** - {string|function=} - html template as a string or a function that returns
|
|
130
|
-
* an html template as a string which should be used by the
|
|
130
|
+
* an html template as a string which should be used by the ngView directives. This property
|
|
131
131
|
* takes precedence over templateUrl.
|
|
132
132
|
*
|
|
133
133
|
* If `template` is a function, it will be called with the following parameters:
|
|
@@ -138,7 +138,7 @@ export declare class StateProvider {
|
|
|
138
138
|
* <a id='templateUrl'></a>
|
|
139
139
|
*
|
|
140
140
|
* - **`templateUrl`** - {string|function=} - path or function that returns a path to an html
|
|
141
|
-
* template that should be used by
|
|
141
|
+
* template that should be used by ngView.
|
|
142
142
|
*
|
|
143
143
|
* If `templateUrl` is a function, it will be called with the following parameters:
|
|
144
144
|
*
|