@lark-apaas/client-toolkit 0.1.0-alpha.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.
Files changed (188) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +8 -0
  3. package/lib/apis/components/AppContainer.d.ts +1 -0
  4. package/lib/apis/components/AppContainer.js +2 -0
  5. package/lib/apis/components/ErrorRender.d.ts +1 -0
  6. package/lib/apis/components/ErrorRender.js +2 -0
  7. package/lib/apis/components/NotFoundRender.d.ts +1 -0
  8. package/lib/apis/components/NotFoundRender.js +2 -0
  9. package/lib/apis/components/SidebarNav.d.ts +1 -0
  10. package/lib/apis/components/SidebarNav.js +2 -0
  11. package/lib/apis/components/User.d.ts +1 -0
  12. package/lib/apis/components/User.js +1 -0
  13. package/lib/apis/components/Welcome.d.ts +1 -0
  14. package/lib/apis/components/Welcome.js +2 -0
  15. package/lib/apis/constants/img-resources/avatar.d.ts +11 -0
  16. package/lib/apis/constants/img-resources/avatar.js +12 -0
  17. package/lib/apis/constants/img-resources/banner.d.ts +24 -0
  18. package/lib/apis/constants/img-resources/banner.js +25 -0
  19. package/lib/apis/constants/img-resources/cover.d.ts +36 -0
  20. package/lib/apis/constants/img-resources/cover.js +37 -0
  21. package/lib/apis/dataloom.d.ts +1 -0
  22. package/lib/apis/dataloom.js +2 -0
  23. package/lib/apis/hooks/useAppInfo.d.ts +1 -0
  24. package/lib/apis/hooks/useAppInfo.js +1 -0
  25. package/lib/apis/hooks/useCurrentUserProfile.d.ts +1 -0
  26. package/lib/apis/hooks/useCurrentUserProfile.js +1 -0
  27. package/lib/apis/logger.d.ts +1 -0
  28. package/lib/apis/logger.js +1 -0
  29. package/lib/apis/tools/generateImage.d.ts +1 -0
  30. package/lib/apis/tools/generateImage.js +1 -0
  31. package/lib/apis/tools/generateTextStream.d.ts +1 -0
  32. package/lib/apis/tools/generateTextStream.js +1 -0
  33. package/lib/apis/tools/getAppInfo.d.ts +1 -0
  34. package/lib/apis/tools/getAppInfo.js +1 -0
  35. package/lib/apis/tools/getCurrentUserProfile.d.ts +1 -0
  36. package/lib/apis/tools/getCurrentUserProfile.js +1 -0
  37. package/lib/apis/tools/storage.d.ts +1 -0
  38. package/lib/apis/tools/storage.js +4 -0
  39. package/lib/apis/udt-types.d.ts +16 -0
  40. package/lib/apis/udt-types.js +0 -0
  41. package/lib/apis/utils/registerChinaMap.d.ts +1 -0
  42. package/lib/apis/utils/registerChinaMap.js +103319 -0
  43. package/lib/components/AppContainer/IframeBridge.d.ts +4 -0
  44. package/lib/components/AppContainer/IframeBridge.js +92 -0
  45. package/lib/components/AppContainer/LogInterceptor.d.ts +1 -0
  46. package/lib/components/AppContainer/LogInterceptor.js +44 -0
  47. package/lib/components/AppContainer/PageHoc.d.ts +4 -0
  48. package/lib/components/AppContainer/PageHoc.js +30 -0
  49. package/lib/components/AppContainer/dayjsPlugins.d.ts +1 -0
  50. package/lib/components/AppContainer/dayjsPlugins.js +69 -0
  51. package/lib/components/AppContainer/index.d.ts +7 -0
  52. package/lib/components/AppContainer/index.js +65 -0
  53. package/lib/components/AppContainer/sonner.css +101 -0
  54. package/lib/components/AppContainer/sonner.d.ts +8 -0
  55. package/lib/components/AppContainer/sonner.js +26 -0
  56. package/lib/components/AppContainer/utils/childApi.d.ts +5 -0
  57. package/lib/components/AppContainer/utils/childApi.js +20 -0
  58. package/lib/components/AppContainer/utils/listenHot.d.ts +1 -0
  59. package/lib/components/AppContainer/utils/listenHot.js +43 -0
  60. package/lib/components/ErrorRender/index.d.ts +5 -0
  61. package/lib/components/ErrorRender/index.js +79 -0
  62. package/lib/components/NotFoundRender/index.d.ts +3 -0
  63. package/lib/components/NotFoundRender/index.js +59 -0
  64. package/lib/components/SidebarNav/DrawerNav.d.ts +3 -0
  65. package/lib/components/SidebarNav/DrawerNav.js +64 -0
  66. package/lib/components/SidebarNav/DropdownNav.d.ts +3 -0
  67. package/lib/components/SidebarNav/DropdownNav.js +40 -0
  68. package/lib/components/SidebarNav/Sidebar.d.ts +3 -0
  69. package/lib/components/SidebarNav/Sidebar.js +33 -0
  70. package/lib/components/SidebarNav/index.d.ts +5 -0
  71. package/lib/components/SidebarNav/index.js +61 -0
  72. package/lib/components/User/UserDisplay.d.ts +9 -0
  73. package/lib/components/User/UserDisplay.js +39 -0
  74. package/lib/components/User/UserProfile/UserProfile.css +34 -0
  75. package/lib/components/User/UserProfile/UserProfile.d.ts +6 -0
  76. package/lib/components/User/UserProfile/UserProfile.js +41 -0
  77. package/lib/components/User/UserProfile/UserProfileContainer.d.ts +4 -0
  78. package/lib/components/User/UserProfile/UserProfileContainer.js +8 -0
  79. package/lib/components/User/UserProfile/UserProfileSkeleton.d.ts +3 -0
  80. package/lib/components/User/UserProfile/UserProfileSkeleton.js +36 -0
  81. package/lib/components/User/UserProfile/UserProfileUI.d.ts +8 -0
  82. package/lib/components/User/UserProfile/UserProfileUI.js +113 -0
  83. package/lib/components/User/UserProfile/index.d.ts +1 -0
  84. package/lib/components/User/UserProfile/index.js +2 -0
  85. package/lib/components/User/UserProfile/type.d.ts +8 -0
  86. package/lib/components/User/UserProfile/type.js +0 -0
  87. package/lib/components/User/UserProfile/utils.d.ts +5 -0
  88. package/lib/components/User/UserProfile/utils.js +26 -0
  89. package/lib/components/User/UserSelect.css +11 -0
  90. package/lib/components/User/UserSelect.d.ts +11 -0
  91. package/lib/components/User/UserSelect.js +172 -0
  92. package/lib/components/User/UserWithAvatar.d.ts +3 -0
  93. package/lib/components/User/UserWithAvatar.js +41 -0
  94. package/lib/components/User/index.d.ts +7 -0
  95. package/lib/components/User/index.js +5 -0
  96. package/lib/components/User/type.d.ts +13 -0
  97. package/lib/components/User/type.js +0 -0
  98. package/lib/components/Welcome/index.d.ts +3 -0
  99. package/lib/components/Welcome/index.js +17 -0
  100. package/lib/components/common/LogoInfo.d.ts +5 -0
  101. package/lib/components/common/LogoInfo.js +30 -0
  102. package/lib/components/common/NavItem.d.ts +20 -0
  103. package/lib/components/common/NavItem.js +112 -0
  104. package/lib/components/common/NavMenu.d.ts +9 -0
  105. package/lib/components/common/NavMenu.js +50 -0
  106. package/lib/components/common/UserAvatarLayout.d.ts +4 -0
  107. package/lib/components/common/UserAvatarLayout.js +41 -0
  108. package/lib/components/common/UserAvatarMenu.d.ts +4 -0
  109. package/lib/components/common/UserAvatarMenu.js +58 -0
  110. package/lib/components/common/index.d.ts +9 -0
  111. package/lib/components/common/index.js +10 -0
  112. package/lib/components/index.d.ts +8 -0
  113. package/lib/components/index.js +6 -0
  114. package/lib/components/theme/ThemeProvider.d.ts +20 -0
  115. package/lib/components/theme/ThemeProvider.js +75 -0
  116. package/lib/components/theme/constants.d.ts +48 -0
  117. package/lib/components/theme/constants.js +557 -0
  118. package/lib/components/theme/index.d.ts +4 -0
  119. package/lib/components/theme/index.js +5 -0
  120. package/lib/components/theme/miaoDarkTheme.d.ts +2 -0
  121. package/lib/components/theme/miaoDarkTheme.js +310 -0
  122. package/lib/components/theme/miaoLightTheme.d.ts +2 -0
  123. package/lib/components/theme/miaoLightTheme.js +296 -0
  124. package/lib/components/theme/ui-config.d.ts +1 -0
  125. package/lib/components/theme/ui-config.js +2 -0
  126. package/lib/components/theme/util.d.ts +20 -0
  127. package/lib/components/theme/util.js +188 -0
  128. package/lib/font-family.css +40 -0
  129. package/lib/hooks/index.d.ts +5 -0
  130. package/lib/hooks/index.js +5 -0
  131. package/lib/hooks/useAppInfo.d.ts +6 -0
  132. package/lib/hooks/useAppInfo.js +21 -0
  133. package/lib/hooks/useCurrentUserProfile.d.ts +12 -0
  134. package/lib/hooks/useCurrentUserProfile.js +58 -0
  135. package/lib/hooks/useIsMobile.d.ts +1 -0
  136. package/lib/hooks/useIsMobile.js +20 -0
  137. package/lib/hooks/useLogout.d.ts +4 -0
  138. package/lib/hooks/useLogout.js +37 -0
  139. package/lib/hooks/useTheme.d.ts +4 -0
  140. package/lib/hooks/useTheme.js +8 -0
  141. package/lib/hooks/useUpdatingRef.d.ts +1 -0
  142. package/lib/hooks/useUpdatingRef.js +7 -0
  143. package/lib/index.css +5 -0
  144. package/lib/index.d.ts +4 -0
  145. package/lib/index.js +5 -0
  146. package/lib/inspector.dev.css +10 -0
  147. package/lib/integrations/dataloom.d.ts +2 -0
  148. package/lib/integrations/dataloom.js +32 -0
  149. package/lib/integrations/generateImage.d.ts +1 -0
  150. package/lib/integrations/generateImage.js +47 -0
  151. package/lib/integrations/generateTextStream.d.ts +21 -0
  152. package/lib/integrations/generateTextStream.js +98 -0
  153. package/lib/integrations/getAppInfo.d.ts +2 -0
  154. package/lib/integrations/getAppInfo.js +14 -0
  155. package/lib/integrations/getCurrentUserProfile.d.ts +6 -0
  156. package/lib/integrations/getCurrentUserProfile.js +5 -0
  157. package/lib/logger/index.d.ts +6 -0
  158. package/lib/logger/index.js +54 -0
  159. package/lib/override.css +29 -0
  160. package/lib/tailwind-theme.css +335 -0
  161. package/lib/theme-layer.css +3 -0
  162. package/lib/types/common.d.ts +4 -0
  163. package/lib/types/common.js +0 -0
  164. package/lib/types/iframe-events.d.ts +50 -0
  165. package/lib/types/iframe-events.js +0 -0
  166. package/lib/types/index.d.ts +43 -0
  167. package/lib/types/index.js +0 -0
  168. package/lib/utils/copyToClipboard.d.ts +6 -0
  169. package/lib/utils/copyToClipboard.js +32 -0
  170. package/lib/utils/getAppId.d.ts +6 -0
  171. package/lib/utils/getAppId.js +11 -0
  172. package/lib/utils/getCsrfToken.d.ts +5 -0
  173. package/lib/utils/getCsrfToken.js +10 -0
  174. package/lib/utils/getEnvPath.d.ts +4 -0
  175. package/lib/utils/getEnvPath.js +4 -0
  176. package/lib/utils/getInitialInfo.d.ts +20 -0
  177. package/lib/utils/getInitialInfo.js +32 -0
  178. package/lib/utils/getParentOrigin.d.ts +5 -0
  179. package/lib/utils/getParentOrigin.js +7 -0
  180. package/lib/utils/getUserProfile.d.ts +47 -0
  181. package/lib/utils/getUserProfile.js +39 -0
  182. package/lib/utils/postMessage.d.ts +8 -0
  183. package/lib/utils/postMessage.js +11 -0
  184. package/lib/utils/url.d.ts +8 -0
  185. package/lib/utils/url.js +22 -0
  186. package/lib/utils/utils.d.ts +20 -0
  187. package/lib/utils/utils.js +22 -0
  188. package/package.json +135 -0
