zova-module-a-router 5.1.21 → 5.1.23

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.
@@ -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,12 +16,12 @@ 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;
22
23
  isRouterName(name?: string | null | undefined): boolean;
23
24
  resolveName<K extends keyof IPageNameRecord>(name: K, options?: IPageNameRecord[K]): string;
24
- resolvePath<K extends keyof IPagePathRecord>(path: K, query?: IPagePathRecord[K]): string;
25
25
  private _resolveNameOrPath;
26
26
  private _loadConfigRoutes;
27
27
  private _loadLegacyRoutes;
@@ -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,6BAA6B,EAC7B,4BAA4B,EAC5B,MAAM,EACN,aAAa,EACd,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EAAE,QAAQ,EAAoB,MAAM,MAAM,CAAC;AAIlD,OAAO,EAEL,qBAAqB,EACrB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AE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GACnF,OAAO;IAYH,qBAAqB,CAC1B,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,oCAAoC,GAClD,OAAO;IAmBG,WAAW,CAAC,QAAQ,EAAE,MAAM;IAiDzC,eAAe,CAAC,KAAK,EAAE,6BAA6B,GAAG,oBAAoB,GAAG,SAAS;IAIvF,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS;IAInE,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAIvD,WAAW,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,MAAM;IAS3F,OAAO,CAAC,kBAAkB;IA2B1B,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,cAAc;CA2EvB"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BeanBase, BeanControllerBase, BeanControllerPageBase, BeanInfo, BeanScopeBase, BeanSimple, Use, Virtual, cast, deepExtend, isHttpUrl, prepareComponentOptions, useComputed, useController } from "zova";
2
2
  import { BeanModelBase, Model } from "zova-module-a-model";
3
3
  import * as ModuleInfo from "@cabloy/module-info";
4
- import { combineParamsAndQuery, combineQueries } from "@cabloy/utils";
4
+ import { combineParamsAndQuery } from "@cabloy/utils";
5
5
  import { RouterView, createMemoryHistory, createRouter, createWebHashHistory, createWebHistory, routerViewLocationKey } from "@cabloy/vue-router";
6
6
  import { Bean, Controller, Scope, Service, Sys } from "zova-module-a-bean";
7
7
  import { KeepAlive, Transition, createVNode, defineComponent, h, inject, shallowReactive } from "vue";
@@ -121,9 +121,17 @@ var SysRouter = (_dec$5 = Sys(), _dec2$5 = BeanInfo({ module: "a-router" }), _de
121
121
  return this.sys.meta.component.createAsyncComponent(component);
122
122
  }
123
123
  getPagePath(path, options, absolute) {
124
+ const query = options?.query;
125
+ let params = options?.params;
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;
130
+ params = Object.assign({}, params, { locale });
131
+ }
124
132
  const pagePath = combineParamsAndQuery(path, {
125
- params: options?.params,
126
- query: options?.query
133
+ params,
134
+ query
127
135
  });
128
136
  return absolute ? this.sys.util.getAbsoluteUrlFromPagePath(pagePath) : pagePath;
129
137
  }
@@ -147,6 +155,18 @@ var SysRouter = (_dec$5 = Sys(), _dec2$5 = BeanInfo({ module: "a-router" }), _de
147
155
  if (!moduleName) return true;
148
156
  return this.sys.meta.module.exists(moduleName);
149
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
+ }
150
170
  async ensureRoute(pagePath) {
151
171
  let route = this._vueRouterSys.resolve(pagePath);
152
172
  if (route && route.name !== "$:/:catchAll(.*)*") return route;
@@ -200,14 +220,6 @@ var SysRouter = (_dec$5 = Sys(), _dec2$5 = BeanInfo({ module: "a-router" }), _de
200
220
  }).fullPath;
201
221
  });
202
222
  }
203
- resolvePath(path, query) {
204
- return this._resolveNameOrPath(query, (query) => {
205
- return this.router.resolve({
206
- path,
207
- query
208
- }).fullPath;
209
- });
210
- }
211
223
  _resolveNameOrPath(query, fn) {
212
224
  const query1 = {};
213
225
  const query2 = [];
@@ -728,15 +740,22 @@ var MonkeySys = class extends BeanSimple {
728
740
  const query = options?.query ?? {};
729
741
  if (options?.returnTo) {
730
742
  const returnTo = typeof options?.returnTo === "string" ? options?.returnTo : app.$getCurrentPagePath();
731
- if (returnTo !== app.sys.env.ROUTER_PAGE_HOME) query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;
743
+ if (returnTo !== app.$getPagePathHome()) query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;
732
744
  }
733
- pagePath = combineQueries(pagePath, query);
745
+ pagePath = app.meta.$router.getPagePath(pagePath, {
746
+ params: options?.params,
747
+ query
748
+ });
734
749
  if (process.env.SERVER || options?.forceRedirect) return app.$redirect(pagePath);
735
750
  if (isHttpUrl(pagePath)) window.location[options?.replace ? "replace" : "assign"](pagePath);
736
751
  else return app.meta.$router[options?.replace ? "replace" : "push"](pagePath);
737
752
  };
738
- app.$gotoHome = () => {
739
- return app.$gotoPage(app.sys.env.ROUTER_PAGE_HOME);
753
+ app.$gotoHome = (options) => {
754
+ const pagePath = app.$getPagePathHome(options);
755
+ return app.$gotoPage(pagePath, {
756
+ ...options,
757
+ params: void 0
758
+ });
740
759
  };
741
760
  app.$gotoLogin = (returnTo, cause) => {
742
761
  if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN) return;
@@ -753,12 +772,17 @@ var MonkeySys = class extends BeanSimple {
753
772
  return app.$gotoPage(pagePath, { replace: true });
754
773
  };
755
774
  app.$getReturnTo = (returnTo) => {
756
- return returnTo || cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] || app.sys.env.ROUTER_PAGE_HOME;
775
+ return returnTo || cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] || app.$getPagePathHome();
757
776
  };
