@spacego/fe-components 0.0.2 → 0.0.4

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.
@@ -30,12 +30,16 @@ function z({ open: m, onClose: a }) {
30
30
  placement: "right",
31
31
  onClose: a,
32
32
  open: m,
33
- width: 380,
34
- closable: !1,
35
- maskStyle: { backdropFilter: "none" },
33
+ closeIcon: null,
36
34
  className: "dark:bg-[#1a1c1f]!",
37
35
  extra: /* @__PURE__ */ e("div", { className: "cursor-pointer hover:text-primary transition-colors", onClick: a, children: /* @__PURE__ */ e(g, { className: "text-sm" }) }),
38
36
  styles: {
37
+ wrapper: {
38
+ width: 380
39
+ },
40
+ mask: {
41
+ backdropFilter: "none"
42
+ },
39
43
  header: {
40
44
  padding: "18px",
41
45
  borderBottom: "1px solid var(--border-color)"
@@ -1,5 +1,5 @@
1
1
  import { jsxs as f, jsx as s } from "react/jsx-runtime";
2
- import { useSelector as y } from "@spacego/zustand";
2
+ import { useSelector as R } from "@spacego/zustand";
3
3
  import { Layout as g, Spin as Z } from "antd";
4
4
  import { useMemo as d, useEffect as $ } from "react";
5
5
  import { useLocation as ee, useNavigate as te, Outlet as oe } from "react-router-dom";
@@ -15,7 +15,7 @@ import { findRouteByPath as b, findMenuParentKeys as ue, buildRouteMap as fe, fi
15
15
  /* empty css */
16
16
  const { Content: he } = g;
17
17
  function Se() {
18
- const r = ee(), m = te(), { logout: R } = ne(), {
18
+ const r = ee(), m = te(), { logout: y } = ne(), {
19
19
  token: T,
20
20
  menus: a = [],
21
21
  routes: o = [],
@@ -32,7 +32,7 @@ function Se() {
32
32
  sidebarAfter: D,
33
33
  tabsBefore: I,
34
34
  tabsAfter: w
35
- } = se(), { tabsAttribute: O, sidebarCollapsed: G, loadingConfig: P, ADD_TAB: V, REMOVE_TAB: j, SET_ACTIVE_TAB_KEY: E, SET_SIDEBAR_COLLAPSED: H } = re(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 } = ae(y(["theme", "TOGGLE_THEME"])), l = d(() => {
35
+ } = se(), { tabsAttribute: O, sidebarCollapsed: G, loadingConfig: P, ADD_TAB: V, REMOVE_TAB: j, SET_ACTIVE_TAB_KEY: E, SET_SIDEBAR_COLLAPSED: H } = re(R(["tabsAttribute", "sidebarCollapsed", "loadingConfig", "ADD_TAB", "REMOVE_TAB", "SET_ACTIVE_TAB_KEY", "SET_SIDEBAR_COLLAPSED"])), { tabsList: h, tabsActiveKey: i } = O, { theme: Y, TOGGLE_THEME: z } = ae(R(["theme", "TOGGLE_THEME"])), l = d(() => {
36
36
  var t;
37
37
  if (!o || o.length === 0)
38
38
  return i;
@@ -68,7 +68,7 @@ function Se() {
68
68
  }, p = d(() => !o || o.length === 0 ? null : (e) => b(e, o), [o]), W = () => {
69
69
  var t;
70
70
  const e = p == null ? void 0 : p(r.pathname);
71
- if (e && e.id && !["root", "blank", "auth"].includes(e.id)) {
71
+ if (console.log("currentRoute:>> ", e), e && e.id && !["root", "blank", "auth"].includes(e.id)) {
72
72
  const n = e.id, c = ((t = e.handle) == null ? void 0 : t.title) || e.id;
73
73
  h.find((u) => u.key === n) ? E(n) : V({
74
74
  key: n,
@@ -95,7 +95,7 @@ function Se() {
95
95
  userMenuItems: k,
96
96
  theme: Y,
97
97
  onToggleTheme: z,
98
- onLogout: R
98
+ onLogout: y
99
99
  }
100
100
  ),
101
101
  /* @__PURE__ */ f(g, { className: "flex-1 overflow-hidden", children: [
@@ -1,43 +1,52 @@
1
- import { createBrowserRouter as c } from "react-router-dom";
2
- import { createPermissionHelpers as u } from "./permission.js";
3
- import { createDefaultRoutes as a } from "./routes.js";
1
+ import { createBrowserRouter as a } from "react-router-dom";
2
+ import { createPermissionHelpers as c } from "./permission.js";
3
+ import { createDefaultRoutes as u } from "./routes.js";
4
4
  import "react";
5
- function h(t) {
6
- const { modules: n, token: o, BaseLayout: e, routes: s = [] } = t, r = u(o), i = a(n, r, e);
5
+ function R(s) {
6
+ const { modules: n, token: e, BaseLayout: t, routes: o = [] } = s, r = c(e), i = u(n, r, t);
7
7
  return {
8
8
  /** 最终合并后的路由配置 */
9
- routes: f(i, s),
9
+ routes: m(i, o),
10
10
  /** 权限帮助函数,包含 ProtectedLoader 等,用于外部调用 processRoutes */
11
11
  permissionHelpers: r
12
12
  };
13
13
  }
14
- function f(t, n) {
15
- const o = /* @__PURE__ */ new Map();
16
- return t.forEach((e) => {
17
- e.id && o.set(e.id, e);
18
- }), n.forEach((e) => {
19
- if (e.id)
20
- if (e.id === "root" && o.has("root")) {
21
- const s = o.get("root"), r = e, i = [
22
- ...s.children || [],
14
+ function m(s, n) {
15
+ const e = /* @__PURE__ */ new Map();
16
+ return s.forEach((t) => {
17
+ if (t.id)
18
+ e.set(t.id, t);
19
+ else {
20
+ const o = t.path || `route-${Math.random().toString(36).substring(2, 9)}`;
21
+ e.set(o, t);
22
+ }
23
+ }), n.forEach((t) => {
24
+ if (t.id)
25
+ if (t.id === "root" && e.has("root")) {
26
+ const o = e.get("root"), r = t, i = [
27
+ ...o.children || [],
23
28
  ...r.children || []
24
29
  ];
25
- o.set("root", {
26
- ...s,
30
+ e.set("root", {
31
+ ...o,
27
32
  ...r,
28
33
  // 属性以 customRoot 为准
29
34
  children: i
30
35
  });
31
36
  } else
32
- o.set(e.id, e);
33
- }), Array.from(o.values());
37
+ e.set(t.id, t);
38
+ else {
39
+ const o = `custom-${t.path || Math.random().toString(36).substring(2, 9)}`;
40
+ e.set(o, t);
41
+ }
42
+ }), Array.from(e.values());
34
43
  }
35
- function g(t) {
36
- return c(t);
44
+ function g(s) {
45
+ return a(s);
37
46
  }
38
47
  export {
39
- a as createDefaultRoutes,
40
- u as createPermissionHelpers,
41
- h as createRouter,
48
+ u as createDefaultRoutes,
49
+ c as createPermissionHelpers,
50
+ R as createRouter,
42
51
  g as generateRouter
43
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spacego/fe-components",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "🚀 A component library for fe to use.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",