zova-module-a-router 5.1.41 → 5.1.43
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/.metadata/component/routerViewEmpty.d.ts +1 -1
- package/dist/.metadata/index.d.ts +19 -19
- package/dist/.metadata/this.d.ts +1 -1
- package/dist/bean/bean.router.d.ts +7 -5
- package/dist/bean/bean.router.d.ts.map +1 -1
- package/dist/bean/bean.routerGuardsBase.d.ts +1 -1
- package/dist/bean/sys.router.d.ts +1 -1
- package/dist/component/routerViewEmpty/controller.d.ts +1 -1
- package/dist/component/routerViewEmpty/controller.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +31 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/routeDiscard.d.ts +3 -0
- package/dist/lib/routeDiscard.d.ts.map +1 -0
- package/dist/lib/routerViewBase.d.ts +2 -2
- package/dist/monkey.d.ts +2 -2
- package/dist/monkeySys.d.ts +1 -1
- package/dist/service/routerGuards.d.ts +2 -2
- package/dist/service/routerGuards.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/pageMeta.d.ts +1 -1
- package/dist/types/routeDiscard.d.ts +23 -0
- package/dist/types/routeDiscard.d.ts.map +1 -0
- package/dist/types/router.d.ts +4 -4
- package/dist/types/router.d.ts.map +1 -1
- package/dist/types/routerView.d.ts +1 -1
- package/package.json +2 -2
- package/src/.metadata/component/routerViewEmpty.ts +1 -1
- package/src/.metadata/index.ts +19 -19
- package/src/.metadata/this.ts +1 -1
- package/src/bean/bean.router.ts +20 -6
- package/src/bean/bean.routerGuardsBase.ts +1 -1
- package/src/bean/sys.router.ts +3 -3
- package/src/component/routerViewEmpty/controller.tsx +2 -2
- package/src/config/config.ts +1 -1
- package/src/index.ts +3 -3
- package/src/lib/index.ts +3 -3
- package/src/lib/routeDiscard.ts +26 -0
- package/src/lib/routerViewBase.tsx +3 -3
- package/src/lib/utils.ts +1 -1
- package/src/monkey.ts +8 -8
- package/src/monkeySys.ts +3 -3
- package/src/service/routerGuards.ts +9 -6
- package/src/types/index.ts +6 -5
- package/src/types/pageMeta.ts +1 -1
- package/src/types/routeDiscard.ts +24 -0
- package/src/types/router.ts +4 -4
- package/src/types/routerView.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ControllerRouterViewEmpty } from '../../component/routerViewEmpty/controller.
|
|
1
|
+
import { ControllerRouterViewEmpty } from '../../component/routerViewEmpty/controller.tsx';
|
|
2
2
|
export type ZRouterViewEmptyProps = {
|
|
3
3
|
controllerRef?: (ref: ControllerRouterViewEmpty) => void;
|
|
4
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** model: begin */
|
|
2
|
-
export * from '../model/pageData.
|
|
3
|
-
import { IModelOptionsPageData } from '../model/pageData.
|
|
2
|
+
export * from '../model/pageData.ts';
|
|
3
|
+
import { IModelOptionsPageData } from '../model/pageData.ts';
|
|
4
4
|
import 'zova-module-a-model';
|
|
5
5
|
declare module 'zova-module-a-model' {
|
|
6
6
|
interface IModelRecord {
|
|
@@ -18,7 +18,7 @@ declare module 'zova-module-a-router' {
|
|
|
18
18
|
}
|
|
19
19
|
/** model: end */
|
|
20
20
|
/** model: begin */
|
|
21
|
-
import type { ModelPageData } from '../model/pageData.
|
|
21
|
+
import type { ModelPageData } from '../model/pageData.ts';
|
|
22
22
|
import 'zova';
|
|
23
23
|
declare module 'zova' {
|
|
24
24
|
interface IBeanRecordGeneral {
|
|
@@ -27,7 +27,7 @@ declare module 'zova' {
|
|
|
27
27
|
}
|
|
28
28
|
/** model: end */
|
|
29
29
|
/** sys: begin */
|
|
30
|
-
export * from '../bean/sys.router.
|
|
30
|
+
export * from '../bean/sys.router.ts';
|
|
31
31
|
import 'zova';
|
|
32
32
|
declare module 'zova' {
|
|
33
33
|
}
|
|
@@ -41,7 +41,7 @@ declare module 'zova-module-a-router' {
|
|
|
41
41
|
}
|
|
42
42
|
/** sys: end */
|
|
43
43
|
/** sys: begin */
|
|
44
|
-
import type { SysRouter } from '../bean/sys.router.
|
|
44
|
+
import type { SysRouter } from '../bean/sys.router.ts';
|
|
45
45
|
import 'zova';
|
|
46
46
|
declare module 'zova' {
|
|
47
47
|
interface IBeanRecordGeneral {
|
|
@@ -50,8 +50,8 @@ declare module 'zova' {
|
|
|
50
50
|
}
|
|
51
51
|
/** sys: end */
|
|
52
52
|
/** bean: begin */
|
|
53
|
-
export * from '../bean/bean.router.
|
|
54
|
-
export * from '../bean/bean.routerGuardsBase.
|
|
53
|
+
export * from '../bean/bean.router.ts';
|
|
54
|
+
export * from '../bean/bean.routerGuardsBase.ts';
|
|
55
55
|
import 'zova';
|
|
56
56
|
declare module 'zova' {
|
|
57
57
|
}
|
|
@@ -65,8 +65,8 @@ declare module 'zova-module-a-router' {
|
|
|
65
65
|
}
|
|
66
66
|
/** bean: end */
|
|
67
67
|
/** bean: begin */
|
|
68
|
-
import type { BeanRouter } from '../bean/bean.router.
|
|
69
|
-
import type { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.
|
|
68
|
+
import type { BeanRouter } from '../bean/bean.router.ts';
|
|
69
|
+
import type { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.ts';
|
|
70
70
|
import 'zova';
|
|
71
71
|
declare module 'zova' {
|
|
72
72
|
interface IBeanRecordGeneral {
|
|
@@ -76,7 +76,7 @@ declare module 'zova' {
|
|
|
76
76
|
}
|
|
77
77
|
/** bean: end */
|
|
78
78
|
/** service: begin */
|
|
79
|
-
export * from '../service/routerGuards.
|
|
79
|
+
export * from '../service/routerGuards.ts';
|
|
80
80
|
import 'zova-module-a-bean';
|
|
81
81
|
declare module 'zova-module-a-bean' {
|
|
82
82
|
interface IServiceRecord {
|
|
@@ -93,7 +93,7 @@ declare module 'zova-module-a-router' {
|
|
|
93
93
|
}
|
|
94
94
|
/** service: end */
|
|
95
95
|
/** service: begin */
|
|
96
|
-
import type { ServiceRouterGuards } from '../service/routerGuards.
|
|
96
|
+
import type { ServiceRouterGuards } from '../service/routerGuards.ts';
|
|
97
97
|
import 'zova';
|
|
98
98
|
declare module 'zova' {
|
|
99
99
|
interface IBeanRecordGeneral {
|
|
@@ -102,7 +102,7 @@ declare module 'zova' {
|
|
|
102
102
|
}
|
|
103
103
|
/** service: end */
|
|
104
104
|
/** controller: begin */
|
|
105
|
-
export * from '../component/routerViewEmpty/controller.
|
|
105
|
+
export * from '../component/routerViewEmpty/controller.tsx';
|
|
106
106
|
import 'zova';
|
|
107
107
|
declare module 'zova' {
|
|
108
108
|
}
|
|
@@ -112,7 +112,7 @@ declare module 'zova-module-a-router' {
|
|
|
112
112
|
}
|
|
113
113
|
/** controller: end */
|
|
114
114
|
/** controller: begin */
|
|
115
|
-
import type { ControllerRouterViewEmpty } from '../component/routerViewEmpty/controller.
|
|
115
|
+
import type { ControllerRouterViewEmpty } from '../component/routerViewEmpty/controller.tsx';
|
|
116
116
|
import 'zova';
|
|
117
117
|
declare module 'zova' {
|
|
118
118
|
interface IBeanRecordLocal {
|
|
@@ -121,8 +121,8 @@ declare module 'zova' {
|
|
|
121
121
|
}
|
|
122
122
|
/** controller: end */
|
|
123
123
|
/** components: begin */
|
|
124
|
-
export * from './component/routerViewEmpty.
|
|
125
|
-
import { ZRouterViewEmpty } from './component/routerViewEmpty.
|
|
124
|
+
export * from './component/routerViewEmpty.ts';
|
|
125
|
+
import { ZRouterViewEmpty } from './component/routerViewEmpty.ts';
|
|
126
126
|
export declare const components: {
|
|
127
127
|
routerViewEmpty: import("vue").DefineSetupFnComponent<import("zova-module-a-router").ZRouterViewEmptyProps, import("vue").EmitsOptions, import("vue").SlotsType<Record<string, any>>, import("zova-module-a-router").ZRouterViewEmptyProps & ({
|
|
128
128
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
@@ -141,14 +141,14 @@ declare module 'zova' {
|
|
|
141
141
|
}
|
|
142
142
|
/** components: end */
|
|
143
143
|
/** config: begin */
|
|
144
|
-
export * from '../config/config.
|
|
145
|
-
import { config } from '../config/config.
|
|
144
|
+
export * from '../config/config.ts';
|
|
145
|
+
import { config } from '../config/config.ts';
|
|
146
146
|
/** config: end */
|
|
147
147
|
/** monkey: begin */
|
|
148
|
-
export * from '../monkey.
|
|
148
|
+
export * from '../monkey.ts';
|
|
149
149
|
/** monkey: end */
|
|
150
150
|
/** monkeySys: begin */
|
|
151
|
-
export * from '../monkeySys.
|
|
151
|
+
export * from '../monkeySys.ts';
|
|
152
152
|
/** monkeySys: end */
|
|
153
153
|
/** scope: begin */
|
|
154
154
|
import { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';
|
package/dist/.metadata/this.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { NavigationGuardWithThis, NavigationHookAfter, RouteLocationNormalizedLoadedGeneric, Router, RouterOptions } from '@cabloy/vue-router';
|
|
2
2
|
import { BeanBase } from 'zova';
|
|
3
|
-
import { BeanRouterViewBase } from '../lib/routerViewBase.
|
|
4
|
-
import { ModelPageData } from '../model/pageData.
|
|
5
|
-
import { IPageMeta } from '../types/pageMeta.
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { BeanRouterViewBase } from '../lib/routerViewBase.tsx';
|
|
4
|
+
import { ModelPageData } from '../model/pageData.ts';
|
|
5
|
+
import { IPageMeta } from '../types/pageMeta.ts';
|
|
6
|
+
import { IRouteDiscardItem, TypeRouteDiscardReason } from '../types/routeDiscard.ts';
|
|
7
|
+
import { TypeErrorListener } from '../types/router.ts';
|
|
8
|
+
import { SysRouter } from './sys.router.ts';
|
|
8
9
|
export interface BeanRouterInitOptions {
|
|
9
10
|
mainRouter?: boolean;
|
|
10
11
|
routerOptions?: RouterOptions;
|
|
@@ -39,6 +40,7 @@ export declare class BeanRouter extends BeanBase {
|
|
|
39
40
|
protected __init__(mainRouterOrOptions?: boolean | BeanRouterInitOptions): Promise<void>;
|
|
40
41
|
addRouterView(routerView: BeanRouterViewBase): void;
|
|
41
42
|
removeRouterView(routerView: BeanRouterViewBase): void;
|
|
43
|
+
notifyRouteDiscard(reason: TypeRouteDiscardReason, items: readonly IRouteDiscardItem[], ownerSelector?: string): Promise<void>;
|
|
42
44
|
afterEachBackRoute(route: RouteLocationNormalizedLoadedGeneric): void;
|
|
43
45
|
afterEachForwardRoute(route: RouteLocationNormalizedLoadedGeneric): void;
|
|
44
46
|
beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bean.router.d.ts","sourceRoot":"","sources":["../../src/bean/bean.router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,oCAAoC,EACpC,MAAM,EACN,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAO,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"bean.router.d.ts","sourceRoot":"","sources":["../../src/bean/bean.router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,mBAAmB,EACnB,oCAAoC,EACpC,MAAM,EACN,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAO,MAAM,MAAM,CAAC;AAKrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,OA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E,uBAAuB,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI;IAIjE,aAAa,CAAC,KAAK,EAAE,uBAAuB,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI;IAIpE,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAIjD,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,IAAI;IAI/C,WAAW,CAAC,KAAK,EAAE,oCAAoC,EAAE,QAAQ,EAAE,SAAS;CAK7E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BeanBase } from 'zova';
|
|
2
|
-
import type { BeanRouter } from './bean.router.
|
|
2
|
+
import type { BeanRouter } from './bean.router.ts';
|
|
3
3
|
export declare class BeanRouterGuardsBase extends BeanBase {
|
|
4
4
|
private _eventRouterGuards;
|
|
5
5
|
protected __init__(): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RouteLocationMatched, RouteLocationNormalizedLoaded, RouteLocationNormalizedLoadedGeneric, RouteLocationResolvedGeneric, Router, RouterOptions } from '@cabloy/vue-router';
|
|
2
2
|
import { BeanBase } from 'zova';
|
|
3
|
-
import { IModuleRouteComponent, IPageNameRecord, IPagePathRecord } from '../types/router.
|
|
3
|
+
import { IModuleRouteComponent, IPageNameRecord, IPagePathRecord } from '../types/router.ts';
|
|
4
4
|
export interface SysRouter extends Router {
|
|
5
5
|
}
|
|
6
6
|
export declare class SysRouter extends BeanBase {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BeanRouterViewBase } from '../../lib/routerViewBase.
|
|
1
|
+
import { BeanRouterViewBase } from '../../lib/routerViewBase.tsx';
|
|
2
2
|
export declare class ControllerRouterViewEmpty extends BeanRouterViewBase {
|
|
3
3
|
protected __init__(): Promise<void>;
|
|
4
4
|
protected render(): import("vue/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/component/routerViewEmpty/controller.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/component/routerViewEmpty/controller.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,qBACa,yBAA0B,SAAQ,kBAAkB;cAC/C,QAAQ;IAExB,SAAS,CAAC,MAAM;CAajB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './.metadata/index.
|
|
2
|
-
export * from './lib/index.
|
|
3
|
-
export * from './types/index.
|
|
1
|
+
export * from './.metadata/index.ts';
|
|
2
|
+
export * from './lib/index.ts';
|
|
3
|
+
export * from './types/index.ts';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -350,6 +350,26 @@ var SysRouter = (_dec$5 = Sys(), _dec2$5 = BeanInfo({ module: "a-router" }), _de
|
|
|
350
350
|
}
|
|
351
351
|
}) || _class$5) || _class$5);
|
|
352
352
|
//#endregion
|
|
353
|
+
//#region src/lib/routeDiscard.ts
|
|
354
|
+
function dispatchRouteDiscard(event, emit, onError) {
|
|
355
|
+
const cleanups = [];
|
|
356
|
+
const items = event.items.map((item) => ({ ...item }));
|
|
357
|
+
try {
|
|
358
|
+
emit({
|
|
359
|
+
...event,
|
|
360
|
+
items,
|
|
361
|
+
waitUntil: (cleanup) => {
|
|
362
|
+
cleanups.push(cleanup);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
} catch (error) {
|
|
366
|
+
onError(error);
|
|
367
|
+
}
|
|
368
|
+
return Promise.allSettled(cleanups).then((results) => {
|
|
369
|
+
for (const result of results) if (result.status === "rejected") onError(result.reason);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
353
373
|
//#region src/lib/routerGuardDisposers.ts
|
|
354
374
|
var RouterGuardDisposers = class {
|
|
355
375
|
constructor() {
|
|
@@ -460,6 +480,14 @@ var BeanRouter = (_dec$4 = Bean(), _dec2$4 = BeanInfo({ module: "a-router" }), _
|
|
|
460
480
|
const index = this._routerViews.findIndex((item) => item === routerView);
|
|
461
481
|
if (index > -1) this._routerViews.splice(index, 1);
|
|
462
482
|
}
|
|
483
|
+
notifyRouteDiscard(reason, items, ownerSelector) {
|
|
484
|
+
return dispatchRouteDiscard({
|
|
485
|
+
router: this,
|
|
486
|
+
reason,
|
|
487
|
+
items,
|
|
488
|
+
ownerSelector
|
|
489
|
+
}, (event) => this.app.meta.event.emitSync("a-router:routeDiscard", event), () => console.error("Route discard cleanup failed"));
|
|
490
|
+
}
|
|
463
491
|
afterEachBackRoute(route) {
|
|
464
492
|
for (const routerView of this._routerViews) if (routerView.backRoute(route)) break;
|
|
465
493
|
}
|
|
@@ -583,7 +611,9 @@ var ServiceRouterGuards = (_dec$2 = Service(), _dec2$2 = BeanInfo({ module: "a-r
|
|
|
583
611
|
}
|
|
584
612
|
_afterEachFrom(router, from, info) {
|
|
585
613
|
if (!info) return;
|
|
586
|
-
|
|
614
|
+
const isBack = info.type === NavigationType.pop && info.direction === NavigationDirection.back;
|
|
615
|
+
if (!(isBack || info.type === NavigationType.push && info.replace)) return;
|
|
616
|
+
if (isBack) router.notifyRouteDiscard("back", [{ fullPath: from.fullPath }]);
|
|
587
617
|
router.afterEachBackRoute(from);
|
|
588
618
|
}
|
|
589
619
|
async _prepareCheck(pathMatched, pathTo) {
|
|
@@ -987,8 +1017,6 @@ function _fixReturnTo(app, returnTo) {
|
|
|
987
1017
|
}
|
|
988
1018
|
//#endregion
|
|
989
1019
|
//#region src/.metadata/index.ts
|
|
990
|
-
/** monkeySys: end */
|
|
991
|
-
/** scope: begin */
|
|
992
1020
|
var _dec;
|
|
993
1021
|
var _dec2;
|
|
994
1022
|
var _class;
|