Skip to content

Commit

Permalink
feat(dialog): add slots type (tusen-ai#6599)
Browse files Browse the repository at this point in the history
  • Loading branch information
nailiable committed Dec 7, 2024
1 parent 0139b74 commit 26e6ded
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dialog/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { useDialog, useDialogReactiveList } from './src/composables'
export { NDialog } from './src/Dialog'
export type { DialogSlots } from './src/Dialog'
export { dialogProps } from './src/dialogProps'
export type { DialogProps } from './src/dialogProps'
export { dialogProviderProps, NDialogProvider } from './src/DialogProvider'
Expand Down
17 changes: 16 additions & 1 deletion src/dialog/src/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import type { ThemeProps } from '../../_mixins'
import type { DialogTheme } from '../styles'
import { getMargin } from 'seemly'
import { computed, type CSSProperties, defineComponent, h } from 'vue'
import {
computed,
type CSSProperties,
defineComponent,
h,
type SlotsType
} from 'vue'
import { NBaseClose, NBaseIcon } from '../../_internal'
import {
ErrorIcon,
Expand Down Expand Up @@ -29,6 +35,14 @@ const iconRenderMap = {
error: () => <ErrorIcon />
}

export interface DialogSlots {
action?: any
default?: any
header?: any
icon?: any
close?: any
}

export const NDialog = defineComponent({
name: 'Dialog',
alias: [
Expand All @@ -39,6 +53,7 @@ export const NDialog = defineComponent({
...(useTheme.props as ThemeProps<DialogTheme>),
...dialogProps
},
slots: Object as SlotsType<DialogSlots>,
setup(props) {
const {
mergedComponentPropsRef,
Expand Down

0 comments on commit 26e6ded

Please sign in to comment.