758
777
  app.$getCurrentPagePath = () => {
759
778
  if (process.env.SERVER) return app.ctx.meta.$ssr.state.pagePathFull ?? app.sys.util.getPagePathFromAbsoluteUrl(app.ctx.meta.$ssr.context.req.url);
760
779
  return cast(app.meta.$router.currentRoute)?.fullPath;
761
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
+ };
762
786
  }
763
787
  };
764
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","export const SymbolRouterHistory = Symbol('SymbolRouterHistory');\n\nexport interface IGotoPageOptions {\n query?: object;\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 pagePath = combineParamsAndQuery(path, {\n params: options?.params,\n query: options?.query,\n });\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 resolvePath<K extends keyof IPagePathRecord>(path: K, query?: IPagePathRecord[K]): string {\n return this._resolveNameOrPath(query, query => {\n const route = this.router.resolve({ path, 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(): 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 { combineQueries } from '@cabloy/utils';\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 // combineQueries\n pagePath = combineQueries(pagePath, query);\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 = () => {\n return app.$gotoPage(app.sys.env.ROUTER_PAGE_HOME);\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,MAAM,WAAW,KAAK,KAAK,MAAM;AACjC,OAAI,UAAU;AACZ,SAAK,iBAAiB,KAAK,YAAY,SAAS;AAChD,SAAK,iBAAiB,KAAK,KAAK,MAAM;AACtC,SAAK,UAAU,KAAK;;aAGlB,KAAK,KAAK,yBACZ,MAAK,UAAU,KAAK,KAAK,MAAM;OAC1B;GACL,MAAM,QAAQ,KAAK;AACnB,QAAK,UAAU,QAAQ,KAAK,YAAY,MAAM,KAAK,GAAG,KAAA;;;;AAK5D,SAAA,KAAY,aAAU,EACpB,UAAY,CAAC,YAAY,SAA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,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,YAAA,CAAA,EAAA,OAAA,WAAA,QAAA,WAAA,MAAA,sBAAA,cAAA;CAEN,YAAM,GAAA,MAAA;AACP,QAAO,GAAM,KAAA;AACX,OAAA,iBAAwB,KAAK;AAC7B,OAA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AAA,EACxB,QACD,CAAA;;;;;;;;AC3GL,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 +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;AAI/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;CAwErD"}
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"}
@@ -27,11 +27,12 @@ declare module 'zova' {
27
27
  interface ZovaApplication {
28
28
  $redirect(pagePath: string, status?: 301 | 302): never;
29
29
  $gotoPage(pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult;
30
- $gotoHome(): TypeGotoPageResult;
30
+ $gotoHome(options?: IGotoPageOptions): TypeGotoPageResult;
31
31
  $gotoLogin(returnTo?: string, cause?: string): TypeGotoPageResult;
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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;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"}
@@ -1,6 +1,6 @@
1
+ import { IParamsAndQuery } from '@cabloy/utils';
1
2
  export declare const SymbolRouterHistory: unique symbol;
2
- export interface IGotoPageOptions {
3
- query?: object;
3
+ export interface IGotoPageOptions extends IParamsAndQuery {
4
4
  returnTo?: string | boolean;
5
5
  forceRedirect?: boolean;
6
6
  replace?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AAEjE,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,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.21",
4
- "gitHead": "a534504c9a232c291c1bf395b63134a9222f2746",
3
+ "version": "5.1.23",
4
+ "gitHead": "5f061ec5af5f200549e10557393ab429821d4ce7",
5
5
  "description": "router",
6
6
  "keywords": [
7
7
  "Zova Module"
@@ -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,
@@ -96,10 +97,15 @@ export class SysRouter extends BeanBase {
96
97
  options?: IPagePathRecord[K],
97
98
  absolute?: boolean,
98
99
  ) {
99
- const pagePath = combineParamsAndQuery(path, {
100
- params: options?.params,
101
- query: options?.query,
102
- });
100
+ const query = options?.query;
101
+ let params = options?.params;
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
+ params = Object.assign({}, params, { locale });
107
+ }
108
+ const pagePath = combineParamsAndQuery(path, { params, query });
103
109
  return absolute ? this.sys.util.getAbsoluteUrlFromPagePath(pagePath) : pagePath;
104
110
  }
105
111
 
@@ -138,6 +144,28 @@ export class SysRouter extends BeanBase {
138
144
  return this.sys.meta.module.exists(moduleName);
139
145
  }
140
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
+
141
169
  public async ensureRoute(pagePath: string) {
142
170
  // try to resolve, support alias route
143
171
  let route = this._vueRouterSys.resolve(pagePath);
@@ -208,13 +236,6 @@ export class SysRouter extends BeanBase {
208
236
  });
209
237
  }
210
238
 
211
- resolvePath<K extends keyof IPagePathRecord>(path: K, query?: IPagePathRecord[K]): string {
212
- return this._resolveNameOrPath(query, query => {
213
- const route = this.router.resolve({ path, query });
214
- return route.fullPath;
215
- });
216
- }
217
-
218
239
  private _resolveNameOrPath(query, fn) {
219
240
  const query1 = {};
220
241
  const query2: any = [];
package/src/monkeySys.ts CHANGED
@@ -2,7 +2,6 @@ import type { IModule } from '@cabloy/module-info';
2
2
  import type { IMonkeyModuleSys, IMonkeySysApplicationInitialize, ZovaApplication } from 'zova';
3
3
  import type { ErrorSSR } from 'zova-module-a-ssr';
4
4
 
5
- import { combineQueries } from '@cabloy/utils';
6
5
  import { BeanSimple, cast, isHttpUrl } from 'zova';
7
6
 
8
7
  import type { SysRouter } from './bean/sys.router.js';
@@ -58,12 +57,18 @@ export class MonkeySys
58
57
  if (options?.returnTo) {
59
58
  const returnTo =
60
59
  typeof options?.returnTo === 'string' ? options?.returnTo : app.$getCurrentPagePath();
61
- if (returnTo !== app.sys.env.ROUTER_PAGE_HOME) {
60
+ if (returnTo !== app.$getPagePathHome()) {
62
61
  query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;
63
62
  }
64
63
  }
65
- // combineQueries
66
- pagePath = combineQueries(pagePath, query);
64
+ // combineParamsAndQuery
65
+ pagePath = app.meta.$router.getPagePath(
66
+ pagePath as never,
67
+ {
68
+ params: options?.params,
69
+ query,
70
+ } as never,
71
+ );
67
72
  // redirect
68
73
  if (process.env.SERVER || options?.forceRedirect) {
69
74
  return app.$redirect(pagePath);
@@ -75,8 +80,9 @@ export class MonkeySys
75
80
  return app.meta.$router[options?.replace ? 'replace' : 'push'](pagePath);
76
81
  }
77
82
  };
78
- app.$gotoHome = () => {
79
- return app.$gotoPage(app.sys.env.ROUTER_PAGE_HOME);
83
+ app.$gotoHome = (options?: IGotoPageOptions) => {
84
+ const pagePath = app.$getPagePathHome(options);
85
+ return app.$gotoPage(pagePath, { ...options, params: undefined });
80
86
  };
81
87
  app.$gotoLogin = (returnTo?: string, cause?: string) => {
82
88
  if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN)
@@ -97,7 +103,7 @@ export class MonkeySys
97
103
  const pagePath =
98
104
  returnTo ||
99
105
  cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] ||
100
- app.sys.env.ROUTER_PAGE_HOME;
106
+ app.$getPagePathHome();
101
107
  return pagePath;
102
108
  };
103
109
  app.$getCurrentPagePath = (): string | undefined => {
@@ -109,5 +115,16 @@ export class MonkeySys
109
115
  }
110
116
  return cast(app.meta.$router.currentRoute)?.fullPath;
111
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
+ };
112
129
  }
113
130
  }
@@ -50,11 +50,12 @@ declare module 'zova' {
50
50
  export interface ZovaApplication {
51
51
  $redirect(pagePath: string, status?: 301 | 302): never;
52
52
  $gotoPage(pagePath: string, options?: IGotoPageOptions): TypeGotoPageResult;
53
- $gotoHome(): TypeGotoPageResult;
53
+ $gotoHome(options?: IGotoPageOptions): TypeGotoPageResult;
54
54
  $gotoLogin(returnTo?: string, cause?: string): TypeGotoPageResult;
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 {
@@ -1,7 +1,8 @@
1
+ import { IParamsAndQuery } from '@cabloy/utils';
2
+
1
3
  export const SymbolRouterHistory = Symbol('SymbolRouterHistory');
2
4
 
3
- export interface IGotoPageOptions {
4
- query?: object;
5
+ export interface IGotoPageOptions extends IParamsAndQuery {
5
6
  returnTo?: string | boolean;
6
7
  forceRedirect?: boolean;
7
8
  replace?: boolean;