@@ -0,0 +1,59 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useLocation, useNavigate } from "react-router-dom";
3
+ import { useEffect } from "react";
4
+ import { postMessage } from "../../utils/postMessage.js";
5
+ import { useUpdatingRef } from "../../hooks/useUpdatingRef.js";
6
+ import { logger } from "../../logger/index.js";
7
+ const NotFound = ()=>{
8
+ const location = useLocation();
9
+ const navigate = useNavigate();
10
+ const navigateRef = useUpdatingRef(navigate);
11
+ useEffect(()=>{
12
+ logger.error('404 Error: User attempted to access non-existent route:', location.pathname);
13
+ }, [
14
+ location.pathname
15
+ ]);
16
+ const onClick = ()=>{
17
+ if ('production' !== process.env.NODE_ENV) postMessage({
18
+ type: 'CreatePage',
19
+ data: location.pathname
20
+ });
21
+ else navigateRef.current('/');
22
+ };
23
+ return /*#__PURE__*/ jsxs("div", {
24
+ className: "min-h-screen flex flex-col items-center justify-center bg-white",
25
+ children: [
26
+ /*#__PURE__*/ jsx("img", {
27
+ src: 'production' !== process.env.NODE_ENV ? 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_positive_create.svg' : 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_failure-miss.svg',
28
+ alt: "Empty",
29
+ className: "mb-3 w-[120px]"
30
+ }),
31
+ /*#__PURE__*/ jsx("p", {
32
+ className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium",
33
+ children: 'production' !== process.env.NODE_ENV ? '哎呀,这个页面尚未生成' : '404'
34
+ }),
35
+ 'production' !== process.env.NODE_ENV ? /*#__PURE__*/ jsxs(Fragment, {
36
+ children: [
37
+ /*#__PURE__*/ jsx("p", {
38
+ className: "text-sm/[22px] text-[14px] text-[#646A73] font-normal mt-1",
39
+ children: "戳下方按钮,我可以根据上下文帮你生成一个"
40
+ }),
41
+ /*#__PURE__*/ jsxs("button", {
42
+ className: "h-[32px] text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md shadow-xs hover:bg-blue-600 active:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-blue-500 px-3 flex flex-row items-center mt-3",
43
+ onClick: onClick,
44
+ children: [
45
+ /*#__PURE__*/ jsx("img", {
46
+ src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/icon_chat-ai_outlined.svg",
47
+ alt: "Icon",
48
+ className: "w-[14px] h-[14px] mr-1"
49
+ }),
50
+ "告诉妙搭生成一个"
51
+ ]
52
+ })
53
+ ]
54
+ }) : null
55
+ ]
56
+ });
57
+ };
58
+ const NotFoundRender = NotFound;
59
+ export { NotFoundRender as default };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { BaseNavProps } from '../../types';
3
+ export default function DrawerNav({ navList, className, activeClassName, }: BaseNavProps): React.JSX.Element;
@@ -0,0 +1,64 @@
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 };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { BaseNavProps } from '../../types';
3
+ export default function DropdownNav({ navList, className, activeClassName, }: BaseNavProps): React.JSX.Element;
@@ -0,0 +1,40 @@
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 };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { NavProps } from '../../types';
3
+ export default function SidebarNav({ activeClassName, className, navList, }: NavProps): React.JSX.Element;
@@ -0,0 +1,33 @@
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 };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { NavProps } from '../../types';
3
+ export declare function SideNavigation(props: NavProps): React.JSX.Element;
4
+ export { SideNavigation as SidebarNav };
5
+ export default SideNavigation;
@@ -0,0 +1,61 @@
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 };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { IUserProfile } from '../../apis/udt-types';
3
+ export interface UserDisplayProps {
4
+ users: IUserProfile[];
5
+ size?: 'small' | 'medium' | 'large';
6
+ className?: string;
7
+ style?: React.CSSProperties;
8
+ }
9
+ export declare const UserDisplay: React.FC<UserDisplayProps>;
@@ -0,0 +1,39 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import react from "react";
3
+ import { Popover } from "antd";
4
+ import { UserWithAvatar } from "./UserWithAvatar.js";
5
+ import { clsxWithTw } from "../../utils/utils.js";
6
+ import { UserProfile } from "./UserProfile/index.js";
7
+ const UserDisplay = ({ users, size, className, style })=>{
8
+ const displayUsers = react.useMemo(()=>Array.isArray(users) ? users : [
9
+ users
10
+ ].filter(Boolean), [
11
+ users
12
+ ]);
13
+ if (!displayUsers.length) return null;
14
+ return /*#__PURE__*/ jsx("div", {
15
+ className: clsxWithTw('flex gap-1 flex-wrap', className),
16
+ style: style,
17
+ children: displayUsers.map((user)=>/*#__PURE__*/ jsx(Popover, {
18
+ placement: "bottomLeft",
19
+ trigger: "click",
20
+ content: /*#__PURE__*/ jsx(UserProfile, {
21
+ user_id: user.user_id
22
+ }),
23
+ arrow: false,
24
+ styles: {
25
+ body: {
26
+ padding: 0
27
+ }
28
+ },
29
+ children: /*#__PURE__*/ jsx("div", {
30
+ children: /*#__PURE__*/ jsx(UserWithAvatar, {
31
+ data: user,
32
+ size: size,
33
+ className: "cursor-pointer hover:bg-[rgba(31,35,41,0.15)] active:bg-[rgba(31,35,41,0.2)]"
34
+ })
35
+ })
36
+ }, user.user_id))
37
+ });
38
+ };
39
+ export { UserDisplay };
@@ -0,0 +1,34 @@
1
+ .user-profile-skeleton-lines .ant-skeleton-paragraph > li {
2
+ border-radius: 100px;
3
+ height: 16px;
4
+ }
5
+
6
+ .user-profile-button .ant-btn-icon {
7
+ height: 18px;
8
+ }
9
+
10
+ .no-scrollbar {
11
+ scrollbar-width: none;
12
+ }
13
+
14
+ .no-scrollbar::-webkit-scrollbar {
15
+ display: none;
16
+ }
17
+
18
+ .user-profile-avatar {
19
+ box-shadow: 0 6px 18px 6px #1f232908, 0 3px 6px -6px #1f23290d, 0 4px 8px #1f232908;
20
+ }
21
+
22
+ .user-profile-name-container {
23
+ margin-top: 10px;
24
+ padding-bottom: 4px;
25
+ }
26
+
27
+ .user-profile-name {
28
+ color: #1f2937;
29
+ margin-bottom: 0;
30
+ font-size: 22px;
31
+ font-weight: 600;
32
+ line-height: 28px;
33
+ }
34
+
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface UserProfileProps {
3
+ user_id: string;
4
+ }
5
+ export declare function UserProfile(props: UserProfileProps): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,41 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { UserProfileUI } from "./UserProfileUI.js";
4
+ import { UserProfileSkeleton } from "./UserProfileSkeleton.js";
5
+ import { getUserProfile } from "../../../utils/getUserProfile.js";
6
+ import { INVALID_USER, formatI18nProfile } from "./utils.js";
7
+ import { UserProfileContainer } from "./UserProfileContainer.js";
8
+ import { logger } from "../../../logger/index.js";
9
+ function UserProfile(props) {
10
+ const { user_id } = props;
11
+ const [user, setUser] = useState(null);
12
+ const [loading, setLoading] = useState(true);
13
+ useEffect(()=>{
14
+ const fetchUser = async ()=>{
15
+ setLoading(true);
16
+ try {
17
+ const { data } = await getUserProfile({
18
+ userID: user_id
19
+ });
20
+ if (data.userProfile) {
21
+ const profile = data.userProfile;
22
+ setUser(formatI18nProfile(profile));
23
+ } else setUser(INVALID_USER);
24
+ } catch (error) {
25
+ setUser(INVALID_USER);
26
+ logger.error('Failed to fetch user profile:', error);
27
+ } finally{
28
+ setLoading(false);
29
+ }
30
+ };
31
+ fetchUser();
32
+ }, [
33
+ user_id
34
+ ]);
35
+ return /*#__PURE__*/ jsx(UserProfileContainer, {
36
+ children: loading || !user ? /*#__PURE__*/ jsx(UserProfileSkeleton, {}) : /*#__PURE__*/ jsx(UserProfileUI, {
37
+ user: user
38
+ })
39
+ });
40
+ }
41
+ export { UserProfile };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { PropsWithChildren } from 'react';
3
+ import './UserProfile.css';
4
+ export declare const UserProfileContainer: ({ children }: PropsWithChildren<any>) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import "./UserProfile.css";
4
+ const UserProfileContainer = ({ children })=>/*#__PURE__*/ jsx("div", {
5
+ className: "w-[320px] h-[468px] rounded-[8px] overflow-y-auto no-scrollbar",
6
+ children: children
7
+ });
8
+ export { UserProfileContainer };
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import './UserProfile.css';
3
+ export declare function UserProfileSkeleton(): React.JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Skeleton } from "antd";
4
+ import "./UserProfile.css";
5
+ function UserProfileSkeleton() {
6
+ return /*#__PURE__*/ jsxs("div", {
7
+ className: "p-5 bg-white",
8
+ children: [
9
+ /*#__PURE__*/ jsx(Skeleton, {
10
+ loading: true,
11
+ avatar: {
12
+ size: 90,
13
+ shape: 'circle'
14
+ },
15
+ active: true,
16
+ paragraph: false,
17
+ round: true,
18
+ title: false,
19
+ className: "mt-[68px]"
20
+ }),
21
+ /*#__PURE__*/ jsx(Skeleton, {
22
+ loading: true,
23
+ title: false,
24
+ paragraph: {
25
+ rows: 2,
26
+ width: [
27
+ '120px',
28
+ '180px'
29
+ ]
30
+ },
31
+ className: "mt-[22px] user-profile-skeleton-lines"
32
+ })
33
+ ]
34
+ });
35
+ }
36
+ export { UserProfileSkeleton };
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import './UserProfile.css';
3
+ import { User } from './type';
4
+ interface UserProfileUIProps {
5
+ user: User;
6
+ }
7
+ export declare function UserProfileUI({ user }: UserProfileUIProps): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,113 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Avatar, Button, Card, Tag, Typography } from "antd";
4
+ import "./UserProfile.css";
5
+ import { getChatAppLink } from "./utils.js";
6
+ import { clsxWithTw } from "../../../utils/utils.js";
7
+ function UserProfileUI({ user }) {
8
+ return /*#__PURE__*/ jsxs(Card, {
9
+ className: "border-0",
10
+ cover: /*#__PURE__*/ jsx("img", {
11
+ alt: "cover",
12
+ src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/default-cover.png",
13
+ className: "h-[136px] w-full object-cover"
14
+ }),
15
+ bodyStyle: {
16
+ padding: '16px'
17
+ },
18
+ children: [
19
+ /*#__PURE__*/ jsxs("div", {
20
+ className: "relative flex flex-col -mt-16 user-profile-button",
21
+ children: [
22
+ /*#__PURE__*/ jsx(Avatar, {
23
+ size: 96,
24
+ src: user.avatar,
25
+ className: "border-4 border-white -mx-1 user-profile-avatar"
26
+ }),
27
+ /*#__PURE__*/ jsxs("div", {
28
+ className: "flex gap-1 items-center user-profile-name-container",
29
+ children: [
30
+ /*#__PURE__*/ jsx(Typography.Title, {
31
+ level: 2,
32
+ ellipsis: {
33
+ rows: 1,
34
+ tooltip: user.name
35
+ },
36
+ className: "user-profile-name",
37
+ children: user.name
38
+ }),
39
+ 'inactive' === user.status && /*#__PURE__*/ jsx(Tag, {
40
+ color: "#f50",
41
+ style: {
42
+ marginRight: 0
43
+ },
44
+ children: "暂停使用"
45
+ })
46
+ ]
47
+ }),
48
+ user.feishu_open_id ? /*#__PURE__*/ jsx("div", {
49
+ className: "w-ful mt-2",
50
+ children: /*#__PURE__*/ jsx(Button, {
51
+ type: "primary",
52
+ icon: /*#__PURE__*/ jsx("svg", {
53
+ width: "24",
54
+ height: "24",
55
+ viewBox: "0 0 24 24",
56
+ fill: "none",
57
+ xmlns: "http://www.w3.org/2000/svg",
58
+ className: "w-[18px] h-[18px]",
59
+ children: /*#__PURE__*/ jsx("path", {
60
+ d: "M4.44576 19.2236L3.39131 20.7324C2.86623 21.4838 3.41996 22.5 4.35448 22.5H11.7556C11.7556 22.5 11.7593 22.4996 11.7661 22.4995C11.8225 22.4984 12.094 22.4991 12.2975 22.4996L12.5 22.5C12.9236 22.5 13.3414 22.4749 13.7519 22.4261L13.7544 22.4258C18.962 21.8059 23 17.3745 23 12C23 10.567 22.5218 8.58544 22.5 8.52497C21.8654 6.76558 20.7624 5.22024 19.3364 4.03023C17.4995 2.45304 15.111 1.5 12.5 1.5C12.4676 1.5 12.4352 1.50015 12.4028 1.50044C12.3695 1.50015 12.3362 1.5 12.3028 1.5C6.33659 1.5 1.5 6.20101 1.5 12C1.5 12.197 1.50558 12.3928 1.5166 12.5871C1.65458 15.1526 2.74286 17.4735 4.44576 19.2236ZM17 10C17 10.5 16.6133 11 16 11H9.01953C8.39798 11 8 10.5 8 10C8 9.39844 8.5 9 9 9H16C16.5 9 17 9.39844 17 10ZM12.9883 13C13.6055 13 14 13.5 14 14C14 14.5 13.6055 15 13 15H9C8.5 15 8 14.6018 8 14C8 13.3982 8.5 13 9 13H12.9883Z",
61
+ fill: "#2B2F36"
62
+ })
63
+ }),
64
+ className: "gap-1 rounded-[10px] h-[42px] w-full bg-[#F5F6F7] text-[#2B2F36] hover:bg-[rgba(31,35,41,0.08)] active:bg-[rgba(31,35,41,0.12)] border-none",
65
+ href: getChatAppLink(user.feishu_open_id),
66
+ target: "_blank",
67
+ rel: "noopener noreferrer",
68
+ children: "消息"
69
+ })
70
+ }) : null
71
+ ]
72
+ }),
73
+ /*#__PURE__*/ jsxs("div", {
74
+ className: "mt-2",
75
+ children: [
76
+ /*#__PURE__*/ jsxs("div", {
77
+ className: "flex py-2 gap-4",
78
+ children: [
79
+ /*#__PURE__*/ jsx("span", {
80
+ className: "text-sm text-[#646A73] min-w-[74px]",
81
+ children: "部门"
82
+ }),
83
+ /*#__PURE__*/ jsx("span", {
84
+ className: clsxWithTw('text-sm text-[#1F2329] flex-1 break-all', {
85
+ 'text-[#8F959E]': !user.department
86
+ }),
87
+ children: user.department || '--'
88
+ })
89
+ ]
90
+ }),
91
+ /*#__PURE__*/ jsxs("div", {
92
+ className: "flex py-2 gap-4",
93
+ children: [
94
+ /*#__PURE__*/ jsx("span", {
95
+ className: "text-sm text-[#646A73] min-w-[74px]",
96
+ children: "邮箱"
97
+ }),
98
+ user.email ? /*#__PURE__*/ jsx("a", {
99
+ href: `mailto:${user.email}`,
100
+ className: "text-sm text-blue-500 flex-1 break-all",
101
+ children: user.email
102
+ }) : /*#__PURE__*/ jsx("span", {
103
+ className: "text-sm text-[#8F959E] flex-1 break-all",
104
+ children: "--"
105
+ })
106
+ ]
107
+ })
108
+ ]
109
+ })
110
+ ]
111
+ });
112
+ }
113
+ export { UserProfileUI };
@@ -0,0 +1 @@
1
+ export { UserProfile } from './UserProfile';
@@ -0,0 +1,2 @@
1
+ import { UserProfile } from "./UserProfile.js";
2
+ export { UserProfile };
@@ -0,0 +1,8 @@
1
+ export interface User {
2
+ name: string;
3
+ avatar: string;
4
+ email: string;
5
+ department: string;
6
+ feishu_open_id: string;
7
+ status: 'active' | 'inactive';
8
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ import { UserProfile } from '../../../utils/getUserProfile';
2
+ import { User } from './type';
3
+ export declare const formatI18nProfile: (profile: UserProfile) => User;
4
+ export declare const getChatAppLink: (openId: string) => string;
5
+ export declare const INVALID_USER: User;
@@ -0,0 +1,26 @@
1
+ const convertI18nTextToText = (i18nText)=>{
2
+ if (Array.isArray(i18nText) && i18nText.length > 0) {
3
+ const chineseText = i18nText.find((value)=>2052 === value.language_code);
4
+ if (chineseText) return chineseText.text;
5
+ return i18nText[0].text;
6
+ }
7
+ return '';
8
+ };
9
+ const formatI18nProfile = (profile)=>({
10
+ name: convertI18nTextToText(profile.name),
11
+ avatar: profile.avatar || '',
12
+ email: profile.email || '',
13
+ department: convertI18nTextToText(profile.departmentName),
14
+ feishu_open_id: profile.feishuOpenID || '',
15
+ status: 1 === profile.status ? 'active' : 'inactive'
16
+ });
17
+ const getChatAppLink = (openId)=>`https://applink.feishu.cn/client/chat/open?openId=${openId}`;
18
+ const INVALID_USER = {
19
+ name: '无效人员',
20
+ avatar: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/no-person.svg',
21
+ email: '',
22
+ department: '',
23
+ feishu_open_id: '',
24
+ status: 'active'
25
+ };
26
+ export { INVALID_USER, formatI18nProfile, getChatAppLink };