@pubinfo/core 2.0.0-rc.3 → 2.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppSetting-3wJKvibc.js → AppSetting-DqVYDIHj.js} +15 -15
- package/dist/{HCheckList.vue_vue_type_script_setup_true_lang-17EywJvs.js → HCheckList.vue_vue_type_script_setup_true_lang-SrNklW3P.js} +1 -1
- package/dist/{HToggle-B-ZjSh6S.js → HToggle-DGTP9jYA.js} +1 -1
- package/dist/{PreferencesContent-xT4paU7N.js → PreferencesContent-5NtwK9RQ.js} +4 -4
- package/dist/{SettingBreadcrumb-CYnO51Ek.js → SettingBreadcrumb-BudqQsuJ.js} +3 -3
- package/dist/{SettingCopyright-FOW5ObHK.js → SettingCopyright-VUberG4R.js} +2 -2
- package/dist/{SettingEnableTransition-Q5cvubmF.js → SettingEnableTransition-C6NYf021.js} +2 -2
- package/dist/SettingHome-BTaeKgwN.js +46 -0
- package/dist/{SettingMenu-BNAJ3el9.js → SettingMenu-D9Aon2LP.js} +3 -3
- package/dist/{SettingMode-LzlRsBL9.js → SettingMode-DaqVd9Mq.js} +1 -1
- package/dist/{SettingNavSearch-BA08vYuw.js → SettingNavSearch-N4JIheIk.js} +2 -2
- package/dist/{SettingOther-BE8dDCYD.js → SettingOther-tLulcors.js} +2 -2
- package/dist/{SettingPage-D061yXCv.js → SettingPage-CEjWB45R.js} +2 -2
- package/dist/{SettingTabbar-COwdPPKy.js → SettingTabbar-DyeLhcCT.js} +3 -3
- package/dist/{SettingThemes-BHaYERNp.js → SettingThemes-C2M3tsVl.js} +1 -1
- package/dist/{SettingToolbar-fSuzu6ND.js → SettingToolbar-DI7de6i0.js} +24 -31
- package/dist/{SettingTopbar-D7GgP0KB.js → SettingTopbar-BgIoXeAq.js} +3 -3
- package/dist/{SettingWidthMode-CNjzChe1.js → SettingWidthMode-DIAU4s5e.js} +1 -1
- package/dist/{TopThinMode-B-28sBJD.js → TopThinMode-JNUHrJI2.js} +1 -1
- package/dist/built-in/authentication/alova/helper.d.ts +34 -0
- package/dist/built-in/authentication/alova/token.d.ts +16 -0
- package/dist/built-in/authentication/helper.d.ts +10 -1
- package/dist/built-in/index.d.ts +1 -1
- package/dist/built-in/layout-component/components/Tools/SearchPanel.vue.d.ts +7 -2
- package/dist/built-in/layout-component/components/ui/HSlideover.vue.d.ts +1 -1
- package/dist/built-in/layout-component/composables/useContext.d.ts +1 -1
- package/dist/built-in/layout-component/composables/useGlobalSearch.d.ts +7 -0
- package/dist/built-in/layout-component/composables/useTitle.d.ts +1 -1
- package/dist/built-in/system-info/components/SystemInfo.vue.d.ts +2 -0
- package/dist/built-in/system-info/index.d.ts +5 -0
- package/dist/{colors-BIQSd520.js → colors-DxWfHM_v.js} +1 -1
- package/dist/core/interface.d.ts +14 -5
- package/dist/core/request.d.ts +2 -8
- package/dist/features/api/modules/auth/renzhengfuwu.d.ts +8 -8
- package/dist/features/api/modules/configData/heibaimingdanfuwu.d.ts +5 -5
- package/dist/features/api/modules/configData/xitongpeizhifuwu.d.ts +14 -14
- package/dist/features/api/modules/configData/zidifuwu.d.ts +10 -10
- package/dist/features/api/modules/rbac/gangweijiekou.d.ts +6 -6
- package/dist/features/api/modules/rbac/jiaosejiekou.d.ts +7 -7
- package/dist/features/api/modules/rbac/pubJiaosezukongzhiqi.d.ts +7 -7
- package/dist/features/api/modules/rbac/shujuquanxianzhubiaokongzhiqi.d.ts +9 -9
- package/dist/features/api/modules/rbac/yonghujiekou.d.ts +15 -15
- package/dist/features/api/modules/rbac/yonghushoucangbiaojiekou.d.ts +5 -5
- package/dist/features/api/modules/rbac/yonghuzuijinchangyongbiaojiekou.d.ts +4 -4
- package/dist/features/api/modules/rbac/ziyuanjiekou.d.ts +13 -13
- package/dist/features/api/modules/rbac/zuhuguanlijiekou.d.ts +5 -5
- package/dist/features/api/modules/rbac/zuzhijiaosebiaokongzhiqi.d.ts +4 -4
- package/dist/features/api/modules/rbac/zuzhijiekou.d.ts +9 -9
- package/dist/features/api/system/user.d.ts +4 -4
- package/dist/features/components/PubinfoIcon/PrismBox.vue.d.ts +21 -0
- package/dist/features/components/PubinfoIcon/SquareBox.vue.d.ts +17 -0
- package/dist/features/components/PubinfoIcon/index.vue.d.ts +13 -9
- package/dist/features/components/PubinfoIcon/props.d.ts +58 -0
- package/dist/features/components/index.d.ts +2 -0
- package/dist/{index-Dlf6GQBd.js → index-5fRpGyLW.js} +4 -4
- package/dist/{index-DNdH93AP.js → index-BFRIv97x.js} +2 -2
- package/dist/{index-WubcSL0v.js → index-BH-vHGvk.js} +1 -1
- package/dist/{index-YSjb6X1D.js → index-C7xIGcDc.js} +4 -7
- package/dist/{index-DYMBkmAp.js → index-CNVn3Ubv.js} +2 -2
- package/dist/{index-CPRiufg0.js → index-Cf-u1Zqh.js} +1 -1
- package/dist/{index-wxEEuQXu.js → index-D4v4g8FJ.js} +111 -97
- package/dist/{index-IscoZG-Y.js → index-DQGnbEGS.js} +2 -2
- package/dist/{index-Beb7_0-E.js → index-Dv7UUFkD.js} +24237 -23807
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -48
- package/dist/{pick-D_XPbQHB.js → pick-VFuUwFn-.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/global.d.ts +33 -0
- package/dist/utils/index.d.ts +2 -1
- package/package.json +10 -7
- package/src/built-in/authentication/alova/helper.ts +158 -0
- package/src/built-in/authentication/alova/token.ts +122 -0
- package/src/built-in/authentication/helper.ts +7 -3
- package/src/built-in/authentication/index.ts +6 -20
- package/src/built-in/index.ts +1 -1
- package/src/built-in/layout-component/components/Header/TopMode/index.vue +30 -9
- package/src/built-in/layout-component/components/Menu/item.vue +44 -9
- package/src/built-in/layout-component/components/SettingBar/components/SettingHome.vue +1 -4
- package/src/built-in/layout-component/components/SettingBar/components/SettingToolbar.vue +0 -6
- package/src/built-in/layout-component/components/Sidebar/MainSidebar.vue +3 -3
- package/src/built-in/layout-component/components/Tools/SearchBar.vue +1 -3
- package/src/built-in/layout-component/components/Tools/SearchPanel.vue +125 -57
- package/src/built-in/layout-component/components/Tools/index.vue +9 -12
- package/src/built-in/layout-component/components/Topbar/Tabbar/MoreAction.vue +64 -11
- package/src/built-in/layout-component/components/Topbar/Tabbar/index.vue +73 -18
- package/src/built-in/layout-component/components/Topbar/Toolbar/Favorites.vue +4 -7
- package/src/built-in/layout-component/components/Topbar/Toolbar/index.vue +6 -6
- package/src/built-in/layout-component/composables/useContext.ts +1 -1
- package/src/built-in/layout-component/composables/useGlobalSearch.ts +40 -1
- package/src/built-in/layout-component/composables/useTitle.ts +8 -14
- package/src/built-in/layout-component/provider.ts +2 -2
- package/src/built-in/system-info/components/SystemInfo.vue +53 -0
- package/src/built-in/system-info/index.ts +16 -0
- package/src/core/ctx.ts +7 -1
- package/src/core/interface.ts +18 -5
- package/src/core/request.ts +35 -15
- package/src/core/resolver/icon.ts +9 -5
- package/src/features/components/PubinfoIcon/PrismBox.vue +203 -0
- package/src/features/components/PubinfoIcon/SquareBox.vue +59 -0
- package/src/features/components/PubinfoIcon/index.vue +128 -37
- package/src/features/components/PubinfoIcon/props.ts +54 -0
- package/src/features/components/index.ts +4 -1
- package/src/features/context/index.ts +1 -16
- package/src/features/router/systemRoutes.ts +0 -1
- package/src/features/settings/index.ts +0 -1
- package/src/features/stores/modules/favorites.ts +0 -1
- package/src/features/stores/modules/route.ts +2 -9
- package/src/features/stores/modules/tabbar.ts +0 -3
- package/src/features/stores/utils/routerHelper.ts +35 -4
- package/src/index.ts +7 -2
- package/src/utils/global.ts +161 -0
- package/src/utils/index.ts +2 -1
- package/src/utils/proxy.ts +7 -8
- package/types/global.d.ts +7 -0
- package/types/menu.d.ts +10 -0
- package/types/settings.d.ts +0 -7
- package/types/vue-router.d.ts +0 -3
- package/dist/SettingHome-Df7-AlWB.js +0 -55
- package/dist/built-in/locales/helpler.d.ts +0 -594
- package/dist/built-in/locales/index.d.ts +0 -5
- package/dist/built-in/locales/lang/en.json.d.ts +0 -99
- package/dist/built-in/locales/lang/zh-cn.json.d.ts +0 -100
- package/dist/built-in/locales/lang/zh-tw.json.d.ts +0 -100
- package/dist/built-in/locales/ui.d.ts +0 -3
- package/src/built-in/locales/helpler.ts +0 -76
- package/src/built-in/locales/index.ts +0 -20
- package/src/built-in/locales/lang/en.json +0 -96
- package/src/built-in/locales/lang/zh-cn.json +0 -97
- package/src/built-in/locales/lang/zh-tw.json +0 -97
- package/src/built-in/locales/ui.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RouterMetaRawBaseOptions } from '#/vue-router';
|
|
2
2
|
import type { RequireExactlyOne } from 'type-fest';
|
|
3
|
-
import { cloneDeep, isUndefined, omitBy } from 'lodash-es';
|
|
3
|
+
import { cloneDeep, isEmpty, isUndefined, omitBy } from 'lodash-es';
|
|
4
4
|
import { setupDefaultLayout, setupPage } from '@/core';
|
|
5
5
|
import { RESOURCE_TYPE } from '@/features/enum';
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ export function formatBackRoutes(
|
|
|
26
26
|
): BackEndRoute[] {
|
|
27
27
|
const backEndRoutes = filterRoutes(routes, [RESOURCE_TYPE.BUTTON]);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const formatRoutes = backEndRoutes.map((route: API.PubResourceTreeBo) => {
|
|
30
30
|
const children = route?.children && route.children.length > 0
|
|
31
31
|
? formatBackRoutes(route.children, route)
|
|
32
32
|
: [];
|
|
@@ -37,7 +37,6 @@ export function formatBackRoutes(
|
|
|
37
37
|
icon: route?.icon,
|
|
38
38
|
...route?.meta,
|
|
39
39
|
|
|
40
|
-
// CLOSE: 根据资源类型设置正确的显示属性
|
|
41
40
|
// 应用和动态应用不需要在侧边栏和标签栏显示,因为它们通过TopMode渲染
|
|
42
41
|
...(route.type === RESOURCE_TYPE.APP || route.type === RESOURCE_TYPE.DYNAMIC_APP
|
|
43
42
|
? {
|
|
@@ -56,7 +55,6 @@ export function formatBackRoutes(
|
|
|
56
55
|
: {}),
|
|
57
56
|
}, isUndefined) as BackEndRoute['meta'];
|
|
58
57
|
|
|
59
|
-
// TODO: 这里的逻辑可能需要根据实际情况调整
|
|
60
58
|
const finalRoute = cloneDeep(omitBy<BackEndRoute>({
|
|
61
59
|
name: route?.meta?.routeName ?? undefined,
|
|
62
60
|
path: route?.meta?.url ?? undefined,
|
|
@@ -87,6 +85,8 @@ export function formatBackRoutes(
|
|
|
87
85
|
return finalRoute;
|
|
88
86
|
}
|
|
89
87
|
});
|
|
88
|
+
|
|
89
|
+
return isEmpty(parent) ? filterEmptyComponentRoutes(formatRoutes) : formatRoutes;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/** 过滤指定类型的路由 */
|
|
@@ -99,6 +99,37 @@ function filterRoutes(routes: API.PubResourceTreeBo[] = [], excludes: string[])
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/** 过滤找不到SFC组件的路由 */
|
|
103
|
+
function filterEmptyComponentRoutes(routes: BackEndRoute[], minDepth = 3): BackEndRoute[] {
|
|
104
|
+
function recurse(route: BackEndRoute): BackEndRoute | null {
|
|
105
|
+
const children = route.children?.map(recurse).filter(Boolean) as BackEndRoute[] | undefined;
|
|
106
|
+
|
|
107
|
+
if (children && children.length > 0) {
|
|
108
|
+
return { ...route, children };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (children?.length === 0 && route.component) {
|
|
112
|
+
// 叶子且有 component
|
|
113
|
+
const { children, ...rest } = route;
|
|
114
|
+
return { ...rest, children: [] };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function maxDepth(route: BackEndRoute): number {
|
|
121
|
+
if (!route.children || route.children.length === 0) {
|
|
122
|
+
return 1;
|
|
123
|
+
}
|
|
124
|
+
return 1 + Math.max(...route.children.map(maxDepth));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return routes
|
|
128
|
+
.map(recurse)
|
|
129
|
+
.filter((r): r is BackEndRoute => !!r)
|
|
130
|
+
.filter(r => maxDepth(r) >= minDepth);
|
|
131
|
+
}
|
|
132
|
+
|
|
102
133
|
/** 转换目录 */
|
|
103
134
|
function transformIndex(route: BackEndRoute, parent: API.PubResourceTreeBo = {}): BackEndRoute {
|
|
104
135
|
switch (parent.type) {
|
package/src/index.ts
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
Authentication,
|
|
4
4
|
Authorization,
|
|
5
5
|
LayoutComponent,
|
|
6
|
-
Locales,
|
|
7
6
|
NProgress,
|
|
8
7
|
PiniaPlugin,
|
|
9
8
|
PreAccess,
|
|
10
9
|
Settings,
|
|
10
|
+
SystemInfo,
|
|
11
11
|
} from './built-in';
|
|
12
12
|
import { createApp } from './core';
|
|
13
13
|
import { createPubinfoContext } from './features/context/index.ts';
|
|
@@ -71,8 +71,8 @@ export function createPubinfo(options: PubinfoOptions) {
|
|
|
71
71
|
Authorization(),
|
|
72
72
|
LayoutComponent(),
|
|
73
73
|
Settings(),
|
|
74
|
-
Locales(),
|
|
75
74
|
NProgress(),
|
|
75
|
+
SystemInfo(),
|
|
76
76
|
...(options.modules ?? []),
|
|
77
77
|
],
|
|
78
78
|
});
|
|
@@ -109,7 +109,12 @@ export * from './features';
|
|
|
109
109
|
export {
|
|
110
110
|
cleanup,
|
|
111
111
|
cleanupWithoutUser,
|
|
112
|
+
clearPersistedState,
|
|
112
113
|
createContext,
|
|
114
|
+
createRawContext,
|
|
115
|
+
getPersistedState,
|
|
116
|
+
getPubinfoNamespace,
|
|
117
|
+
setPersistedState,
|
|
113
118
|
storage,
|
|
114
119
|
wrapProxy,
|
|
115
120
|
} from './utils';
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { UseContext } from 'unctx';
|
|
2
|
+
import { createContext as createRawContext } from 'unctx';
|
|
3
|
+
|
|
4
|
+
type PubinfoNamespace = Record<string, unknown>;
|
|
5
|
+
|
|
6
|
+
function ensureNamespace(): PubinfoNamespace {
|
|
7
|
+
const g = globalThis as typeof globalThis & { __PUBINFO__?: PubinfoNamespace };
|
|
8
|
+
if (!g.__PUBINFO__) {
|
|
9
|
+
g.__PUBINFO__ = {};
|
|
10
|
+
}
|
|
11
|
+
return g.__PUBINFO__;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Return the shared __PUBINFO__ namespace, creating it if necessary.
|
|
16
|
+
*/
|
|
17
|
+
export function getPubinfoNamespace(): PubinfoNamespace {
|
|
18
|
+
return ensureNamespace();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface PersistedContextOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Optional key used to hydrate persisted state.
|
|
24
|
+
* Defaults to transforming `FooCtx` into `FooState`.
|
|
25
|
+
*/
|
|
26
|
+
stateKey?: string
|
|
27
|
+
/**
|
|
28
|
+
* Toggle hydration behaviour. Enabled by default.
|
|
29
|
+
*/
|
|
30
|
+
hydrate?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* Automatically persist whenever ctx.set() is called.
|
|
33
|
+
*/
|
|
34
|
+
persistOnSet?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create (or reuse) a context stored on the global namespace and
|
|
39
|
+
* hydrate it from a persisted state if available.
|
|
40
|
+
*/
|
|
41
|
+
export function createContext<T>(
|
|
42
|
+
contextKey: string,
|
|
43
|
+
options: PersistedContextOptions = {},
|
|
44
|
+
): UseContext<T> {
|
|
45
|
+
const namespace = ensureNamespace();
|
|
46
|
+
|
|
47
|
+
const normalized = normalizeKeys(contextKey, options.stateKey);
|
|
48
|
+
|
|
49
|
+
if (!namespace[normalized.contextKey]) {
|
|
50
|
+
const existing = normalized.aliasKey ? namespace[normalized.aliasKey] : undefined;
|
|
51
|
+
namespace[normalized.contextKey] = (existing as UseContext<T> | undefined) ?? createRawContext<T>();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const ctx = namespace[normalized.contextKey] as UseContext<T> & { __pubinfo_persisted?: boolean };
|
|
55
|
+
|
|
56
|
+
if (normalized.aliasKey) {
|
|
57
|
+
namespace[normalized.aliasKey] = ctx;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const { hydrate = true, persistOnSet = true } = options;
|
|
61
|
+
const hydrateKey = normalized.stateKey;
|
|
62
|
+
|
|
63
|
+
if (hydrateKey && persistOnSet && !ctx.__pubinfo_persisted) {
|
|
64
|
+
const originalSet = ctx.set.bind(ctx);
|
|
65
|
+
const originalUnset = ctx.unset.bind(ctx);
|
|
66
|
+
|
|
67
|
+
ctx.set = (instance?: T, replace?: boolean) => {
|
|
68
|
+
originalSet(instance, replace);
|
|
69
|
+
if (instance !== undefined) {
|
|
70
|
+
setPersistedState(hydrateKey, instance);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
clearPersistedState(hydrateKey);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
ctx.unset = () => {
|
|
78
|
+
clearPersistedState(hydrateKey);
|
|
79
|
+
originalUnset();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
ctx.__pubinfo_persisted = true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (hydrate && hydrateKey) {
|
|
86
|
+
const savedState = namespace[hydrateKey];
|
|
87
|
+
if (savedState !== undefined) {
|
|
88
|
+
try {
|
|
89
|
+
ctx.set(savedState as T);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// ignore hydration failures; callers can recover manually
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return ctx;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Persist a value inside the __PUBINFO__ namespace. */
|
|
101
|
+
export function setPersistedState<T>(stateKey: string, state: T) {
|
|
102
|
+
const namespace = ensureNamespace();
|
|
103
|
+
namespace[stateKey] = state;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Retrieve a value from the __PUBINFO__ namespace. */
|
|
107
|
+
export function getPersistedState<T>(stateKey: string): T | undefined {
|
|
108
|
+
const namespace = ensureNamespace();
|
|
109
|
+
return namespace[stateKey] as T | undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Remove a value from the __PUBINFO__ namespace. */
|
|
113
|
+
export function clearPersistedState(stateKey: string) {
|
|
114
|
+
const namespace = ensureNamespace();
|
|
115
|
+
if (stateKey in namespace) {
|
|
116
|
+
delete namespace[stateKey];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface NormalizedKeys {
|
|
121
|
+
contextKey: string
|
|
122
|
+
stateKey?: string
|
|
123
|
+
aliasKey?: string
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function normalizeKeys(contextKey: string, explicitStateKey?: string): NormalizedKeys {
|
|
127
|
+
if (explicitStateKey) {
|
|
128
|
+
return { contextKey, stateKey: explicitStateKey };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (contextKey.endsWith('Ctx')) {
|
|
132
|
+
const base = contextKey.slice(0, -3);
|
|
133
|
+
return {
|
|
134
|
+
contextKey,
|
|
135
|
+
stateKey: base ? `${base}State` : undefined,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (contextKey.endsWith('Context')) {
|
|
140
|
+
const base = contextKey.slice(0, -7);
|
|
141
|
+
if (base) {
|
|
142
|
+
return {
|
|
143
|
+
contextKey: `${base}Ctx`,
|
|
144
|
+
stateKey: `${base}State`,
|
|
145
|
+
aliasKey: contextKey,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const base = contextKey;
|
|
151
|
+
if (!base) {
|
|
152
|
+
return { contextKey, stateKey: undefined };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const normalizedContextKey = `${base}Ctx`;
|
|
156
|
+
return {
|
|
157
|
+
contextKey: normalizedContextKey,
|
|
158
|
+
stateKey: `${base}State`,
|
|
159
|
+
aliasKey: normalizedContextKey !== contextKey ? contextKey : undefined,
|
|
160
|
+
};
|
|
161
|
+
}
|
package/src/utils/index.ts
CHANGED
package/src/utils/proxy.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getPersistedState } from './global';
|
|
2
|
+
|
|
1
3
|
export function wrapProxy<T extends Record<K, any>, K extends keyof T>(
|
|
2
4
|
fn: () => T,
|
|
3
5
|
key: K,
|
|
@@ -10,14 +12,11 @@ export function wrapProxy<T extends Record<K, any>, K extends keyof T>(
|
|
|
10
12
|
}
|
|
11
13
|
catch (e) {
|
|
12
14
|
// 1. 从全局缓存读取
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const val = (inst as any)[prop];
|
|
19
|
-
return typeof val === 'function' ? val.bind(inst) : val;
|
|
20
|
-
}
|
|
15
|
+
const cached = getPersistedState<T>('state');
|
|
16
|
+
if (cached && cached[key]) {
|
|
17
|
+
const inst = cached[key];
|
|
18
|
+
const val = (inst as any)[prop];
|
|
19
|
+
return typeof val === 'function' ? val.bind(inst) : val;
|
|
21
20
|
}
|
|
22
21
|
throw e;
|
|
23
22
|
}
|
package/types/menu.d.ts
CHANGED
|
@@ -24,6 +24,16 @@ export declare namespace Menu {
|
|
|
24
24
|
icon?: string
|
|
25
25
|
activeIcon?: string
|
|
26
26
|
auth?: string | string[]
|
|
27
|
+
iconOptions?: {
|
|
28
|
+
angle?: number | string
|
|
29
|
+
background?: string | {
|
|
30
|
+
from: string
|
|
31
|
+
to: string
|
|
32
|
+
}
|
|
33
|
+
boxType?: 'square' | 'prism'
|
|
34
|
+
iconColor?: string
|
|
35
|
+
radius?: number | string
|
|
36
|
+
}
|
|
27
37
|
sidebar?: boolean
|
|
28
38
|
isDev?: boolean
|
|
29
39
|
devText?: string
|
package/types/settings.d.ts
CHANGED
package/types/vue-router.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { User } from './user';
|
|
|
4
4
|
|
|
5
5
|
export interface RouterMetaRawBaseOptions {
|
|
6
6
|
title: string | (() => string)
|
|
7
|
-
i18n: string
|
|
8
7
|
icon: string
|
|
9
8
|
activeIcon: string
|
|
10
9
|
defaultOpened: boolean
|
|
@@ -36,7 +35,6 @@ export declare namespace Route {
|
|
|
36
35
|
|
|
37
36
|
type mainMeta
|
|
38
37
|
= | 'title'
|
|
39
|
-
| 'i18n'
|
|
40
38
|
| 'icon'
|
|
41
39
|
| 'activeIcon'
|
|
42
40
|
| 'auth'
|
|
@@ -60,7 +58,6 @@ export declare namespace Route {
|
|
|
60
58
|
interface breadcrumb {
|
|
61
59
|
path: string
|
|
62
60
|
title?: string | (() => string)
|
|
63
|
-
i18n?: string
|
|
64
61
|
icon?: string
|
|
65
62
|
activeIcon?: string
|
|
66
63
|
hide: boolean
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { _ as f } from "./HDivider.vue_vue_type_script_setup_true_lang-DIHR-9Yv.js";
|
|
2
|
-
import { _ as b } from "./HInput.vue_vue_type_script_setup_true_lang-DBqCXRnn.js";
|
|
3
|
-
import { _ as g } from "./HToggle-B-ZjSh6S.js";
|
|
4
|
-
import { bL as V, bN as x } from "./index-Beb7_0-E.js";
|
|
5
|
-
import { defineComponent as H, toRefs as v, createBlock as N, openBlock as C, withCtx as i, createElementVNode as s, createVNode as o, createTextVNode as a, unref as t } from "vue";
|
|
6
|
-
import { R as _ } from "./question-line-CfkciTFq.js";
|
|
7
|
-
const R = { class: "setting-item" }, S = { class: "label" }, T = { class: "setting-item" }, $ = { class: "label" }, Q = /* @__PURE__ */ H({
|
|
8
|
-
name: "SettingHome",
|
|
9
|
-
__name: "SettingHome",
|
|
10
|
-
setup(k) {
|
|
11
|
-
const { settingsStore: d } = V(), { home: n, toolbar: r } = v(d.settings);
|
|
12
|
-
return (B, e) => {
|
|
13
|
-
const m = x, p = g, u = b, c = f;
|
|
14
|
-
return C(), N(c, { title: "主页" }, {
|
|
15
|
-
default: i(() => [
|
|
16
|
-
s("div", R, [
|
|
17
|
-
s("div", S, [
|
|
18
|
-
e[2] || (e[2] = a(" 是否启用 ")),
|
|
19
|
-
o(m, { text: "该功能开启时,登录成功默认进入主页,反之则默认进入导航栏里第一个导航页面" }, {
|
|
20
|
-
default: i(() => [
|
|
21
|
-
o(t(_))
|
|
22
|
-
]),
|
|
23
|
-
_: 1
|
|
24
|
-
})
|
|
25
|
-
]),
|
|
26
|
-
o(p, {
|
|
27
|
-
modelValue: t(n).enable,
|
|
28
|
-
"onUpdate:modelValue": e[0] || (e[0] = (l) => t(n).enable = l)
|
|
29
|
-
}, null, 8, ["modelValue"])
|
|
30
|
-
]),
|
|
31
|
-
s("div", T, [
|
|
32
|
-
s("div", $, [
|
|
33
|
-
e[3] || (e[3] = a(" 主页名称 ")),
|
|
34
|
-
o(m, { text: "开启国际化时,该设置无效" }, {
|
|
35
|
-
default: i(() => [
|
|
36
|
-
o(t(_))
|
|
37
|
-
]),
|
|
38
|
-
_: 1
|
|
39
|
-
})
|
|
40
|
-
]),
|
|
41
|
-
o(u, {
|
|
42
|
-
modelValue: t(n).title,
|
|
43
|
-
"onUpdate:modelValue": e[1] || (e[1] = (l) => t(n).title = l),
|
|
44
|
-
disabled: t(r).enableI18n
|
|
45
|
-
}, null, 8, ["modelValue", "disabled"])
|
|
46
|
-
])
|
|
47
|
-
]),
|
|
48
|
-
_: 1
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
export {
|
|
54
|
-
Q as default
|
|
55
|
-
};
|