@angular-wave/angular.ts 0.0.24 → 0.0.25
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/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/package.json +1 -1
- package/src/router/index.js +1 -1
- package/src/router/location-services.js +3 -27
- package/src/router/router.js +3 -1
- package/src/router/services.js +22 -1
- package/src/router/state/state-service.js +1 -0
- package/src/router/transition/transition-service.js +2 -36
- package/src/router/transition/transition.js +1 -32
- package/src/router/url/url-router.js +0 -4
- package/src/router/url/url-rules.js +0 -1
- package/src/router/url/url-service.js +4 -0
- package/src/router/view/view.js +1 -5
- package/src/shared/common.js +0 -2
package/package.json
CHANGED
package/src/router/index.js
CHANGED
|
@@ -14,36 +14,12 @@ export class Ng1LocationServices {
|
|
|
14
14
|
constructor($locationProvider) {
|
|
15
15
|
// .onChange() registry
|
|
16
16
|
this._urlListeners = [];
|
|
17
|
-
/** @type {angular.ILocationProvider} */
|
|
18
|
-
|
|
17
|
+
/** @type {angular.ILocationProvider} */
|
|
18
|
+
this.$locationProvider = $locationProvider;
|
|
19
19
|
const _lp = val($locationProvider);
|
|
20
20
|
createProxyFunctions(_lp, this, _lp, ["hashPrefix"]);
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
* Applys ng1-specific path parameter encoding
|
|
24
|
-
*
|
|
25
|
-
* The Angular 1 `$location` service is a bit weird.
|
|
26
|
-
* It doesn't allow slashes to be encoded/decoded bi-directionally.
|
|
27
|
-
*
|
|
28
|
-
* See the writeup at https://github.com/angular-ui/ui-router/issues/2598
|
|
29
|
-
*
|
|
30
|
-
* This code patches the `path` parameter type so it encoded/decodes slashes as ~2F
|
|
31
|
-
*
|
|
32
|
-
* @param router
|
|
33
|
-
*/
|
|
34
|
-
static monkeyPatchPathParameterType(router) {
|
|
35
|
-
const pathType = router.urlMatcherFactory.type("path");
|
|
36
|
-
pathType.encode = (x) =>
|
|
37
|
-
x != null
|
|
38
|
-
? x.toString().replace(/(~|\/)/g, (m) => ({ "~": "~~", "/": "~2F" })[m])
|
|
39
|
-
: x;
|
|
40
|
-
pathType.decode = (x) =>
|
|
41
|
-
x != null
|
|
42
|
-
? x
|
|
43
|
-
.toString()
|
|
44
|
-
.replace(/(~~|~2F)/g, (m) => ({ "~~": "~", "~2F": "/" })[m])
|
|
45
|
-
: x;
|
|
46
|
-
}
|
|
22
|
+
|
|
47
23
|
dispose() {}
|
|
48
24
|
|
|
49
25
|
onChange(callback) {
|
package/src/router/router.js
CHANGED
package/src/router/services.js
CHANGED
|
@@ -19,6 +19,7 @@ import { StateProvider } from "./state-provider";
|
|
|
19
19
|
import { Ng1LocationServices } from "./location-services";
|
|
20
20
|
import { ResolveContext } from "./resolve/resolve-context";
|
|
21
21
|
|
|
22
|
+
/** @type {angular.UIRouter}} */
|
|
22
23
|
export let router = null;
|
|
23
24
|
$routerProvider.$inject = ["$locationProvider"];
|
|
24
25
|
/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */
|
|
@@ -42,7 +43,27 @@ export function $routerProvider($locationProvider) {
|
|
|
42
43
|
// Disable decoding of params by UrlMatcherFactory because $location already handles this
|
|
43
44
|
router.urlService.config._decodeParams = false;
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Applys ng1-specific path parameter encoding
|
|
48
|
+
*
|
|
49
|
+
* The Angular 1 `$location` service is a bit weird.
|
|
50
|
+
* It doesn't allow slashes to be encoded/decoded bi-directionally.
|
|
51
|
+
*
|
|
52
|
+
* See the writeup at https://github.com/angular-ui/ui-router/issues/2598
|
|
53
|
+
*
|
|
54
|
+
* This code patches the `path` parameter type so it encoded/decodes slashes as ~2F
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
const pathType = router.urlMatcherFactory.type("path");
|
|
58
|
+
pathType.encode = (x) =>
|
|
59
|
+
x != null
|
|
60
|
+
? x.toString().replace(/(~|\/)/g, (m) => ({ "~": "~~", "/": "~2F" })[m])
|
|
61
|
+
: x;
|
|
62
|
+
pathType.decode = (x) =>
|
|
63
|
+
x != null
|
|
64
|
+
? x.toString().replace(/(~~|~2F)/g, (m) => ({ "~~": "~", "~2F": "/" })[m])
|
|
65
|
+
: x;
|
|
66
|
+
|
|
46
67
|
// backwards compat: also expose router instance as $routerProvider.router
|
|
47
68
|
router["router"] = router;
|
|
48
69
|
router["$get"] = $get;
|
|
@@ -109,46 +109,12 @@ export class TransitionService {
|
|
|
109
109
|
* @param options the registration options
|
|
110
110
|
* @returns a function which deregisters the hook.
|
|
111
111
|
*/
|
|
112
|
-
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
/** @inheritdoc */
|
|
116
|
-
onBefore(criteria, callback, options) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
/** @inheritdoc */
|
|
120
|
-
onStart(criteria, callback, options) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
/** @inheritdoc */
|
|
124
|
-
onExit(criteria, callback, options) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
/** @inheritdoc */
|
|
128
|
-
onRetain(criteria, callback, options) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
/** @inheritdoc */
|
|
132
|
-
onEnter(criteria, callback, options) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
/** @inheritdoc */
|
|
136
|
-
onFinish(criteria, callback, options) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
/** @inheritdoc */
|
|
140
|
-
onSuccess(criteria, callback, options) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
/** @inheritdoc */
|
|
144
|
-
onError(criteria, callback, options) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
112
|
+
|
|
147
113
|
/**
|
|
148
114
|
* dispose
|
|
149
115
|
* @internal
|
|
150
116
|
*/
|
|
151
|
-
dispose(
|
|
117
|
+
dispose() {
|
|
152
118
|
Object.values(this._registeredHooks).forEach((hooksArray) =>
|
|
153
119
|
hooksArray.forEach((hook) => {
|
|
154
120
|
hook._deregistered = true;
|
|
@@ -35,38 +35,7 @@ const stateSelf = prop("self");
|
|
|
35
35
|
* It has information about all states being entered and exited as a result of the transition.
|
|
36
36
|
*/
|
|
37
37
|
export class Transition {
|
|
38
|
-
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
/** @inheritdoc */
|
|
42
|
-
onStart(criteria, callback, options) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
/** @inheritdoc */
|
|
46
|
-
onExit(criteria, callback, options) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
/** @inheritdoc */
|
|
50
|
-
onRetain(criteria, callback, options) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
/** @inheritdoc */
|
|
54
|
-
onEnter(criteria, callback, options) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
/** @inheritdoc */
|
|
58
|
-
onFinish(criteria, callback, options) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
/** @inheritdoc */
|
|
62
|
-
onSuccess(criteria, callback, options) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
/** @inheritdoc */
|
|
66
|
-
onError(criteria, callback, options) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
/** @internal
|
|
38
|
+
/**
|
|
70
39
|
* Creates the transition-level hook registration functions
|
|
71
40
|
* (which can then be used to register hooks)
|
|
72
41
|
*/
|
|
@@ -84,8 +84,4 @@ export class UrlRouter {
|
|
|
84
84
|
const port = cfgPort === 80 || cfgPort === 443 ? "" : ":" + cfgPort;
|
|
85
85
|
return [cfg.protocol(), "://", cfg.host(), port, slash, url].join("");
|
|
86
86
|
}
|
|
87
|
-
/** @deprecated use [[UrlService.interceptDeferred]]*/
|
|
88
|
-
get interceptDeferred() {
|
|
89
|
-
return this.router.urlService.interceptDeferred;
|
|
90
|
-
}
|
|
91
87
|
}
|
|
@@ -16,17 +16,21 @@ export class UrlService {
|
|
|
16
16
|
* @type {import('../router').UIRouter}
|
|
17
17
|
*/
|
|
18
18
|
this.router = router;
|
|
19
|
+
|
|
20
|
+
/** @type {boolean} */
|
|
19
21
|
this.interceptDeferred = false;
|
|
20
22
|
/**
|
|
21
23
|
* The nested [[UrlRules]] API for managing URL rules and rewrites
|
|
22
24
|
*
|
|
23
25
|
* See: [[UrlRules]] for details
|
|
26
|
+
* @type {UrlRules}
|
|
24
27
|
*/
|
|
25
28
|
this.rules = new UrlRules(this.router);
|
|
26
29
|
/**
|
|
27
30
|
* The nested [[UrlConfig]] API to configure the URL and retrieve URL information
|
|
28
31
|
*
|
|
29
32
|
* See: [[UrlConfig]] for details
|
|
33
|
+
* @type {UrlConfig}
|
|
30
34
|
*/
|
|
31
35
|
this.config = new UrlConfig(this.router);
|
|
32
36
|
// Delegate these calls to the current LocationServices implementation
|
package/src/router/view/view.js
CHANGED
|
@@ -29,10 +29,6 @@ export class ViewService {
|
|
|
29
29
|
* @param {import('../router').UIRouter} router
|
|
30
30
|
*/
|
|
31
31
|
constructor(router) {
|
|
32
|
-
/**
|
|
33
|
-
* @type {import('../router').UIRouter}
|
|
34
|
-
*/
|
|
35
|
-
this.router = router;
|
|
36
32
|
this._uiViews = [];
|
|
37
33
|
this._viewConfigs = [];
|
|
38
34
|
this._viewConfigFactories = {};
|
|
@@ -41,7 +37,7 @@ export class ViewService {
|
|
|
41
37
|
_rootViewContext: this._rootViewContext.bind(this),
|
|
42
38
|
_viewConfigFactory: this._viewConfigFactory.bind(this),
|
|
43
39
|
_registeredUIView: (id) =>
|
|
44
|
-
find(this._uiViews, (view) => `${
|
|
40
|
+
find(this._uiViews, (view) => `${router.$id}.${view.id}` === id),
|
|
45
41
|
_registeredUIViews: () => this._uiViews,
|
|
46
42
|
_activeViewConfigs: () => this._viewConfigs,
|
|
47
43
|
_onSync: (listener) => {
|
package/src/shared/common.js
CHANGED