zova-module-a-router 5.1.22 → 5.1.26
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/bean/sys.router.d.ts +2 -1
- package/dist/bean/sys.router.d.ts.map +1 -1
- package/dist/index.js +30 -7
- package/dist/index.js.map +1 -1
- package/dist/monkeySys.d.ts.map +1 -1
- package/dist/types/router.d.ts +1 -0
- package/dist/types/router.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/bean/sys.router.ts +28 -6
- package/src/monkeySys.ts +15 -3
- package/src/types/router.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RouteLocationMatched, RouteLocationNormalizedLoaded, RouteLocationResolvedGeneric, Router, RouterOptions } from '@cabloy/vue-router';
|
|
1
|
+
import type { RouteLocationMatched, RouteLocationNormalizedLoaded, RouteLocationNormalizedLoadedGeneric, RouteLocationResolvedGeneric, Router, RouterOptions } from '@cabloy/vue-router';
|
|
2
2
|
import { BeanBase } from 'zova';
|
|
3
3
|
import { IModuleRouteComponent, IPageNameRecord, IPagePathRecord } from '../types/router.js';
|
|
4
4
|
export interface SysRouter extends Router {
|
|
@@ -16,6 +16,7 @@ export declare class SysRouter extends BeanBase {
|
|
|
16
16
|
name?: string;
|
|
17
17
|
path?: string | null | undefined;
|
|
18
18
|
} | string | null | undefined): boolean;
|
|
19
|
+
checkActiveOfFullPath(fullPath: string, currentRoute?: RouteLocationNormalizedLoadedGeneric): boolean;
|
|
19
20
|
ensureRoute(pagePath: string): Promise<RouteLocationResolvedGeneric>;
|
|
20
21
|
getRouteMatched(route: RouteLocationNormalizedLoaded): RouteLocationMatched | undefined;
|
|
21
22
|
getRealRouteName(name?: string | symbol | null): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sys.router.d.ts","sourceRoot":"","sources":["../../src/bean/sys.router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA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Sys(), _dec2$5 = BeanInfo({ module: "a-router" }), _de
|
|
|
123
123
|
getPagePath(path, options, absolute) {
|
|
124
124
|
const query = options?.query;
|
|
125
125
|
let params = options?.params;
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
const paramsLocale = cast(params)?.locale;
|
|
127
|
+
if (paramsLocale !== void 0) {
|
|
128
|
+
const localeCurrent = paramsLocale === true ? this.app.meta.locale.current : paramsLocale;
|
|
129
|
+
const locale = localeCurrent === this.sys.config.locale.default ? void 0 : localeCurrent;
|
|
128
130
|
params = Object.assign({}, params, { locale });
|
|
129
131
|
}
|
|
130
132
|
const pagePath = combineParamsAndQuery(path, {
|
|
@@ -153,6 +155,18 @@ var SysRouter = (_dec$5 = Sys(), _dec2$5 = BeanInfo({ module: "a-router" }), _de
|
|
|
153
155
|
if (!moduleName) return true;
|
|
154
156
|
return this.sys.meta.module.exists(moduleName);
|
|
155
157
|
}
|
|
158
|
+
checkActiveOfFullPath(fullPath, currentRoute) {
|
|
159
|
+
if (!currentRoute) currentRoute = getCurrentRoute(this.ctx)?.value;
|
|
160
|
+
if (!currentRoute) return false;
|
|
161
|
+
if (currentRoute.fullPath === fullPath) return true;
|
|
162
|
+
if (!currentRoute.matched || currentRoute.matched.length === 0) return false;
|
|
163
|
+
return currentRoute.matched.some((routeAlias) => {
|
|
164
|
+
return this.getPagePath(routeAlias.path, {
|
|
165
|
+
params: currentRoute.params,
|
|
166
|
+
query: currentRoute.query
|
|
167
|
+
}) === fullPath;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
156
170
|
async ensureRoute(pagePath) {
|
|
157
171
|
let route = this._vueRouterSys.resolve(pagePath);
|
|
158
172
|
if (route && route.name !== "$:/:catchAll(.*)*") return route;
|
|
@@ -414,12 +428,12 @@ var BeanRouterGuardsBase = (_dec$3 = Bean(), _dec2$3 = Virtual(), _dec3 = BeanIn
|
|
|
414
428
|
}) || _class$3) || _class$3) || _class$3);
|
|
415
429
|
//#endregion
|
|
416
430
|
//#region src/types/router.ts
|
|
417
|
-
var NavigationType =
|
|
431
|
+
var NavigationType = /*#__PURE__*/ function(NavigationType) {
|
|
418
432
|
NavigationType["pop"] = "pop";
|
|
419
433
|
NavigationType["push"] = "push";
|
|
420
434
|
return NavigationType;
|
|
421
435
|
}({});
|
|
422
|
-
var NavigationDirection =
|
|
436
|
+
var NavigationDirection = /*#__PURE__*/ function(NavigationDirection) {
|
|
423
437
|
NavigationDirection["back"] = "back";
|
|
424
438
|
NavigationDirection["forward"] = "forward";
|
|
425
439
|
NavigationDirection["unknown"] = "";
|
|
@@ -726,7 +740,7 @@ var MonkeySys = class extends BeanSimple {
|
|
|
726
740
|
const query = options?.query ?? {};
|
|
727
741
|
if (options?.returnTo) {
|
|
728
742
|
const returnTo = typeof options?.returnTo === "string" ? options?.returnTo : app.$getCurrentPagePath();
|
|
729
|
-
if (returnTo !== app
|
|
743
|
+
if (returnTo !== app.$getPagePathHome()) query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;
|
|
730
744
|
}
|
|
731
745
|
pagePath = app.meta.$router.getPagePath(pagePath, {
|
|
732
746
|
params: options?.params,
|
|
@@ -737,7 +751,11 @@ var MonkeySys = class extends BeanSimple {
|
|
|
737
751
|
else return app.meta.$router[options?.replace ? "replace" : "push"](pagePath);
|
|
738
752
|
};
|
|
739
753
|
app.$gotoHome = (options) => {
|
|
740
|
-
|
|
754
|
+
const pagePath = app.$getPagePathHome(options);
|
|
755
|
+
return app.$gotoPage(pagePath, {
|
|
756
|
+
...options,
|
|
757
|
+
params: void 0
|
|
758
|
+
});
|
|
741
759
|
};
|
|
742
760
|
app.$gotoLogin = (returnTo, cause) => {
|
|
743
761
|
if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN) return;
|
|
@@ -754,12 +772,17 @@ var MonkeySys = class extends BeanSimple {
|
|
|
754
772
|
return app.$gotoPage(pagePath, { replace: true });
|
|
755
773
|
};
|
|
756
774
|
app.$getReturnTo = (returnTo) => {
|
|
757
|
-
return returnTo || cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] || app
|
|
775
|
+
return returnTo || cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] || app.$getPagePathHome();
|
|
758
776
|
};
|
|
759
777
|
app.$getCurrentPagePath = () => {
|
|
760
778
|
if (process.env.SERVER) return app.ctx.meta.$ssr.state.pagePathFull ?? app.sys.util.getPagePathFromAbsoluteUrl(app.ctx.meta.$ssr.context.req.url);
|
|
761
779
|
return cast(app.meta.$router.currentRoute)?.fullPath;
|
|
762
780
|
};
|
|
781
|
+
app.$getPagePathHome = (options) => {
|
|
782
|
+
let params = options?.params;
|
|
783
|
+
if (params?.locale === void 0) params = Object.assign({}, params, { locale: true });
|
|
784
|
+
return app.meta.$router.getPagePath(app.sys.env.ROUTER_PAGE_HOME, { params });
|
|
785
|
+
};
|
|
763
786
|
}
|
|
764
787
|
};
|
|
765
788
|
//#endregion
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["RouterView","h","KeepAlive","Transition","BeanControllerBase","cast","pageRouteKey","routerViewKey","BeanRouterViewBase","__init__","bean","_setBean","$router","addRouterView","__dispose__","removeRouterView","backRoute","_route","forwardRoute","setPageMeta","_pageMeta","prepareRouteMeta","Error","getKeepAliveInclude","render","slots","default","component","routeMeta","route","vnode","Component","key","componentKey","zovaHostProviders","include","_createVNode","RouterView","h","cast","Controller","pageRouteKey","BeanRouterViewBase","ControllerRouterViewEmpty","_dec","_dec2","__z_BeanInfo","module","_class","__init__","render","slots","default","component","vnode","Component","zovaHostProviders","route","_createVNode"],"sources":["../src/model/pageData.ts","../src/lib/const.ts","../src/lib/utils.ts","../src/types/utils.ts","../src/bean/sys.router.ts","../src/bean/bean.router.ts","../src/bean/bean.routerGuardsBase.ts","../src/types/router.ts","../src/service/routerGuards.ts","../src/lib/routerViewBase.tsx","../src/component/routerViewEmpty/controller.tsx","../src/.metadata/component/routerViewEmpty.ts","../src/config/config.ts","../src/monkey.ts","../src/monkeySys.ts","../src/.metadata/index.ts"],"sourcesContent":["import type { IDecoratorModelOptions } from 'zova-module-a-model';\n\nimport { BeanModelBase, Model } from 'zova-module-a-model';\n\nexport interface IModelOptionsPageData extends IDecoratorModelOptions {}\n\n@Model<IModelOptionsPageData>()\nexport class ModelPageData<PAGEDATA = unknown> extends BeanModelBase {\n protected _pageDataInner: any;\n public current: PAGEDATA | undefined;\n\n protected async __init__() {\n if (process.env.SERVER) {\n const pagePath = this.$ssr.state.pagePath;\n if (pagePath) {\n this._pageDataInner = this.getPageData(pagePath);\n this._pageDataInner = this.$ssr.state.pageData;\n this.current = this._pageDataInner;\n }\n } else {\n if (this.$ssr.isRuntimeSsrPreHydration) {\n this.current = this.$ssr.state.pageData as PAGEDATA;\n } else {\n const route = this.$pageRoute;\n this.current = route ? this.getPageData(route.path) : undefined;\n }\n }\n }\n\n getPageData(pagePath: string): PAGEDATA {\n return this.$useStateMem({ queryKey: ['pageData', pagePath] });\n }\n}\n","export const pageRouteKey = '$$pageRoute';\nexport const routerViewKey = '$$routerView';\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouterScrollBehavior,\n} from '@cabloy/vue-router';\nimport type { Ref } from 'vue';\nimport type { ZovaContext } from 'zova';\n\nimport { routerViewLocationKey } from '@cabloy/vue-router';\nimport { inject } from 'vue';\n\nimport { pageRouteKey } from './const.js';\n\nexport function getRouteMatched(\n route: RouteLocationNormalizedLoaded,\n): RouteLocationMatched | undefined {\n let match = route.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = route.matched[route.matched.length - 1];\n }\n return match;\n}\n\nexport function getRealRouteName(name?: string | symbol | null): string | undefined {\n if (!name) return undefined;\n name = String(name);\n if (name.startsWith('$:')) return undefined;\n return name;\n}\n\nexport function isRouterName(name?: string | null | undefined): boolean {\n return !!name && name.includes(':') && !name.includes('/');\n}\n\nexport function getPageRoute(ctx: ZovaContext): RouteLocationNormalizedLoadedGeneric | undefined {\n const route = ctx.bean._getBeanFromHost({ name: pageRouteKey });\n return route as RouteLocationNormalizedLoadedGeneric | undefined;\n}\n\nexport function getCurrentRoute(\n ctx: ZovaContext,\n): Ref<RouteLocationNormalizedLoadedGeneric> | undefined {\n const route = ctx.util.instanceScope(() => {\n return inject(routerViewLocationKey);\n });\n return route;\n}\n\nexport const scrollBehavior: RouterScrollBehavior = (to, _from, savedPosition) => {\n if (savedPosition) {\n return new Promise(resolve => {\n setTimeout(() => {\n // savedPosition = Object.assign({}, savedPosition, { behavior: 'smooth' });\n resolve(savedPosition);\n }, 100);\n });\n } else if (to.hash) {\n return new Promise(resolve => {\n setTimeout(() => {\n // resolve({ el: to.hash, behavior: 'smooth' });\n resolve({ el: to.hash });\n }, 200);\n });\n } else {\n return { left: 0, top: 0 };\n }\n};\n","import { IParamsAndQuery } from '@cabloy/utils';\n\nexport const SymbolRouterHistory = Symbol('SymbolRouterHistory');\n\nexport interface IGotoPageOptions extends IParamsAndQuery {\n returnTo?: string | boolean;\n forceRedirect?: boolean;\n replace?: boolean;\n}\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoaded,\n RouteLocationResolvedGeneric,\n Router,\n RouterOptions,\n} from '@cabloy/vue-router';\n\nimport { IModule } from '@cabloy/module-info';\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { combineParamsAndQuery } from '@cabloy/utils';\nimport {\n createMemoryHistory,\n createRouter,\n createWebHashHistory,\n createWebHistory,\n} from '@cabloy/vue-router';\nimport { BeanBase, cast, deepExtend } from 'zova';\nimport { Sys } from 'zova-module-a-bean';\n\nimport { getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';\nimport {\n IModuleRoute,\n IModuleRouteComponent,\n IPageNameRecord,\n IPagePathRecord,\n} from '../types/router.js';\nimport { SymbolRouterHistory } from '../types/utils.js';\n\nexport interface SysRouter extends Router {}\n\n@Sys()\nexport class SysRouter extends BeanBase {\n private _vueRouterSys: Router;\n\n get router(): Router {\n return this._vueRouterSys;\n }\n\n protected __get__(prop: string) {\n return this._vueRouterSys && this._vueRouterSys[prop];\n }\n\n protected async __init__() {\n // create router\n this._vueRouterSys = this.createRouter();\n // config.routes\n this._loadConfigRoutes();\n // legacy routes\n this._loadLegacyRoutes();\n }\n\n public createRouter(options?: RouterOptions) {\n options = Object.assign({}, options);\n // matcher\n if (!options.matcher) {\n options.matcher = this._vueRouterSys?.matcher;\n }\n // routes\n if (!options.routes) {\n if (!this._vueRouterSys) {\n options.routes = [];\n }\n }\n // scrollBehavior\n if (!options.scrollBehavior) {\n options.scrollBehavior = this.scope.config.scrollBehavior;\n }\n // history\n if (!options.history) {\n const createHistory = process.env.SERVER\n ? createMemoryHistory\n : this.sys.env.ROUTER_MODE === 'history'\n ? createWebHistory\n : createWebHashHistory;\n const routeBase =\n process.env.SERVER || this.sys.env.ROUTER_MODE === 'history'\n ? this.sys.env.APP_PUBLIC_PATH\n : undefined;\n options.history = createHistory(routeBase);\n }\n // create\n const router = createRouter(options);\n cast(router).__hasDevtools = true;\n router[SymbolRouterHistory] = options.history;\n return router;\n }\n\n public createAsyncComponent(component: string | IModuleRouteComponent) {\n if (typeof component !== 'string') return component;\n return this.sys.meta.component.createAsyncComponent(component);\n }\n\n public getPagePath<K extends keyof IPagePathRecord>(\n path: K,\n options?: IPagePathRecord[K],\n absolute?: boolean,\n ) {\n const query = options?.query;\n let params = options?.params;\n if (cast(params)?.locale === true) {\n const locale =\n this.app.meta.locale.current === this.sys.config.locale.default\n ? undefined\n : this.app.meta.locale.current;\n params = Object.assign({}, params, { locale });\n }\n const pagePath = combineParamsAndQuery(path, { params, query });\n return absolute ? this.sys.util.getAbsoluteUrlFromPagePath(pagePath) : pagePath;\n }\n\n public async resolveRoute(\n url: string,\n check404?: boolean,\n checkAliasOf?: boolean,\n ): Promise<RouteLocationResolvedGeneric | undefined> {\n const pagePath = this.sys.util.getPagePathFromAbsoluteUrl(url);\n let route = await this.ensureRoute(pagePath);\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n // aliasOf\n if (checkAliasOf) {\n const matchItem = route.matched.find(item => item.aliasOf);\n if (matchItem) {\n route = matchItem.aliasOf as unknown as RouteLocationResolvedGeneric;\n }\n // 404\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n }\n // ok\n return route;\n }\n\n public checkPathValid(\n to?: { name?: string; path?: string | null | undefined } | string | null | undefined,\n ): boolean {\n const _name = to && typeof to === 'object' ? to.name : undefined;\n const _path = to && typeof to === 'object' ? (to.name ?? to.path) : to;\n // legacy\n if (this._findLegacyRoute(_name, _path)) return true;\n // general check\n if (!_path) return true;\n const moduleName = ModuleInfo.parseName(_path);\n if (!moduleName) return true;\n return this.sys.meta.module.exists(moduleName);\n }\n\n public async ensureRoute(pagePath: string) {\n // try to resolve, support alias route\n let route = this._vueRouterSys.resolve(pagePath);\n if (route && route.name !== '$:/:catchAll(.*)*') return route;\n // try to load module\n const moduleName = ModuleInfo.parseName(pagePath);\n if (moduleName) {\n if (this.sys.meta.module.exists(moduleName)) {\n const module = this.sys.meta.module.get(moduleName);\n if (!module) {\n await this.sys.meta.module.use(moduleName);\n // try to resolve again\n route = this._vueRouterSys.resolve(pagePath);\n }\n }\n }\n return route;\n }\n\n /** @internal */\n public _registerRoutes(module: IModule) {\n if (!module.resource.routes) return;\n for (const route of module.resource.routes) {\n this._registerRoute(route, module);\n }\n }\n\n /** @internal */\n public _findConfigRoute(\n name: string | symbol | null | undefined,\n path: string | undefined,\n ): IModuleRoute | undefined {\n name = this.getRealRouteName(name);\n return name ? this.sys.config.routes.name[name] : this.sys.config.routes.path[path!];\n }\n\n /** @internal */\n public _findLegacyRoute(\n name: string | symbol | null | undefined,\n path: string | null | undefined,\n ): IModuleRoute | undefined {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n name = this.getRealRouteName(name);\n return legacyRoutes.find(item => {\n return name ? item.name === name : item.path === path;\n });\n }\n\n getRouteMatched(route: RouteLocationNormalizedLoaded): RouteLocationMatched | undefined {\n return getRouteMatched(route);\n }\n\n getRealRouteName(name?: string | symbol | null): string | undefined {\n return getRealRouteName(name);\n }\n\n isRouterName(name?: string | null | undefined): boolean {\n return isRouterName(name);\n }\n\n resolveName<K extends keyof IPageNameRecord>(name: K, options?: IPageNameRecord[K]): string {\n const params = cast(options)?.params;\n const query = cast(options)?.query;\n return this._resolveNameOrPath(query, query => {\n const route = this.router.resolve({ name, params, query });\n return route.fullPath;\n });\n }\n\n private _resolveNameOrPath(query, fn) {\n const query1 = {};\n const query2: any = [];\n if (query) {\n for (const key in query) {\n const value = query[key];\n if (value && typeof value === 'object') {\n query2.push([key, value]);\n } else {\n query1[key] = value;\n }\n }\n }\n // resolve\n const fullPath = fn(query1);\n // query2\n const query2str = query2\n .map(([key, value]) => {\n return `${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`;\n })\n .join('&');\n // join\n if (!query2str) return fullPath;\n const join = Object.keys(query1).length > 0 ? '&' : '?';\n return `${fullPath}${join}${query2str}`;\n }\n\n private _loadConfigRoutes() {\n const routesPath = this.sys.config.routes.path;\n for (const key in routesPath) {\n const route = routesPath[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: key, name: `$:${key}` });\n }\n const routesName = this.sys.config.routes.name;\n for (const key in routesName) {\n const route = routesName[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: route.path || (route.alias as string), name: key });\n }\n }\n\n private _loadLegacyRoutes() {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n for (const route of legacyRoutes) {\n this._registerRoute(route);\n }\n }\n\n private _loadConfigRoute(route: IModuleRoute) {\n this.router.addRoute(route);\n }\n\n private _registerRoute(route: IModuleRoute, module?: IModule) {\n // path\n let path: string | undefined;\n if (route.path !== undefined) {\n if (!module || route.meta?.absolute === true) {\n path = route.path;\n } else {\n path = route.path\n ? `/${module.info.pid}/${module.info.name}/${route.path}`\n : `/${module.info.pid}/${module.info.name}`;\n }\n }\n // name\n let name: string | undefined;\n if (route.name) {\n if (!module || route.meta?.absolute === true) {\n name = String(route.name);\n } else {\n name = `${module.info.relativeName}:${String(route.name)}`;\n }\n }\n // config route\n const configRoute = name\n ? this.sys.config.routes.name[name]\n : this.sys.config.routes.path[path!];\n if (configRoute) {\n route = deepExtend({}, route, configRoute);\n }\n // name alias\n if (name && configRoute?.alias) {\n // add extra route\n this.router.addRoute({\n name: `$alias:${name}`,\n path: `/__alias__${configRoute?.alias}`,\n redirect: '',\n });\n }\n // name\n if (!name) {\n name = `$:${path}`;\n }\n // meta\n const meta = route.meta;\n // component\n const component = route.component;\n // layout / routeData\n let layout = meta?.layout;\n let routeData;\n let routeNameParent;\n if (layout === false) {\n routeData = { ...route, name, path, component, meta };\n } else {\n if (layout === undefined || layout === 'default') {\n layout = this.sys.config.layout.component.default;\n } else if (layout === 'empty') {\n layout = this.sys.config.layout.component.empty;\n }\n routeNameParent = `$:${name}`;\n routeData = {\n name: routeNameParent,\n path,\n component: this.createAsyncComponent(layout as any),\n children: [{ ...route, name, path: '', component, meta }],\n };\n }\n // force delete\n if (this.router.hasRoute(routeNameParent)) {\n this.router.removeRoute(routeNameParent);\n }\n if (this.router.hasRoute(name)) {\n this.router.removeRoute(name);\n }\n // add\n this.router.addRoute(routeData);\n }\n}\n","import type {\n NavigationGuardWithThis,\n NavigationHookAfter,\n RouteLocationNormalizedLoadedGeneric,\n Router,\n} from '@cabloy/vue-router';\n\nimport { BeanBase, TypeEventOff, Use } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport { ModelPageData } from '../model/pageData.js';\nimport { IPageMeta } from '../types/pageMeta.js';\nimport { TypeErrorListener } from '../types/router.js';\nimport { SysRouter } from './sys.router.js';\n\nexport interface BeanRouter extends Omit<\n SysRouter,\n '$beanFullName' | '$onionName' | '$onionOptions'\n> {}\n\n@Bean()\nexport class BeanRouter extends BeanBase {\n private _vueRouterApp: Router;\n private _eventRouterGuards: TypeEventOff[] = [];\n private _routerViews: BeanRouterViewBase[] = [];\n\n @Use()\n $$sysRouter: SysRouter;\n\n @Use()\n $$modelPageData: ModelPageData; // for prepare pageData on server\n\n get router(): Router {\n return this._vueRouterApp;\n }\n\n protected __dispose__() {\n for (const fn of this._eventRouterGuards) {\n fn();\n }\n }\n\n protected __get__(prop: string) {\n // SymbolRouter first\n const value = this._vueRouterApp?.[prop];\n if (value !== undefined) return value;\n return this.$$sysRouter?.[prop];\n }\n\n protected async __init__(mainRouter?: boolean) {\n // create router\n this._vueRouterApp = this.$$sysRouter.createRouter();\n if (!mainRouter) {\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', this);\n }\n }\n\n addRouterView(routerView: BeanRouterViewBase) {\n this._routerViews.push(routerView);\n }\n\n removeRouterView(routerView: BeanRouterViewBase) {\n const index = this._routerViews.findIndex(item => item === routerView);\n if (index > -1) {\n this._routerViews.splice(index, 1);\n }\n }\n\n afterEachBackRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.backRoute(route);\n if (res) break;\n }\n }\n\n afterEachForwardRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.forwardRoute(route);\n if (res) break;\n }\n }\n\n beforeEach(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeResolve(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n afterEach(guard: NavigationHookAfter): () => void {\n const fn = this._vueRouterApp.afterEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n onError(handler: TypeErrorListener): () => void {\n const fn = this._vueRouterApp.onError(handler);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n setPageMeta(route: RouteLocationNormalizedLoadedGeneric, pageMeta: IPageMeta) {\n for (const routerView of this._routerViews) {\n routerView.setPageMeta(route, pageMeta);\n }\n }\n}\n","import type { TypeEventOff } from 'zova';\n\nimport { BeanBase, Virtual } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport type { BeanRouter } from './bean.router.js';\n\n@Bean()\n@Virtual()\nexport class BeanRouterGuardsBase extends BeanBase {\n private _eventRouterGuards: TypeEventOff;\n\n protected async __init__() {\n this._eventRouterGuards = this.app.meta.event.on(\n 'a-router:routerGuards',\n async (router, next) => {\n this.onRouterGuards(router);\n return await next();\n },\n );\n }\n\n protected __dispose__() {\n this.dispose();\n }\n\n dispose() {\n if (this._eventRouterGuards) {\n this._eventRouterGuards();\n }\n }\n\n protected onRouterGuards(_router: BeanRouter) {}\n}\n","import type {\n NavigationFailure,\n RouteComponent,\n RouteLocationMatched,\n RouteLocationNormalized,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouteRecordRaw,\n} from '@cabloy/vue-router';\nimport type { z } from 'zod';\nimport type {\n ILayoutRecord,\n ILocaleRecord,\n TypeComponentLayoutRecord,\n ZovaApplication,\n} from 'zova';\n\nimport type { BeanRouter } from '../bean/bean.router.js';\nimport type { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport type { IGotoPageOptions } from './utils.js';\nimport 'vue-router';\n\nexport type Lazy<T> = () => Promise<T>;\nexport type IModuleRouteComponent = RouteComponent | Lazy<RouteComponent>;\nexport type IModuleRoute = RouteRecordRaw;\n\nexport type TypeComponentKeyMode = 'nameOnly' | 'withParams';\n\nexport type TypeGotoPageResult = void | Promise<NavigationFailure | void | undefined>;\n\ndeclare module '@cabloy/vue-router' {\n interface RouteMeta {\n absolute?: boolean;\n layout?: keyof TypeComponentLayoutRecord | keyof ILayoutRecord | false | IModuleRouteComponent;\n requiresAuth?: boolean;\n locale?: boolean;\n locales?: Record<keyof ILocaleRecord, string>;\n componentKeyMode?: TypeComponentKeyMode;\n componentKey?:\n | ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string)\n | string;\n tabKey?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string) | string;\n keepAlive?:\n | ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => boolean)\n | boolean;\n }\n}\n\ndeclare module 'zova' {\n export interface ZovaApplication {\n $redirect(pagePath: string, status?: 301 | 302): never;\n $gotoPage(pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult;\n $gotoHome(options?: IGotoPageOptions): TypeGotoPageResult;\n $gotoLogin(returnTo?: string, cause?: string): TypeGotoPageResult;\n $gotoReturnTo(returnTo?: string): TypeGotoPageResult;\n $getReturnTo(returnTo?: string): string;\n $getCurrentPagePath(): string | undefined;\n }\n\n export interface AppMeta {\n $router: BeanRouter;\n }\n export interface BeanBase {\n $router: BeanRouter;\n $routerView: BeanRouterViewBase;\n $pageRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n $currentRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n }\n\n export interface IModuleResource {\n routes: IModuleRoute[];\n }\n\n export interface IControllerDataContext {\n route?: RouteLocationNormalizedLoaded;\n }\n\n export interface IModuleResource {\n pagePathSchemas?: TypePageSchemas;\n pageNameSchemas?: TypePageSchemas;\n }\n\n export interface ZovaConfigRoutes {\n path: Record<keyof IPagePathRecord, IModuleRoute>;\n name: Record<keyof IPageNameRecord, IModuleRoute>;\n }\n\n export interface IEventRecord {\n 'a-router:routerGuards': { data: BeanRouter; result: void };\n }\n\n export interface ZovaConfigEnv {\n ROUTER_MODE: 'hash' | 'history' | 'abstract' | undefined;\n ROUTER_PAGE_HOME: string;\n ROUTER_PAGE_LOGIN: string;\n ROUTER_KEY_RETURNTO: string;\n }\n\n export interface BeanControllerPageBase {\n $route: RouteLocationNormalizedLoaded;\n $routeMatched: RouteLocationMatched;\n }\n\n // export interface IEventRecord {\n // 'a-router:routerGuards': BeanRouter;\n // }\n\n // export interface IEventResultRecord {\n // 'a-router:routerGuards': void;\n // }\n}\n\nexport interface IPageNameRecord {}\nexport interface IPagePathRecord {}\nexport interface IPagePathSchemaRecord {}\n\nexport interface TypePageSchema {\n params?: z.ZodTypeAny;\n query: z.ZodTypeAny;\n}\nexport type TypePageSchemas = Record<string, TypePageSchema>;\n\nexport interface TypePagePathSchema<PARAMS = unknown, QUERY = unknown> {\n params?: PARAMS;\n query?: QUERY;\n}\n\nexport interface TypeErrorListener {\n (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;\n}\n\nexport enum NavigationType {\n pop = 'pop',\n push = 'push',\n}\n\nexport enum NavigationDirection {\n back = 'back',\n forward = 'forward',\n unknown = '',\n}\n\nexport interface NavigationInformation {\n type: NavigationType;\n direction: NavigationDirection;\n delta: number;\n replace?: boolean;\n}\n","import * as ModuleInfo from '@cabloy/module-info';\nimport { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\nimport { Service } from 'zova-module-a-bean';\n\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport { NavigationDirection, NavigationInformation, NavigationType } from '../types/router.js';\n\n@Service()\nexport class ServiceRouterGuards extends BeanRouterGuardsBase {\n protected onRouterGuards(router: BeanRouter) {\n const self = this;\n router.beforeEach(async to => {\n // match path\n let match = to.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = to.matched[to.matched.length - 1];\n // prepareCheck\n if (!(await this._prepareCheck(match?.path, to.path))) {\n // redirect again\n return to.fullPath;\n }\n // legacy\n const legacyRoute = router._findLegacyRoute(match?.name, match?.path);\n if (legacyRoute) return;\n // alias\n const configRoute = router._findConfigRoute(match?.name, match?.path);\n const alias = configRoute?.alias;\n if (alias) {\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule && resLoadModule !== true) return resLoadModule;\n if (resLoadModule === false) return to.fullPath;\n if (router.getRealRouteName(match?.name)) {\n const routeAlias = router.resolveName(\n `$alias:${match?.name as string}` as never,\n {\n params: to.params,\n query: to.query,\n } as any,\n );\n const fullPath = routeAlias.startsWith('/__alias__')\n ? routeAlias.substring('/__alias__'.length)\n : routeAlias;\n return fullPath || '/';\n } else {\n return {\n path: Array.isArray(alias) ? alias[0] : alias,\n params: to.params,\n query: to.query,\n };\n }\n }\n }\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule === true) return;\n if (resLoadModule) return resLoadModule;\n // redirect again\n return to.fullPath;\n });\n router.afterEach(function (to, from, error) {\n if (error) return;\n const info: NavigationInformation | undefined = arguments[3];\n // from\n if (from.fullPath !== to.fullPath) {\n self._afterEachFrom(router, from, info);\n }\n // to\n router.afterEachForwardRoute(to);\n });\n }\n\n private _afterEachFrom(\n router: BeanRouter,\n from: RouteLocationNormalizedLoadedGeneric,\n info: NavigationInformation | undefined,\n ) {\n if (!info) return;\n const needBack =\n (info.type === NavigationType.pop && info.direction === NavigationDirection.back) ||\n (info.type === NavigationType.push && info.replace);\n if (!needBack) return;\n router.afterEachBackRoute(from);\n }\n\n // if 404 then check if module loaded\n private async _prepareCheck(pathMatched: string | undefined, pathTo: string): Promise<boolean> {\n if (pathMatched === '/:catchAll(.*)*') {\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(pathTo));\n if (\n moduleInfo &&\n this.app.meta.module.exists(moduleInfo.relativeName) &&\n !this.app.meta.module.get(moduleInfo.relativeName, false)\n ) {\n // use module\n await this.app.meta.module.use(moduleInfo.relativeName);\n // redirect again\n return false;\n }\n }\n return true;\n }\n\n private async _forceLoadModule(\n router: BeanRouter,\n name: string | symbol | null | undefined,\n path: string | undefined,\n ): Promise<string | boolean | undefined> {\n const nameOrPath = router.getRealRouteName(name) || path;\n // module info\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(nameOrPath));\n if (!moduleInfo) {\n // donothing\n return true;\n }\n const moduleName = moduleInfo.relativeName;\n // check if exists\n if (!this.app.meta.module.exists(moduleName)) return '/404';\n // check if loaded\n const module = this.app.meta.module.get(moduleName, false);\n if (module) return true;\n // use module\n await this.app.meta.module.use(moduleName);\n // means need load\n return false;\n }\n}\n","import type { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\n\nimport { RouterView } from '@cabloy/vue-router';\nimport { h, KeepAlive, Transition } from 'vue';\nimport { BeanControllerBase, cast } from 'zova';\n\nimport type { IPageMeta } from '../types/pageMeta.js';\nimport type { IRouterViewSlotParams, IRouteViewRouteMeta } from '../types/routerView.js';\n\nimport { pageRouteKey, routerViewKey } from './const.js';\n\nexport interface IRouterViewPropsBase {}\n\nexport class BeanRouterViewBase extends BeanControllerBase implements IRouterViewPropsBase {\n protected async __init__() {\n this.bean._setBean(routerViewKey, this);\n this.$router.addRouterView(this);\n }\n\n protected __dispose__() {\n this.$router.removeRouterView(this);\n }\n\n public backRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public forwardRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public setPageMeta(_route: RouteLocationNormalizedLoadedGeneric, _pageMeta: IPageMeta) {}\n\n protected prepareRouteMeta(_route: RouteLocationNormalizedLoadedGeneric): IRouteViewRouteMeta {\n throw new Error('Not Implemented');\n }\n\n protected getKeepAliveInclude(): string[] | undefined {\n throw new Error('Not Implemented');\n }\n\n protected render() {\n const slots = {\n default: (component: IRouterViewSlotParams) => {\n const routeMeta = this.prepareRouteMeta(component.route);\n return h(Transition, null, {\n default: () => {\n const vnode = h(component.Component as any, {\n key: routeMeta.componentKey,\n });\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return [\n h(\n KeepAlive,\n {\n include: this.getKeepAliveInclude(),\n },\n [vnode],\n ),\n ];\n },\n });\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { RouterView } from '@cabloy/vue-router';\nimport { h } from 'vue';\nimport { cast } from 'zova';\nimport { Controller } from 'zova-module-a-bean';\n\nimport { pageRouteKey } from '../../lib/const.js';\nimport { BeanRouterViewBase } from '../../lib/routerViewBase.js';\n\n@Controller()\nexport class ControllerRouterViewEmpty extends BeanRouterViewBase {\n protected async __init__() {}\n\n protected render() {\n const slots = {\n default: component => {\n const vnode = h(component.Component);\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return vnode;\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\n\nimport { ControllerRouterViewEmpty } from '../../component/routerViewEmpty/controller.jsx';\nexport type ZRouterViewEmptyProps = {\n controllerRef?: (ref: ControllerRouterViewEmpty) => void;\n};\n\nexport const ZRouterViewEmpty = defineComponent((_props: ZRouterViewEmptyProps) => {\n useController(ControllerRouterViewEmpty, undefined, undefined);\n return () => {};\n}, prepareComponentOptions());\n","import type { ZovaSys } from 'zova';\n\nimport { scrollBehavior } from '../lib/utils.js';\n\nexport const config = (_sys: ZovaSys) => {\n return {\n scrollBehavior,\n };\n};\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoadedGeneric,\n} from '@cabloy/vue-router';\nimport type {\n BeanBase,\n BeanContainer,\n IControllerData,\n IErrorHandlerEventData,\n IMonkeyAppClose,\n IMonkeyAppInitialize,\n IMonkeyAppInitialized,\n IMonkeyAppReady,\n IMonkeyBeanInit,\n IMonkeyController,\n ZovaContext,\n} from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { shallowReactive } from 'vue';\nimport { BeanControllerPageBase, BeanSimple, cast, useComputed } from 'zova';\n\nimport type { BeanRouter } from './bean/bean.router.js';\nimport type { TypePageSchema } from './types/router.js';\n\nimport { routerViewKey } from './lib/const.js';\nimport { getCurrentRoute, getPageRoute, getRealRouteName, getRouteMatched } from './lib/utils.js';\nimport { ServiceRouterGuards } from './service/routerGuards.js';\nimport { SymbolRouterHistory } from './types/utils.js';\n\nexport class Monkey\n extends BeanSimple\n implements\n IMonkeyAppInitialize,\n IMonkeyAppInitialized,\n IMonkeyAppReady,\n IMonkeyAppClose,\n IMonkeyBeanInit,\n IMonkeyController\n{\n private _beanRouter: BeanRouter;\n serviceRouterGuards: ServiceRouterGuards;\n\n async getBeanRouter() {\n if (!this._beanRouter) {\n // markReactive: true\n this._beanRouter = this.app.meta.$router = (await this.bean._getBean(\n 'a-router.bean.router',\n true,\n true,\n )) as BeanRouter;\n }\n return this._beanRouter;\n }\n\n async appInitialize() {\n // router\n this.serviceRouterGuards = await this.bean._newBean(ServiceRouterGuards, false);\n // ssr errorHandler\n if (process.env.CLIENT) {\n this._ssrErrorHandler();\n }\n }\n\n async appInitialized() {\n const beanRouter = await this.getBeanRouter();\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', beanRouter);\n }\n\n appClose(): void {\n if (this.serviceRouterGuards) {\n this.serviceRouterGuards.dispose();\n }\n }\n\n async appReady() {\n const beanRouter = await this.getBeanRouter();\n // pagePath\n if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n const pagePathFull = this.ctx.meta.$ssr.state.pagePathFull;\n if (pagePathFull) {\n const routerHistory = beanRouter.router[SymbolRouterHistory];\n routerHistory.push(pagePathFull);\n }\n }\n // use router\n this.app.vue.use(beanRouter);\n // ssr\n if (process.env.SERVER) {\n // push\n const pagePath = this.app.$getCurrentPagePath()!;\n beanRouter.push(pagePath);\n await beanRouter.isReady();\n } else if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n await beanRouter.isReady();\n }\n }\n\n async beanInit(bean: BeanContainer, beanInstance: BeanBase) {\n bean.defineProperty(beanInstance, '$router', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost('a-router.bean.router');\n },\n });\n bean.defineProperty(beanInstance, '$routerView', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost({ name: routerViewKey });\n },\n });\n bean.defineProperty(beanInstance, '$pageRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getPageRoute(cast(bean).ctx);\n });\n },\n });\n bean.defineProperty(beanInstance, '$currentRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getCurrentRoute(cast(bean).ctx);\n });\n },\n });\n }\n\n controllerDataPrepare(controllerData: IControllerData, ctx: ZovaContext) {\n controllerData.context.route = getPageRoute(ctx);\n }\n\n controllerDataInit(controllerData: IControllerData, controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = controllerData.context.route;\n this._initControllerRoute(route, controller);\n }\n\n controllerDataUpdate(controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = getPageRoute(cast<ZovaContext>(cast(controller).ctx));\n this._initControllerRoute(route, controller);\n }\n\n private _initControllerRoute(\n route: RouteLocationNormalizedLoadedGeneric | undefined,\n controller: BeanControllerPageBase,\n ) {\n if (!route) return;\n const routeMatched = getRouteMatched(route);\n if (!routeMatched) return;\n // check if the same\n if (controller.$routeMatched && !this._checkIfRouteSame(routeMatched, controller.$routeMatched))\n return;\n // check if changed\n const changed = !controller.$route || controller.$route.fullPath !== route.fullPath;\n if (!changed) return;\n controller.$route = route;\n controller.$routeMatched = routeMatched;\n // update $params/$query\n const routeName = getRealRouteName(routeMatched.name);\n const schemaKey = routeName || String(routeMatched.path);\n let schemas: TypePageSchema | undefined;\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(schemaKey));\n if (!moduleInfo) {\n // do nothing\n return;\n }\n if (!this.app.meta.module.exists(moduleInfo.relativeName)) {\n // do nothing\n return;\n }\n const module = this.app.meta.module.get(moduleInfo.relativeName)!;\n if (routeName) {\n schemas = module.resource.pageNameSchemas?.[schemaKey];\n } else {\n schemas = module.resource.pagePathSchemas?.[schemaKey];\n }\n if (schemas?.params) {\n const params = schemas.params.parse(route.params);\n if (!controller.$params) {\n controller.$params = process.env.SERVER ? params : shallowReactive(params as any);\n } else {\n // hold the same $params ref\n Object.assign(controller.$params as any, params);\n }\n }\n if (schemas?.query) {\n const query = schemas.query.parse(route.query);\n if (!controller.$query) {\n controller.$query = process.env.SERVER ? query : shallowReactive(query as any);\n } else {\n // hold the same $query ref\n Object.assign(controller.$query as any, query);\n }\n }\n }\n\n private _checkIfRouteSame(route1: RouteLocationMatched, route2: RouteLocationMatched) {\n return (route1.name && route1.name === route2.name) || route1.path === route2.path;\n }\n\n private _ssrErrorHandler() {\n if (!process.env.CLIENT) return;\n this.app.meta.event.on('app:errorHandler', (data, next) => {\n const err = next();\n if (!err || !(err instanceof Error)) return err;\n return this._errorHandlerDefaultClient(err, data);\n });\n }\n\n private _errorHandlerDefaultClient(err: ErrorSSR, _data: IErrorHandlerEventData) {\n if (!process.env.CLIENT) return err;\n // client\n if ([301, 302].includes(Number(err.code))) {\n this.app.$gotoPage(err.pagePath!);\n return undefined;\n }\n // COMPONENT_UNMOUNTED\n if (err.code === 600) {\n // do nothing\n return undefined;\n }\n // 401\n if (err.code === 401) {\n this.app.$gotoLogin();\n return undefined;\n }\n // not handled\n return err;\n }\n}\n","import type { IModule } from '@cabloy/module-info';\nimport type { IMonkeyModuleSys, IMonkeySysApplicationInitialize, ZovaApplication } from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport { BeanSimple, cast, isHttpUrl } from 'zova';\n\nimport type { SysRouter } from './bean/sys.router.js';\nimport type { TypeGotoPageResult } from './types/router.js';\nimport type { IGotoPageOptions } from './types/utils.js';\n\nexport class MonkeySys\n extends BeanSimple\n implements IMonkeyModuleSys, IMonkeySysApplicationInitialize\n{\n private _moduleSelf: IModule;\n private _sysRouter: SysRouter;\n\n constructor(moduleSelf: IModule) {\n super();\n this._moduleSelf = moduleSelf;\n }\n\n async getSysRouter() {\n if (!this._sysRouter) {\n this._sysRouter = (await this.bean._getBean('a-router.sys.router', false)) as SysRouter;\n }\n return this._sysRouter;\n }\n\n async moduleLoading(module: IModule) {\n if (this._moduleSelf === module) return;\n if (!module.resource.routes) return;\n const sysRouter = await this.getSysRouter();\n sysRouter._registerRoutes(module);\n }\n\n async moduleLoaded(_module: IModule) {}\n async configLoaded(_module: IModule, _config) {}\n\n sysApplicationInitialize(app: ZovaApplication): void {\n app.$redirect = (pagePath: string, status?: 301 | 302): never => {\n const error = new Error() as ErrorSSR;\n error.code = status ?? 302;\n if (isHttpUrl(pagePath)) {\n error.pagePath = pagePath;\n error.url = pagePath;\n } else {\n error.pagePath = pagePath;\n error.url = app.sys.util.getAbsoluteUrlFromPagePath(pagePath, true);\n }\n error.message = process.env.SERVER ? error.url : error.pagePath;\n throw error;\n };\n app.$gotoPage = (pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult => {\n const query = options?.query ?? {};\n // returnTo\n if (options?.returnTo) {\n const returnTo =\n typeof options?.returnTo === 'string' ? options?.returnTo : app.$getCurrentPagePath();\n if (returnTo !== app.sys.env.ROUTER_PAGE_HOME) {\n query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;\n }\n }\n // combineParamsAndQuery\n pagePath = app.meta.$router.getPagePath(\n pagePath as never,\n {\n params: options?.params,\n query,\n } as never,\n );\n // redirect\n if (process.env.SERVER || options?.forceRedirect) {\n return app.$redirect(pagePath);\n }\n // replace\n if (isHttpUrl(pagePath)) {\n window.location[options?.replace ? 'replace' : 'assign'](pagePath);\n } else {\n return app.meta.$router[options?.replace ? 'replace' : 'push'](pagePath);\n }\n };\n app.$gotoHome = (options?: IGotoPageOptions) => {\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_HOME, options);\n };\n app.$gotoLogin = (returnTo?: string, cause?: string) => {\n if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN)\n return;\n const query: any = {};\n if (cause) {\n query.cause = cause;\n }\n const returnTo2 = returnTo === app.sys.env.ROUTER_PAGE_LOGIN ? undefined : (returnTo ?? true);\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_LOGIN, { query, returnTo: returnTo2 });\n };\n app.$gotoReturnTo = (returnTo?: string) => {\n const pagePath = app.$getReturnTo(returnTo);\n return app.$gotoPage(pagePath, { replace: true });\n };\n app.$getReturnTo = (returnTo?: string) => {\n // not use ??\n const pagePath =\n returnTo ||\n cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] ||\n app.sys.env.ROUTER_PAGE_HOME;\n return pagePath;\n };\n app.$getCurrentPagePath = (): string | undefined => {\n if (process.env.SERVER) {\n return (\n app.ctx.meta.$ssr.state.pagePathFull ??\n app.sys.util.getPagePathFromAbsoluteUrl(app.ctx.meta.$ssr.context.req.url)\n );\n }\n return cast(app.meta.$router.currentRoute)?.fullPath;\n };\n }\n}\n","// eslint-disable\n/** model: begin */\nexport * from '../model/pageData.js';\nimport { IModelOptionsPageData } from '../model/pageData.js';\nimport 'zova-module-a-model';\ndeclare module 'zova-module-a-model' {\n \n export interface IModelRecord {\n 'a-router:pageData': IModelOptionsPageData;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ModelPageData {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ModelPageData {\n get $beanFullName(): 'a-router.model.pageData';\n get $onionName(): 'a-router:pageData';\n get $onionOptions(): IModelOptionsPageData;\n } \n}\n/** model: end */\n/** model: begin */\nimport { ModelPageData } from '../model/pageData.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.model.pageData': ModelPageData;\n }\n}\n/** model: end */\n/** sys: begin */\nexport * from '../bean/sys.router.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface SysRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface SysRouter {\n get $beanFullName(): 'a-router.sys.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** sys: end */\n/** sys: begin */\nimport { SysRouter } from '../bean/sys.router.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.sys.router': SysRouter;\n }\n}\n/** sys: end */\n/** bean: begin */\nexport * from '../bean/bean.router.js';\nexport * from '../bean/bean.routerGuardsBase.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface BeanRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface BeanRouter {\n get $beanFullName(): 'a-router.bean.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** bean: end */\n/** bean: begin */\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.bean.router': BeanRouter;\n'a-router.bean.routerGuardsBase': BeanRouterGuardsBase;\n }\n}\n/** bean: end */\n/** service: begin */\nexport * from '../service/routerGuards.js';\n\nimport 'zova-module-a-bean';\ndeclare module 'zova-module-a-bean' {\n \n export interface IServiceRecord {\n 'a-router:routerGuards': never;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ServiceRouterGuards {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ServiceRouterGuards {\n get $beanFullName(): 'a-router.service.routerGuards';\n get $onionName(): 'a-router:routerGuards';\n \n } \n}\n/** service: end */\n/** service: begin */\nimport { ServiceRouterGuards } from '../service/routerGuards.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.service.routerGuards': ServiceRouterGuards;\n }\n}\n/** service: end */\n/** controller: begin */\nexport * from '../component/routerViewEmpty/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ControllerRouterViewEmpty {\n /** @internal */\n get scope(): ScopeModuleARouter;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerRouterViewEmpty } from '../component/routerViewEmpty/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-router.controller.routerViewEmpty': ControllerRouterViewEmpty;\n }\n}\n/** controller: end */\n\n/** components: begin */\nexport * from './component/routerViewEmpty.js';\nimport { ZRouterViewEmpty } from './component/routerViewEmpty.js';\nexport const components = {\n 'routerViewEmpty': ZRouterViewEmpty,\n};\nimport 'zova';\ndeclare module 'zova' {\nexport interface IComponentRecord {\n 'a-router:routerViewEmpty': ControllerRouterViewEmpty;\n}\nexport interface IZovaComponentRecord {\n 'a-router:routerViewEmpty': typeof ZRouterViewEmpty;\n}\n}\n/** components: end */\n/** config: begin */\nexport * from '../config/config.js';\nimport { config } from '../config/config.js';\n/** config: end */\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleARouter extends BeanScopeBase {}\n\nexport interface ScopeModuleARouter {\n util: BeanScopeUtil;\nconfig: TypeModuleConfig<typeof config>;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-router': ScopeModuleARouter;\n }\n \n export interface IBeanScopeConfig {\n 'a-router': ReturnType<typeof config>;\n }\n\n \n\n \n}\n \n/** scope: end */\n"],"mappings":";;;;;;;;;AAAA,IAAA,QAAO,SAAO;4DAId,QAAO,YAAA,CAAA,EAAA,OAAA,WAAA,QAAA,WAAA,MAAA,sBAAA,cAAA;CAEN,YAAM,GAAA,MAAA;AACP,QAAO,GAAM,KAAA;AACX,OAAA,iBAAwB,KAAK;AAC7B,OAAO,UAAS,KAAA;;CAEhB,MAAA,WAAgB;AACd,MAAI,QAAQ,IAAI,QAAQ;GACtB,MAA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AA,YAAA;AACD,UAAG,IAAA,UAAA,IAAA,IAAA,IAAA,mBAAA;IACD;IACA,UAAU;IACZ,CAAA;;AAEF,MAAI,iBAAY,aAAW;GACzB,MAAE,WAAe,IAAC,aAAgB,SAAI;AACtC,UAAO,IAAA,UAAA,UAAA,EACL,SAAO,MACT,CAAA;;AAEF,MAAI,gBAAa,aAAU;AAG3B,UADC,YAAA,KAAA,IAAA,KAAA,QAAA,aAAA,EAAA,QAAA,IAAA,IAAA,IAAA,wBAAA,IAAA,IAAA,IAAA;;AAGD,MAAI,4BAAM;AACR,OAAA,QAAY,IAAI,OACd,QAAO,IAAE,IAAA,KAAA,KAAA,MAAA,gBAAA,IAAA,IAAA,KAAA,2BAAA,IAAA,IAAA,KAAA,KAAA,QAAA,IAAA,IAAA;AAEX,UAAA,KAAA,IAAA,KAAA,QAAA,aAAA,EAAA;;;;;;;;AC3FN,IAAG,MAAO,OAAA;AAgDV,IAAa,aAAU,EACrB,mBAAM,kBAAA;AAgBR,IAAA,sBAAA,OAAA,OAAA,EAAA,QAAA,SAAA,EACE,QAAO,YACR,CAAC,EAAE,KAAK,SAAQ,MAAA,SAAA,MAAA,2BAAA,cAAA,GAAA,IAAA,OAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["RouterView","h","KeepAlive","Transition","BeanControllerBase","cast","pageRouteKey","routerViewKey","BeanRouterViewBase","__init__","bean","_setBean","$router","addRouterView","__dispose__","removeRouterView","backRoute","_route","forwardRoute","setPageMeta","_pageMeta","prepareRouteMeta","Error","getKeepAliveInclude","render","slots","default","component","routeMeta","route","vnode","Component","key","componentKey","zovaHostProviders","include","_createVNode","RouterView","h","cast","Controller","pageRouteKey","BeanRouterViewBase","ControllerRouterViewEmpty","_dec","_dec2","__z_BeanInfo","module","_class","__init__","render","slots","default","component","vnode","Component","zovaHostProviders","route","_createVNode"],"sources":["../src/model/pageData.ts","../src/lib/const.ts","../src/lib/utils.ts","../src/types/utils.ts","../src/bean/sys.router.ts","../src/bean/bean.router.ts","../src/bean/bean.routerGuardsBase.ts","../src/types/router.ts","../src/service/routerGuards.ts","../src/lib/routerViewBase.tsx","../src/component/routerViewEmpty/controller.tsx","../src/.metadata/component/routerViewEmpty.ts","../src/config/config.ts","../src/monkey.ts","../src/monkeySys.ts","../src/.metadata/index.ts"],"sourcesContent":["import type { IDecoratorModelOptions } from 'zova-module-a-model';\n\nimport { BeanModelBase, Model } from 'zova-module-a-model';\n\nexport interface IModelOptionsPageData extends IDecoratorModelOptions {}\n\n@Model<IModelOptionsPageData>()\nexport class ModelPageData<PAGEDATA = unknown> extends BeanModelBase {\n protected _pageDataInner: any;\n public current: PAGEDATA | undefined;\n\n protected async __init__() {\n if (process.env.SERVER) {\n const pagePath = this.$ssr.state.pagePath;\n if (pagePath) {\n this._pageDataInner = this.getPageData(pagePath);\n this._pageDataInner = this.$ssr.state.pageData;\n this.current = this._pageDataInner;\n }\n } else {\n if (this.$ssr.isRuntimeSsrPreHydration) {\n this.current = this.$ssr.state.pageData as PAGEDATA;\n } else {\n const route = this.$pageRoute;\n this.current = route ? this.getPageData(route.path) : undefined;\n }\n }\n }\n\n getPageData(pagePath: string): PAGEDATA {\n return this.$useStateMem({ queryKey: ['pageData', pagePath] });\n }\n}\n","export const pageRouteKey = '$$pageRoute';\nexport const routerViewKey = '$$routerView';\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouterScrollBehavior,\n} from '@cabloy/vue-router';\nimport type { Ref } from 'vue';\nimport type { ZovaContext } from 'zova';\n\nimport { routerViewLocationKey } from '@cabloy/vue-router';\nimport { inject } from 'vue';\n\nimport { pageRouteKey } from './const.js';\n\nexport function getRouteMatched(\n route: RouteLocationNormalizedLoaded,\n): RouteLocationMatched | undefined {\n let match = route.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = route.matched[route.matched.length - 1];\n }\n return match;\n}\n\nexport function getRealRouteName(name?: string | symbol | null): string | undefined {\n if (!name) return undefined;\n name = String(name);\n if (name.startsWith('$:')) return undefined;\n return name;\n}\n\nexport function isRouterName(name?: string | null | undefined): boolean {\n return !!name && name.includes(':') && !name.includes('/');\n}\n\nexport function getPageRoute(ctx: ZovaContext): RouteLocationNormalizedLoadedGeneric | undefined {\n const route = ctx.bean._getBeanFromHost({ name: pageRouteKey });\n return route as RouteLocationNormalizedLoadedGeneric | undefined;\n}\n\nexport function getCurrentRoute(\n ctx: ZovaContext,\n): Ref<RouteLocationNormalizedLoadedGeneric> | undefined {\n const route = ctx.util.instanceScope(() => {\n return inject(routerViewLocationKey);\n });\n return route;\n}\n\nexport const scrollBehavior: RouterScrollBehavior = (to, _from, savedPosition) => {\n if (savedPosition) {\n return new Promise(resolve => {\n setTimeout(() => {\n // savedPosition = Object.assign({}, savedPosition, { behavior: 'smooth' });\n resolve(savedPosition);\n }, 100);\n });\n } else if (to.hash) {\n return new Promise(resolve => {\n setTimeout(() => {\n // resolve({ el: to.hash, behavior: 'smooth' });\n resolve({ el: to.hash });\n }, 200);\n });\n } else {\n return { left: 0, top: 0 };\n }\n};\n","import { IParamsAndQuery } from '@cabloy/utils';\n\nexport const SymbolRouterHistory = Symbol('SymbolRouterHistory');\n\nexport interface IGotoPageOptions extends IParamsAndQuery {\n returnTo?: string | boolean;\n forceRedirect?: boolean;\n replace?: boolean;\n}\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouteLocationResolvedGeneric,\n Router,\n RouterOptions,\n} from '@cabloy/vue-router';\n\nimport { IModule } from '@cabloy/module-info';\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { combineParamsAndQuery } from '@cabloy/utils';\nimport {\n createMemoryHistory,\n createRouter,\n createWebHashHistory,\n createWebHistory,\n} from '@cabloy/vue-router';\nimport { BeanBase, cast, deepExtend } from 'zova';\nimport { Sys } from 'zova-module-a-bean';\n\nimport { getCurrentRoute, getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';\nimport {\n IModuleRoute,\n IModuleRouteComponent,\n IPageNameRecord,\n IPagePathRecord,\n} from '../types/router.js';\nimport { SymbolRouterHistory } from '../types/utils.js';\n\nexport interface SysRouter extends Router {}\n\n@Sys()\nexport class SysRouter extends BeanBase {\n private _vueRouterSys: Router;\n\n get router(): Router {\n return this._vueRouterSys;\n }\n\n protected __get__(prop: string) {\n return this._vueRouterSys && this._vueRouterSys[prop];\n }\n\n protected async __init__() {\n // create router\n this._vueRouterSys = this.createRouter();\n // config.routes\n this._loadConfigRoutes();\n // legacy routes\n this._loadLegacyRoutes();\n }\n\n public createRouter(options?: RouterOptions) {\n options = Object.assign({}, options);\n // matcher\n if (!options.matcher) {\n options.matcher = this._vueRouterSys?.matcher;\n }\n // routes\n if (!options.routes) {\n if (!this._vueRouterSys) {\n options.routes = [];\n }\n }\n // scrollBehavior\n if (!options.scrollBehavior) {\n options.scrollBehavior = this.scope.config.scrollBehavior;\n }\n // history\n if (!options.history) {\n const createHistory = process.env.SERVER\n ? createMemoryHistory\n : this.sys.env.ROUTER_MODE === 'history'\n ? createWebHistory\n : createWebHashHistory;\n const routeBase =\n process.env.SERVER || this.sys.env.ROUTER_MODE === 'history'\n ? this.sys.env.APP_PUBLIC_PATH\n : undefined;\n options.history = createHistory(routeBase);\n }\n // create\n const router = createRouter(options);\n cast(router).__hasDevtools = true;\n router[SymbolRouterHistory] = options.history;\n return router;\n }\n\n public createAsyncComponent(component: string | IModuleRouteComponent) {\n if (typeof component !== 'string') return component;\n return this.sys.meta.component.createAsyncComponent(component);\n }\n\n public getPagePath<K extends keyof IPagePathRecord>(\n path: K,\n options?: IPagePathRecord[K],\n absolute?: boolean,\n ) {\n const query = options?.query;\n let params = options?.params;\n const paramsLocale = cast(params)?.locale;\n if (paramsLocale !== undefined) {\n const localeCurrent = paramsLocale === true ? this.app.meta.locale.current : paramsLocale;\n const locale = localeCurrent === this.sys.config.locale.default ? undefined : localeCurrent;\n params = Object.assign({}, params, { locale });\n }\n const pagePath = combineParamsAndQuery(path, { params, query });\n return absolute ? this.sys.util.getAbsoluteUrlFromPagePath(pagePath) : pagePath;\n }\n\n public async resolveRoute(\n url: string,\n check404?: boolean,\n checkAliasOf?: boolean,\n ): Promise<RouteLocationResolvedGeneric | undefined> {\n const pagePath = this.sys.util.getPagePathFromAbsoluteUrl(url);\n let route = await this.ensureRoute(pagePath);\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n // aliasOf\n if (checkAliasOf) {\n const matchItem = route.matched.find(item => item.aliasOf);\n if (matchItem) {\n route = matchItem.aliasOf as unknown as RouteLocationResolvedGeneric;\n }\n // 404\n if (check404 && route.name === '$:/:catchAll(.*)*') return;\n }\n // ok\n return route;\n }\n\n public checkPathValid(\n to?: { name?: string; path?: string | null | undefined } | string | null | undefined,\n ): boolean {\n const _name = to && typeof to === 'object' ? to.name : undefined;\n const _path = to && typeof to === 'object' ? (to.name ?? to.path) : to;\n // legacy\n if (this._findLegacyRoute(_name, _path)) return true;\n // general check\n if (!_path) return true;\n const moduleName = ModuleInfo.parseName(_path);\n if (!moduleName) return true;\n return this.sys.meta.module.exists(moduleName);\n }\n\n public checkActiveOfFullPath(\n fullPath: string,\n currentRoute?: RouteLocationNormalizedLoadedGeneric,\n ): boolean {\n if (!currentRoute) {\n currentRoute = getCurrentRoute(this.ctx)?.value;\n }\n if (!currentRoute) return false;\n if (currentRoute.fullPath === fullPath) return true;\n if (!currentRoute.matched || currentRoute.matched.length === 0) return false;\n return currentRoute.matched.some(routeAlias => {\n const fullPathAlias = this.getPagePath(\n routeAlias.path as never,\n {\n params: currentRoute.params,\n query: currentRoute.query,\n } as never,\n );\n return fullPathAlias === fullPath;\n });\n }\n\n public async ensureRoute(pagePath: string) {\n // try to resolve, support alias route\n let route = this._vueRouterSys.resolve(pagePath);\n if (route && route.name !== '$:/:catchAll(.*)*') return route;\n // try to load module\n const moduleName = ModuleInfo.parseName(pagePath);\n if (moduleName) {\n if (this.sys.meta.module.exists(moduleName)) {\n const module = this.sys.meta.module.get(moduleName);\n if (!module) {\n await this.sys.meta.module.use(moduleName);\n // try to resolve again\n route = this._vueRouterSys.resolve(pagePath);\n }\n }\n }\n return route;\n }\n\n /** @internal */\n public _registerRoutes(module: IModule) {\n if (!module.resource.routes) return;\n for (const route of module.resource.routes) {\n this._registerRoute(route, module);\n }\n }\n\n /** @internal */\n public _findConfigRoute(\n name: string | symbol | null | undefined,\n path: string | undefined,\n ): IModuleRoute | undefined {\n name = this.getRealRouteName(name);\n return name ? this.sys.config.routes.name[name] : this.sys.config.routes.path[path!];\n }\n\n /** @internal */\n public _findLegacyRoute(\n name: string | symbol | null | undefined,\n path: string | null | undefined,\n ): IModuleRoute | undefined {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n name = this.getRealRouteName(name);\n return legacyRoutes.find(item => {\n return name ? item.name === name : item.path === path;\n });\n }\n\n getRouteMatched(route: RouteLocationNormalizedLoaded): RouteLocationMatched | undefined {\n return getRouteMatched(route);\n }\n\n getRealRouteName(name?: string | symbol | null): string | undefined {\n return getRealRouteName(name);\n }\n\n isRouterName(name?: string | null | undefined): boolean {\n return isRouterName(name);\n }\n\n resolveName<K extends keyof IPageNameRecord>(name: K, options?: IPageNameRecord[K]): string {\n const params = cast(options)?.params;\n const query = cast(options)?.query;\n return this._resolveNameOrPath(query, query => {\n const route = this.router.resolve({ name, params, query });\n return route.fullPath;\n });\n }\n\n private _resolveNameOrPath(query, fn) {\n const query1 = {};\n const query2: any = [];\n if (query) {\n for (const key in query) {\n const value = query[key];\n if (value && typeof value === 'object') {\n query2.push([key, value]);\n } else {\n query1[key] = value;\n }\n }\n }\n // resolve\n const fullPath = fn(query1);\n // query2\n const query2str = query2\n .map(([key, value]) => {\n return `${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`;\n })\n .join('&');\n // join\n if (!query2str) return fullPath;\n const join = Object.keys(query1).length > 0 ? '&' : '?';\n return `${fullPath}${join}${query2str}`;\n }\n\n private _loadConfigRoutes() {\n const routesPath = this.sys.config.routes.path;\n for (const key in routesPath) {\n const route = routesPath[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: key, name: `$:${key}` });\n }\n const routesName = this.sys.config.routes.name;\n for (const key in routesName) {\n const route = routesName[key];\n if (!route) continue;\n this._loadConfigRoute({ ...route, path: route.path || (route.alias as string), name: key });\n }\n }\n\n private _loadLegacyRoutes() {\n const legacyRoutes = cast(this.sys.meta).legacyRoutes;\n if (!legacyRoutes) return;\n for (const route of legacyRoutes) {\n this._registerRoute(route);\n }\n }\n\n private _loadConfigRoute(route: IModuleRoute) {\n this.router.addRoute(route);\n }\n\n private _registerRoute(route: IModuleRoute, module?: IModule) {\n // path\n let path: string | undefined;\n if (route.path !== undefined) {\n if (!module || route.meta?.absolute === true) {\n path = route.path;\n } else {\n path = route.path\n ? `/${module.info.pid}/${module.info.name}/${route.path}`\n : `/${module.info.pid}/${module.info.name}`;\n }\n }\n // name\n let name: string | undefined;\n if (route.name) {\n if (!module || route.meta?.absolute === true) {\n name = String(route.name);\n } else {\n name = `${module.info.relativeName}:${String(route.name)}`;\n }\n }\n // config route\n const configRoute = name\n ? this.sys.config.routes.name[name]\n : this.sys.config.routes.path[path!];\n if (configRoute) {\n route = deepExtend({}, route, configRoute);\n }\n // name alias\n if (name && configRoute?.alias) {\n // add extra route\n this.router.addRoute({\n name: `$alias:${name}`,\n path: `/__alias__${configRoute?.alias}`,\n redirect: '',\n });\n }\n // name\n if (!name) {\n name = `$:${path}`;\n }\n // meta\n const meta = route.meta;\n // component\n const component = route.component;\n // layout / routeData\n let layout = meta?.layout;\n let routeData;\n let routeNameParent;\n if (layout === false) {\n routeData = { ...route, name, path, component, meta };\n } else {\n if (layout === undefined || layout === 'default') {\n layout = this.sys.config.layout.component.default;\n } else if (layout === 'empty') {\n layout = this.sys.config.layout.component.empty;\n }\n routeNameParent = `$:${name}`;\n routeData = {\n name: routeNameParent,\n path,\n component: this.createAsyncComponent(layout as any),\n children: [{ ...route, name, path: '', component, meta }],\n };\n }\n // force delete\n if (this.router.hasRoute(routeNameParent)) {\n this.router.removeRoute(routeNameParent);\n }\n if (this.router.hasRoute(name)) {\n this.router.removeRoute(name);\n }\n // add\n this.router.addRoute(routeData);\n }\n}\n","import type {\n NavigationGuardWithThis,\n NavigationHookAfter,\n RouteLocationNormalizedLoadedGeneric,\n Router,\n} from '@cabloy/vue-router';\n\nimport { BeanBase, TypeEventOff, Use } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport { ModelPageData } from '../model/pageData.js';\nimport { IPageMeta } from '../types/pageMeta.js';\nimport { TypeErrorListener } from '../types/router.js';\nimport { SysRouter } from './sys.router.js';\n\nexport interface BeanRouter extends Omit<\n SysRouter,\n '$beanFullName' | '$onionName' | '$onionOptions'\n> {}\n\n@Bean()\nexport class BeanRouter extends BeanBase {\n private _vueRouterApp: Router;\n private _eventRouterGuards: TypeEventOff[] = [];\n private _routerViews: BeanRouterViewBase[] = [];\n\n @Use()\n $$sysRouter: SysRouter;\n\n @Use()\n $$modelPageData: ModelPageData; // for prepare pageData on server\n\n get router(): Router {\n return this._vueRouterApp;\n }\n\n protected __dispose__() {\n for (const fn of this._eventRouterGuards) {\n fn();\n }\n }\n\n protected __get__(prop: string) {\n // SymbolRouter first\n const value = this._vueRouterApp?.[prop];\n if (value !== undefined) return value;\n return this.$$sysRouter?.[prop];\n }\n\n protected async __init__(mainRouter?: boolean) {\n // create router\n this._vueRouterApp = this.$$sysRouter.createRouter();\n if (!mainRouter) {\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', this);\n }\n }\n\n addRouterView(routerView: BeanRouterViewBase) {\n this._routerViews.push(routerView);\n }\n\n removeRouterView(routerView: BeanRouterViewBase) {\n const index = this._routerViews.findIndex(item => item === routerView);\n if (index > -1) {\n this._routerViews.splice(index, 1);\n }\n }\n\n afterEachBackRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.backRoute(route);\n if (res) break;\n }\n }\n\n afterEachForwardRoute(route: RouteLocationNormalizedLoadedGeneric) {\n for (const routerView of this._routerViews) {\n const res = routerView.forwardRoute(route);\n if (res) break;\n }\n }\n\n beforeEach(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void {\n const fn = this._vueRouterApp.beforeResolve(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n afterEach(guard: NavigationHookAfter): () => void {\n const fn = this._vueRouterApp.afterEach(guard);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n onError(handler: TypeErrorListener): () => void {\n const fn = this._vueRouterApp.onError(handler);\n this._eventRouterGuards.push(fn);\n return fn;\n }\n\n setPageMeta(route: RouteLocationNormalizedLoadedGeneric, pageMeta: IPageMeta) {\n for (const routerView of this._routerViews) {\n routerView.setPageMeta(route, pageMeta);\n }\n }\n}\n","import type { TypeEventOff } from 'zova';\n\nimport { BeanBase, Virtual } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\n\nimport type { BeanRouter } from './bean.router.js';\n\n@Bean()\n@Virtual()\nexport class BeanRouterGuardsBase extends BeanBase {\n private _eventRouterGuards: TypeEventOff;\n\n protected async __init__() {\n this._eventRouterGuards = this.app.meta.event.on(\n 'a-router:routerGuards',\n async (router, next) => {\n this.onRouterGuards(router);\n return await next();\n },\n );\n }\n\n protected __dispose__() {\n this.dispose();\n }\n\n dispose() {\n if (this._eventRouterGuards) {\n this._eventRouterGuards();\n }\n }\n\n protected onRouterGuards(_router: BeanRouter) {}\n}\n","import type {\n NavigationFailure,\n RouteComponent,\n RouteLocationMatched,\n RouteLocationNormalized,\n RouteLocationNormalizedLoaded,\n RouteLocationNormalizedLoadedGeneric,\n RouteRecordRaw,\n} from '@cabloy/vue-router';\nimport type { z } from 'zod';\nimport type {\n ILayoutRecord,\n ILocaleRecord,\n TypeComponentLayoutRecord,\n ZovaApplication,\n} from 'zova';\n\nimport type { BeanRouter } from '../bean/bean.router.js';\nimport type { BeanRouterViewBase } from '../lib/routerViewBase.js';\nimport type { IGotoPageOptions } from './utils.js';\nimport 'vue-router';\n\nexport type Lazy<T> = () => Promise<T>;\nexport type IModuleRouteComponent = RouteComponent | Lazy<RouteComponent>;\nexport type IModuleRoute = RouteRecordRaw;\n\nexport type TypeComponentKeyMode = 'nameOnly' | 'withParams';\n\nexport type TypeGotoPageResult = void | Promise<NavigationFailure | void | undefined>;\n\ndeclare module '@cabloy/vue-router' {\n interface RouteMeta {\n absolute?: boolean;\n layout?: keyof TypeComponentLayoutRecord | keyof ILayoutRecord | false | IModuleRouteComponent;\n requiresAuth?: boolean;\n locale?: boolean;\n locales?: Record<keyof ILocaleRecord, string>;\n componentKeyMode?: TypeComponentKeyMode;\n componentKey?:\n | ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string)\n | string;\n tabKey?: ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => string) | string;\n keepAlive?:\n | ((this: ZovaApplication, route: RouteLocationNormalizedLoaded) => boolean)\n | boolean;\n }\n}\n\ndeclare module 'zova' {\n export interface ZovaApplication {\n $redirect(pagePath: string, status?: 301 | 302): never;\n $gotoPage(pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult;\n $gotoHome(options?: IGotoPageOptions): TypeGotoPageResult;\n $gotoLogin(returnTo?: string, cause?: string): TypeGotoPageResult;\n $gotoReturnTo(returnTo?: string): TypeGotoPageResult;\n $getReturnTo(returnTo?: string): string;\n $getCurrentPagePath(): string | undefined;\n $getPagePathHome(options?: IGotoPageOptions): string;\n }\n\n export interface AppMeta {\n $router: BeanRouter;\n }\n export interface BeanBase {\n $router: BeanRouter;\n $routerView: BeanRouterViewBase;\n $pageRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n $currentRoute: RouteLocationNormalizedLoadedGeneric | undefined;\n }\n\n export interface IModuleResource {\n routes: IModuleRoute[];\n }\n\n export interface IControllerDataContext {\n route?: RouteLocationNormalizedLoaded;\n }\n\n export interface IModuleResource {\n pagePathSchemas?: TypePageSchemas;\n pageNameSchemas?: TypePageSchemas;\n }\n\n export interface ZovaConfigRoutes {\n path: Record<keyof IPagePathRecord, IModuleRoute>;\n name: Record<keyof IPageNameRecord, IModuleRoute>;\n }\n\n export interface IEventRecord {\n 'a-router:routerGuards': { data: BeanRouter; result: void };\n }\n\n export interface ZovaConfigEnv {\n ROUTER_MODE: 'hash' | 'history' | 'abstract' | undefined;\n ROUTER_PAGE_HOME: string;\n ROUTER_PAGE_LOGIN: string;\n ROUTER_KEY_RETURNTO: string;\n }\n\n export interface BeanControllerPageBase {\n $route: RouteLocationNormalizedLoaded;\n $routeMatched: RouteLocationMatched;\n }\n\n // export interface IEventRecord {\n // 'a-router:routerGuards': BeanRouter;\n // }\n\n // export interface IEventResultRecord {\n // 'a-router:routerGuards': void;\n // }\n}\n\nexport interface IPageNameRecord {}\nexport interface IPagePathRecord {}\nexport interface IPagePathSchemaRecord {}\n\nexport interface TypePageSchema {\n params?: z.ZodTypeAny;\n query: z.ZodTypeAny;\n}\nexport type TypePageSchemas = Record<string, TypePageSchema>;\n\nexport interface TypePagePathSchema<PARAMS = unknown, QUERY = unknown> {\n params?: PARAMS;\n query?: QUERY;\n}\n\nexport interface TypeErrorListener {\n (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;\n}\n\nexport enum NavigationType {\n pop = 'pop',\n push = 'push',\n}\n\nexport enum NavigationDirection {\n back = 'back',\n forward = 'forward',\n unknown = '',\n}\n\nexport interface NavigationInformation {\n type: NavigationType;\n direction: NavigationDirection;\n delta: number;\n replace?: boolean;\n}\n","import * as ModuleInfo from '@cabloy/module-info';\nimport { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\nimport { Service } from 'zova-module-a-bean';\n\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport { NavigationDirection, NavigationInformation, NavigationType } from '../types/router.js';\n\n@Service()\nexport class ServiceRouterGuards extends BeanRouterGuardsBase {\n protected onRouterGuards(router: BeanRouter) {\n const self = this;\n router.beforeEach(async to => {\n // match path\n let match = to.matched.find(item => item.aliasOf);\n if (match) {\n match = match.aliasOf;\n } else {\n match = to.matched[to.matched.length - 1];\n // prepareCheck\n if (!(await this._prepareCheck(match?.path, to.path))) {\n // redirect again\n return to.fullPath;\n }\n // legacy\n const legacyRoute = router._findLegacyRoute(match?.name, match?.path);\n if (legacyRoute) return;\n // alias\n const configRoute = router._findConfigRoute(match?.name, match?.path);\n const alias = configRoute?.alias;\n if (alias) {\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule && resLoadModule !== true) return resLoadModule;\n if (resLoadModule === false) return to.fullPath;\n if (router.getRealRouteName(match?.name)) {\n const routeAlias = router.resolveName(\n `$alias:${match?.name as string}` as never,\n {\n params: to.params,\n query: to.query,\n } as any,\n );\n const fullPath = routeAlias.startsWith('/__alias__')\n ? routeAlias.substring('/__alias__'.length)\n : routeAlias;\n return fullPath || '/';\n } else {\n return {\n path: Array.isArray(alias) ? alias[0] : alias,\n params: to.params,\n query: to.query,\n };\n }\n }\n }\n // force load module\n const resLoadModule = await this._forceLoadModule(router, match?.name, match?.path);\n if (resLoadModule === true) return;\n if (resLoadModule) return resLoadModule;\n // redirect again\n return to.fullPath;\n });\n router.afterEach(function (to, from, error) {\n if (error) return;\n const info: NavigationInformation | undefined = arguments[3];\n // from\n if (from.fullPath !== to.fullPath) {\n self._afterEachFrom(router, from, info);\n }\n // to\n router.afterEachForwardRoute(to);\n });\n }\n\n private _afterEachFrom(\n router: BeanRouter,\n from: RouteLocationNormalizedLoadedGeneric,\n info: NavigationInformation | undefined,\n ) {\n if (!info) return;\n const needBack =\n (info.type === NavigationType.pop && info.direction === NavigationDirection.back) ||\n (info.type === NavigationType.push && info.replace);\n if (!needBack) return;\n router.afterEachBackRoute(from);\n }\n\n // if 404 then check if module loaded\n private async _prepareCheck(pathMatched: string | undefined, pathTo: string): Promise<boolean> {\n if (pathMatched === '/:catchAll(.*)*') {\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(pathTo));\n if (\n moduleInfo &&\n this.app.meta.module.exists(moduleInfo.relativeName) &&\n !this.app.meta.module.get(moduleInfo.relativeName, false)\n ) {\n // use module\n await this.app.meta.module.use(moduleInfo.relativeName);\n // redirect again\n return false;\n }\n }\n return true;\n }\n\n private async _forceLoadModule(\n router: BeanRouter,\n name: string | symbol | null | undefined,\n path: string | undefined,\n ): Promise<string | boolean | undefined> {\n const nameOrPath = router.getRealRouteName(name) || path;\n // module info\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(nameOrPath));\n if (!moduleInfo) {\n // donothing\n return true;\n }\n const moduleName = moduleInfo.relativeName;\n // check if exists\n if (!this.app.meta.module.exists(moduleName)) return '/404';\n // check if loaded\n const module = this.app.meta.module.get(moduleName, false);\n if (module) return true;\n // use module\n await this.app.meta.module.use(moduleName);\n // means need load\n return false;\n }\n}\n","import type { RouteLocationNormalizedLoadedGeneric } from '@cabloy/vue-router';\n\nimport { RouterView } from '@cabloy/vue-router';\nimport { h, KeepAlive, Transition } from 'vue';\nimport { BeanControllerBase, cast } from 'zova';\n\nimport type { IPageMeta } from '../types/pageMeta.js';\nimport type { IRouterViewSlotParams, IRouteViewRouteMeta } from '../types/routerView.js';\n\nimport { pageRouteKey, routerViewKey } from './const.js';\n\nexport interface IRouterViewPropsBase {}\n\nexport class BeanRouterViewBase extends BeanControllerBase implements IRouterViewPropsBase {\n protected async __init__() {\n this.bean._setBean(routerViewKey, this);\n this.$router.addRouterView(this);\n }\n\n protected __dispose__() {\n this.$router.removeRouterView(this);\n }\n\n public backRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public forwardRoute(_route: RouteLocationNormalizedLoadedGeneric) {\n return false;\n }\n\n public setPageMeta(_route: RouteLocationNormalizedLoadedGeneric, _pageMeta: IPageMeta) {}\n\n protected prepareRouteMeta(_route: RouteLocationNormalizedLoadedGeneric): IRouteViewRouteMeta {\n throw new Error('Not Implemented');\n }\n\n protected getKeepAliveInclude(): string[] | undefined {\n throw new Error('Not Implemented');\n }\n\n protected render() {\n const slots = {\n default: (component: IRouterViewSlotParams) => {\n const routeMeta = this.prepareRouteMeta(component.route);\n return h(Transition, null, {\n default: () => {\n const vnode = h(component.Component as any, {\n key: routeMeta.componentKey,\n });\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return [\n h(\n KeepAlive,\n {\n include: this.getKeepAliveInclude(),\n },\n [vnode],\n ),\n ];\n },\n });\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { RouterView } from '@cabloy/vue-router';\nimport { h } from 'vue';\nimport { cast } from 'zova';\nimport { Controller } from 'zova-module-a-bean';\n\nimport { pageRouteKey } from '../../lib/const.js';\nimport { BeanRouterViewBase } from '../../lib/routerViewBase.js';\n\n@Controller()\nexport class ControllerRouterViewEmpty extends BeanRouterViewBase {\n protected async __init__() {}\n\n protected render() {\n const slots = {\n default: component => {\n const vnode = h(component.Component);\n cast(vnode).zovaHostProviders = { [pageRouteKey]: component.route };\n return vnode;\n },\n };\n return <RouterView v-slots={slots}></RouterView>;\n }\n}\n","import { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\n\nimport { ControllerRouterViewEmpty } from '../../component/routerViewEmpty/controller.jsx';\nexport type ZRouterViewEmptyProps = {\n controllerRef?: (ref: ControllerRouterViewEmpty) => void;\n};\n\nexport const ZRouterViewEmpty = defineComponent((_props: ZRouterViewEmptyProps) => {\n useController(ControllerRouterViewEmpty, undefined, undefined);\n return () => {};\n}, prepareComponentOptions());\n","import type { ZovaSys } from 'zova';\n\nimport { scrollBehavior } from '../lib/utils.js';\n\nexport const config = (_sys: ZovaSys) => {\n return {\n scrollBehavior,\n };\n};\n","import type {\n RouteLocationMatched,\n RouteLocationNormalizedLoadedGeneric,\n} from '@cabloy/vue-router';\nimport type {\n BeanBase,\n BeanContainer,\n IControllerData,\n IErrorHandlerEventData,\n IMonkeyAppClose,\n IMonkeyAppInitialize,\n IMonkeyAppInitialized,\n IMonkeyAppReady,\n IMonkeyBeanInit,\n IMonkeyController,\n ZovaContext,\n} from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport * as ModuleInfo from '@cabloy/module-info';\nimport { shallowReactive } from 'vue';\nimport { BeanControllerPageBase, BeanSimple, cast, useComputed } from 'zova';\n\nimport type { BeanRouter } from './bean/bean.router.js';\nimport type { TypePageSchema } from './types/router.js';\n\nimport { routerViewKey } from './lib/const.js';\nimport { getCurrentRoute, getPageRoute, getRealRouteName, getRouteMatched } from './lib/utils.js';\nimport { ServiceRouterGuards } from './service/routerGuards.js';\nimport { SymbolRouterHistory } from './types/utils.js';\n\nexport class Monkey\n extends BeanSimple\n implements\n IMonkeyAppInitialize,\n IMonkeyAppInitialized,\n IMonkeyAppReady,\n IMonkeyAppClose,\n IMonkeyBeanInit,\n IMonkeyController\n{\n private _beanRouter: BeanRouter;\n serviceRouterGuards: ServiceRouterGuards;\n\n async getBeanRouter() {\n if (!this._beanRouter) {\n // markReactive: true\n this._beanRouter = this.app.meta.$router = (await this.bean._getBean(\n 'a-router.bean.router',\n true,\n true,\n )) as BeanRouter;\n }\n return this._beanRouter;\n }\n\n async appInitialize() {\n // router\n this.serviceRouterGuards = await this.bean._newBean(ServiceRouterGuards, false);\n // ssr errorHandler\n if (process.env.CLIENT) {\n this._ssrErrorHandler();\n }\n }\n\n async appInitialized() {\n const beanRouter = await this.getBeanRouter();\n // emit event\n await this.app.meta.event.emit('a-router:routerGuards', beanRouter);\n }\n\n appClose(): void {\n if (this.serviceRouterGuards) {\n this.serviceRouterGuards.dispose();\n }\n }\n\n async appReady() {\n const beanRouter = await this.getBeanRouter();\n // pagePath\n if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n const pagePathFull = this.ctx.meta.$ssr.state.pagePathFull;\n if (pagePathFull) {\n const routerHistory = beanRouter.router[SymbolRouterHistory];\n routerHistory.push(pagePathFull);\n }\n }\n // use router\n this.app.vue.use(beanRouter);\n // ssr\n if (process.env.SERVER) {\n // push\n const pagePath = this.app.$getCurrentPagePath()!;\n beanRouter.push(pagePath);\n await beanRouter.isReady();\n } else if (process.env.CLIENT && this.ctx.meta.$ssr.isRuntimeSsrPreHydration) {\n await beanRouter.isReady();\n }\n }\n\n async beanInit(bean: BeanContainer, beanInstance: BeanBase) {\n bean.defineProperty(beanInstance, '$router', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost('a-router.bean.router');\n },\n });\n bean.defineProperty(beanInstance, '$routerView', {\n enumerable: false,\n configurable: true,\n get() {\n return bean._getBeanFromHost({ name: routerViewKey });\n },\n });\n bean.defineProperty(beanInstance, '$pageRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getPageRoute(cast(bean).ctx);\n });\n },\n });\n bean.defineProperty(beanInstance, '$currentRoute', {\n enumerable: false,\n configurable: true,\n get() {\n return useComputed(() => {\n return getCurrentRoute(cast(bean).ctx);\n });\n },\n });\n }\n\n controllerDataPrepare(controllerData: IControllerData, ctx: ZovaContext) {\n controllerData.context.route = getPageRoute(ctx);\n }\n\n controllerDataInit(controllerData: IControllerData, controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = controllerData.context.route;\n this._initControllerRoute(route, controller);\n }\n\n controllerDataUpdate(controller: BeanBase) {\n // only for controller page\n if (!(controller instanceof BeanControllerPageBase)) return;\n const route = getPageRoute(cast<ZovaContext>(cast(controller).ctx));\n this._initControllerRoute(route, controller);\n }\n\n private _initControllerRoute(\n route: RouteLocationNormalizedLoadedGeneric | undefined,\n controller: BeanControllerPageBase,\n ) {\n if (!route) return;\n const routeMatched = getRouteMatched(route);\n if (!routeMatched) return;\n // check if the same\n if (controller.$routeMatched && !this._checkIfRouteSame(routeMatched, controller.$routeMatched))\n return;\n // check if changed\n const changed = !controller.$route || controller.$route.fullPath !== route.fullPath;\n if (!changed) return;\n controller.$route = route;\n controller.$routeMatched = routeMatched;\n // update $params/$query\n const routeName = getRealRouteName(routeMatched.name);\n const schemaKey = routeName || String(routeMatched.path);\n let schemas: TypePageSchema | undefined;\n const moduleInfo = ModuleInfo.parseInfo(ModuleInfo.parseName(schemaKey));\n if (!moduleInfo) {\n // do nothing\n return;\n }\n if (!this.app.meta.module.exists(moduleInfo.relativeName)) {\n // do nothing\n return;\n }\n const module = this.app.meta.module.get(moduleInfo.relativeName)!;\n if (routeName) {\n schemas = module.resource.pageNameSchemas?.[schemaKey];\n } else {\n schemas = module.resource.pagePathSchemas?.[schemaKey];\n }\n if (schemas?.params) {\n const params = schemas.params.parse(route.params);\n if (!controller.$params) {\n controller.$params = process.env.SERVER ? params : shallowReactive(params as any);\n } else {\n // hold the same $params ref\n Object.assign(controller.$params as any, params);\n }\n }\n if (schemas?.query) {\n const query = schemas.query.parse(route.query);\n if (!controller.$query) {\n controller.$query = process.env.SERVER ? query : shallowReactive(query as any);\n } else {\n // hold the same $query ref\n Object.assign(controller.$query as any, query);\n }\n }\n }\n\n private _checkIfRouteSame(route1: RouteLocationMatched, route2: RouteLocationMatched) {\n return (route1.name && route1.name === route2.name) || route1.path === route2.path;\n }\n\n private _ssrErrorHandler() {\n if (!process.env.CLIENT) return;\n this.app.meta.event.on('app:errorHandler', (data, next) => {\n const err = next();\n if (!err || !(err instanceof Error)) return err;\n return this._errorHandlerDefaultClient(err, data);\n });\n }\n\n private _errorHandlerDefaultClient(err: ErrorSSR, _data: IErrorHandlerEventData) {\n if (!process.env.CLIENT) return err;\n // client\n if ([301, 302].includes(Number(err.code))) {\n this.app.$gotoPage(err.pagePath!);\n return undefined;\n }\n // COMPONENT_UNMOUNTED\n if (err.code === 600) {\n // do nothing\n return undefined;\n }\n // 401\n if (err.code === 401) {\n this.app.$gotoLogin();\n return undefined;\n }\n // not handled\n return err;\n }\n}\n","import type { IModule } from '@cabloy/module-info';\nimport type { IMonkeyModuleSys, IMonkeySysApplicationInitialize, ZovaApplication } from 'zova';\nimport type { ErrorSSR } from 'zova-module-a-ssr';\n\nimport { BeanSimple, cast, isHttpUrl } from 'zova';\n\nimport type { SysRouter } from './bean/sys.router.js';\nimport type { TypeGotoPageResult } from './types/router.js';\nimport type { IGotoPageOptions } from './types/utils.js';\n\nexport class MonkeySys\n extends BeanSimple\n implements IMonkeyModuleSys, IMonkeySysApplicationInitialize\n{\n private _moduleSelf: IModule;\n private _sysRouter: SysRouter;\n\n constructor(moduleSelf: IModule) {\n super();\n this._moduleSelf = moduleSelf;\n }\n\n async getSysRouter() {\n if (!this._sysRouter) {\n this._sysRouter = (await this.bean._getBean('a-router.sys.router', false)) as SysRouter;\n }\n return this._sysRouter;\n }\n\n async moduleLoading(module: IModule) {\n if (this._moduleSelf === module) return;\n if (!module.resource.routes) return;\n const sysRouter = await this.getSysRouter();\n sysRouter._registerRoutes(module);\n }\n\n async moduleLoaded(_module: IModule) {}\n async configLoaded(_module: IModule, _config) {}\n\n sysApplicationInitialize(app: ZovaApplication): void {\n app.$redirect = (pagePath: string, status?: 301 | 302): never => {\n const error = new Error() as ErrorSSR;\n error.code = status ?? 302;\n if (isHttpUrl(pagePath)) {\n error.pagePath = pagePath;\n error.url = pagePath;\n } else {\n error.pagePath = pagePath;\n error.url = app.sys.util.getAbsoluteUrlFromPagePath(pagePath, true);\n }\n error.message = process.env.SERVER ? error.url : error.pagePath;\n throw error;\n };\n app.$gotoPage = (pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult => {\n const query = options?.query ?? {};\n // returnTo\n if (options?.returnTo) {\n const returnTo =\n typeof options?.returnTo === 'string' ? options?.returnTo : app.$getCurrentPagePath();\n if (returnTo !== app.$getPagePathHome()) {\n query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;\n }\n }\n // combineParamsAndQuery\n pagePath = app.meta.$router.getPagePath(\n pagePath as never,\n {\n params: options?.params,\n query,\n } as never,\n );\n // redirect\n if (process.env.SERVER || options?.forceRedirect) {\n return app.$redirect(pagePath);\n }\n // replace\n if (isHttpUrl(pagePath)) {\n window.location[options?.replace ? 'replace' : 'assign'](pagePath);\n } else {\n return app.meta.$router[options?.replace ? 'replace' : 'push'](pagePath);\n }\n };\n app.$gotoHome = (options?: IGotoPageOptions) => {\n const pagePath = app.$getPagePathHome(options);\n return app.$gotoPage(pagePath, { ...options, params: undefined });\n };\n app.$gotoLogin = (returnTo?: string, cause?: string) => {\n if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN)\n return;\n const query: any = {};\n if (cause) {\n query.cause = cause;\n }\n const returnTo2 = returnTo === app.sys.env.ROUTER_PAGE_LOGIN ? undefined : (returnTo ?? true);\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_LOGIN, { query, returnTo: returnTo2 });\n };\n app.$gotoReturnTo = (returnTo?: string) => {\n const pagePath = app.$getReturnTo(returnTo);\n return app.$gotoPage(pagePath, { replace: true });\n };\n app.$getReturnTo = (returnTo?: string) => {\n // not use ??\n const pagePath =\n returnTo ||\n cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] ||\n app.$getPagePathHome();\n return pagePath;\n };\n app.$getCurrentPagePath = (): string | undefined => {\n if (process.env.SERVER) {\n return (\n app.ctx.meta.$ssr.state.pagePathFull ??\n app.sys.util.getPagePathFromAbsoluteUrl(app.ctx.meta.$ssr.context.req.url)\n );\n }\n return cast(app.meta.$router.currentRoute)?.fullPath;\n };\n app.$getPagePathHome = (options?: IGotoPageOptions): string => {\n let params = options?.params;\n if (params?.locale === undefined) {\n params = Object.assign({}, params, { locale: true });\n }\n // not handle options?.query\n return app.meta.$router.getPagePath(\n app.sys.env.ROUTER_PAGE_HOME as never,\n { params } as never,\n );\n };\n }\n}\n","// eslint-disable\n/** model: begin */\nexport * from '../model/pageData.js';\nimport { IModelOptionsPageData } from '../model/pageData.js';\nimport 'zova-module-a-model';\ndeclare module 'zova-module-a-model' {\n \n export interface IModelRecord {\n 'a-router:pageData': IModelOptionsPageData;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ModelPageData {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ModelPageData {\n get $beanFullName(): 'a-router.model.pageData';\n get $onionName(): 'a-router:pageData';\n get $onionOptions(): IModelOptionsPageData;\n } \n}\n/** model: end */\n/** model: begin */\nimport { ModelPageData } from '../model/pageData.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.model.pageData': ModelPageData;\n }\n}\n/** model: end */\n/** sys: begin */\nexport * from '../bean/sys.router.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface SysRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface SysRouter {\n get $beanFullName(): 'a-router.sys.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** sys: end */\n/** sys: begin */\nimport { SysRouter } from '../bean/sys.router.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.sys.router': SysRouter;\n }\n}\n/** sys: end */\n/** bean: begin */\nexport * from '../bean/bean.router.js';\nexport * from '../bean/bean.routerGuardsBase.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface BeanRouter {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface BeanRouter {\n get $beanFullName(): 'a-router.bean.router';\n get $onionName(): 'a-router:router';\n \n } \n}\n/** bean: end */\n/** bean: begin */\nimport { BeanRouter } from '../bean/bean.router.js';\nimport { BeanRouterGuardsBase } from '../bean/bean.routerGuardsBase.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.bean.router': BeanRouter;\n'a-router.bean.routerGuardsBase': BeanRouterGuardsBase;\n }\n}\n/** bean: end */\n/** service: begin */\nexport * from '../service/routerGuards.js';\n\nimport 'zova-module-a-bean';\ndeclare module 'zova-module-a-bean' {\n \n export interface IServiceRecord {\n 'a-router:routerGuards': never;\n }\n\n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ServiceRouterGuards {\n /** @internal */\n get scope(): ScopeModuleARouter;\n }\n\n export interface ServiceRouterGuards {\n get $beanFullName(): 'a-router.service.routerGuards';\n get $onionName(): 'a-router:routerGuards';\n \n } \n}\n/** service: end */\n/** service: begin */\nimport { ServiceRouterGuards } from '../service/routerGuards.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-router.service.routerGuards': ServiceRouterGuards;\n }\n}\n/** service: end */\n/** controller: begin */\nexport * from '../component/routerViewEmpty/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-router' {\n \n export interface ControllerRouterViewEmpty {\n /** @internal */\n get scope(): ScopeModuleARouter;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerRouterViewEmpty } from '../component/routerViewEmpty/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-router.controller.routerViewEmpty': ControllerRouterViewEmpty;\n }\n}\n/** controller: end */\n\n/** components: begin */\nexport * from './component/routerViewEmpty.js';\nimport { ZRouterViewEmpty } from './component/routerViewEmpty.js';\nexport const components = {\n 'routerViewEmpty': ZRouterViewEmpty,\n};\nimport 'zova';\ndeclare module 'zova' {\nexport interface IComponentRecord {\n 'a-router:routerViewEmpty': ControllerRouterViewEmpty;\n}\nexport interface IZovaComponentRecord {\n 'a-router:routerViewEmpty': typeof ZRouterViewEmpty;\n}\n}\n/** components: end */\n/** config: begin */\nexport * from '../config/config.js';\nimport { config } from '../config/config.js';\n/** config: end */\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleARouter extends BeanScopeBase {}\n\nexport interface ScopeModuleARouter {\n util: BeanScopeUtil;\nconfig: TypeModuleConfig<typeof config>;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-router': ScopeModuleARouter;\n }\n \n export interface IBeanScopeConfig {\n 'a-router': ReturnType<typeof config>;\n }\n\n \n\n \n}\n \n/** scope: end */\n"],"mappings":";;;;;;;;;AAAA,IAAA,QAAO,SAAO;4DAId,QAAO,WAAA,CAAA,GAAA,OAAA,WAAA,QAAA,WAAA,MAAA,sBAAA,cAAA;CAEN,YAAM,GAAA,MAAA;EACP,MAAO,GAAM,IAAA;EACX,KAAA,iBAAwB,KAAK;EAC7B,KAAO,UAAS,KAAA;;CAEhB,MAAA,WAAgB;EACd,IAAI,QAAQ,IAAI,QAAQ;GACtB,MAAM,WAAW,KAAK,KAAK,MAAM;GACjC,IAAI,UAAU;IACZ,KAAK,iBAAiB,KAAK,YAAY,QAAQ;IAC/C,KAAK,iBAAiB,KAAK,KAAK,MAAM;IACtC,KAAK,UAAU,KAAK;GACtB;EACF,OACE,IAAI,KAAK,KAAK,0BACZ,KAAK,UAAU,KAAK,KAAK,MAAM;OAC1B;GACL,MAAM,QAAQ,KAAK;GACnB,KAAK,UAAU,QAAQ,KAAK,YAAY,MAAM,IAAI,IAAI,KAAA;EACxD;CAEJ;;EAEA,OAAA,KAAY,aAAU,EACpB,UAAY,CAAC,YAAY,QAAE,EAC7B,CAAA;CACF;;;;AChCA,IAAa,eAAe;AAC5B,IAAa,gBAAgB;;;ACE7B,SAAE,gBAAA,OAAoC;CACpC,IAAA,QAAA,MAAA,QAAoB,MAAA,SA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kBAAA,EACxB,OACD,CAAA;EACD;CACF;AACF;;;;;AC9GA,IAAG,MAAO,OAAA;AAgDV,IAAa,aAAU,EACrB,mBAAM,iBAAA;AAgBR,IAAA,sBAAA,OAAA,MAAA,GAAA,QAAA,SAAA,EACE,QAAO,WACT,CAAC,GAAG,KAAK,SAAQ,MAAA,SAAA,MAAA,2BAAA,cAAA,CAAA,CAAA,KAAA,MAAA,KAAA"}
|
package/dist/monkeySys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monkeySys.d.ts","sourceRoot":"","sources":["../src/monkeySys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAG/F,OAAO,EAAE,UAAU,EAAmB,MAAM,MAAM,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,qBAAa,SACX,SAAQ,UACR,YAAW,gBAAgB,EAAE,+BAA+B;IAE5D,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,UAAU,CAAY;gBAElB,UAAU,EAAE,OAAO;IAKzB,YAAY;IAOZ,aAAa,CAAC,MAAM,EAAE,OAAO;IAO7B,YAAY,CAAC,OAAO,EAAE,OAAO;IAC7B,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,KAAA;IAE5C,wBAAwB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"monkeySys.d.ts","sourceRoot":"","sources":["../src/monkeySys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAG/F,OAAO,EAAE,UAAU,EAAmB,MAAM,MAAM,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,qBAAa,SACX,SAAQ,UACR,YAAW,gBAAgB,EAAE,+BAA+B;IAE5D,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,UAAU,CAAY;gBAElB,UAAU,EAAE,OAAO;IAKzB,YAAY;IAOZ,aAAa,CAAC,MAAM,EAAE,OAAO;IAO7B,YAAY,CAAC,OAAO,EAAE,OAAO;IAC7B,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,KAAA;IAE5C,wBAAwB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;CA0FrD"}
|
package/dist/types/router.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare module 'zova' {
|
|
|
32
32
|
$gotoReturnTo(returnTo?: string): TypeGotoPageResult;
|
|
33
33
|
$getReturnTo(returnTo?: string): string;
|
|
34
34
|
$getCurrentPagePath(): string | undefined;
|
|
35
|
+
$getPagePathHome(options?: IGotoPageOptions): string;
|
|
35
36
|
}
|
|
36
37
|
interface AppMeta {
|
|
37
38
|
$router: BeanRouter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/types/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,6BAA6B,EAC7B,oCAAoC,EACpC,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,yBAAyB,EACzB,eAAe,EAChB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,K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AED,UAAiB,sBAAsB;QACrC,MAAM,EAAE,6BAA6B,CAAC;QACtC,aAAa,EAAE,oBAAoB,CAAC;KACrC;CASF;AAED,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,qBAAqB;CAAG;AAEzC,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;IACtB,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC;CACrB;AACD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE7D,MAAM,WAAW,kBAAkB,CAAC,MAAM,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,6BAA6B,GAAG,GAAG,CAAC;CACrF;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,oBAAY,mBAAmB;IAC7B,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,KAAK;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-router",
|
|
3
|
-
"version": "5.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "5.1.26",
|
|
4
|
+
"gitHead": "3380f8c5d3989242b60dc2a34cbb330f74335cbe",
|
|
5
5
|
"description": "router",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Zova Module"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
|
|
27
|
-
"tsc:publish": "npm run clean && zova :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
27
|
+
"tsc:publish": "npm run clean && node ../../../../../packages-cli/cli/src/bin/zova.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
|
|
28
28
|
"prepublishOnly": "npm run tsc:publish",
|
|
29
29
|
"prepack": "clean-package",
|
|
30
30
|
"postpack": "clean-package restore && npm run clean"
|
package/src/bean/sys.router.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
RouteLocationMatched,
|
|
3
3
|
RouteLocationNormalizedLoaded,
|
|
4
|
+
RouteLocationNormalizedLoadedGeneric,
|
|
4
5
|
RouteLocationResolvedGeneric,
|
|
5
6
|
Router,
|
|
6
7
|
RouterOptions,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
import { BeanBase, cast, deepExtend } from 'zova';
|
|
19
20
|
import { Sys } from 'zova-module-a-bean';
|
|
20
21
|
|
|
21
|
-
import { getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';
|
|
22
|
+
import { getCurrentRoute, getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';
|
|
22
23
|
import {
|
|
23
24
|
IModuleRoute,
|
|
24
25
|
IModuleRouteComponent,
|
|
@@ -98,11 +99,10 @@ export class SysRouter extends BeanBase {
|
|
|
98
99
|
) {
|
|
99
100
|
const query = options?.query;
|
|
100
101
|
let params = options?.params;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
: this.app.meta.locale.current;
|
|
102
|
+
const paramsLocale = cast(params)?.locale;
|
|
103
|
+
if (paramsLocale !== undefined) {
|
|
104
|
+
const localeCurrent = paramsLocale === true ? this.app.meta.locale.current : paramsLocale;
|
|
105
|
+
const locale = localeCurrent === this.sys.config.locale.default ? undefined : localeCurrent;
|
|
106
106
|
params = Object.assign({}, params, { locale });
|
|
107
107
|
}
|
|
108
108
|
const pagePath = combineParamsAndQuery(path, { params, query });
|
|
@@ -144,6 +144,28 @@ export class SysRouter extends BeanBase {
|
|
|
144
144
|
return this.sys.meta.module.exists(moduleName);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
public checkActiveOfFullPath(
|
|
148
|
+
fullPath: string,
|
|
149
|
+
currentRoute?: RouteLocationNormalizedLoadedGeneric,
|
|
150
|
+
): boolean {
|
|
151
|
+
if (!currentRoute) {
|
|
152
|
+
currentRoute = getCurrentRoute(this.ctx)?.value;
|
|
153
|
+
}
|
|
154
|
+
if (!currentRoute) return false;
|
|
155
|
+
if (currentRoute.fullPath === fullPath) return true;
|
|
156
|
+
if (!currentRoute.matched || currentRoute.matched.length === 0) return false;
|
|
157
|
+
return currentRoute.matched.some(routeAlias => {
|
|
158
|
+
const fullPathAlias = this.getPagePath(
|
|
159
|
+
routeAlias.path as never,
|
|
160
|
+
{
|
|
161
|
+
params: currentRoute.params,
|
|
162
|
+
query: currentRoute.query,
|
|
163
|
+
} as never,
|
|
164
|
+
);
|
|
165
|
+
return fullPathAlias === fullPath;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
147
169
|
public async ensureRoute(pagePath: string) {
|
|
148
170
|
// try to resolve, support alias route
|
|
149
171
|
let route = this._vueRouterSys.resolve(pagePath);
|
package/src/monkeySys.ts
CHANGED
|
@@ -57,7 +57,7 @@ export class MonkeySys
|
|
|
57
57
|
if (options?.returnTo) {
|
|
58
58
|
const returnTo =
|
|
59
59
|
typeof options?.returnTo === 'string' ? options?.returnTo : app.$getCurrentPagePath();
|
|
60
|
-
if (returnTo !== app
|
|
60
|
+
if (returnTo !== app.$getPagePathHome()) {
|
|
61
61
|
query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -81,7 +81,8 @@ export class MonkeySys
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
app.$gotoHome = (options?: IGotoPageOptions) => {
|
|
84
|
-
|
|
84
|
+
const pagePath = app.$getPagePathHome(options);
|
|
85
|
+
return app.$gotoPage(pagePath, { ...options, params: undefined });
|
|
85
86
|
};
|
|
86
87
|
app.$gotoLogin = (returnTo?: string, cause?: string) => {
|
|
87
88
|
if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN)
|
|
@@ -102,7 +103,7 @@ export class MonkeySys
|
|
|
102
103
|
const pagePath =
|
|
103
104
|
returnTo ||
|
|
104
105
|
cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] ||
|
|
105
|
-
app
|
|
106
|
+
app.$getPagePathHome();
|
|
106
107
|
return pagePath;
|
|
107
108
|
};
|
|
108
109
|
app.$getCurrentPagePath = (): string | undefined => {
|
|
@@ -114,5 +115,16 @@ export class MonkeySys
|
|
|
114
115
|
}
|
|
115
116
|
return cast(app.meta.$router.currentRoute)?.fullPath;
|
|
116
117
|
};
|
|
118
|
+
app.$getPagePathHome = (options?: IGotoPageOptions): string => {
|
|
119
|
+
let params = options?.params;
|
|
120
|
+
if (params?.locale === undefined) {
|
|
121
|
+
params = Object.assign({}, params, { locale: true });
|
|
122
|
+
}
|
|
123
|
+
// not handle options?.query
|
|
124
|
+
return app.meta.$router.getPagePath(
|
|
125
|
+
app.sys.env.ROUTER_PAGE_HOME as never,
|
|
126
|
+
{ params } as never,
|
|
127
|
+
);
|
|
128
|
+
};
|
|
117
129
|
}
|
|
118
130
|
}
|
package/src/types/router.ts
CHANGED
|
@@ -55,6 +55,7 @@ declare module 'zova' {
|
|
|
55
55
|
$gotoReturnTo(returnTo?: string): TypeGotoPageResult;
|
|
56
56
|
$getReturnTo(returnTo?: string): string;
|
|
57
57
|
$getCurrentPagePath(): string | undefined;
|
|
58
|
+
$getPagePathHome(options?: IGotoPageOptions): string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export interface AppMeta {
|