@spacego/fe-components 0.0.5 → 0.0.7
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/lib/config/constants.js +0 -1
- package/lib/fe-layouts/auth-layout/index.js +40 -37
- package/lib/fe-layouts/basics-layout/components/basics-layout/header.js +3 -3
- package/lib/fe-layouts/basics-layout/components/basics-layout/sidebar.js +27 -25
- package/lib/fe-layouts/basics-layout/index.js +56 -54
- package/lib/fe-layouts/context/global-context.provider.js +25 -30
- package/lib/fe-layouts/layout.js +13 -11
- package/lib/hooks/use-auth.hook.js +7 -7
- package/lib/hooks/use-nprogress.hook.js +15 -0
- package/lib/index.css +1 -1
- package/lib/index.js +36 -40
- package/lib/router/index.js +4 -48
- package/lib/store/modules/layout-config.store.js +11 -9
- package/lib/store/modules/theme.store.js +20 -18
- package/lib/types/config/constants.d.ts +0 -1
- package/lib/types/fe-layouts/context/global-context.d.ts +6 -10
- package/lib/types/hooks/index.d.ts +1 -0
- package/lib/types/hooks/use-nprogress.hook.d.ts +4 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/router/index.d.ts +1 -33
- package/package.json +5 -5
- package/lib/router/permission.js +0 -43
- package/lib/router/routes.js +0 -57
- package/lib/types/router/permission.d.ts +0 -23
- package/lib/types/router/routes.d.ts +0 -11
package/lib/config/constants.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useSelector as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { FaCheck as
|
|
5
|
-
import { IoMoon as
|
|
6
|
-
import { LuPalette as
|
|
7
|
-
import { MdWbSunny as
|
|
8
|
-
import { Outlet as
|
|
9
|
-
import
|
|
10
|
-
import T from "../../fe-loading/index.js";
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { useSelector as N } from "@spacego/zustand";
|
|
3
|
+
import { useState as b } from "react";
|
|
4
|
+
import { FaCheck as y } from "react-icons/fa6";
|
|
5
|
+
import { IoMoon as w } from "react-icons/io5";
|
|
6
|
+
import { LuPalette as k } from "react-icons/lu";
|
|
7
|
+
import { MdWbSunny as T } from "react-icons/md";
|
|
8
|
+
import { Outlet as E } from "react-router-dom";
|
|
9
|
+
import C from "../../assets/svg/login-view.svg.js";
|
|
11
10
|
import "@ant-design/icons";
|
|
12
|
-
import { applyThemeWithTransition as
|
|
11
|
+
import { applyThemeWithTransition as L } from "../../utils/theme.js";
|
|
13
12
|
import "../../store/modules/layout-config.store.js";
|
|
14
|
-
import { useThemeStore as
|
|
15
|
-
import { THEME_COLORS as
|
|
16
|
-
import "
|
|
17
|
-
import
|
|
13
|
+
import { useThemeStore as M } from "../../store/modules/theme.store.js";
|
|
14
|
+
import { THEME_COLORS as j } from "../../config/theme.js";
|
|
15
|
+
import { useGlobal as O } from "../context/context.js";
|
|
16
|
+
import "nprogress";
|
|
17
|
+
/* empty css */
|
|
18
18
|
/* empty css */
|
|
19
19
|
import "../basics-layout/index.js";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
import "antd";
|
|
21
|
+
import "@spacego/turbo-utils";
|
|
22
|
+
/* empty css */
|
|
23
|
+
function ee() {
|
|
24
|
+
const { appName: n, logo: c, description: m, descriptionDetail: f, copyright: a } = O(), { theme: s, themeColor: d, TOGGLE_THEME: h, SET_THEME_COLOR: x } = M(N(["theme", "themeColor", "TOGGLE_THEME", "SET_THEME_COLOR"])), [o, i] = b(!1), p = (r) => {
|
|
25
|
+
const l = r.currentTarget.getBoundingClientRect(), u = l.left + l.width / 2, g = l.top + l.height / 2;
|
|
26
|
+
L(s === "light" ? "dark" : "light", u, g).then(() => {
|
|
27
|
+
h();
|
|
25
28
|
});
|
|
26
29
|
};
|
|
27
30
|
return /* @__PURE__ */ t("div", { className: "flex min-h-full flex-1 select-none overflow-x-hidden", children: [
|
|
@@ -35,21 +38,21 @@ function K() {
|
|
|
35
38
|
{
|
|
36
39
|
className: "flex overflow-hidden items-center gap-3 whitespace-nowrap origin-right",
|
|
37
40
|
style: {
|
|
38
|
-
width:
|
|
41
|
+
width: o ? "224px" : "0",
|
|
39
42
|
// 7个颜色(20px) + 6个gap(12px) = 140 + 72 = 212px
|
|
40
|
-
transform: `scaleX(${
|
|
41
|
-
opacity:
|
|
43
|
+
transform: `scaleX(${o ? 1 : 0})`,
|
|
44
|
+
opacity: o ? 1 : 0,
|
|
42
45
|
transition: "transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
43
46
|
},
|
|
44
47
|
onMouseEnter: () => i(!0),
|
|
45
48
|
onMouseLeave: () => i(!1),
|
|
46
|
-
children:
|
|
49
|
+
children: j.map((r) => /* @__PURE__ */ e(
|
|
47
50
|
"div",
|
|
48
51
|
{
|
|
49
52
|
className: "w-5 h-5 rounded-full flex items-center justify-center cursor-pointer hover-scale-animation shrink-0",
|
|
50
53
|
style: { backgroundColor: r },
|
|
51
|
-
onClick: () =>
|
|
52
|
-
children:
|
|
54
|
+
onClick: () => x(r),
|
|
55
|
+
children: d === r && /* @__PURE__ */ e(y, { className: "size-[10px] text-white" })
|
|
53
56
|
},
|
|
54
57
|
r
|
|
55
58
|
))
|
|
@@ -62,35 +65,35 @@ function K() {
|
|
|
62
65
|
className: "w-8 h-8 flex items-center justify-center cursor-pointer hover-scale-animation",
|
|
63
66
|
onMouseEnter: () => i(!0),
|
|
64
67
|
onMouseLeave: () => i(!1),
|
|
65
|
-
children: /* @__PURE__ */ e(
|
|
68
|
+
children: /* @__PURE__ */ e(k, { className: "h-[16px] w-[16px] text-(--color-primary)" })
|
|
66
69
|
}
|
|
67
70
|
),
|
|
68
|
-
/* @__PURE__ */ e("div", { className: "w-8 h-8 flex items-center justify-center cursor-pointer hover-scale-animation", onClick:
|
|
71
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 flex items-center justify-center cursor-pointer hover-scale-animation", onClick: p, children: s === "dark" ? /* @__PURE__ */ e(T, { className: "h-[18px] w-[18px]" }) : /* @__PURE__ */ e(w, { className: "h-[18px] w-[18px]" }) })
|
|
69
72
|
] })
|
|
70
73
|
]
|
|
71
74
|
}
|
|
72
75
|
),
|
|
73
76
|
/* @__PURE__ */ e("div", { className: "absolute left-0 top-0 z-10 flex flex-1", children: /* @__PURE__ */ e("div", { className: "text-foreground lg:text-foreground ml-4 mt-4 flex flex-1 items-center sm:left-6 sm:top-6", children: /* @__PURE__ */ t("div", { className: "m-0 text-xl font-medium flex items-center gap-2 text-[#333] dark:text-[#f2f2f2]", children: [
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
c,
|
|
78
|
+
n
|
|
76
79
|
] }) }) }),
|
|
77
80
|
/* @__PURE__ */ e("div", { className: "relative hidden w-0 flex-1 lg:block", children: /* @__PURE__ */ t("div", { className: "bg-background-deep absolute inset-0 h-full w-full dark:bg-[#070709]!", children: [
|
|
78
81
|
/* @__PURE__ */ e("div", { className: "login-background absolute left-0 top-0 size-full" }),
|
|
79
82
|
/* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center mr-20 h-full -enter-x", children: [
|
|
80
|
-
/* @__PURE__ */ e(
|
|
81
|
-
/* @__PURE__ */ e("div", { className: "text-1xl mt-6 font-sans lg:text-2xl text-[#333] dark:text-[#f2f2f2]", children:
|
|
82
|
-
/* @__PURE__ */ e("div", { className: "mt-2 text-[#323639] dark:text-[#a1a1aa]", children:
|
|
83
|
+
/* @__PURE__ */ e(C, { className: "animate-float h-64 w-2/5" }),
|
|
84
|
+
/* @__PURE__ */ e("div", { className: "text-1xl mt-6 font-sans lg:text-2xl text-[#333] dark:text-[#f2f2f2]", children: m }),
|
|
85
|
+
/* @__PURE__ */ e("div", { className: "mt-2 text-[#323639] dark:text-[#a1a1aa]", children: f })
|
|
83
86
|
] })
|
|
84
87
|
] }) }),
|
|
85
88
|
/* @__PURE__ */ t("div", { className: "login-side flex flex-col items-center justify-center relative px-6 py-10 lg:flex-initial lg:px-8 min-h-full w-2/5 flex-1 dark:bg-[#14161a]", children: [
|
|
86
|
-
/* @__PURE__ */ e(
|
|
87
|
-
/* @__PURE__ */ e("div", { className: "text-[#71717a] absolute bottom-3 flex text-center text-xs", children: /* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ e(E, {}),
|
|
90
|
+
/* @__PURE__ */ e("div", { className: "text-[#71717a] absolute bottom-3 flex text-center text-xs", children: /* @__PURE__ */ e("div", { className: "text-md flex justify-center mt-4", children: a || /* @__PURE__ */ t(v, { children: [
|
|
88
91
|
"Copyright © 2024 ",
|
|
89
92
|
/* @__PURE__ */ e("a", { href: "https://dshuais.netlify.app/", className: "text-(--color-primary)! hover:text-(--hover-primary-color)! mx-1", target: "_blank", children: "DuShuai" })
|
|
90
|
-
] }) })
|
|
93
|
+
] }) }) })
|
|
91
94
|
] })
|
|
92
95
|
] });
|
|
93
96
|
}
|
|
94
97
|
export {
|
|
95
|
-
|
|
98
|
+
ee as default
|
|
96
99
|
};
|
|
@@ -78,7 +78,7 @@ function $(i) {
|
|
|
78
78
|
children: a === "light" ? /* @__PURE__ */ e(A, { className: "text-lg" }) : /* @__PURE__ */ e(I, { className: "text-lg" })
|
|
79
79
|
}
|
|
80
80
|
),
|
|
81
|
-
p && /* @__PURE__ */ e(
|
|
81
|
+
p && /* @__PURE__ */ e(
|
|
82
82
|
B,
|
|
83
83
|
{
|
|
84
84
|
placement: "bottom",
|
|
@@ -88,9 +88,9 @@ function $(i) {
|
|
|
88
88
|
container: "p-0!"
|
|
89
89
|
},
|
|
90
90
|
content: g,
|
|
91
|
-
children: /* @__PURE__ */ e(C, { dot: !0, color: "var(--color-primary)", children: /* @__PURE__ */ e(D, {}) })
|
|
91
|
+
children: /* @__PURE__ */ e("div", { className: "cursor-pointer w-8 h-8 text-(--icon-text-color) hover:text-primary transition-colors p-2 rounded-full hover:bg-(--hover-background-color) hover-scale-animation", children: /* @__PURE__ */ e(C, { dot: !0, color: "var(--color-primary)", children: /* @__PURE__ */ e(D, {}) }) })
|
|
92
92
|
}
|
|
93
|
-
)
|
|
93
|
+
),
|
|
94
94
|
/* @__PURE__ */ e(M, { menu: { items: N }, placement: "bottomRight", arrow: !0, children: /* @__PURE__ */ t("div", { className: "flex items-center gap-2 cursor-pointer hover:bg-(--hover-background-color) px-2 py-1 rounded-full transition-all border border-transparent", children: [
|
|
95
95
|
/* @__PURE__ */ e(
|
|
96
96
|
j,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { Layout as y, Menu as x } from "antd";
|
|
3
3
|
import { useState as g, useEffect as v, useMemo as k } from "react";
|
|
4
4
|
import { MdOutlineKeyboardDoubleArrowRight as K, MdOutlineKeyboardDoubleArrowLeft as w } from "react-icons/md";
|
|
@@ -6,22 +6,22 @@ import { renderIcon as M } from "../../../../utils/icon.js";
|
|
|
6
6
|
import "../../../../store/modules/layout-config.store.js";
|
|
7
7
|
import "../../../../store/modules/theme.store.js";
|
|
8
8
|
const { Sider: N } = y;
|
|
9
|
-
function D(
|
|
9
|
+
function D(s) {
|
|
10
10
|
const {
|
|
11
11
|
collapsed: l,
|
|
12
12
|
menus: n = [],
|
|
13
|
-
activeKey:
|
|
13
|
+
activeKey: d,
|
|
14
14
|
openKeys: o = [],
|
|
15
|
-
onMenuClick:
|
|
16
|
-
onCollapse:
|
|
17
|
-
beforeRender:
|
|
18
|
-
afterRender:
|
|
19
|
-
} =
|
|
15
|
+
onMenuClick: c,
|
|
16
|
+
onCollapse: f,
|
|
17
|
+
beforeRender: m,
|
|
18
|
+
afterRender: u
|
|
19
|
+
} = s, [b, i] = g(o);
|
|
20
20
|
v(() => {
|
|
21
21
|
o.length > 0 && i(o);
|
|
22
22
|
}, [o]);
|
|
23
|
-
const
|
|
24
|
-
const t = (
|
|
23
|
+
const h = k(() => {
|
|
24
|
+
const t = (p) => p.map((r) => ({
|
|
25
25
|
key: r.key,
|
|
26
26
|
label: r.label,
|
|
27
27
|
icon: M(r.icon),
|
|
@@ -38,30 +38,32 @@ function D(a) {
|
|
|
38
38
|
width: 224,
|
|
39
39
|
className: "layout-sidebar border-r border-(--border-color) bg-(--global-background-color)! h-full relative",
|
|
40
40
|
theme: "light",
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
|
|
41
|
+
children: /* @__PURE__ */ a("div", { className: "h-full flex flex-col", children: [
|
|
42
|
+
m,
|
|
43
43
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto overflow-x-hidden py-2 custom-scrollbar", children: /* @__PURE__ */ e(
|
|
44
44
|
x,
|
|
45
45
|
{
|
|
46
46
|
mode: "inline",
|
|
47
|
-
selectedKeys: [
|
|
48
|
-
openKeys:
|
|
47
|
+
selectedKeys: [d],
|
|
48
|
+
openKeys: b,
|
|
49
49
|
onOpenChange: i,
|
|
50
|
-
items:
|
|
51
|
-
onClick: ({ key: t }) =>
|
|
50
|
+
items: h,
|
|
51
|
+
onClick: ({ key: t }) => c(t),
|
|
52
52
|
className: "sidebar-menu border-none",
|
|
53
53
|
inlineIndent: 16
|
|
54
54
|
}
|
|
55
55
|
) }),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between pl-4 mb-2", children: [
|
|
57
|
+
/* @__PURE__ */ e(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
onClick: () => f(!l),
|
|
61
|
+
className: "text-gray-500 dark:text-[#a1a1a2] text-xl hover:text-[#323639] dark:hover:text-[#f0f0f0] hover:bg-[#dfe3e4] dark:hover:bg-[#333538] transition-all duration-300 w-7 h-7 rounded-sm bg-[#f4f4f5] dark:bg-[#292a2d] cursor-pointer flex items-center justify-center",
|
|
62
|
+
children: l ? /* @__PURE__ */ e(K, {}) : /* @__PURE__ */ e(w, {})
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
u
|
|
66
|
+
] })
|
|
65
67
|
] })
|
|
66
68
|
}
|
|
67
69
|
);
|
|
@@ -1,63 +1,65 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useSelector as y } from "@spacego/zustand";
|
|
3
3
|
import { Layout as g, Spin as Z } from "antd";
|
|
4
|
-
import { useMemo as d, useEffect as
|
|
5
|
-
import { useLocation as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { useLayoutConfigStore as
|
|
9
|
-
import { useThemeStore as
|
|
10
|
-
import { useGlobal as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
4
|
+
import { useMemo as d, useEffect as $ } from "react";
|
|
5
|
+
import { useLocation as ee, useNavigate as te, Outlet as oe } from "react-router-dom";
|
|
6
|
+
import { useAuth as ne } from "../../hooks/use-auth.hook.js";
|
|
7
|
+
import { useNProgress as re } from "../../hooks/use-nprogress.hook.js";
|
|
8
|
+
import { useLayoutConfigStore as ae } from "../../store/modules/layout-config.store.js";
|
|
9
|
+
import { useThemeStore as se } from "../../store/modules/theme.store.js";
|
|
10
|
+
import { useGlobal as ie } from "../context/context.js";
|
|
11
|
+
import le from "./components/basics-layout/header.js";
|
|
12
|
+
import ce from "./components/basics-layout/sidebar.js";
|
|
13
13
|
import ue from "./components/basics-layout/tabs.js";
|
|
14
|
-
import { findRouteByPath as b, findMenuParentKeys as
|
|
14
|
+
import { findRouteByPath as b, findMenuParentKeys as fe, buildRouteMap as de, findParentRoutes as me, findMenuByKey as he } from "./components/utils/index.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
/* empty css */
|
|
17
|
-
const { Content:
|
|
17
|
+
const { Content: pe } = g;
|
|
18
18
|
function Ne() {
|
|
19
|
-
const r =
|
|
19
|
+
const r = ee(), m = te(), { logout: R } = ne();
|
|
20
|
+
re();
|
|
21
|
+
const {
|
|
20
22
|
token: T,
|
|
21
|
-
menus:
|
|
23
|
+
menus: a = [],
|
|
22
24
|
routes: o = [],
|
|
23
|
-
appName:
|
|
24
|
-
logo:
|
|
25
|
+
appName: _,
|
|
26
|
+
logo: L,
|
|
25
27
|
headerActionsRender: v,
|
|
26
28
|
breadcrumbBeforeRender: M,
|
|
27
|
-
searchRender:
|
|
28
|
-
noticeRender:
|
|
29
|
-
isNotice:
|
|
30
|
-
userInfo:
|
|
31
|
-
userMenuItems:
|
|
32
|
-
sidebarBefore:
|
|
29
|
+
searchRender: x,
|
|
30
|
+
noticeRender: B,
|
|
31
|
+
isNotice: S,
|
|
32
|
+
userInfo: K,
|
|
33
|
+
userMenuItems: N,
|
|
34
|
+
sidebarBefore: k,
|
|
33
35
|
sidebarAfter: D,
|
|
34
36
|
tabsBefore: I,
|
|
35
37
|
tabsAfter: w
|
|
36
|
-
} =
|
|
38
|
+
} = ie(), { tabsAttribute: O, sidebarCollapsed: G, loadingConfig: P, ADD_TAB: V, REMOVE_TAB: j, SET_ACTIVE_TAB_KEY: E, SET_SIDEBAR_COLLAPSED: H } = ae(y(["tabsAttribute", "sidebarCollapsed", "loadingConfig", "ADD_TAB", "REMOVE_TAB", "SET_ACTIVE_TAB_KEY", "SET_SIDEBAR_COLLAPSED"])), { tabsList: h, tabsActiveKey: i } = O, { theme: Y, TOGGLE_THEME: z } = se(y(["theme", "TOGGLE_THEME"])), l = d(() => {
|
|
37
39
|
var t;
|
|
38
40
|
if (!o || o.length === 0)
|
|
39
41
|
return i;
|
|
40
42
|
const e = b(r.pathname, o);
|
|
41
43
|
return e && (((t = e.handle) == null ? void 0 : t.activeRouteMenuId) || e.id) || i;
|
|
42
|
-
}, [r.pathname, o, i]),
|
|
44
|
+
}, [r.pathname, o, i]), q = d(() => {
|
|
43
45
|
const e = [];
|
|
44
|
-
if (!
|
|
46
|
+
if (!a || a.length === 0 || !l)
|
|
45
47
|
return e;
|
|
46
|
-
const t =
|
|
48
|
+
const t = fe(l, a);
|
|
47
49
|
return t && e.push(...t), e;
|
|
48
|
-
}, [l,
|
|
50
|
+
}, [l, a]), F = d(() => {
|
|
49
51
|
const e = [];
|
|
50
52
|
if (!o || o.length === 0)
|
|
51
53
|
return r.pathname === "/" && e.push({ title: "首页" }), e;
|
|
52
|
-
const t = o, n =
|
|
53
|
-
return c ?
|
|
54
|
+
const t = o, n = de(t), c = b(r.pathname, t);
|
|
55
|
+
return c ? me(c, n).forEach((u) => {
|
|
54
56
|
var C;
|
|
55
|
-
const A = ((C =
|
|
57
|
+
const A = ((C = u.handle) == null ? void 0 : C.title) || u.id || "";
|
|
56
58
|
A && e.push({ title: A });
|
|
57
59
|
}) : r.pathname === "/" && e.push({ title: "首页" }), e;
|
|
58
60
|
}, [r.pathname, o]), J = (e) => {
|
|
59
61
|
var n;
|
|
60
|
-
const t =
|
|
62
|
+
const t = he(e, a);
|
|
61
63
|
m(((n = t == null ? void 0 : t.routeNode) == null ? void 0 : n.path) ?? "/");
|
|
62
64
|
}, Q = (e) => {
|
|
63
65
|
E(e);
|
|
@@ -71,7 +73,7 @@ function Ne() {
|
|
|
71
73
|
const e = p == null ? void 0 : p(r.pathname);
|
|
72
74
|
if (e && e.id && !["root", "blank", "auth"].includes(e.id)) {
|
|
73
75
|
const n = e.id, c = ((t = e.handle) == null ? void 0 : t.title) || e.id;
|
|
74
|
-
h.find((
|
|
76
|
+
h.find((u) => u.key === n) ? E(n) : V({
|
|
75
77
|
key: n,
|
|
76
78
|
label: c,
|
|
77
79
|
path: r.pathname
|
|
@@ -80,41 +82,41 @@ function Ne() {
|
|
|
80
82
|
};
|
|
81
83
|
return $(() => {
|
|
82
84
|
T && W();
|
|
83
|
-
}, [r.pathname, T]), /* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
85
|
+
}, [r.pathname, T]), /* @__PURE__ */ f(g, { className: "basics-layout w-full h-screen overflow-hidden flex flex-col", children: [
|
|
86
|
+
/* @__PURE__ */ s(
|
|
87
|
+
le,
|
|
86
88
|
{
|
|
87
|
-
breadcrumbItems:
|
|
88
|
-
appName:
|
|
89
|
-
logo:
|
|
89
|
+
breadcrumbItems: F,
|
|
90
|
+
appName: _,
|
|
91
|
+
logo: L,
|
|
90
92
|
headerActionsRender: v,
|
|
91
93
|
breadcrumbBeforeRender: M,
|
|
92
|
-
searchRender:
|
|
93
|
-
noticeRender:
|
|
94
|
-
isNotice:
|
|
95
|
-
userInfo:
|
|
96
|
-
userMenuItems:
|
|
94
|
+
searchRender: x,
|
|
95
|
+
noticeRender: B,
|
|
96
|
+
isNotice: S,
|
|
97
|
+
userInfo: K,
|
|
98
|
+
userMenuItems: N,
|
|
97
99
|
theme: Y,
|
|
98
100
|
onToggleTheme: z,
|
|
99
101
|
onLogout: R
|
|
100
102
|
}
|
|
101
103
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
104
|
+
/* @__PURE__ */ f(g, { className: "flex-1 overflow-hidden", children: [
|
|
105
|
+
/* @__PURE__ */ s(
|
|
106
|
+
ce,
|
|
105
107
|
{
|
|
106
108
|
collapsed: G,
|
|
107
109
|
onCollapse: H,
|
|
108
|
-
menus:
|
|
110
|
+
menus: a,
|
|
109
111
|
activeKey: l,
|
|
110
|
-
openKeys:
|
|
112
|
+
openKeys: q,
|
|
111
113
|
onMenuClick: J,
|
|
112
|
-
beforeRender:
|
|
114
|
+
beforeRender: k,
|
|
113
115
|
afterRender: D
|
|
114
116
|
}
|
|
115
117
|
),
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ f(pe, { className: "flex flex-col flex-1 overflow-hidden bg-[#eff1f4] dark:bg-[#141619]", children: [
|
|
119
|
+
/* @__PURE__ */ s(
|
|
118
120
|
ue,
|
|
119
121
|
{
|
|
120
122
|
tabs: h,
|
|
@@ -125,9 +127,9 @@ function Ne() {
|
|
|
125
127
|
afterRender: w
|
|
126
128
|
}
|
|
127
129
|
),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
P.show && /* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ f("div", { className: "flex-1 overflow-auto p-3 custom-scrollbar relative", children: [
|
|
131
|
+
/* @__PURE__ */ s(oe, {}),
|
|
132
|
+
P.show && /* @__PURE__ */ s("div", { className: "absolute inset-0 z-9999 flex items-center justify-center bg-white/80 dark:bg-[#1a1c1f]/80", children: /* @__PURE__ */ s(Z, { spinning: !0 }) })
|
|
131
133
|
] })
|
|
132
134
|
] })
|
|
133
135
|
] })
|
|
@@ -1,55 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as H } from "react/jsx-runtime";
|
|
2
2
|
import { useState as t } from "react";
|
|
3
|
-
import { GlobalContext as
|
|
4
|
-
function
|
|
5
|
-
const [
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
|
|
3
|
+
import { GlobalContext as L } from "./context.js";
|
|
4
|
+
function z(e) {
|
|
5
|
+
const [r, n] = t(e.appName), [s, o] = t(e.logo), [i, c] = t(e.noticeRender), [a, d] = t(e.description), [f, b] = t(e.descriptionDetail), [u, m] = t(e.copyright), [l, R] = t(e.userMenuItems), [h, A] = t(e.userInfo), [B, I] = t(e.sidebarBefore), [N, g] = t(e.sidebarAfter), [D, x] = t(e.tabsBefore), [S, v] = t(e.tabsAfter), [y, C] = t(e.headerActionsRender), [M, G] = t(e.searchRender), [P, T] = t(e.breadcrumbBeforeRender), [U, j] = t(e.isNotice ?? !0);
|
|
6
|
+
return /* @__PURE__ */ H(
|
|
7
|
+
L.Provider,
|
|
8
8
|
{
|
|
9
9
|
value: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
...e,
|
|
11
|
+
appName: r,
|
|
12
|
+
logo: s,
|
|
13
|
+
noticeRender: i,
|
|
13
14
|
description: a,
|
|
14
15
|
descriptionDetail: f,
|
|
15
|
-
copyright:
|
|
16
|
+
copyright: u,
|
|
16
17
|
userMenuItems: l,
|
|
17
18
|
userInfo: h,
|
|
18
19
|
sidebarBefore: B,
|
|
19
20
|
sidebarAfter: N,
|
|
20
21
|
tabsBefore: D,
|
|
21
|
-
tabsAfter:
|
|
22
|
-
headerActionsRender:
|
|
23
|
-
searchRender:
|
|
24
|
-
breadcrumbBeforeRender:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
routes: L,
|
|
28
|
-
isNotice: w,
|
|
29
|
-
setAppName: s,
|
|
22
|
+
tabsAfter: S,
|
|
23
|
+
headerActionsRender: y,
|
|
24
|
+
searchRender: M,
|
|
25
|
+
breadcrumbBeforeRender: P,
|
|
26
|
+
isNotice: U,
|
|
27
|
+
setAppName: n,
|
|
30
28
|
setLogo: o,
|
|
31
|
-
setNoticeRender:
|
|
29
|
+
setNoticeRender: c,
|
|
32
30
|
setDescription: d,
|
|
33
|
-
setDescriptionDetail:
|
|
31
|
+
setDescriptionDetail: b,
|
|
34
32
|
setCopyright: m,
|
|
35
33
|
setUserMenuItems: R,
|
|
36
34
|
setUserInfo: A,
|
|
37
35
|
setSidebarBefore: I,
|
|
38
36
|
setSidebarAfter: g,
|
|
39
37
|
setTabsBefore: x,
|
|
40
|
-
setTabsAfter:
|
|
41
|
-
setHeaderActionsRender:
|
|
42
|
-
setSearchRender:
|
|
43
|
-
setBreadcrumbBeforeRender:
|
|
44
|
-
|
|
45
|
-
setMenus: H,
|
|
46
|
-
setRoutes: q,
|
|
47
|
-
setIsNotice: z
|
|
38
|
+
setTabsAfter: v,
|
|
39
|
+
setHeaderActionsRender: C,
|
|
40
|
+
setSearchRender: G,
|
|
41
|
+
setBreadcrumbBeforeRender: T,
|
|
42
|
+
setIsNotice: j
|
|
48
43
|
},
|
|
49
44
|
children: e.children
|
|
50
45
|
}
|
|
51
46
|
);
|
|
52
47
|
}
|
|
53
48
|
export {
|
|
54
|
-
|
|
49
|
+
z as default
|
|
55
50
|
};
|
package/lib/fe-layouts/layout.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { useSelector as
|
|
3
|
-
import { theme as
|
|
2
|
+
import { useSelector as i } from "@spacego/zustand";
|
|
3
|
+
import { theme as n, ConfigProvider as c, Spin as u } from "antd";
|
|
4
4
|
import { useMemo as g } from "react";
|
|
5
5
|
import "@ant-design/icons";
|
|
6
6
|
import { getRealTheme as d } from "../utils/theme.js";
|
|
@@ -10,20 +10,22 @@ import p from "../config/theme.js";
|
|
|
10
10
|
import "react-router-dom";
|
|
11
11
|
import "./context/context.js";
|
|
12
12
|
import k from "./context/global-context.provider.js";
|
|
13
|
+
import "nprogress";
|
|
14
|
+
/* empty css */
|
|
13
15
|
import L from "./auth-layout/index.js";
|
|
14
16
|
import M from "./basics-layout/index.js";
|
|
15
17
|
import T from "./blank-layout/index.js";
|
|
16
18
|
import "@spacego/turbo-utils";
|
|
17
19
|
/* empty css */
|
|
18
|
-
function
|
|
19
|
-
const { layoutType:
|
|
20
|
-
const h = d(
|
|
20
|
+
function I(a) {
|
|
21
|
+
const { layoutType: t, ...s } = a, { loadingConfig: l } = C(i(["loadingConfig"])), { theme: e, themeColor: r } = y(i(["theme", "themeColor"])), f = g(() => {
|
|
22
|
+
const h = d(e);
|
|
21
23
|
return {
|
|
22
24
|
cssVar: {
|
|
23
25
|
prefix: "ant"
|
|
24
26
|
},
|
|
25
27
|
// 启用 CSS 变量模式,生成 --ant-color-primary 等变量
|
|
26
|
-
algorithm: h === "dark" ?
|
|
28
|
+
algorithm: h === "dark" ? n.darkAlgorithm : n.defaultAlgorithm,
|
|
27
29
|
token: {
|
|
28
30
|
colorPrimary: r,
|
|
29
31
|
...p.token
|
|
@@ -32,20 +34,20 @@ function E(a) {
|
|
|
32
34
|
...p.components
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
|
-
}, [
|
|
37
|
+
}, [e, r]), m = (/* @__PURE__ */ new Map([
|
|
36
38
|
["blank", T],
|
|
37
39
|
["basic", M],
|
|
38
40
|
["auth", L]
|
|
39
|
-
])).get(
|
|
41
|
+
])).get(t);
|
|
40
42
|
return /* @__PURE__ */ o(c, { theme: f, children: /* @__PURE__ */ o(k, { ...s, children: /* @__PURE__ */ o(
|
|
41
43
|
u,
|
|
42
44
|
{
|
|
43
|
-
spinning: l.show &&
|
|
45
|
+
spinning: l.show && t !== "basic",
|
|
44
46
|
wrapperClassName: "spin-wrapper-full",
|
|
45
|
-
children: m && /* @__PURE__ */ o(m, {},
|
|
47
|
+
children: m && /* @__PURE__ */ o(m, {}, t)
|
|
46
48
|
}
|
|
47
49
|
) }) });
|
|
48
50
|
}
|
|
49
51
|
export {
|
|
50
|
-
|
|
52
|
+
I as default
|
|
51
53
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useSubmit as i, useFetcher as
|
|
1
|
+
import { useSubmit as i, useFetcher as c, useSearchParams as n } from "react-router-dom";
|
|
2
2
|
import { useLayoutConfigStore as a } from "../store/modules/layout-config.store.js";
|
|
3
3
|
import "../store/modules/theme.store.js";
|
|
4
4
|
import { useGlobal as l } from "../fe-layouts/context/context.js";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "react";
|
|
7
|
-
function
|
|
8
|
-
const
|
|
7
|
+
function E() {
|
|
8
|
+
const o = i(), e = c(), [r] = n(), { setToken: t } = l();
|
|
9
9
|
return {
|
|
10
10
|
login: (s, u) => {
|
|
11
|
-
const m = u ||
|
|
12
|
-
|
|
11
|
+
const m = u || r.get("from") || "/";
|
|
12
|
+
o({ token: s, redirectTo: m }, { method: "post", replace: !0 });
|
|
13
13
|
},
|
|
14
14
|
logout: () => {
|
|
15
|
-
|
|
15
|
+
t == null || t(void 0), e.submit(null, { action: "/logout", method: "post" }), setTimeout(() => {
|
|
16
16
|
a.getState().RESET();
|
|
17
17
|
}, 300);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
22
|
-
|
|
22
|
+
E as useAuth
|
|
23
23
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import t from "nprogress";
|
|
2
|
+
import { useEffect as e } from "react";
|
|
3
|
+
import { useLocation as n, useNavigation as r } from "react-router-dom";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function u() {
|
|
6
|
+
const s = n(), o = r();
|
|
7
|
+
t.configure({ showSpinner: !1 }), e(() => (t.done(), () => {
|
|
8
|
+
t.start();
|
|
9
|
+
}), [s.pathname]), e(() => {
|
|
10
|
+
o.state === "loading" || o.state === "submitting" ? t.start() : t.done();
|
|
11
|
+
}, [o.state]);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
u as useNProgress
|
|
15
|
+
};
|