@@ -2,7 +2,12 @@ import React from "react";
22import { createDecorators } from "@next-core/element" ;
33import { ReactNextElement , wrapBrick } from "@next-core/react-element" ;
44import "@next-core/theme" ;
5- import type { EoAvatar , AvatarProps , AvatarSize } from "../avatar/index.js" ;
5+ import type {
6+ EoAvatar ,
7+ AvatarProps ,
8+ AvatarSize ,
9+ AvatarGapSize ,
10+ } from "../avatar/index.js" ;
611import { useUserInfoByNameOrInstanceId } from "./useUserInfoByNameOrInstanceId.js" ;
712import styleText from "./styles.shadow.css" ;
813
@@ -13,6 +18,7 @@ const WrappedAvatar = wrapBrick<EoAvatar, AvatarProps>("eo-avatar");
1318export interface EoEasyopsAvatarProps {
1419 nameOrInstanceId ?: string ;
1520 size ?: AvatarSize ;
21+ gapSize ?: AvatarGapSize ;
1622 bordered ?: boolean ;
1723 showName ?: boolean ;
1824}
@@ -25,6 +31,7 @@ export interface EoEasyopsAvatarProps {
2531 * @part avatar-img - 显示为图片时的头像容器
2632 * @part avatar-icon - 显示为图标时的头像容器
2733 * @part avatar-text - 显示为文本时的头像容器
34+ * @part name - 用户名
2835 * @category display-component
2936 */
3037export
@@ -42,6 +49,13 @@ class EoEasyopsAvatar extends ReactNextElement implements EoEasyopsAvatarProps {
4249 */
4350 @property ( ) accessor size : AvatarSize = "medium" ;
4451
52+ /**
53+ * 头像和名称间距大小
54+ *
55+ * @default "medium"
56+ */
57+ @property ( ) accessor gapSize : AvatarGapSize | undefined ;
58+
4559 /**
4660 * 是否有边框
4761 */
@@ -71,7 +85,7 @@ class EoEasyopsAvatar extends ReactNextElement implements EoEasyopsAvatarProps {
7185}
7286
7387export function EoEasyopsAvatarComponent ( props : EoEasyopsAvatarProps ) {
74- const { nameOrInstanceId, size, bordered, showName } = props ;
88+ const { nameOrInstanceId, size, gapSize , bordered, showName } = props ;
7589
7690 const { user } = useUserInfoByNameOrInstanceId ( nameOrInstanceId ) ;
7791
@@ -80,10 +94,11 @@ export function EoEasyopsAvatarComponent(props: EoEasyopsAvatarProps) {
8094 src = { user ?. user_icon }
8195 name = { user ?. name }
8296 size = { size }
97+ gapSize = { gapSize }
8398 bordered = { bordered }
8499 showName = { showName }
85100 part = "eo-avatar"
86- exportparts = "avatar, avatar-img, avatar-icon, avatar-text"
101+ exportparts = "avatar, avatar-img, avatar-icon, avatar-text, name "
87102 />
88103 ) ;
89104}
0 commit comments