diff --git a/src/avatar-group/index.ts b/src/avatar-group/index.ts index 5f5357f709f..25c5da24628 100644 --- a/src/avatar-group/index.ts +++ b/src/avatar-group/index.ts @@ -1,2 +1,6 @@ export { avatarGroupProps, default as NAvatarGroup } from './src/AvatarGroup' export type { AvatarGroupOption, AvatarGroupProps } from './src/AvatarGroup' +export type { + AvatarGroupAvatarSlotOptions, + AvatarGroupRestSlotOptions +} from './src/interface' diff --git a/src/avatar-group/src/AvatarGroup.tsx b/src/avatar-group/src/AvatarGroup.tsx index 898e41ab81e..ddd853f842e 100644 --- a/src/avatar-group/src/AvatarGroup.tsx +++ b/src/avatar-group/src/AvatarGroup.tsx @@ -2,13 +2,18 @@ import type { ThemeProps } from '../../_mixins' import type { ExtractPublicPropTypes } from '../../_utils' import type { Size } from '../../avatar/src/interface' import type { AvatarGroupTheme } from '../styles' +import type { + AvatarGroupAvatarSlotOptions, + AvatarGroupRestSlotOptions +} from './interface' import { computed, type CSSProperties, defineComponent, h, type PropType, - provide + provide, + type SlotsType } from 'vue' import { useConfig, useTheme } from '../../_mixins' import { useRtl } from '../../_mixins/use-rtl' @@ -40,9 +45,16 @@ export const avatarGroupProps = { export type AvatarGroupProps = ExtractPublicPropTypes +export interface AvatarGroupSlots { + avatar?: (info: AvatarGroupAvatarSlotOptions) => any + rest?: (info: AvatarGroupRestSlotOptions) => any + default?: any +} + export default defineComponent({ name: 'AvatarGroup', props: avatarGroupProps, + slots: Object as SlotsType, setup(props) { const { mergedClsPrefixRef, mergedRtlRef } = useConfig(props) const mergedThemeRef = useTheme( diff --git a/src/avatar-group/src/interface.ts b/src/avatar-group/src/interface.ts new file mode 100644 index 00000000000..54a2bd3b1d4 --- /dev/null +++ b/src/avatar-group/src/interface.ts @@ -0,0 +1,8 @@ +export interface AvatarGroupAvatarSlotOptions { + option: Record +} + +export interface AvatarGroupRestSlotOptions { + options: Array + rest: number +}