zova-module-a-router 5.0.39 → 5.0.40
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/package.json +2 -2
- package/src/bean/bean.router.ts +4 -4
- package/src/bean/virtual.router.ts +2 -2
- package/src/monkey.ts +3 -3
- package/src/resource/events.ts +2 -2
- package/src/resource/injects.ts +2 -2
- package/src/types.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-router",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.40",
|
|
4
4
|
"title": "a-router",
|
|
5
5
|
"zovaModule": {
|
|
6
6
|
"capabilities": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"vue-router": "^4.3.2"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "8816955c45f2fc3911d5eebf5b09764f54777123"
|
|
41
41
|
}
|
package/src/bean/bean.router.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { IModuleRoute, IModuleRouteComponent } from '../types.js';
|
|
|
5
5
|
|
|
6
6
|
const SymbolRouter = Symbol('SymbolRouter');
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export interface BeanRouter extends Router {}
|
|
9
9
|
|
|
10
10
|
@Bean()
|
|
11
11
|
export class BeanRouter extends BeanBase {
|
|
@@ -27,8 +27,8 @@ export class BeanRouter extends BeanBase {
|
|
|
27
27
|
if (!router) {
|
|
28
28
|
throw new Error('Should provide router');
|
|
29
29
|
}
|
|
30
|
-
this.app.vue.provide('a-router:router',
|
|
31
|
-
this.bean.provide('a-router:router',
|
|
30
|
+
this.app.vue.provide('a-router:router', this);
|
|
31
|
+
this.bean.provide('a-router:router', this);
|
|
32
32
|
// event
|
|
33
33
|
this.eventRouterGuards = this.app.meta.event.on('a-router:routerGuards', async (context, next) => {
|
|
34
34
|
this._routerGuards(context.data);
|
|
@@ -99,7 +99,7 @@ export class BeanRouter extends BeanBase {
|
|
|
99
99
|
return `${fullPath}${join}${query2str}`;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
private _routerGuards(router:
|
|
102
|
+
private _routerGuards(router: BeanRouter) {
|
|
103
103
|
router.beforeEach(async to => {
|
|
104
104
|
// fullPath
|
|
105
105
|
const fullPath = to.fullPath;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BeanBase, TypeEventOff, Virtual } from 'zova';
|
|
2
|
-
import {
|
|
2
|
+
import { BeanRouter } from './bean.router.js';
|
|
3
3
|
|
|
4
4
|
@Virtual()
|
|
5
5
|
export class BeanRouterBase<TScopeModule = unknown> extends BeanBase<TScopeModule> {
|
|
@@ -18,5 +18,5 @@ export class BeanRouterBase<TScopeModule = unknown> extends BeanBase<TScopeModul
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
protected onRouterGuards(_router:
|
|
21
|
+
protected onRouterGuards(_router: BeanRouter) {}
|
|
22
22
|
}
|
package/src/monkey.ts
CHANGED
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
} from 'zova';
|
|
14
14
|
import * as ModuleInfo from '@cabloy/module-info';
|
|
15
15
|
import { useRoute } from 'vue-router';
|
|
16
|
-
import {
|
|
16
|
+
import { BeanRouter } from './bean/bean.router.js';
|
|
17
17
|
|
|
18
18
|
export class Monkey extends BeanSimple implements IMonkeySystem, IMonkeyModule, IMonkeyController {
|
|
19
|
-
private _beanRouter:
|
|
19
|
+
private _beanRouter: BeanRouter;
|
|
20
20
|
private _moduleSelf: IModule;
|
|
21
21
|
|
|
22
22
|
constructor(moduleSelf: IModule) {
|
|
@@ -26,7 +26,7 @@ export class Monkey extends BeanSimple implements IMonkeySystem, IMonkeyModule,
|
|
|
26
26
|
|
|
27
27
|
async getBeanRouter() {
|
|
28
28
|
if (!this._beanRouter) {
|
|
29
|
-
this._beanRouter = (await this.bean._getBean('a-router.bean.router', false)) as
|
|
29
|
+
this._beanRouter = (await this.bean._getBean('a-router.bean.router', false)) as BeanRouter;
|
|
30
30
|
}
|
|
31
31
|
return this._beanRouter;
|
|
32
32
|
}
|
package/src/resource/events.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BeanRouter } from './beans.js';
|
|
2
2
|
|
|
3
3
|
import 'zova';
|
|
4
4
|
declare module 'zova' {
|
|
5
5
|
export interface IEventRecord {
|
|
6
|
-
'a-router:routerGuards':
|
|
6
|
+
'a-router:routerGuards': BeanRouter;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface IEventResultRecord {
|
package/src/resource/injects.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Router } from 'vue-router';
|
|
2
|
-
import {
|
|
2
|
+
import { BeanRouter } from '../bean/bean.router.js';
|
|
3
3
|
|
|
4
4
|
import 'zova';
|
|
5
5
|
declare module 'zova' {
|
|
6
6
|
export interface IInjectRecord {
|
|
7
7
|
'a-router:appRouter': Router;
|
|
8
|
-
'a-router:router':
|
|
8
|
+
'a-router:router': BeanRouter;
|
|
9
9
|
}
|
|
10
10
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IComponentLayoutRecord, TypePageSchemas } from 'zova';
|
|
2
2
|
import { RouteComponent, RouteLocationNormalizedLoaded, RouteRecordRaw } from 'vue-router';
|
|
3
|
-
import {
|
|
3
|
+
import { BeanRouter } from './bean/bean.router.js';
|
|
4
4
|
|
|
5
5
|
export type Lazy<T> = () => Promise<T>;
|
|
6
6
|
export type IModuleRouteComponent = RouteComponent | Lazy<RouteComponent>;
|
|
@@ -17,7 +17,7 @@ declare module 'vue-router' {
|
|
|
17
17
|
|
|
18
18
|
declare module 'zova' {
|
|
19
19
|
export interface BeanBase {
|
|
20
|
-
$router:
|
|
20
|
+
$router: BeanRouter;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface IModuleResource {
|