@lark-apaas/client-toolkit 1.0.10 → 1.0.11
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/components/User/UserDisplay.d.ts +1 -0
- package/lib/components/User/UserDisplay.js +2 -1
- package/lib/components/User/UserWithAvatar.d.ts +1 -1
- package/lib/components/User/UserWithAvatar.js +2 -2
- package/lib/components/User/type.d.ts +4 -0
- package/lib/logger/batch-logger.js +1 -1
- package/lib/utils/getAppId.js +4 -3
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { clsxWithTw } from "../../utils/utils.js";
|
|
|
5
5
|
import { UserProfile } from "./UserProfile/index.js";
|
|
6
6
|
import { UserWithAvatar } from "./UserWithAvatar.js";
|
|
7
7
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
|
|
8
|
-
const UserDisplay = ({ users, size, className, style })=>{
|
|
8
|
+
const UserDisplay = ({ users, size, className, style, showLabel = true })=>{
|
|
9
9
|
const normalizedUsers = useMemo(()=>Array.isArray(users) ? users : [
|
|
10
10
|
users
|
|
11
11
|
].filter(Boolean), [
|
|
@@ -96,6 +96,7 @@ const UserDisplay = ({ users, size, className, style })=>{
|
|
|
96
96
|
children: /*#__PURE__*/ jsx(UserWithAvatar, {
|
|
97
97
|
data: user,
|
|
98
98
|
size: size,
|
|
99
|
+
showLabel: showLabel,
|
|
99
100
|
className: "cursor-pointer hover:bg-[rgba(31,35,41,0.15)] active:bg-[rgba(31,35,41,0.2)]"
|
|
100
101
|
})
|
|
101
102
|
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { UserWithAvatarProps } from './type';
|
|
3
|
-
export declare function UserWithAvatar({ data, size, mode, className, }: UserWithAvatarProps): React.JSX.Element;
|
|
3
|
+
export declare function UserWithAvatar({ data, size, mode, className, showLabel, }: UserWithAvatarProps): React.JSX.Element;
|
|
@@ -23,7 +23,7 @@ const textVariantMap = {
|
|
|
23
23
|
medium: 'text-[14px] leading-[20px]',
|
|
24
24
|
large: 'text-[16px] leading-[24px]'
|
|
25
25
|
};
|
|
26
|
-
function UserWithAvatar({ data, size = 'medium', mode = 'tag', className }) {
|
|
26
|
+
function UserWithAvatar({ data, size = 'medium', mode = 'tag', className, showLabel = true }) {
|
|
27
27
|
const { avatar, name } = data;
|
|
28
28
|
const displayName = name?.trim() || '无效人员';
|
|
29
29
|
const formatSize = [
|
|
@@ -48,7 +48,7 @@ function UserWithAvatar({ data, size = 'medium', mode = 'tag', className }) {
|
|
|
48
48
|
})
|
|
49
49
|
]
|
|
50
50
|
}),
|
|
51
|
-
/*#__PURE__*/ jsx(OverflowTooltipText, {
|
|
51
|
+
showLabel && /*#__PURE__*/ jsx(OverflowTooltipText, {
|
|
52
52
|
text: displayName,
|
|
53
53
|
className: clsxWithTw('text-card-foreground', textVariantMap[formatSize])
|
|
54
54
|
})
|
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 };
|