cabloy 5.1.49 → 5.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/package.json +1 -1
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/src/suite/a-demo/modules/demo-basic/src/page/toolTwo/controller.tsx +0 -2
- package/zova/src/suite/a-home/modules/home-base/src/config/locale/en-us.ts +1 -0
- package/zova/src/suite/a-home/modules/home-base/src/config/locale/zh-cn.ts +1 -0
- package/zova/src/suite/a-home/modules/home-base/src/page/errorNotFound/controller.tsx +8 -2
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/controller.tsx +1 -1
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.header.tsx +1 -1
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.locale.tsx +2 -5
- package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.tabs.tsx +1 -4
- package/zova/src/suite-vendor/a-zova/modules/a-router/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-router/src/bean/sys.router.ts +28 -6
- package/zova/src/suite-vendor/a-zova/modules/a-router/src/monkeySys.ts +15 -3
- package/zova/src/suite-vendor/a-zova/modules/a-router/src/types/router.ts +1 -0
- package/zova/src/suite-vendor/a-zova/modules/a-routertabs/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-routertabs/src/model/tabs.ts +4 -0
- package/zova/src/suite-vendor/a-zova/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.1.50
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Update tab-related behavior and rendering.
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- Reset tabs when the layout refreshes.
|
|
12
|
+
- Improve active tab route matching.
|
|
13
|
+
- Handle alias routes correctly for active tabs.
|
|
14
|
+
- Improve navigation for localized home routes.
|
|
15
|
+
|
|
16
|
+
### Improvements
|
|
17
|
+
|
|
18
|
+
- Refine tab rendering logic.
|
|
19
|
+
|
|
3
20
|
## 5.1.49
|
|
4
21
|
|
|
5
22
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.93",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "A vue3 framework with ioc",
|
|
6
6
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"zova-core": "^5.1.48",
|
|
49
|
-
"zova-suite-a-zova": "^5.1.
|
|
49
|
+
"zova-suite-a-zova": "^5.1.92"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"clean-package": "^2.2.0",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RouterLink } from '@cabloy/vue-router';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import { BeanControllerPageBase, Use } from 'zova';
|
|
4
3
|
import { Controller } from 'zova-module-a-bean';
|
|
@@ -27,7 +26,6 @@ export class ControllerPageToolTwo extends BeanControllerPageBase {
|
|
|
27
26
|
<div>{`id: ${pageData?.id}`}</div>
|
|
28
27
|
<div>{`name: ${pageData?.name}`}</div>
|
|
29
28
|
<div>{`married: ${pageData?.married}`}</div>
|
|
30
|
-
<RouterLink to={this.sys.env.ROUTER_PAGE_HOME}>Go Home</RouterLink>
|
|
31
29
|
</div>
|
|
32
30
|
);
|
|
33
31
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RouterLink } from '@cabloy/vue-router';
|
|
2
1
|
import { classes } from 'typestyle';
|
|
3
2
|
import { BeanControllerPageBase } from 'zova';
|
|
4
3
|
import { Controller } from 'zova-module-a-bean';
|
|
@@ -26,7 +25,14 @@ export class ControllerPageErrorNotFound extends BeanControllerPageBase {
|
|
|
26
25
|
<div>
|
|
27
26
|
<div class={this.cTitle}>404</div>
|
|
28
27
|
<div class={this.cDescription}>Oops. Nothing here...</div>
|
|
29
|
-
<
|
|
28
|
+
<button
|
|
29
|
+
class="btn btn-primary"
|
|
30
|
+
onClick={() => {
|
|
31
|
+
this.app.$gotoHome();
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
{this.scope.locale.GoHome()}
|
|
35
|
+
</button>
|
|
30
36
|
</div>
|
|
31
37
|
</div>
|
|
32
38
|
);
|
package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.locale.tsx
CHANGED
|
@@ -22,13 +22,10 @@ export class RenderLocale extends BeanRenderBase {
|
|
|
22
22
|
<a
|
|
23
23
|
onClick={event => {
|
|
24
24
|
if (metaLocale) {
|
|
25
|
-
|
|
26
|
-
params:
|
|
27
|
-
locale: key === this.sys.config.locale.default ? '' : key,
|
|
28
|
-
}),
|
|
25
|
+
this.app.$gotoPage(currentRoute.matched[0].path, {
|
|
26
|
+
params: { ...currentRoute.params, locale: key },
|
|
29
27
|
query: currentRoute.query,
|
|
30
28
|
});
|
|
31
|
-
this.$router.push(fullPath);
|
|
32
29
|
} else {
|
|
33
30
|
this.$$serviceLocale.setLocale(key as any);
|
|
34
31
|
}
|
package/zova/src/suite/a-home/modules/home-layoutweb/src/component/layoutWeb/render.tabs.tsx
CHANGED
|
@@ -16,7 +16,6 @@ export class RenderTabs extends BeanRenderBase {
|
|
|
16
16
|
public renderTabs(): VNode | undefined {
|
|
17
17
|
const $$modelTabs = this.$$modelTabs;
|
|
18
18
|
if (!$$modelTabs) return;
|
|
19
|
-
|
|
20
19
|
const domTabs = $$modelTabs.tabs.map(tab => {
|
|
21
20
|
return this._renderMenuItem(tab.info as TypeMenuItem, true, tab.tabKey);
|
|
22
21
|
});
|
|
@@ -144,9 +143,7 @@ export class RenderTabs extends BeanRenderBase {
|
|
|
144
143
|
|
|
145
144
|
private _isMenuLeafCurrent(item: TypeMenuLeaf): boolean {
|
|
146
145
|
if (item.external || !item.link) return false;
|
|
147
|
-
|
|
148
|
-
if (!currentRoute) return false;
|
|
149
|
-
return currentRoute.fullPath === item.link;
|
|
146
|
+
return this.$router.checkActiveOfFullPath(item.link);
|
|
150
147
|
}
|
|
151
148
|
|
|
152
149
|
private _getMenuItemKey(item: TypeMenuItem): string {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
RouteLocationMatched,
|
|
3
3
|
RouteLocationNormalizedLoaded,
|
|
4
|
+
RouteLocationNormalizedLoadedGeneric,
|
|
4
5
|
RouteLocationResolvedGeneric,
|
|
5
6
|
Router,
|
|
6
7
|
RouterOptions,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
import { BeanBase, cast, deepExtend } from 'zova';
|
|
19
20
|
import { Sys } from 'zova-module-a-bean';
|
|
20
21
|
|
|
21
|
-
import { getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';
|
|
22
|
+
import { getCurrentRoute, getRealRouteName, getRouteMatched, isRouterName } from '../lib/utils.js';
|
|
22
23
|
import {
|
|
23
24
|
IModuleRoute,
|
|
24
25
|
IModuleRouteComponent,
|
|
@@ -98,11 +99,10 @@ export class SysRouter extends BeanBase {
|
|
|
98
99
|
) {
|
|
99
100
|
const query = options?.query;
|
|
100
101
|
let params = options?.params;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
: this.app.meta.locale.current;
|
|
102
|
+
const paramsLocale = cast(params)?.locale;
|
|
103
|
+
if (paramsLocale !== undefined) {
|
|
104
|
+
const localeCurrent = paramsLocale === true ? this.app.meta.locale.current : paramsLocale;
|
|
105
|
+
const locale = localeCurrent === this.sys.config.locale.default ? undefined : localeCurrent;
|
|
106
106
|
params = Object.assign({}, params, { locale });
|
|
107
107
|
}
|
|
108
108
|
const pagePath = combineParamsAndQuery(path, { params, query });
|
|
@@ -144,6 +144,28 @@ export class SysRouter extends BeanBase {
|
|
|
144
144
|
return this.sys.meta.module.exists(moduleName);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
public checkActiveOfFullPath(
|
|
148
|
+
fullPath: string,
|
|
149
|
+
currentRoute?: RouteLocationNormalizedLoadedGeneric,
|
|
150
|
+
): boolean {
|
|
151
|
+
if (!currentRoute) {
|
|
152
|
+
currentRoute = getCurrentRoute(this.ctx)?.value;
|
|
153
|
+
}
|
|
154
|
+
if (!currentRoute) return false;
|
|
155
|
+
if (currentRoute.fullPath === fullPath) return true;
|
|
156
|
+
if (!currentRoute.matched || currentRoute.matched.length === 0) return false;
|
|
157
|
+
return currentRoute.matched.some(routeAlias => {
|
|
158
|
+
const fullPathAlias = this.getPagePath(
|
|
159
|
+
routeAlias.path as never,
|
|
160
|
+
{
|
|
161
|
+
params: currentRoute.params,
|
|
162
|
+
query: currentRoute.query,
|
|
163
|
+
} as never,
|
|
164
|
+
);
|
|
165
|
+
return fullPathAlias === fullPath;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
147
169
|
public async ensureRoute(pagePath: string) {
|
|
148
170
|
// try to resolve, support alias route
|
|
149
171
|
let route = this._vueRouterSys.resolve(pagePath);
|
|
@@ -57,7 +57,7 @@ export class MonkeySys
|
|
|
57
57
|
if (options?.returnTo) {
|
|
58
58
|
const returnTo =
|
|
59
59
|
typeof options?.returnTo === 'string' ? options?.returnTo : app.$getCurrentPagePath();
|
|
60
|
-
if (returnTo !== app
|
|
60
|
+
if (returnTo !== app.$getPagePathHome()) {
|
|
61
61
|
query[app.sys.env.ROUTER_KEY_RETURNTO] = returnTo;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -81,7 +81,8 @@ export class MonkeySys
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
app.$gotoHome = (options?: IGotoPageOptions) => {
|
|
84
|
-
|
|
84
|
+
const pagePath = app.$getPagePathHome(options);
|
|
85
|
+
return app.$gotoPage(pagePath, { ...options, params: undefined });
|
|
85
86
|
};
|
|
86
87
|
app.$gotoLogin = (returnTo?: string, cause?: string) => {
|
|
87
88
|
if (!returnTo && cast(app.meta.$router.currentRoute)?.path === app.sys.env.ROUTER_PAGE_LOGIN)
|
|
@@ -102,7 +103,7 @@ export class MonkeySys
|
|
|
102
103
|
const pagePath =
|
|
103
104
|
returnTo ||
|
|
104
105
|
cast(app.meta.$router.currentRoute)?.query?.[app.sys.env.ROUTER_KEY_RETURNTO] ||
|
|
105
|
-
app
|
|
106
|
+
app.$getPagePathHome();
|
|
106
107
|
return pagePath;
|
|
107
108
|
};
|
|
108
109
|
app.$getCurrentPagePath = (): string | undefined => {
|
|
@@ -114,5 +115,16 @@ export class MonkeySys
|
|
|
114
115
|
}
|
|
115
116
|
return cast(app.meta.$router.currentRoute)?.fullPath;
|
|
116
117
|
};
|
|
118
|
+
app.$getPagePathHome = (options?: IGotoPageOptions): string => {
|
|
119
|
+
let params = options?.params;
|
|
120
|
+
if (params?.locale === undefined) {
|
|
121
|
+
params = Object.assign({}, params, { locale: true });
|
|
122
|
+
}
|
|
123
|
+
// not handle options?.query
|
|
124
|
+
return app.meta.$router.getPagePath(
|
|
125
|
+
app.sys.env.ROUTER_PAGE_HOME as never,
|
|
126
|
+
{ params } as never,
|
|
127
|
+
);
|
|
128
|
+
};
|
|
117
129
|
}
|
|
118
130
|
}
|
|
@@ -55,6 +55,7 @@ declare module 'zova' {
|
|
|
55
55
|
$gotoReturnTo(returnTo?: string): TypeGotoPageResult;
|
|
56
56
|
$getReturnTo(returnTo?: string): string;
|
|
57
57
|
$getCurrentPagePath(): string | undefined;
|
|
58
|
+
$getPagePathHome(options?: IGotoPageOptions): string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export interface AppMeta {
|
|
@@ -183,6 +183,10 @@ export class ModelTabs extends BeanModelBase {
|
|
|
183
183
|
return true;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
resetAllTabInfos() {
|
|
187
|
+
this.tabs = this._getInitialTabs() as RouteTab[];
|
|
188
|
+
}
|
|
189
|
+
|
|
186
190
|
updateAllTabInfos(tabInitials?: RouteTabInitial[]) {
|
|
187
191
|
for (const tab of this.tabs) {
|
|
188
192
|
const tabInitial = tabInitials?.find(item => item.tabKey === tab.tabKey);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-suite-a-zova",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.92",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "zova",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"zova-module-a-meta": "^5.1.15",
|
|
24
24
|
"zova-module-a-model": "^5.1.23",
|
|
25
25
|
"zova-module-a-openapi": "^5.1.30",
|
|
26
|
-
"zova-module-a-router": "^5.1.
|
|
26
|
+
"zova-module-a-router": "^5.1.23",
|
|
27
27
|
"zova-module-a-routerstack": "^5.1.20",
|
|
28
|
-
"zova-module-a-routertabs": "^5.1.
|
|
28
|
+
"zova-module-a-routertabs": "^5.1.25",
|
|
29
29
|
"zova-module-a-ssr": "^5.1.18",
|
|
30
30
|
"zova-module-a-ssrhmr": "^5.1.16",
|
|
31
31
|
"zova-module-a-ssrserver": "^5.1.15",
|