Skip to content

Commit

Permalink
feat(avatar-group): add slots type (tusen-ai#6599), may not be partic…
Browse files Browse the repository at this point in the history
…ularly precise
  • Loading branch information
nailiable committed Dec 7, 2024
1 parent 6efc1ff commit f4901d6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/avatar-group/index.ts
Original file line number Diff line number Diff line change
@@ -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'
14 changes: 13 additions & 1 deletion src/avatar-group/src/AvatarGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -40,9 +45,16 @@ export const avatarGroupProps = {

export type AvatarGroupProps = ExtractPublicPropTypes<typeof avatarGroupProps>

export interface AvatarGroupSlots {
avatar?: (info: AvatarGroupAvatarSlotOptions) => any
rest?: (info: AvatarGroupRestSlotOptions) => any
default?: any
}

export default defineComponent({
name: 'AvatarGroup',
props: avatarGroupProps,
slots: Object as SlotsType<AvatarGroupSlots>,
setup(props) {
const { mergedClsPrefixRef, mergedRtlRef } = useConfig(props)
const mergedThemeRef = useTheme(
Expand Down
8 changes: 8 additions & 0 deletions src/avatar-group/src/interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface AvatarGroupAvatarSlotOptions {
option: Record<string, any>
}

export interface AvatarGroupRestSlotOptions {
options: Array<any>
rest: number
}

0 comments on commit f4901d6

Please sign in to comment.