@done-coding/admin-core 0.3.1-alpha.0 → 0.5.0
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/es/bridge/index.mjs +83 -27
- package/es/components/app-layout/AppBody.vue.mjs +7 -0
- package/es/components/app-layout/AppBody.vue2.mjs +89 -0
- package/es/components/app-layout/AppBreadcrumb.vue.mjs +7 -0
- package/es/components/app-layout/AppBreadcrumb.vue2.mjs +58 -0
- package/es/components/app-layout/AppFooter.vue.mjs +7 -0
- package/es/components/app-layout/AppFooter.vue2.mjs +17 -0
- package/es/components/app-layout/AppHeader.vue.mjs +7 -0
- package/es/components/app-layout/AppHeader.vue2.mjs +99 -0
- package/es/components/app-layout/AppLayout.vue.mjs +7 -0
- package/es/components/app-layout/AppLayout.vue2.mjs +130 -0
- package/es/components/app-layout/AppPage.vue.mjs +7 -0
- package/es/components/app-layout/AppPage.vue2.mjs +39 -0
- package/es/components/app-layout/AppSidebar.vue.mjs +7 -0
- package/es/components/app-layout/AppSidebar.vue2.mjs +97 -0
- package/es/components/app-layout/index.mjs +32 -0
- package/es/components/display/ActionBtnGroup.vue.mjs +61 -0
- package/es/components/display/ActionBtnGroup.vue2.mjs +4 -0
- package/es/components/display/index.mjs +13 -11
- package/es/components/misc/ActionBtn.vue.mjs +84 -65
- package/es/components/misc/ActionConfirm.vue.mjs +1 -1
- package/es/components/misc/ActionConfirm.vue2.mjs +77 -71
- package/es/components/misc/SelectModule.vue.mjs +55 -0
- package/es/components/misc/SelectModule.vue2.mjs +4 -0
- package/es/components/modal/ConfirmModal.vue.mjs +1 -1
- package/es/components/modal/ConfirmModal.vue2.mjs +13 -12
- package/es/components/modal/modal-shelf-hierarchy.mjs +4 -6
- package/es/components/table/ToolbarButtons.vue.mjs +10 -40
- package/es/index.mjs +165 -132
- package/es/inject/key.mjs +15 -6
- package/es/router/guard/index.mjs +31 -0
- package/es/router/guard/login.mjs +4 -0
- package/es/router/guard/permission.mjs +4 -0
- package/es/store/app.mjs +103 -0
- package/es/store/router-permission.mjs +65 -0
- package/es/store/user.mjs +52 -52
- package/es/style.css +1 -1
- package/package.json +2 -2
- package/types/bridge/index.d.ts +180 -76
- package/types/components/app-layout/AppBody.vue.d.ts +45 -0
- package/types/components/app-layout/AppBreadcrumb.vue.d.ts +25 -0
- package/types/components/app-layout/AppFooter.vue.d.ts +2 -0
- package/types/components/app-layout/AppHeader.vue.d.ts +55 -0
- package/types/components/app-layout/AppLayout.vue.d.ts +76 -0
- package/types/components/app-layout/AppPage.vue.d.ts +54 -0
- package/types/components/app-layout/AppSidebar.vue.d.ts +51 -0
- package/types/components/app-layout/index.d.ts +27 -0
- package/types/components/app-layout/types.d.ts +43 -0
- package/types/components/display/ActionBtnGroup.vue.d.ts +16 -0
- package/types/components/display/TabsHeader.vue.d.ts +8 -8
- package/types/components/display/index.d.ts +10 -1
- package/types/components/display/types.d.ts +42 -1
- package/types/components/form/types.d.ts +2 -2
- package/types/components/misc/ActionBtn.vue.d.ts +17 -23
- package/types/components/misc/ActionConfirm.vue.d.ts +56 -27
- package/types/components/misc/SelectModule.vue.d.ts +2 -0
- package/types/components/misc/index.d.ts +2 -1
- package/types/components/misc/types.d.ts +35 -26
- package/types/components/modal/ConfirmModal.vue.d.ts +19 -2
- package/types/components/modal/modal-shelf-hierarchy.d.ts +1 -1
- package/types/components/table/TableToolbar.vue.d.ts +8 -8
- package/types/components/table/types.d.ts +10 -12
- package/types/config/list-model.d.ts +2 -0
- package/types/helpers/index.d.ts +10 -3
- package/types/index.d.ts +4 -1
- package/types/inject/key.d.ts +25 -0
- package/types/router/guard/index.d.ts +21 -0
- package/types/router/guard/login.d.ts +5 -0
- package/types/router/guard/permission.d.ts +5 -0
- package/types/router/guard/types.d.ts +15 -0
- package/types/router/index.d.ts +1 -0
- package/types/store/app.d.ts +149 -0
- package/types/store/index.d.ts +2 -0
- package/types/store/router-permission.d.ts +80 -0
- package/types/store/user.d.ts +11 -9
- /package/es/{helpers → bridge}/route.mjs +0 -0
- /package/es/{helpers → bridge}/state.mjs +0 -0
- /package/es/{helpers → bridge}/storage.mjs +0 -0
- /package/types/{helpers → bridge}/route.d.ts +0 -0
- /package/types/{helpers → bridge}/state.d.ts +0 -0
- /package/types/{helpers → bridge}/storage.d.ts +0 -0
package/es/bridge/index.mjs
CHANGED
|
@@ -1,59 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { createStorageWithNamespace as u } from "./storage.mjs";
|
|
2
|
+
import { createUseState as a } from "./state.mjs";
|
|
3
|
+
import { createGenerateRouteMetaRawTree as L } from "./route.mjs";
|
|
4
|
+
function l(e) {
|
|
5
|
+
const n = e.APP_CACHE_CONFIG.namespace;
|
|
6
|
+
let _;
|
|
7
|
+
n === "" ? (console.error(
|
|
8
|
+
"[adminBridge] APP_CACHE_CONFIG.namespace 为空,已兜底为 'ADMIN_CORE'"
|
|
9
|
+
), _ = "ADMIN_CORE") : _ = n, Object.freeze(e);
|
|
10
|
+
let N = u(_), f = e.routes, g = e.getUserInfoInitFn;
|
|
11
|
+
const U = a(_), R = L(
|
|
12
|
+
e.APP_ROUTER_META_DEFAULT_CONFIG
|
|
13
|
+
), G = Object.freeze({
|
|
14
|
+
header: e.APP_LAYOUT_HEADER_CONFIG,
|
|
15
|
+
footer: e.APP_LAYOUT_FOOTER_CONFIG,
|
|
16
|
+
sidebar: e.APP_LAYOUT_SIDEBAR_CONFIG,
|
|
17
|
+
breadcrumb: e.APP_LAYOUT_BREADCRUMB_CONFIG,
|
|
18
|
+
body: e.APP_LAYOUT_BODY_CONFIG
|
|
19
|
+
});
|
|
20
|
+
let P, O, T, t, E, I, F, C;
|
|
21
|
+
const A = (r) => `admin bridge: ${r} 未注册`;
|
|
4
22
|
return {
|
|
5
|
-
register(
|
|
6
|
-
|
|
23
|
+
register(r) {
|
|
24
|
+
r.getToken && (P = r.getToken), r.goToLogin && (O = r.goToLogin), r.refreshToken && (T = r.refreshToken), r.refreshAuth && (t = r.refreshAuth), r.loginApi && (E = r.loginApi), r.logoutApi && (I = r.logoutApi), r.getUserInfoApi && (F = r.getUserInfoApi), r.refreshTokenApi && (C = r.refreshTokenApi);
|
|
7
25
|
},
|
|
8
26
|
// 已注册返回 undefined 是合法业务态不 throw
|
|
9
27
|
// v3 终锁 Δ8b:零参 facade(BR-1 ③ 终裁——core 对 UserInfo 不透明 + 拦截器无 info 源)
|
|
10
28
|
getToken() {
|
|
11
|
-
if (!
|
|
12
|
-
return
|
|
29
|
+
if (!P) throw new Error(A("getToken"));
|
|
30
|
+
return P();
|
|
13
31
|
},
|
|
14
32
|
goToLogin() {
|
|
15
|
-
if (!
|
|
16
|
-
|
|
33
|
+
if (!O) throw new Error(A("goToLogin"));
|
|
34
|
+
O();
|
|
17
35
|
},
|
|
18
36
|
// 异步对:未注册才返回 rejected Promise(既有降级语义保留)。
|
|
19
37
|
refreshToken() {
|
|
20
|
-
return
|
|
21
|
-
}) : Promise.reject(new Error(
|
|
38
|
+
return T ? T().then(() => {
|
|
39
|
+
}) : Promise.reject(new Error(A("refreshToken")));
|
|
22
40
|
},
|
|
23
41
|
refreshAuth() {
|
|
24
|
-
return
|
|
25
|
-
}) : Promise.reject(new Error(
|
|
42
|
+
return t ? t().then(() => {
|
|
43
|
+
}) : Promise.reject(new Error(A("refreshAuth")));
|
|
26
44
|
},
|
|
45
|
+
// #2.5 期 ADR-4 候选 b:getAppConfig facade 保留 + 内部从 12 readonly 属性组装聚合对象
|
|
46
|
+
// 每次调用产新对象(多次调用 !== 引用不等),与原 facade 返回 options.appConfig 引用语义不同;
|
|
47
|
+
// store/app.ts:18 解构后丢弃返回引用,引用相等性不被消费,行为对等 ✅
|
|
27
48
|
getAppConfig() {
|
|
28
|
-
return
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
APP_BASE_INFO: e.APP_BASE_INFO,
|
|
51
|
+
APP_LAYOUT_HEADER_CONFIG: e.APP_LAYOUT_HEADER_CONFIG,
|
|
52
|
+
APP_LAYOUT_FOOTER_CONFIG: e.APP_LAYOUT_FOOTER_CONFIG,
|
|
53
|
+
APP_LAYOUT_SIDEBAR_CONFIG: e.APP_LAYOUT_SIDEBAR_CONFIG,
|
|
54
|
+
APP_LAYOUT_BODY_CONFIG: e.APP_LAYOUT_BODY_CONFIG,
|
|
55
|
+
APP_THEME_CONFIG: e.APP_THEME_CONFIG,
|
|
56
|
+
APP_ROUTER_META_DEFAULT_CONFIG: e.APP_ROUTER_META_DEFAULT_CONFIG,
|
|
57
|
+
APP_CACHE_CONFIG: e.APP_CACHE_CONFIG
|
|
58
|
+
});
|
|
29
59
|
},
|
|
30
60
|
getStorage() {
|
|
31
|
-
return
|
|
61
|
+
return N;
|
|
32
62
|
},
|
|
33
63
|
getRoutes() {
|
|
34
|
-
return
|
|
35
|
-
},
|
|
36
|
-
getUserInfoAccess() {
|
|
37
|
-
return T;
|
|
64
|
+
return f;
|
|
38
65
|
},
|
|
39
66
|
getUserInfoInitFn() {
|
|
40
|
-
return
|
|
67
|
+
return g;
|
|
41
68
|
},
|
|
69
|
+
useState: U,
|
|
70
|
+
generateRouteMetaRawTree: R,
|
|
71
|
+
// ============ #2.5 期 12 readonly 属性值挂载(per ADR-1 sibling pattern 复用 useState / generateRouteMetaRawTree) ============
|
|
72
|
+
/** 应用基础信息(per #2.5 期 REQ-1 直接挂载形态) */
|
|
73
|
+
APP_BASE_INFO: e.APP_BASE_INFO,
|
|
74
|
+
/** 应用环境信息(per #2.5 期 REQ-1) */
|
|
75
|
+
APP_ENV_INFO: e.APP_ENV_INFO,
|
|
76
|
+
/** 应用缓存配置(per #2.5 期 REQ-1) */
|
|
77
|
+
APP_CACHE_CONFIG: e.APP_CACHE_CONFIG,
|
|
78
|
+
/** 应用布局-header 配置(per #2.5 期 REQ-1) */
|
|
79
|
+
APP_LAYOUT_HEADER_CONFIG: e.APP_LAYOUT_HEADER_CONFIG,
|
|
80
|
+
/** 应用布局-footer 配置(per #2.5 期 REQ-1) */
|
|
81
|
+
APP_LAYOUT_FOOTER_CONFIG: e.APP_LAYOUT_FOOTER_CONFIG,
|
|
82
|
+
/** 应用布局-sidebar 配置(per #2.5 期 REQ-1) */
|
|
83
|
+
APP_LAYOUT_SIDEBAR_CONFIG: e.APP_LAYOUT_SIDEBAR_CONFIG,
|
|
84
|
+
/** 应用布局-面包屑配置(per #2.5 期 REQ-1) */
|
|
85
|
+
APP_LAYOUT_BREADCRUMB_CONFIG: e.APP_LAYOUT_BREADCRUMB_CONFIG,
|
|
86
|
+
/** 应用布局-页面主体配置(per #2.5 期 REQ-1) */
|
|
87
|
+
APP_LAYOUT_BODY_CONFIG: e.APP_LAYOUT_BODY_CONFIG,
|
|
88
|
+
/** 应用布局聚合配置(per #2.5 期 ADR-3 bridge 内部聚合派生) */
|
|
89
|
+
APP_LAYOUT_CONFIG: G,
|
|
90
|
+
/** 应用路由元信息默认配置(per #2.5 期 REQ-1) */
|
|
91
|
+
APP_ROUTER_META_DEFAULT_CONFIG: e.APP_ROUTER_META_DEFAULT_CONFIG,
|
|
92
|
+
/** 应用路由配置(per #2.5 期 REQ-1) */
|
|
93
|
+
APP_ROUTER_CONFIG: e.APP_ROUTER_CONFIG,
|
|
94
|
+
/** 应用路由路径配置(per #7.3 期 readonly 挂载) */
|
|
95
|
+
APP_ROUTER_PATHS_CONFIG: e.APP_ROUTER_PATHS_CONFIG,
|
|
96
|
+
/** 应用主题配置(per #2.5 期 REQ-1) */
|
|
97
|
+
APP_THEME_CONFIG: e.APP_THEME_CONFIG,
|
|
42
98
|
// 异步对:未注册返回 rejected 原生 Error(#4a-2 per-method 降级)
|
|
43
|
-
loginApi(
|
|
44
|
-
return
|
|
99
|
+
loginApi(r) {
|
|
100
|
+
return E ? E(r) : Promise.reject(new Error(A("loginApi")));
|
|
45
101
|
},
|
|
46
102
|
logoutApi() {
|
|
47
|
-
return
|
|
103
|
+
return I ? I() : Promise.reject(new Error(A("logoutApi")));
|
|
48
104
|
},
|
|
49
105
|
getUserInfoApi() {
|
|
50
|
-
return
|
|
106
|
+
return F ? F() : Promise.reject(new Error(A("getUserInfoApi")));
|
|
51
107
|
},
|
|
52
|
-
refreshTokenApi(
|
|
53
|
-
return
|
|
108
|
+
refreshTokenApi(r) {
|
|
109
|
+
return C ? C(r) : Promise.reject(new Error(A("refreshTokenApi")));
|
|
54
110
|
}
|
|
55
111
|
};
|
|
56
112
|
}
|
|
57
113
|
export {
|
|
58
|
-
|
|
114
|
+
l as createAdminBridge
|
|
59
115
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ElAffix as V } from "element-plus/es";
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/affix/style/css";
|
|
4
|
+
import { defineComponent as F, useCssVars as N, unref as t, inject as A, ref as E, provide as H, computed as o, watch as I, resolveComponent as U, openBlock as i, createElementBlock as Y, normalizeStyle as b, createElementVNode as k, createBlock as r, withCtx as P, createVNode as w, createCommentVNode as l, KeepAlive as G, resolveDynamicComponent as S, renderSlot as D } from "vue";
|
|
5
|
+
import $ from "./AppBreadcrumb.vue.mjs";
|
|
6
|
+
import z from "lodash/debounce";
|
|
7
|
+
import { APP_LAYOUT_APP_STORE_KEY as K, APP_LAYOUT_BRIDGE_KEY as M, BODY_CONTENT_VIEWPORT_HEIGHT as j } from "../../inject/key.mjs";
|
|
8
|
+
import { useActivatedExec as W, useActivatedEvent as q } from "../../hooks/activated.mjs";
|
|
9
|
+
const se = /* @__PURE__ */ F({
|
|
10
|
+
__name: "AppBody",
|
|
11
|
+
props: {
|
|
12
|
+
menus: { default: () => [] },
|
|
13
|
+
menuFlatList: { default: () => [] }
|
|
14
|
+
},
|
|
15
|
+
setup(c) {
|
|
16
|
+
N((e) => ({
|
|
17
|
+
v078aa5b4: t(a)
|
|
18
|
+
}));
|
|
19
|
+
const n = A(K), m = A(M), x = m.APP_LAYOUT_BREADCRUMB_CONFIG, C = m.APP_ROUTER_CONFIG, d = E(!1), u = x.height, p = E(0);
|
|
20
|
+
H(j, p);
|
|
21
|
+
const g = o(() => n.bodyShimPadding), f = o(() => n.bodyShimStyle), O = o(() => n.bodyStyle), _ = o(() => n.showBreadcrumb), B = o(() => parseFloat(`${n.bodyStyle.paddingTop ?? 0}`) || 0), a = o(
|
|
22
|
+
() => `calc(${f.value.minHeight} - ${_.value && d.value ? u : 0}px - ${g.value * 2}px)`
|
|
23
|
+
), R = (e) => {
|
|
24
|
+
d.value = e;
|
|
25
|
+
}, s = z(() => {
|
|
26
|
+
const e = document.createElement("div");
|
|
27
|
+
e.style.height = a.value, e.style.position = "fixed", e.style.left = "100%", e.style.top = "100%", e.style.opacity = "0", e.style.pointerEvents = "none", document.body.appendChild(e), p.value = e.clientHeight, e.remove();
|
|
28
|
+
}, 16);
|
|
29
|
+
return W(() => {
|
|
30
|
+
s();
|
|
31
|
+
}), q(
|
|
32
|
+
() => {
|
|
33
|
+
window.addEventListener("resize", s);
|
|
34
|
+
},
|
|
35
|
+
() => {
|
|
36
|
+
window.removeEventListener("resize", s);
|
|
37
|
+
}
|
|
38
|
+
), I(a, () => {
|
|
39
|
+
s();
|
|
40
|
+
}), (e, J) => {
|
|
41
|
+
const T = V, L = U("RouterView");
|
|
42
|
+
return i(), Y("div", {
|
|
43
|
+
class: "app-body",
|
|
44
|
+
style: b(t(O))
|
|
45
|
+
}, [
|
|
46
|
+
k("div", {
|
|
47
|
+
class: "app-body-shim",
|
|
48
|
+
style: b(t(f))
|
|
49
|
+
}, [
|
|
50
|
+
t(_) ? (i(), r(T, {
|
|
51
|
+
key: 0,
|
|
52
|
+
offset: t(B)
|
|
53
|
+
}, {
|
|
54
|
+
default: P(() => [
|
|
55
|
+
w($, {
|
|
56
|
+
menus: c.menus,
|
|
57
|
+
height: t(u),
|
|
58
|
+
menuFlatList: c.menuFlatList,
|
|
59
|
+
onShow: R
|
|
60
|
+
}, null, 8, ["menus", "height", "menuFlatList"])
|
|
61
|
+
]),
|
|
62
|
+
_: 1
|
|
63
|
+
}, 8, ["offset"])) : l("", !0),
|
|
64
|
+
w(L, null, {
|
|
65
|
+
default: P(({
|
|
66
|
+
Component: y,
|
|
67
|
+
route: {
|
|
68
|
+
path: h,
|
|
69
|
+
meta: { keepAlive: v }
|
|
70
|
+
}
|
|
71
|
+
}) => [
|
|
72
|
+
(i(), r(G, {
|
|
73
|
+
max: t(C).keepAliveMaxCount
|
|
74
|
+
}, [
|
|
75
|
+
v ? (i(), r(S(y), { key: h })) : l("", !0)
|
|
76
|
+
], 1032, ["max"])),
|
|
77
|
+
v ? l("", !0) : (i(), r(S(y), { key: h }))
|
|
78
|
+
]),
|
|
79
|
+
_: 1
|
|
80
|
+
})
|
|
81
|
+
], 4),
|
|
82
|
+
D(e.$slots, "footer", {}, void 0, !0)
|
|
83
|
+
], 4);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
export {
|
|
88
|
+
se as default
|
|
89
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ElBreadcrumb as b, ElBreadcrumbItem as w } from "element-plus/es";
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/breadcrumb/style/css";
|
|
4
|
+
import "element-plus/es/components/breadcrumb-item/style/css";
|
|
5
|
+
import { defineComponent as g, computed as o, watch as x, withDirectives as y, openBlock as n, createElementBlock as u, normalizeStyle as E, unref as m, createVNode as k, withCtx as p, Fragment as v, renderList as I, createBlock as F, createTextVNode as L, toDisplayString as S, vShow as A } from "vue";
|
|
6
|
+
import { useRoute as C } from "vue-router";
|
|
7
|
+
const $ = /* @__PURE__ */ g({
|
|
8
|
+
name: "AppBreadcrumb",
|
|
9
|
+
__name: "AppBreadcrumb",
|
|
10
|
+
props: {
|
|
11
|
+
menus: {},
|
|
12
|
+
height: {},
|
|
13
|
+
menuFlatList: {}
|
|
14
|
+
},
|
|
15
|
+
emits: ["show"],
|
|
16
|
+
setup(i, { emit: l }) {
|
|
17
|
+
const a = i, h = l, d = C(), c = o(() => d.matched.map((t) => a.menuFlatList.find(
|
|
18
|
+
(e) => e.path === t.path
|
|
19
|
+
)).filter((t) => t)), s = o(() => c.value.length > 1), _ = o(() => ({
|
|
20
|
+
height: `${a.height}px`
|
|
21
|
+
}));
|
|
22
|
+
return x(
|
|
23
|
+
s,
|
|
24
|
+
(t) => {
|
|
25
|
+
h("show", t);
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
immediate: !0
|
|
29
|
+
}
|
|
30
|
+
), (t, f) => {
|
|
31
|
+
const e = w, B = b;
|
|
32
|
+
return y((n(), u("div", {
|
|
33
|
+
class: "app-breadcrumb",
|
|
34
|
+
style: E(m(_))
|
|
35
|
+
}, [
|
|
36
|
+
k(B, { separator: "/" }, {
|
|
37
|
+
default: p(() => [
|
|
38
|
+
(n(!0), u(v, null, I(m(c), (r) => (n(), F(e, {
|
|
39
|
+
key: r.path,
|
|
40
|
+
to: r.path
|
|
41
|
+
}, {
|
|
42
|
+
default: p(() => [
|
|
43
|
+
L(S(r.title), 1)
|
|
44
|
+
]),
|
|
45
|
+
_: 2
|
|
46
|
+
}, 1032, ["to"]))), 128))
|
|
47
|
+
]),
|
|
48
|
+
_: 1
|
|
49
|
+
})
|
|
50
|
+
], 4)), [
|
|
51
|
+
[A, m(s)]
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
$ as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineComponent as r, inject as n, computed as p, openBlock as l, createElementBlock as s, normalizeStyle as m, unref as a, createElementVNode as c } from "vue";
|
|
2
|
+
import { APP_LAYOUT_APP_STORE_KEY as f } from "../../inject/key.mjs";
|
|
3
|
+
const S = /* @__PURE__ */ r({
|
|
4
|
+
__name: "AppFooter",
|
|
5
|
+
setup(_) {
|
|
6
|
+
const o = n(f), t = p(() => o.footerStyle);
|
|
7
|
+
return (i, e) => (l(), s("div", {
|
|
8
|
+
class: "app-footer",
|
|
9
|
+
style: m(a(t))
|
|
10
|
+
}, [...e[0] || (e[0] = [
|
|
11
|
+
c("div", { class: "app-footer-shim" }, null, -1)
|
|
12
|
+
])], 4));
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
S as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ElIcon as E, ElSwitch as g } from "element-plus/es";
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/switch/style/css";
|
|
4
|
+
import "element-plus/es/components/icon/style/css";
|
|
5
|
+
import { defineComponent as w, useCssVars as I, unref as o, inject as B, toRefs as P, computed as m, watch as V, nextTick as $, openBlock as r, createElementBlock as s, normalizeStyle as T, createElementVNode as d, renderSlot as v, normalizeClass as _, Fragment as b, renderList as x, createBlock as f, withCtx as A, resolveDynamicComponent as D, createCommentVNode as y, toDisplayString as L, createVNode as N } from "vue";
|
|
6
|
+
import { Sunny as R, Moon as q } from "@element-plus/icons-vue";
|
|
7
|
+
import { useRouter as z } from "vue-router";
|
|
8
|
+
import { APP_LAYOUT_APP_STORE_KEY as F } from "../../inject/key.mjs";
|
|
9
|
+
const O = { class: "app-header-shim" }, U = ["name", "onClick"], Y = {
|
|
10
|
+
class: "app-header-userInfo",
|
|
11
|
+
pl20: ""
|
|
12
|
+
}, ee = /* @__PURE__ */ w({
|
|
13
|
+
__name: "AppHeader",
|
|
14
|
+
props: {
|
|
15
|
+
show: { type: Boolean },
|
|
16
|
+
menus: { default: () => [] },
|
|
17
|
+
activeMenu: {},
|
|
18
|
+
activeModuleMenu: {},
|
|
19
|
+
menuFlatList: {}
|
|
20
|
+
},
|
|
21
|
+
setup(p) {
|
|
22
|
+
I((e) => ({
|
|
23
|
+
v4db2d700: o(u).baseColor,
|
|
24
|
+
v23ceefd3: o(u).primaryColor
|
|
25
|
+
}));
|
|
26
|
+
const c = p, i = B(F), { theme: u } = P(i), S = m(() => i.headerStyle), k = z(), h = `app-header-module_${Math.random().toString(36).substring(2)}`, C = m(() => c.menus), l = m({
|
|
27
|
+
get() {
|
|
28
|
+
var e;
|
|
29
|
+
return (e = c.activeModuleMenu) == null ? void 0 : e.path;
|
|
30
|
+
},
|
|
31
|
+
set(e) {
|
|
32
|
+
var n, a;
|
|
33
|
+
((a = (n = c.activeMenu) == null ? void 0 : n.parentPathList) == null ? void 0 : a[0]) !== e && k.push(e);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return V(
|
|
37
|
+
l,
|
|
38
|
+
(e) => {
|
|
39
|
+
e && $(() => {
|
|
40
|
+
var n, a;
|
|
41
|
+
(a = (n = document.querySelector(`.${h}`)) == null ? void 0 : n.querySelector(`[name="${e}"]`)) == null || a.scrollIntoView({
|
|
42
|
+
behavior: "smooth"
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
immediate: !0
|
|
48
|
+
}
|
|
49
|
+
), (e, n) => {
|
|
50
|
+
const a = E, M = g;
|
|
51
|
+
return r(), s("div", {
|
|
52
|
+
class: "app-header",
|
|
53
|
+
style: T(o(S))
|
|
54
|
+
}, [
|
|
55
|
+
d("div", O, [
|
|
56
|
+
v(e.$slots, "left", {}, void 0, !0),
|
|
57
|
+
o(C) ? (r(), s("div", {
|
|
58
|
+
key: 0,
|
|
59
|
+
class: _(["app-header-module", h])
|
|
60
|
+
}, [
|
|
61
|
+
(r(!0), s(b, null, x(p.menus, (t) => (r(), s("div", {
|
|
62
|
+
key: t.path,
|
|
63
|
+
name: t.path,
|
|
64
|
+
class: _([
|
|
65
|
+
"app-header-module-item",
|
|
66
|
+
o(l) === t.path ? "app-header-module-item_active" : ""
|
|
67
|
+
]),
|
|
68
|
+
onClick: (j) => l.value = t.path
|
|
69
|
+
}, [
|
|
70
|
+
t.menuIcon ? (r(), f(a, {
|
|
71
|
+
key: 0,
|
|
72
|
+
mr2: ""
|
|
73
|
+
}, {
|
|
74
|
+
default: A(() => [
|
|
75
|
+
(r(), f(D(t.menuIcon)))
|
|
76
|
+
]),
|
|
77
|
+
_: 2
|
|
78
|
+
}, 1024)) : y("", !0),
|
|
79
|
+
d("span", null, L(t.title), 1)
|
|
80
|
+
], 10, U))), 128))
|
|
81
|
+
])) : y("", !0),
|
|
82
|
+
d("div", Y, [
|
|
83
|
+
N(M, {
|
|
84
|
+
"model-value": o(i).isDarkTheme,
|
|
85
|
+
mr3: "",
|
|
86
|
+
"active-action-icon": o(q),
|
|
87
|
+
"inactive-action-icon": o(R),
|
|
88
|
+
"onUpdate:modelValue": n[0] || (n[0] = (t) => o(i).changeIsDarkTheme(!!t))
|
|
89
|
+
}, null, 8, ["model-value", "active-action-icon", "inactive-action-icon"]),
|
|
90
|
+
v(e.$slots, "right", {}, void 0, !0)
|
|
91
|
+
])
|
|
92
|
+
])
|
|
93
|
+
], 4);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
export {
|
|
98
|
+
ee as default
|
|
99
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ElWatermark as F } from "element-plus/es";
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/watermark/style/css";
|
|
4
|
+
import { defineComponent as R, provide as l, computed as n, watch as f, openBlock as E, createElementBlock as P, normalizeClass as B, unref as t, createVNode as a, withCtx as r, renderSlot as u } from "vue";
|
|
5
|
+
import H from "./AppBody.vue.mjs";
|
|
6
|
+
import T from "./AppHeader.vue.mjs";
|
|
7
|
+
import k from "./AppFooter.vue.mjs";
|
|
8
|
+
import y from "./AppSidebar.vue.mjs";
|
|
9
|
+
import $ from "../modal/ModalShelf.vue.mjs";
|
|
10
|
+
import { useRoute as C, useRouter as Y } from "vue-router";
|
|
11
|
+
import { APP_LAYOUT_BRIDGE_KEY as K, APP_LAYOUT_APP_STORE_KEY as O, APP_LAYOUT_USER_STORE_KEY as U } from "../../inject/key.mjs";
|
|
12
|
+
import { flatRouteMetaResolveRaw as z } from "../../utils/router.mjs";
|
|
13
|
+
import { useMenusDataDispatch as D } from "../../hooks/menus-dispatch.mjs";
|
|
14
|
+
const te = /* @__PURE__ */ R({
|
|
15
|
+
__name: "AppLayout",
|
|
16
|
+
props: {
|
|
17
|
+
adminBridge: {},
|
|
18
|
+
appStore: {},
|
|
19
|
+
userStore: {},
|
|
20
|
+
watermarkContent: {},
|
|
21
|
+
sidebarAboveHeader: { type: Boolean, default: !1 }
|
|
22
|
+
},
|
|
23
|
+
setup(m) {
|
|
24
|
+
const o = m, h = {
|
|
25
|
+
color: "rgba(0,0,0,0.08)",
|
|
26
|
+
fontSize: 12
|
|
27
|
+
};
|
|
28
|
+
l(K, o.adminBridge), l(O, o.appStore), l(U, o.userStore);
|
|
29
|
+
const p = n(() => o.adminBridge.generateRouteMetaRawTree(
|
|
30
|
+
o.adminBridge.getRoutes(),
|
|
31
|
+
{
|
|
32
|
+
parentPath: "",
|
|
33
|
+
filterFn: (e, i, d) => e.checkPermission ? e.menuShow && o.userStore.havePermissionByKey(e.permissionKey) : e.menuShow && (!d || i),
|
|
34
|
+
sortFn: (e, i) => e.menuSort - i.menuSort
|
|
35
|
+
}
|
|
36
|
+
)), s = n(() => z(p.value)), {
|
|
37
|
+
sidebarMenus: c,
|
|
38
|
+
headerMenus: v,
|
|
39
|
+
activeMenu: S,
|
|
40
|
+
activeModuleMenu: _,
|
|
41
|
+
needRedirectToFirstChildMenu: g
|
|
42
|
+
} = D({
|
|
43
|
+
getMenus: () => p.value,
|
|
44
|
+
getMenuFlatList: () => s.value,
|
|
45
|
+
getExtractLevel1ToHeader: () => o.appStore.extractLevel1ToHeader
|
|
46
|
+
}), M = n(() => o.userStore.isLogin), L = n(() => o.appStore.showHeader), b = n(() => o.appStore.showSidebar);
|
|
47
|
+
f(
|
|
48
|
+
() => c.value.length,
|
|
49
|
+
(e) => {
|
|
50
|
+
o.appStore.changeSidebarHasMenusStatus(!!e);
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
immediate: !0
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
const w = C(), A = Y();
|
|
57
|
+
return f(
|
|
58
|
+
g,
|
|
59
|
+
(e) => {
|
|
60
|
+
e && (console.log(`${w.path}需要重定向到${e.path}`), A.replace(e.path));
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
immediate: !0
|
|
64
|
+
}
|
|
65
|
+
), (e, i) => {
|
|
66
|
+
const d = F;
|
|
67
|
+
return E(), P("div", {
|
|
68
|
+
class: B(["app-layout", {
|
|
69
|
+
"app-layout_noLogin": !t(M)
|
|
70
|
+
}])
|
|
71
|
+
}, [
|
|
72
|
+
a(d, {
|
|
73
|
+
content: m.watermarkContent,
|
|
74
|
+
font: h,
|
|
75
|
+
zIndex: 1e4
|
|
76
|
+
}, {
|
|
77
|
+
default: r(() => [
|
|
78
|
+
a(t($), { level: "app" }, {
|
|
79
|
+
default: r(() => [
|
|
80
|
+
a(H, {
|
|
81
|
+
menus: t(p),
|
|
82
|
+
menuFlatList: t(s)
|
|
83
|
+
}, {
|
|
84
|
+
footer: r(() => [
|
|
85
|
+
a(k)
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
}, 8, ["menus", "menuFlatList"]),
|
|
89
|
+
a(y, {
|
|
90
|
+
show: t(b),
|
|
91
|
+
aboveHeader: m.sidebarAboveHeader,
|
|
92
|
+
menus: t(c),
|
|
93
|
+
menuFlatList: t(s)
|
|
94
|
+
}, {
|
|
95
|
+
top: r(() => [
|
|
96
|
+
u(e.$slots, "sidebar-top", {}, void 0, !0)
|
|
97
|
+
]),
|
|
98
|
+
bottom: r(() => [
|
|
99
|
+
u(e.$slots, "sidebar-bottom", {}, void 0, !0)
|
|
100
|
+
]),
|
|
101
|
+
_: 3
|
|
102
|
+
}, 8, ["show", "aboveHeader", "menus", "menuFlatList"]),
|
|
103
|
+
a(T, {
|
|
104
|
+
show: t(L),
|
|
105
|
+
menus: t(v),
|
|
106
|
+
activeMenu: t(S),
|
|
107
|
+
activeModuleMenu: t(_),
|
|
108
|
+
menuFlatList: t(s)
|
|
109
|
+
}, {
|
|
110
|
+
left: r(() => [
|
|
111
|
+
u(e.$slots, "header-left", {}, void 0, !0)
|
|
112
|
+
]),
|
|
113
|
+
right: r(() => [
|
|
114
|
+
u(e.$slots, "header-right", {}, void 0, !0)
|
|
115
|
+
]),
|
|
116
|
+
_: 3
|
|
117
|
+
}, 8, ["show", "menus", "activeMenu", "activeModuleMenu", "menuFlatList"])
|
|
118
|
+
]),
|
|
119
|
+
_: 3
|
|
120
|
+
})
|
|
121
|
+
]),
|
|
122
|
+
_: 3
|
|
123
|
+
}, 8, ["content"])
|
|
124
|
+
], 2);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
export {
|
|
129
|
+
te as default
|
|
130
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineComponent as r, useCssVars as p, computed as l, openBlock as n, createElementBlock as s, normalizeStyle as i, createElementVNode as c, createVNode as u, unref as d, withCtx as f, renderSlot as m } from "vue";
|
|
2
|
+
import g from "../modal/ModalShelf.vue.mjs";
|
|
3
|
+
const h = { class: "app-page-shim" }, _ = "--app-viewport-max-height", w = /* @__PURE__ */ r({
|
|
4
|
+
name: "AppPage",
|
|
5
|
+
__name: "AppPage",
|
|
6
|
+
props: {
|
|
7
|
+
fullViewport: { type: Boolean, default: !1 },
|
|
8
|
+
fullMode: { default: "min-height" },
|
|
9
|
+
nextViewportMaxHeight: { default: "var(--app-viewport-max-height)" },
|
|
10
|
+
background: {}
|
|
11
|
+
},
|
|
12
|
+
setup(a) {
|
|
13
|
+
p((t) => ({
|
|
14
|
+
v54888f0e: e.nextViewportMaxHeight
|
|
15
|
+
}));
|
|
16
|
+
const e = a, o = l(() => ({
|
|
17
|
+
background: e.background,
|
|
18
|
+
...e.fullViewport ? {
|
|
19
|
+
[e.fullMode]: `var(${_})`
|
|
20
|
+
} : {}
|
|
21
|
+
}));
|
|
22
|
+
return (t, v) => (n(), s("div", {
|
|
23
|
+
class: "app-page",
|
|
24
|
+
style: i(o.value)
|
|
25
|
+
}, [
|
|
26
|
+
c("div", h, [
|
|
27
|
+
u(d(g), { level: "page" }, {
|
|
28
|
+
default: f(() => [
|
|
29
|
+
m(t.$slots, "default", {}, void 0, !0)
|
|
30
|
+
]),
|
|
31
|
+
_: 3
|
|
32
|
+
})
|
|
33
|
+
])
|
|
34
|
+
], 4));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
w as default
|
|
39
|
+
};
|