Skip to content

Commit

Permalink
fix: sth about types
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-huxiyang committed Dec 4, 2024
1 parent 786ff04 commit aafb914
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/packages/uploader/index.taro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { Uploader } from './uploader.taro'

export type { UploaderProps } from './uploader.taro'

export type { FileType, FileItem, FileItemStatus } from '../uploader'
export type { FileType, FileItem, FileItemStatus } from './types'
export default Uploader
29 changes: 1 addition & 28 deletions src/packages/uploader/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
import { ReactNode } from 'react'
import { Uploader } from './uploader'

export type { UploaderProps } from './uploader'

type FileItem = {
status?: FileItemStatus

message?: string

uid?: string | number

name?: string

url?: string

type?: 'image' | 'list' | string

path?: string

loadingIcon?: ReactNode

failIcon?: ReactNode

file?: File
}

type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error'

type FileType<T> = { [key: string]: T }

export type { FileType, FileItem, FileItemStatus }
export type { FileType, FileItem, FileItemStatus } from './types'
export default Uploader
25 changes: 25 additions & 0 deletions src/packages/uploader/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export type FileItem = {
status?: FileItemStatus

message?: string

uid?: string | number

name?: string

url?: string

type?: 'image' | 'list' | string

path?: string

loadingIcon?: React.ReactNode

failIcon?: React.ReactNode

file?: File
}

export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error'

export type FileType<T> = { [key: string]: T }
2 changes: 1 addition & 1 deletion src/packages/uploader/uploader.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Button from '@/packages/button/index.taro'
import { useConfig } from '@/packages/configprovider/configprovider.taro'
import { funcInterceptor } from '@/utils/interceptor'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { FileItem } from '../uploader'
import { FileItem } from './types'
import { usePropsValue } from '@/utils/use-props-value'
import { Preview } from '@/packages/uploader/preview.taro'

Expand Down
2 changes: 1 addition & 1 deletion src/packages/uploader/uploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import Button from '@/packages/button'
import { usePropsValue } from '@/utils/use-props-value'
import { Preview } from '@/packages/uploader/preview'
import { FileItem } from '../uploader'
import { FileItem } from './types'
import { mergeProps } from '@/utils/merge-props'

export interface UploaderProps extends BasicComponent {
Expand Down

0 comments on commit aafb914

Please sign in to comment.