1
1
import React from 'react' ;
2
2
import Icon from '@uiw/react-icon' ;
3
3
import { FileInputListProps } from './' ;
4
+ import {
5
+ FileInputListWarp ,
6
+ FileInputListActionsWarp ,
7
+ FileInputListActionsSearchWarp ,
8
+ FileInputListUploadTypeWarp ,
9
+ FileInputListUploadInfoTypeWarp ,
10
+ FileInputListUploadTextTypeWarp ,
11
+ FileInputListUploadIconTypeWarp ,
12
+ } from './style' ;
4
13
import './style/index.less' ;
5
14
6
15
const Picture = ( props : FileInputListProps ) => {
7
16
const {
8
17
className,
9
18
prefixCls = 'w-fileinput-list' ,
10
19
dataList = [ ] ,
11
- uploadType,
20
+ uploadType, // 'input' | 'picture' | 'text' | 'card';
12
21
size = 'middle' ,
13
22
shape = 'round' ,
14
23
readonly,
@@ -22,13 +31,10 @@ const Picture = (props: FileInputListProps) => {
22
31
onRemove,
23
32
} = props ;
24
33
25
- const cls = [ prefixCls , `${ prefixCls } -size-${ size } ` , `${ prefixCls } -shape-${ shape } ` , className ]
26
- . filter ( Boolean )
27
- . join ( ' ' )
28
- . trim ( ) ;
34
+ const cls = [ prefixCls , className ] . filter ( Boolean ) . join ( ' ' ) . trim ( ) ;
29
35
30
36
return (
31
- < div className = { cls } >
37
+ < FileInputListWarp uploadType = { uploadType } size = { size } shape = { shape } className = { cls } >
32
38
{ children &&
33
39
! readonly &&
34
40
React . isValidElement ( children ) &&
@@ -37,29 +43,37 @@ const Picture = (props: FileInputListProps) => {
37
43
} ) }
38
44
< div >
39
45
{ dataList . map ( ( item , index ) => (
40
- < div className = { `${ prefixCls } -${ uploadType } ` } key = { index } >
46
+ < FileInputListUploadTypeWarp className = { `${ prefixCls } -${ uploadType } ` } uploadType = { uploadType } key = { index } >
41
47
{ uploadType === 'picture' && (
42
- < div className = { `${ prefixCls } -info ${ prefixCls } -${ uploadType } -info` } >
48
+ < FileInputListUploadInfoTypeWarp className = { `${ prefixCls } -info ${ prefixCls } -${ uploadType } -info` } >
43
49
< img src = { item [ 'dataURL' ] } alt = "" />
44
50
{ showFileIcon ?. showPreviewIcon && (
45
- < div className = { `${ prefixCls } -actions` } >
46
- < span className = { `${ prefixCls } -actions-search` } onClick = { ( ) => onPreview ?.( item ) } >
51
+ < FileInputListActionsWarp className = { `${ prefixCls } -actions` } >
52
+ < FileInputListActionsSearchWarp
53
+ className = { `${ prefixCls } -actions-search` }
54
+ onClick = { ( ) => onPreview ?.( item ) }
55
+ >
47
56
< Icon type = "search" style = { { color : '#fff' , fontSize : 16 } } />
48
- </ span >
49
- </ div >
57
+ </ FileInputListActionsSearchWarp >
58
+ </ FileInputListActionsWarp >
50
59
) }
51
- </ div >
60
+ </ FileInputListUploadInfoTypeWarp >
52
61
) }
53
- < div className = { `${ prefixCls } -${ uploadType } -text` } > { item . name } </ div >
62
+ < FileInputListUploadTextTypeWarp className = { `${ prefixCls } -${ uploadType } -text` } >
63
+ { item . name }
64
+ </ FileInputListUploadTextTypeWarp >
54
65
{ showFileIcon ?. showRemoveIcon && (
55
- < div className = { `${ prefixCls } -${ uploadType } -icon` } onClick = { ( ) => onRemove ?.( index ) } >
66
+ < FileInputListUploadIconTypeWarp
67
+ className = { `${ prefixCls } -${ uploadType } -icon` }
68
+ onClick = { ( ) => onRemove ?.( index ) }
69
+ >
56
70
< Icon type = "delete" style = { { color : '#999' } } />
57
- </ div >
71
+ </ FileInputListUploadIconTypeWarp >
58
72
) }
59
- </ div >
73
+ </ FileInputListUploadTypeWarp >
60
74
) ) }
61
75
</ div >
62
- </ div >
76
+ </ FileInputListWarp >
63
77
) ;
64
78
} ;
65
79
0 commit comments