@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.
@@ -4,7 +4,6 @@ const _ = "SPACEGO_ADMIN", E = () => {
4
4
  THEME: `__${_}_THEME_STORE__`
5
5
  };
6
6
  export {
7
- _ as APP_KEY,
8
7
  E as NOOP,
9
8
  O as STORE_KEY
10
9
  };
@@ -1,27 +1,30 @@
1
- import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import { useSelector as p } from "@spacego/zustand";
3
- import { useState as u, Suspense as g } from "react";
4
- import { FaCheck as v } from "react-icons/fa6";
5
- import { IoMoon as N } from "react-icons/io5";
6
- import { LuPalette as b } from "react-icons/lu";
7
- import { MdWbSunny as y } from "react-icons/md";
8
- import { Outlet as w } from "react-router-dom";
9
- import k from "../../assets/svg/login-view.svg.js";
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 E } from "../../utils/theme.js";
11
+ import { applyThemeWithTransition as L } from "../../utils/theme.js";
13
12
  import "../../store/modules/layout-config.store.js";
14
- import { useThemeStore as L } from "../../store/modules/theme.store.js";
15
- import { THEME_COLORS as C } from "../../config/theme.js";
16
- import "antd";
17
- import { useGlobal as M } from "../context/context.js";
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
- function K() {
21
- const { appName: s, logo: n } = M(), { theme: o, themeColor: c, TOGGLE_THEME: m, SET_THEME_COLOR: f } = L(p(["theme", "themeColor", "TOGGLE_THEME", "SET_THEME_COLOR"])), [a, i] = u(!1), d = (r) => {
22
- const l = r.currentTarget.getBoundingClientRect(), h = l.left + l.width / 2, x = l.top + l.height / 2;
23
- E(o === "light" ? "dark" : "light", h, x).then(() => {
24
- m();
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: a ? "224px" : "0",
41
+ width: o ? "224px" : "0",
39
42
  // 7个颜色(20px) + 6个gap(12px) = 140 + 72 = 212px
40
- transform: `scaleX(${a ? 1 : 0})`,
41
- opacity: a ? 1 : 0,
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: C.map((r) => /* @__PURE__ */ e(
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: () => f(r),
52
- children: c === r && /* @__PURE__ */ e(v, { className: "size-[10px] text-white" })
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(b, { className: "h-[16px] w-[16px] text-(--color-primary)" })
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: d, children: o === "dark" ? /* @__PURE__ */ e(y, { className: "h-[18px] w-[18px]" }) : /* @__PURE__ */ e(N, { className: "h-[18px] w-[18px]" }) })
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
- n,
75
- s
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(k, { className: "animate-float h-64 w-2/5" }),
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(g, { fallback: /* @__PURE__ */ e(T, {}), children: /* @__PURE__ */ e(w, {}) }),
87
- /* @__PURE__ */ e("div", { className: "text-[#71717a] absolute bottom-3 flex text-center text-xs", children: /* @__PURE__ */ t("div", { className: "text-md flex justify-center mt-4", children: [
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
- K as default
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("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(
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 p } from "react/jsx-runtime";
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(a) {
9
+ function D(s) {
10
10
  const {
11
11
  collapsed: l,
12
12
  menus: n = [],
13
- activeKey: s,
13
+ activeKey: d,
14
14
  openKeys: o = [],
15
- onMenuClick: d,
16
- onCollapse: c,
17
- beforeRender: f,
18
- afterRender: m
19
- } = a, [u, i] = g(o);
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 b = k(() => {
24
- const t = (h) => h.map((r) => ({
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__ */ p("div", { className: "h-full flex flex-col", children: [
42
- f,
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: [s],
48
- openKeys: u,
47
+ selectedKeys: [d],
48
+ openKeys: b,
49
49
  onOpenChange: i,
50
- items: b,
51
- onClick: ({ key: t }) => d(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
- m,
57
- /* @__PURE__ */ e("div", { className: "flex items-center justify-start pl-4 mb-2", children: /* @__PURE__ */ e(
58
- "div",
59
- {
60
- onClick: () => c(!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
- ) })
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 u, jsx as a } from "react/jsx-runtime";
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 $, Suspense as ee } from "react";
5
- import { useLocation as te, useNavigate as oe, Outlet as ne } from "react-router-dom";
6
- import re from "../../fe-loading/index.js";
7
- import { useAuth as ae } from "../../hooks/use-auth.hook.js";
8
- import { useLayoutConfigStore as se } from "../../store/modules/layout-config.store.js";
9
- import { useThemeStore as ie } from "../../store/modules/theme.store.js";
10
- import { useGlobal as le } from "../context/context.js";
11
- import ce from "./components/basics-layout/header.js";
12
- import fe from "./components/basics-layout/sidebar.js";
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 de, buildRouteMap as me, findParentRoutes as he, findMenuByKey as pe } from "./components/utils/index.js";
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: be } = g;
17
+ const { Content: pe } = g;
18
18
  function Ne() {
19
- const r = te(), m = oe(), { logout: R } = ae(), {
19
+ const r = ee(), m = te(), { logout: R } = ne();
20
+ re();
21
+ const {
20
22
  token: T,
21
- menus: s = [],
23
+ menus: a = [],
22
24
  routes: o = [],
23
- appName: L,
24
- logo: _,
25
+ appName: _,
26
+ logo: L,
25
27
  headerActionsRender: v,
26
28
  breadcrumbBeforeRender: M,
27
- searchRender: S,
28
- noticeRender: x,
29
- isNotice: B,
30
- userInfo: k,
31
- userMenuItems: K,
32
- sidebarBefore: N,
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
- } = le(), { tabsAttribute: O, sidebarCollapsed: G, loadingConfig: P, ADD_TAB: V, REMOVE_TAB: j, SET_ACTIVE_TAB_KEY: E, SET_SIDEBAR_COLLAPSED: H } = se(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 } = ie(y(["theme", "TOGGLE_THEME"])), l = d(() => {
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]), F = d(() => {
44
+ }, [r.pathname, o, i]), q = d(() => {
43
45
  const e = [];
44
- if (!s || s.length === 0 || !l)
46
+ if (!a || a.length === 0 || !l)
45
47
  return e;
46
- const t = de(l, s);
48
+ const t = fe(l, a);
47
49
  return t && e.push(...t), e;
48
- }, [l, s]), q = d(() => {
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 = me(t), c = b(r.pathname, t);
53
- return c ? he(c, n).forEach((f) => {
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 = f.handle) == null ? void 0 : C.title) || f.id || "";
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 = pe(e, s);
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((f) => f.key === n) ? E(n) : V({
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__ */ u(g, { className: "basics-layout w-full h-screen overflow-hidden flex flex-col", children: [
84
- /* @__PURE__ */ a(
85
- ce,
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: q,
88
- appName: L,
89
- logo: _,
89
+ breadcrumbItems: F,
90
+ appName: _,
91
+ logo: L,
90
92
  headerActionsRender: v,
91
93
  breadcrumbBeforeRender: M,
92
- searchRender: S,
93
- noticeRender: x,
94
- isNotice: B,
95
- userInfo: k,
96
- userMenuItems: K,
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__ */ u(g, { className: "flex-1 overflow-hidden", children: [
103
- /* @__PURE__ */ a(
104
- fe,
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: s,
110
+ menus: a,
109
111
  activeKey: l,
110
- openKeys: F,
112
+ openKeys: q,
111
113
  onMenuClick: J,
112
- beforeRender: N,
114
+ beforeRender: k,
113
115
  afterRender: D
114
116
  }
115
117
  ),
116
- /* @__PURE__ */ u(be, { className: "flex flex-col flex-1 overflow-hidden bg-[#eff1f4] dark:bg-[#141619]", children: [
117
- /* @__PURE__ */ a(
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__ */ u("div", { className: "flex-1 overflow-auto p-3 custom-scrollbar relative", children: [
129
- /* @__PURE__ */ a(ee, { fallback: /* @__PURE__ */ a(re, {}), children: /* @__PURE__ */ a(ne, {}) }),
130
- P.show && /* @__PURE__ */ a("div", { className: "absolute inset-0 z-9999 flex items-center justify-center bg-white/80 dark:bg-[#1a1c1f]/80", children: /* @__PURE__ */ a(Z, { spinning: !0 }) })
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 E } from "react/jsx-runtime";
1
+ import { jsx as H } from "react/jsx-runtime";
2
2
  import { useState as t } from "react";
3
- import { GlobalContext as F } from "./context.js";
4
- function Q(e) {
5
- const [n, s] = t(e.appName), [r, o] = t(e.logo), [c, i] = t(e.noticeRender), [a, d] = t(e.description), [f, u] = t(e.descriptionDetail), [b, 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), [M, S] = t(e.tabsAfter), [k, v] = t(e.headerActionsRender), [y, C] = t(e.searchRender), [T, G] = t(e.breadcrumbBeforeRender), [P, U] = t(e.token), [j, H] = t(e.menus), [L, q] = t(e.routes), [w, z] = t(e.isNotice ?? !0);
6
- return /* @__PURE__ */ E(
7
- F.Provider,
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
- appName: n,
11
- logo: r,
12
- noticeRender: c,
10
+ ...e,
11
+ appName: r,
12
+ logo: s,
13
+ noticeRender: i,
13
14
  description: a,
14
15
  descriptionDetail: f,
15
- copyright: b,
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: M,
22
- headerActionsRender: k,
23
- searchRender: y,
24
- breadcrumbBeforeRender: T,
25
- token: P,
26
- menus: j,
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: i,
29
+ setNoticeRender: c,
32
30
  setDescription: d,
33
- setDescriptionDetail: u,
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: S,
41
- setHeaderActionsRender: v,
42
- setSearchRender: C,
43
- setBreadcrumbBeforeRender: G,
44
- setToken: U,
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
- Q as default
49
+ z as default
55
50
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { useSelector as n } from "@spacego/zustand";
3
- import { theme as i, ConfigProvider as c, Spin as u } from "antd";
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 E(a) {
19
- const { layoutType: e, ...s } = a, { loadingConfig: l } = C(n(["loadingConfig"])), { theme: t, themeColor: r } = y(n(["theme", "themeColor"])), f = g(() => {
20
- const h = d(t);
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" ? i.darkAlgorithm : i.defaultAlgorithm,
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
- }, [t, r]), m = (/* @__PURE__ */ new Map([
37
+ }, [e, r]), m = (/* @__PURE__ */ new Map([
36
38
  ["blank", T],
37
39
  ["basic", M],
38
40
  ["auth", L]
39
- ])).get(e);
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 && e !== "basic",
45
+ spinning: l.show && t !== "basic",
44
46
  wrapperClassName: "spin-wrapper-full",
45
- children: m && /* @__PURE__ */ o(m, {}, e)
47
+ children: m && /* @__PURE__ */ o(m, {}, t)
46
48
  }
47
49
  ) }) });
48
50
  }
49
51
  export {
50
- E as default
52
+ I as default
51
53
  };
@@ -1,23 +1,23 @@
1
- import { useSubmit as i, useFetcher as n, useSearchParams as c } from "react-router-dom";
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 P() {
8
- const t = i(), o = n(), [e] = c(), { setToken: r } = l();
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 || e.get("from") || "/";
12
- t({ token: s, redirectTo: m }, { method: "post", replace: !0 });
11
+ const m = u || r.get("from") || "/";
12
+ o({ token: s, redirectTo: m }, { method: "post", replace: !0 });
13
13
  },
14
14
  logout: () => {
15
- r(void 0), o.submit(null, { action: "/logout", method: "post" }), setTimeout(() => {
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
- P as useAuth
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
+ };