Skip to content

Commit

Permalink
feat(upload-trigger): export 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 b9f0b9f commit 41ad866
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { default as NUpload, uploadProps } from './src/Upload'
export { default as NUploadDragger } from './src/UploadDragger'
export { default as NUploadFileList } from './src/UploadFileList'
export { default as NUploadTrigger } from './src/UploadTrigger'
export type { UploadTriggerSlots } from './src/UploadTrigger'
5 changes: 5 additions & 0 deletions src/upload/src/UploadTrigger.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { UploadTriggerDefaultSlotOptions } from './interface'
import { computed, defineComponent, h, inject } from 'vue'
import { NBaseIcon } from '../../_internal'
import { AddIcon } from '../../_internal/icons'
Expand All @@ -6,6 +7,10 @@ import { uploadInjectionKey } from './interface'
import NUploadDragger from './UploadDragger'
import { getFilesFromEntries } from './utils'

export interface UploadTriggerSlots {
default?: (options: UploadTriggerDefaultSlotOptions) => any
}

export default defineComponent({
name: 'UploadTrigger',
props: {
Expand Down
8 changes: 8 additions & 0 deletions src/upload/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,11 @@ export interface FileAndEntry {
entry: FileSystemFileEntry | null
source: 'dnd' | 'input'
}

export interface UploadTriggerDefaultSlotOptions {
handleClick: () => void
handleDragOver: (e: DragEvent) => void
handleDragEnter: (e: DragEvent) => void
handleDragLeave: (e: DragEvent) => void
handleDrop: (e: DragEvent) => void
}

0 comments on commit 41ad866

Please sign in to comment.