@lark-apaas/client-toolkit 0.1.0-alpha.log.2 → 0.1.0-alpha.safe.1
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/apis/hooks/useTheme.d.ts +1 -0
- package/lib/apis/hooks/useTheme.js +1 -0
- package/lib/components/AppContainer/LogInterceptor.js +27 -5
- package/lib/components/AppContainer/api-proxy/core.d.ts +155 -0
- package/lib/components/AppContainer/api-proxy/core.js +270 -0
- package/lib/components/AppContainer/index.js +11 -5
- package/lib/components/AppContainer/safety.d.ts +3 -0
- package/lib/components/AppContainer/safety.js +129 -0
- package/lib/components/AppContainer/utils/api-panel.d.ts +29 -0
- package/lib/components/AppContainer/utils/api-panel.js +66 -0
- package/lib/components/AppContainer/utils/childApi.js +11 -1
- package/lib/components/ErrorRender/index.js +3 -3
- package/lib/components/User/UserDisplay.d.ts +2 -1
- package/lib/components/User/UserDisplay.js +103 -26
- package/lib/components/User/UserProfile/UserProfile.css +1 -1
- package/lib/components/User/UserProfile/UserProfileContainer.d.ts +1 -1
- package/lib/components/User/UserProfile/UserProfileSkeleton.d.ts +0 -1
- package/lib/components/User/UserProfile/UserProfileSkeleton.js +21 -29
- package/lib/components/User/UserProfile/UserProfileUI.d.ts +1 -2
- package/lib/components/User/UserProfile/UserProfileUI.js +106 -92
- package/lib/components/User/UserSelect.d.ts +1 -1
- package/lib/components/User/UserSelect.js +17 -143
- package/lib/components/User/UserSelectUI/ActionButtons.d.ts +11 -0
- package/lib/components/User/UserSelectUI/ActionButtons.js +44 -0
- package/lib/components/User/UserSelectUI/Dropdown.d.ts +12 -0
- package/lib/components/User/UserSelectUI/Dropdown.js +66 -0
- package/lib/components/User/UserSelectUI/MultipleSelectionTags.d.ts +14 -0
- package/lib/components/User/UserSelectUI/MultipleSelectionTags.js +48 -0
- package/lib/components/User/UserSelectUI/SingleSelectionPreview.d.ts +9 -0
- package/lib/components/User/UserSelectUI/SingleSelectionPreview.js +37 -0
- package/lib/components/User/UserSelectUI/Spinner.d.ts +2 -0
- package/lib/components/User/UserSelectUI/Spinner.js +13 -0
- package/lib/components/User/UserSelectUI/UserSelectUI.d.ts +5 -0
- package/lib/components/User/UserSelectUI/UserSelectUI.js +230 -0
- package/lib/components/User/UserSelectUI/index.d.ts +2 -0
- package/lib/components/User/UserSelectUI/index.js +2 -0
- package/lib/components/User/UserSelectUI/types.d.ts +14 -0
- package/lib/components/User/UserSelectUI/types.js +0 -0
- package/lib/components/User/UserWithAvatar.d.ts +1 -1
- package/lib/components/User/UserWithAvatar.js +39 -22
- package/lib/components/User/type.d.ts +4 -0
- package/lib/components/index.d.ts +2 -5
- package/lib/components/index.js +2 -3
- package/lib/components/ui/avatar.d.ts +6 -0
- package/lib/components/ui/avatar.js +27 -0
- package/lib/components/ui/badge.d.ts +9 -0
- package/lib/components/ui/badge.js +29 -0
- package/lib/components/ui/button.d.ts +10 -0
- package/lib/components/ui/button.js +42 -0
- package/lib/components/ui/input.d.ts +3 -0
- package/lib/components/ui/input.js +12 -0
- package/lib/components/ui/overflow-tooltip-text.d.ts +8 -0
- package/lib/components/ui/overflow-tooltip-text.js +66 -0
- package/lib/components/ui/popover.d.ts +7 -0
- package/lib/components/ui/popover.js +35 -0
- package/lib/components/ui/skeleton.d.ts +7 -0
- package/lib/components/ui/skeleton.js +10 -0
- package/lib/components/ui/tooltip.d.ts +7 -0
- package/lib/components/ui/tooltip.js +24 -0
- package/lib/hooks/useAppInfo.js +12 -1
- package/lib/integrations/getAppInfo.js +4 -2
- package/lib/logger/__tests__/batch-logger.test.d.ts +1 -0
- package/lib/logger/__tests__/batch-logger.test.js +367 -0
- package/lib/logger/batch-logger.d.ts +78 -0
- package/lib/logger/batch-logger.js +134 -0
- package/lib/override.css +0 -16
- package/lib/types/iframe-events.d.ts +9 -0
- package/lib/types/index.d.ts +0 -29
- package/lib/utils/axiosConfig.js +7 -7
- package/lib/utils/getAppId.js +4 -3
- package/package.json +8 -1
- package/lib/apis/components/SidebarNav.d.ts +0 -1
- package/lib/apis/components/SidebarNav.js +0 -2
- package/lib/components/SidebarNav/DrawerNav.d.ts +0 -3
- package/lib/components/SidebarNav/DrawerNav.js +0 -64
- package/lib/components/SidebarNav/DropdownNav.d.ts +0 -3
- package/lib/components/SidebarNav/DropdownNav.js +0 -40
- package/lib/components/SidebarNav/Sidebar.d.ts +0 -3
- package/lib/components/SidebarNav/Sidebar.js +0 -33
- package/lib/components/SidebarNav/index.d.ts +0 -5
- package/lib/components/SidebarNav/index.js +0 -61
- package/lib/components/User/UserSelect.css +0 -11
- package/lib/components/common/LogoInfo.d.ts +0 -5
- package/lib/components/common/LogoInfo.js +0 -30
- package/lib/components/common/NavItem.d.ts +0 -20
- package/lib/components/common/NavItem.js +0 -112
- package/lib/components/common/NavMenu.d.ts +0 -9
- package/lib/components/common/NavMenu.js +0 -50
- package/lib/components/common/UserAvatarLayout.d.ts +0 -4
- package/lib/components/common/UserAvatarLayout.js +0 -41
- package/lib/components/common/UserAvatarMenu.d.ts +0 -4
- package/lib/components/common/UserAvatarMenu.js +0 -58
- package/lib/components/common/index.d.ts +0 -9
- package/lib/components/common/index.js +0 -10
|
@@ -48,4 +48,13 @@ export interface ParentApi {
|
|
|
48
48
|
export interface ChildApi {
|
|
49
49
|
getRoutes: () => Promise<any[]>;
|
|
50
50
|
getSourceMap: () => Promise<string>;
|
|
51
|
+
apiProxy: {
|
|
52
|
+
api_get: (url: string, config?: any) => Promise<any>;
|
|
53
|
+
api_post: (url: string, data?: any, config?: any) => Promise<any>;
|
|
54
|
+
api_put: (url: string, data?: any, config?: any) => Promise<any>;
|
|
55
|
+
api_delete: (url: string, config?: any) => Promise<any>;
|
|
56
|
+
api_patch: (url: string, data?: any, config?: any) => Promise<any>;
|
|
57
|
+
api_head: (url: string, config?: any) => Promise<any>;
|
|
58
|
+
api_options: (url: string, config?: any) => Promise<any>;
|
|
59
|
+
};
|
|
51
60
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
import { type ComponentType } from 'react';
|
|
2
1
|
export type ITheme = 'dark' | 'light' | 'system';
|
|
3
|
-
export interface NavItemProps {
|
|
4
|
-
name: string;
|
|
5
|
-
to: string;
|
|
6
|
-
icon?: ComponentType<{
|
|
7
|
-
className?: string;
|
|
8
|
-
}>;
|
|
9
|
-
children?: NavItemProps[];
|
|
10
|
-
className?: string;
|
|
11
|
-
hasBadge?: boolean;
|
|
12
|
-
direction?: 'horizontal' | 'vertical';
|
|
13
|
-
onClick?: () => void;
|
|
14
|
-
hideActive?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface BaseNavProps {
|
|
17
|
-
navList?: NavItemProps[];
|
|
18
|
-
className?: string;
|
|
19
|
-
activeClassName?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface NavProps extends BaseNavProps {
|
|
22
|
-
/** 亮色主题下的主色 */
|
|
23
|
-
lightColorPrimary?: string;
|
|
24
|
-
/** 暗色主题下的主色 */
|
|
25
|
-
darkColorPrimary?: string;
|
|
26
|
-
/**
|
|
27
|
-
* 移动端导航栏 变体
|
|
28
|
-
*/
|
|
29
|
-
mobileVariant?: 'normal' | 'dropdown';
|
|
30
|
-
}
|
|
31
2
|
declare global {
|
|
32
3
|
interface Window {
|
|
33
4
|
token?: string;
|
package/lib/utils/axiosConfig.js
CHANGED
|
@@ -2,14 +2,14 @@ import axios from "axios";
|
|
|
2
2
|
import { logger } from "../apis/logger.js";
|
|
3
3
|
function getRequestLogInfo(config) {
|
|
4
4
|
return {
|
|
5
|
-
url: config
|
|
6
|
-
method: config
|
|
7
|
-
params: config
|
|
8
|
-
data: config
|
|
5
|
+
url: config?.url,
|
|
6
|
+
method: config?.method?.toUpperCase(),
|
|
7
|
+
params: config?.params,
|
|
8
|
+
data: config?.data,
|
|
9
9
|
headers: {
|
|
10
|
-
...config
|
|
11
|
-
'X-Suda-Csrf-Token': config
|
|
12
|
-
Authorization: config
|
|
10
|
+
...config?.headers,
|
|
11
|
+
'X-Suda-Csrf-Token': config?.headers['X-Suda-Csrf-Token'] ? '[REDACTED]' : void 0,
|
|
12
|
+
Authorization: config?.headers.Authorization ? '[REDACTED]' : void 0
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
}
|
package/lib/utils/getAppId.js
CHANGED
|
@@ -2,10 +2,11 @@ function getAppId(path) {
|
|
|
2
2
|
if (window.MIAODA_APP_ID) return window.MIAODA_APP_ID;
|
|
3
3
|
let prefix;
|
|
4
4
|
prefix = path.includes('/ai/feida/runtime/') ? '/ai/feida/runtime/' : path.includes('/spark/r/') ? '/spark/r/' : '/ai/miaoda/';
|
|
5
|
-
|
|
5
|
+
const windowAppId = window.appId || null;
|
|
6
|
+
if (!path.startsWith(prefix)) return windowAppId;
|
|
6
7
|
const remainder = path.substring(prefix.length);
|
|
7
8
|
const nextSlashIndex = remainder.indexOf('/');
|
|
8
|
-
if (-1 === nextSlashIndex) return remainder;
|
|
9
|
-
return remainder.substring(0, nextSlashIndex);
|
|
9
|
+
if (-1 === nextSlashIndex) return remainder || windowAppId;
|
|
10
|
+
return remainder.substring(0, nextSlashIndex) || windowAppId;
|
|
10
11
|
}
|
|
11
12
|
export { getAppId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.safe.1",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -77,7 +77,13 @@
|
|
|
77
77
|
"@ant-design/cssinjs": "^1.24.0",
|
|
78
78
|
"@data-loom/js": "0.3.1",
|
|
79
79
|
"@lark-apaas/miaoda-inspector": "^1.0.0",
|
|
80
|
+
"@radix-ui/react-avatar": "^1.1.10",
|
|
81
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
82
|
+
"@radix-ui/react-slot": "^1.2.3",
|
|
83
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
80
84
|
"@zumer/snapdom": "^1.9.14",
|
|
85
|
+
"axios": "^1.12.2",
|
|
86
|
+
"class-variance-authority": "^0.7.1",
|
|
81
87
|
"clsx": "~2.0.1",
|
|
82
88
|
"dayjs": "^1.11.13",
|
|
83
89
|
"echarts": "^6.0.0",
|
|
@@ -102,6 +108,7 @@
|
|
|
102
108
|
"@storybook/blocks": "^8.6.14",
|
|
103
109
|
"@storybook/react": "^8.6.14",
|
|
104
110
|
"@storybook/test": "^8.6.14",
|
|
111
|
+
"@tailwindcss/postcss": "^4.1.0",
|
|
105
112
|
"@testing-library/jest-dom": "^6.6.4",
|
|
106
113
|
"@testing-library/react": "^16.3.0",
|
|
107
114
|
"@types/lodash": "^4.17.20",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as SidebarNav } from '../../components/SidebarNav';
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Button, Drawer } from "antd";
|
|
4
|
-
import { Menu } from "lucide-react";
|
|
5
|
-
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
-
import { LogoInfo, NavMenu, TopHeaderThemeClass, UserAvatarLayout } from "../common/index.js";
|
|
7
|
-
function DrawerNav({ navList, className, activeClassName }) {
|
|
8
|
-
const [open, setOpen] = useState(false);
|
|
9
|
-
const showDrawer = ()=>{
|
|
10
|
-
setOpen(true);
|
|
11
|
-
};
|
|
12
|
-
const onClose = ()=>{
|
|
13
|
-
setOpen(false);
|
|
14
|
-
};
|
|
15
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
16
|
-
className: clsxWithTw('w-full sticky top-0 z-50 flex flex-row h-14 px-3 items-center', TopHeaderThemeClass, className),
|
|
17
|
-
children: [
|
|
18
|
-
/*#__PURE__*/ jsx(Button, {
|
|
19
|
-
type: "text",
|
|
20
|
-
onClick: showDrawer,
|
|
21
|
-
className: "md:hidden px-0 text-inherit border-0",
|
|
22
|
-
children: /*#__PURE__*/ jsx(Menu, {
|
|
23
|
-
className: "h-6 w-6"
|
|
24
|
-
})
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ jsx(LogoInfo, {
|
|
27
|
-
className: "ml-[6px] pl-3"
|
|
28
|
-
}),
|
|
29
|
-
/*#__PURE__*/ jsxs(Drawer, {
|
|
30
|
-
placement: "left",
|
|
31
|
-
rootClassName: "miao-nav",
|
|
32
|
-
closeIcon: null,
|
|
33
|
-
classNames: {
|
|
34
|
-
body: clsxWithTw('w-full h-full flex flex-col p-0', className),
|
|
35
|
-
content: 'w-[320px]'
|
|
36
|
-
},
|
|
37
|
-
onClose: onClose,
|
|
38
|
-
open: open,
|
|
39
|
-
children: [
|
|
40
|
-
/*#__PURE__*/ jsx("div", {
|
|
41
|
-
className: "w-full h-14",
|
|
42
|
-
children: /*#__PURE__*/ jsx(LogoInfo, {
|
|
43
|
-
className: "pl-5 pr-3 h-full flex items-center"
|
|
44
|
-
})
|
|
45
|
-
}),
|
|
46
|
-
/*#__PURE__*/ jsx("div", {
|
|
47
|
-
className: "flex-1 overflow-auto min-h-0",
|
|
48
|
-
children: /*#__PURE__*/ jsx(NavMenu, {
|
|
49
|
-
navList: navList,
|
|
50
|
-
className: clsxWithTw('border-0', className),
|
|
51
|
-
activeClassName: activeClassName,
|
|
52
|
-
mode: "vertical",
|
|
53
|
-
onClick: onClose
|
|
54
|
-
})
|
|
55
|
-
}),
|
|
56
|
-
/*#__PURE__*/ jsx(UserAvatarLayout, {
|
|
57
|
-
className: "mt-2"
|
|
58
|
-
})
|
|
59
|
-
]
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
export { DrawerNav as default };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Menu, X } from "lucide-react";
|
|
4
|
-
import { clsxWithTw } from "../../utils/utils.js";
|
|
5
|
-
import { DropdownThemeClass, LogoInfo, NavMenu, TopHeaderThemeClass, UserAvatarMenu } from "../common/index.js";
|
|
6
|
-
function DropdownNav({ navList = [], className, activeClassName }) {
|
|
7
|
-
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
8
|
-
const MenuDropdownIcon = isMenuOpen ? X : Menu;
|
|
9
|
-
return /*#__PURE__*/ jsxs("header", {
|
|
10
|
-
className: clsxWithTw('w-full flex sticky top-0 z-50 h-14 px-3 gap-1.5 items-center', TopHeaderThemeClass, isMenuOpen ? 'border-transparent' : '', className),
|
|
11
|
-
children: [
|
|
12
|
-
navList.length > 0 ? /*#__PURE__*/ jsx("div", {
|
|
13
|
-
className: "md:hidden flex mr-3",
|
|
14
|
-
children: /*#__PURE__*/ jsx(MenuDropdownIcon, {
|
|
15
|
-
className: "h-6 w-6 cursor-pointer",
|
|
16
|
-
onClick: ()=>setIsMenuOpen(!isMenuOpen)
|
|
17
|
-
})
|
|
18
|
-
}) : null,
|
|
19
|
-
/*#__PURE__*/ jsx(LogoInfo, {
|
|
20
|
-
className: "flex-1"
|
|
21
|
-
}),
|
|
22
|
-
/*#__PURE__*/ jsx(UserAvatarMenu, {
|
|
23
|
-
className: className
|
|
24
|
-
}),
|
|
25
|
-
isMenuOpen && navList.length > 0 ? /*#__PURE__*/ jsx("div", {
|
|
26
|
-
className: clsxWithTw('overflow-y-auto max-h-[482px] px-2 pb-2 absolute top-14 left-0 right-0 shadow-lg', DropdownThemeClass, className),
|
|
27
|
-
children: /*#__PURE__*/ jsx(NavMenu, {
|
|
28
|
-
navList: navList,
|
|
29
|
-
className: className,
|
|
30
|
-
activeClassName: activeClassName,
|
|
31
|
-
onClick: (_key)=>{
|
|
32
|
-
setIsMenuOpen(false);
|
|
33
|
-
},
|
|
34
|
-
mode: "vertical"
|
|
35
|
-
})
|
|
36
|
-
}) : null
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export { DropdownNav as default };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import { clsxWithTw } from "../../utils/utils.js";
|
|
4
|
-
import { LogoInfo, NavMenu, TopHeaderThemeClass, UserAvatarLayout } from "../common/index.js";
|
|
5
|
-
function SidebarNav({ activeClassName, className, navList }) {
|
|
6
|
-
return /*#__PURE__*/ jsx("div", {
|
|
7
|
-
className: clsxWithTw('h-full overflow-y-auto scrollbar-none w-[260px] dark:border-gray-800', className),
|
|
8
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
9
|
-
className: clsxWithTw('fixed top-0 bottom-0 left-0 w-[260px] flex flex-col border-r', TopHeaderThemeClass, className),
|
|
10
|
-
children: [
|
|
11
|
-
/*#__PURE__*/ jsx("div", {
|
|
12
|
-
className: "w-full px-2 pt-2 h-12 mb-3",
|
|
13
|
-
children: /*#__PURE__*/ jsx(LogoInfo, {
|
|
14
|
-
className: "px-2 pt-[9px] pb-[15px]"
|
|
15
|
-
})
|
|
16
|
-
}),
|
|
17
|
-
/*#__PURE__*/ jsx("div", {
|
|
18
|
-
className: "flex-1 overflow-auto min-h-0",
|
|
19
|
-
children: /*#__PURE__*/ jsx(NavMenu, {
|
|
20
|
-
navList: navList,
|
|
21
|
-
className: clsxWithTw('border-0', className),
|
|
22
|
-
activeClassName: activeClassName,
|
|
23
|
-
mode: "vertical"
|
|
24
|
-
})
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ jsx(UserAvatarLayout, {
|
|
27
|
-
className: "mt-2"
|
|
28
|
-
})
|
|
29
|
-
]
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
export { SidebarNav as default };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useMemo } from "react";
|
|
3
|
-
import { useIsMobile } from "../../hooks/useIsMobile.js";
|
|
4
|
-
import { useLocation } from "react-router-dom";
|
|
5
|
-
import DrawerNav from "./DrawerNav.js";
|
|
6
|
-
import Sidebar from "./Sidebar.js";
|
|
7
|
-
import DropdownNav from "./DropdownNav.js";
|
|
8
|
-
import { ConfigProvider } from "antd";
|
|
9
|
-
import { generateDarkTheme, generateLightTheme } from "../theme/util.js";
|
|
10
|
-
import { useTheme } from "../../hooks/useTheme.js";
|
|
11
|
-
function SideNavigationBar({ navList = [], className, activeClassName, mobileVariant = 'normal' }) {
|
|
12
|
-
const isMobile = useIsMobile();
|
|
13
|
-
const location = useLocation();
|
|
14
|
-
useEffect(()=>{
|
|
15
|
-
window.scrollTo(0, 0);
|
|
16
|
-
}, [
|
|
17
|
-
location.pathname
|
|
18
|
-
]);
|
|
19
|
-
if (isMobile) {
|
|
20
|
-
if ('dropdown' === mobileVariant) return /*#__PURE__*/ jsx(DropdownNav, {
|
|
21
|
-
navList: navList,
|
|
22
|
-
className: className,
|
|
23
|
-
activeClassName: activeClassName
|
|
24
|
-
});
|
|
25
|
-
return /*#__PURE__*/ jsx(DrawerNav, {
|
|
26
|
-
navList: navList,
|
|
27
|
-
className: className,
|
|
28
|
-
activeClassName: activeClassName
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return /*#__PURE__*/ jsx(Sidebar, {
|
|
32
|
-
navList: navList,
|
|
33
|
-
className: className,
|
|
34
|
-
activeClassName: activeClassName
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
function SideNavigation(props) {
|
|
38
|
-
const { theme } = useTheme();
|
|
39
|
-
const { darkColorPrimary, lightColorPrimary } = props;
|
|
40
|
-
const themeToken = useMemo(()=>{
|
|
41
|
-
if ('dark' === theme && darkColorPrimary) return generateDarkTheme({
|
|
42
|
-
colorPrimary: darkColorPrimary
|
|
43
|
-
});
|
|
44
|
-
if ('light' === theme && lightColorPrimary) return generateLightTheme({
|
|
45
|
-
colorPrimary: lightColorPrimary
|
|
46
|
-
});
|
|
47
|
-
return {};
|
|
48
|
-
}, [
|
|
49
|
-
theme,
|
|
50
|
-
darkColorPrimary,
|
|
51
|
-
lightColorPrimary
|
|
52
|
-
]);
|
|
53
|
-
return /*#__PURE__*/ jsx(ConfigProvider, {
|
|
54
|
-
theme: themeToken,
|
|
55
|
-
children: /*#__PURE__*/ jsx(SideNavigationBar, {
|
|
56
|
-
...props
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
const SidebarNav = SideNavigation;
|
|
61
|
-
export { SideNavigation, SideNavigation as SidebarNav, SidebarNav as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
.user-select-container .ant-select-selection-item {
|
|
2
|
-
height: unset !important;
|
|
3
|
-
border-radius: 50px !important;
|
|
4
|
-
padding: 1px 8px 1px 1px !important;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.user-select-container .ant-select-focused .ant-select-selector {
|
|
8
|
-
box-shadow: none !important;
|
|
9
|
-
border-color: #1456f0 !important;
|
|
10
|
-
}
|
|
11
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import { Link } from "react-router-dom";
|
|
4
|
-
import { useAppInfo } from "../../hooks/useAppInfo.js";
|
|
5
|
-
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
-
function LogoInfo({ className, logoClassName }) {
|
|
7
|
-
const { name, avatar } = useAppInfo();
|
|
8
|
-
return /*#__PURE__*/ jsx("div", {
|
|
9
|
-
className: clsxWithTw('overflow-hidden text-ellipsis whitespace-nowrap', className),
|
|
10
|
-
children: /*#__PURE__*/ jsxs(Link, {
|
|
11
|
-
to: "/",
|
|
12
|
-
className: "text-inherit flex items-center gap-2 w-full",
|
|
13
|
-
children: [
|
|
14
|
-
avatar ? /*#__PURE__*/ jsx("img", {
|
|
15
|
-
src: avatar,
|
|
16
|
-
alt: name,
|
|
17
|
-
className: clsxWithTw('h-7 w-7', logoClassName)
|
|
18
|
-
}) : null,
|
|
19
|
-
/*#__PURE__*/ jsxs("span", {
|
|
20
|
-
className: "w-full truncate",
|
|
21
|
-
children: [
|
|
22
|
-
name || '新应用',
|
|
23
|
-
" "
|
|
24
|
-
]
|
|
25
|
-
})
|
|
26
|
-
]
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
export { LogoInfo as default };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface NavItemProps {
|
|
3
|
-
name: string;
|
|
4
|
-
to: string;
|
|
5
|
-
icon?: React.ComponentType<{
|
|
6
|
-
className?: string;
|
|
7
|
-
}>;
|
|
8
|
-
children?: NavItemProps[];
|
|
9
|
-
className?: string;
|
|
10
|
-
hasBadge?: boolean;
|
|
11
|
-
direction?: 'horizontal' | 'vertical';
|
|
12
|
-
onClick?: () => void;
|
|
13
|
-
hideActive?: boolean;
|
|
14
|
-
forceActive?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare const NavItem: React.ForwardRefExoticComponent<NavItemProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
17
|
-
export declare const MoreNavItem: React.FC<{
|
|
18
|
-
expandedNavItemsPath: string[];
|
|
19
|
-
isExpanded: boolean;
|
|
20
|
-
} & Omit<NavItemProps, 'icon' | 'to'>>;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import react, { forwardRef, useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
-
import { NavLink, matchPath, useLocation } from "react-router-dom";
|
|
4
|
-
import { Button } from "antd";
|
|
5
|
-
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
-
import { MoreHorizontal } from "lucide-react";
|
|
7
|
-
const HashLink = /*#__PURE__*/ forwardRef(({ className, to, name, icon, onClick, direction, hideActive = false }, _ref)=>{
|
|
8
|
-
const [isActive, setIsActive] = useState(false);
|
|
9
|
-
useEffect(()=>{
|
|
10
|
-
const checkHash = ()=>{
|
|
11
|
-
setIsActive(window.location.hash === to);
|
|
12
|
-
};
|
|
13
|
-
checkHash();
|
|
14
|
-
window.addEventListener('hashchange', checkHash);
|
|
15
|
-
return ()=>window.removeEventListener('hashchange', checkHash);
|
|
16
|
-
}, [
|
|
17
|
-
to
|
|
18
|
-
]);
|
|
19
|
-
const iconNode = icon ? /*#__PURE__*/ react.createElement(icon, {
|
|
20
|
-
className: 'w-6 h-6'
|
|
21
|
-
}) : null;
|
|
22
|
-
return /*#__PURE__*/ jsxs(Button, {
|
|
23
|
-
variant: "link",
|
|
24
|
-
href: to,
|
|
25
|
-
onClick: ()=>{
|
|
26
|
-
setIsActive(true);
|
|
27
|
-
onClick?.();
|
|
28
|
-
},
|
|
29
|
-
color: isActive && !hideActive ? 'primary' : 'default',
|
|
30
|
-
className: clsxWithTw('miao-nav p-0 b-0 h-full w-full', 'transition-colors inline-flex gap-1 items-center overflow-hidden', {
|
|
31
|
-
'flex-col': 'vertical' === direction,
|
|
32
|
-
'w-full': 'vertical' === direction,
|
|
33
|
-
'justify-center': 'horizontal' === direction,
|
|
34
|
-
'text-inherit': !isActive
|
|
35
|
-
}, className),
|
|
36
|
-
children: [
|
|
37
|
-
iconNode,
|
|
38
|
-
name ? /*#__PURE__*/ jsx("span", {
|
|
39
|
-
className: clsxWithTw('truncate w-full', {
|
|
40
|
-
'text-center': 'vertical' === direction
|
|
41
|
-
}),
|
|
42
|
-
children: name
|
|
43
|
-
}) : null
|
|
44
|
-
]
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
HashLink.displayName = 'HashLink';
|
|
48
|
-
const NavItem = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
49
|
-
const isHashLink = props.to.startsWith('#');
|
|
50
|
-
if (isHashLink) return /*#__PURE__*/ jsx(HashLink, {
|
|
51
|
-
ref: ref,
|
|
52
|
-
...props
|
|
53
|
-
});
|
|
54
|
-
return /*#__PURE__*/ jsx(NavLink, {
|
|
55
|
-
ref: ref,
|
|
56
|
-
to: props.to,
|
|
57
|
-
end: true,
|
|
58
|
-
onClick: props.onClick,
|
|
59
|
-
className: ()=>clsxWithTw('inline-flex justify-center'),
|
|
60
|
-
children: ({ isActive: linkIsActive })=>/*#__PURE__*/ jsxs(Button, {
|
|
61
|
-
variant: "link",
|
|
62
|
-
color: linkIsActive && !props.hideActive || props.forceActive ? 'primary' : 'default',
|
|
63
|
-
className: clsxWithTw('miao-nav p-0 b-0 h-full w-full', 'transition-colors inline-flex gap-1 items-center overflow-hidden', {
|
|
64
|
-
'flex-col': 'vertical' === props.direction,
|
|
65
|
-
'justify-center': 'horizontal' === props.direction,
|
|
66
|
-
'text-inherit': !(linkIsActive && !props.hideActive || props.forceActive)
|
|
67
|
-
}, props.className),
|
|
68
|
-
children: [
|
|
69
|
-
props.icon ? /*#__PURE__*/ jsx(props.icon, {
|
|
70
|
-
className: "w-6 h-6"
|
|
71
|
-
}) : null,
|
|
72
|
-
props.name ? /*#__PURE__*/ jsx("span", {
|
|
73
|
-
className: clsxWithTw('truncate w-full', {
|
|
74
|
-
' text-center': 'vertical' === props.direction
|
|
75
|
-
}),
|
|
76
|
-
children: props.name
|
|
77
|
-
}) : null
|
|
78
|
-
]
|
|
79
|
-
})
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
NavItem.displayName = 'NavItem';
|
|
83
|
-
const MoreNavItem = ({ expandedNavItemsPath, onClick, isExpanded, name = '更多', ...restProps })=>{
|
|
84
|
-
const { pathname } = useLocation();
|
|
85
|
-
const isActive = useMemo(()=>{
|
|
86
|
-
const matched = expandedNavItemsPath.some((path)=>{
|
|
87
|
-
const match = matchPath(path, pathname);
|
|
88
|
-
return match && match.pathname === pathname;
|
|
89
|
-
});
|
|
90
|
-
return matched;
|
|
91
|
-
}, [
|
|
92
|
-
expandedNavItemsPath,
|
|
93
|
-
pathname
|
|
94
|
-
]);
|
|
95
|
-
const handleClick = useCallback((e)=>{
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
onClick?.();
|
|
98
|
-
}, [
|
|
99
|
-
onClick
|
|
100
|
-
]);
|
|
101
|
-
return /*#__PURE__*/ jsx(NavItem, {
|
|
102
|
-
icon: MoreHorizontal,
|
|
103
|
-
name: name,
|
|
104
|
-
to: "",
|
|
105
|
-
hideActive: !isActive,
|
|
106
|
-
forceActive: isExpanded || isActive,
|
|
107
|
-
onClick: handleClick,
|
|
108
|
-
...restProps
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
MoreNavItem.displayName = 'MoreNavItem';
|
|
112
|
-
export { MoreNavItem, NavItem };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BaseNavProps } from '../../types';
|
|
3
|
-
type NavMenuProps = BaseNavProps & {
|
|
4
|
-
mode?: 'horizontal' | 'vertical';
|
|
5
|
-
iconClassName?: string;
|
|
6
|
-
onClick?: (key: string) => void;
|
|
7
|
-
};
|
|
8
|
-
export default function NavMenu({ navList, className, iconClassName, mode, onClick, }: NavMenuProps): React.JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Menu } from "antd";
|
|
3
|
-
import react, { useEffect, useMemo, useState } from "react";
|
|
4
|
-
import { NavLink, useLocation } from "react-router-dom";
|
|
5
|
-
import { clsxWithTw } from "../../utils/utils.js";
|
|
6
|
-
function NavMenu({ navList, className, iconClassName = '', mode = 'horizontal', onClick }) {
|
|
7
|
-
const location = useLocation();
|
|
8
|
-
const [currentMenu, setCurrentMenu] = useState(location.pathname);
|
|
9
|
-
useEffect(()=>{
|
|
10
|
-
setCurrentMenu(location.pathname);
|
|
11
|
-
}, [
|
|
12
|
-
location
|
|
13
|
-
]);
|
|
14
|
-
const menuItems = useMemo(()=>navList?.map((n)=>({
|
|
15
|
-
label: /*#__PURE__*/ jsxs(NavLink, {
|
|
16
|
-
to: n.to,
|
|
17
|
-
end: true,
|
|
18
|
-
className: ({ isActive })=>clsxWithTw('flex items-center', {
|
|
19
|
-
'text-[var(--ant-menu-horizontal-item-selected-color)]': isActive
|
|
20
|
-
}),
|
|
21
|
-
children: [
|
|
22
|
-
n.icon ? /*#__PURE__*/ react.createElement(n.icon, {
|
|
23
|
-
className: clsxWithTw('w-4 h-4', iconClassName)
|
|
24
|
-
}) : null,
|
|
25
|
-
/*#__PURE__*/ jsx("span", {
|
|
26
|
-
children: n.name
|
|
27
|
-
})
|
|
28
|
-
]
|
|
29
|
-
}),
|
|
30
|
-
key: n.to
|
|
31
|
-
})), [
|
|
32
|
-
navList
|
|
33
|
-
]);
|
|
34
|
-
return /*#__PURE__*/ jsx(Menu, {
|
|
35
|
-
className: clsxWithTw('bg-inherit h-full', className),
|
|
36
|
-
items: menuItems,
|
|
37
|
-
selectedKeys: [
|
|
38
|
-
currentMenu
|
|
39
|
-
],
|
|
40
|
-
onClick: (info)=>{
|
|
41
|
-
setCurrentMenu(info.key);
|
|
42
|
-
onClick?.(info.key);
|
|
43
|
-
},
|
|
44
|
-
mode: mode,
|
|
45
|
-
style: {
|
|
46
|
-
borderBottomWidth: 0
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export { NavMenu as default };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import { Button } from "antd";
|
|
4
|
-
import { LogOut } from "lucide-react";
|
|
5
|
-
import { useCurrentUserProfile, useLogout } from "../../hooks/index.js";
|
|
6
|
-
import { clsxWithTw } from "../../utils/utils.js";
|
|
7
|
-
function UserAvatarLayout({ className }) {
|
|
8
|
-
const { name, avatar } = useCurrentUserProfile();
|
|
9
|
-
const { handlerLogout } = useLogout();
|
|
10
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
11
|
-
children: name ? /*#__PURE__*/ jsx("div", {
|
|
12
|
-
className: clsxWithTw('py-4 px-5 border-gray-200 border-t', className),
|
|
13
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
14
|
-
className: "flex items-center justify-between",
|
|
15
|
-
children: [
|
|
16
|
-
/*#__PURE__*/ jsxs("div", {
|
|
17
|
-
className: "flex items-center gap-2 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
18
|
-
children: [
|
|
19
|
-
avatar ? /*#__PURE__*/ jsx("img", {
|
|
20
|
-
src: avatar,
|
|
21
|
-
alt: name,
|
|
22
|
-
className: "h-8 w-8 rounded-full"
|
|
23
|
-
}) : null,
|
|
24
|
-
/*#__PURE__*/ jsx("span", {
|
|
25
|
-
className: "text-sm font-medium truncate",
|
|
26
|
-
children: name
|
|
27
|
-
})
|
|
28
|
-
]
|
|
29
|
-
}),
|
|
30
|
-
/*#__PURE__*/ jsx(Button, {
|
|
31
|
-
type: "text",
|
|
32
|
-
className: "text-inherit",
|
|
33
|
-
icon: /*#__PURE__*/ jsx(LogOut, {}),
|
|
34
|
-
onClick: handlerLogout
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
})
|
|
38
|
-
}) : null
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export { UserAvatarLayout as default };
|