Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85e9cf5

Browse files
committed
#1720 fix UI
1 parent5464c85 commit85e9cf5

File tree

1 file changed

+104
-73
lines changed

1 file changed

+104
-73
lines changed

‎client/packages/lowcoder/src/comps/comps/fileComp/draggerUpload.tsx‎

Lines changed: 104 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
changeValueAction,
1010
CompAction,
1111
multiChangeAction,
12-
RecordConstructorToView,
1312
}from"lowcoder-core";
1413
import{hasIcon}from"comps/utils";
1514
import{messageInstance}from"lowcoder-design/src/components/GlobalInstances";
@@ -20,51 +19,81 @@ const IconWrapper = styled.span`
2019
display: flex;
2120
`;
2221

22+
constDraggerShell=styled.div<{$auto:boolean}>`
23+
height:${(p)=>(p.$auto ?"auto" :"100%")};
24+
25+
/* AntD wraps dragger + list in this */
26+
.ant-upload-wrapper {
27+
display: flex;
28+
flex-direction: column;
29+
height: 100%;
30+
overflow: auto; /* allows list to be visible if it grows */
31+
}
32+
33+
/* The drag area itself */
34+
.ant-upload-drag {
35+
${(p)=>
36+
!p.$auto&&
37+
`
38+
flex: 1 1 auto;
39+
min-height: 120px;
40+
min-width: 0;
41+
`}
42+
}
43+
44+
/* The list sits below the dragger */
45+
.ant-upload-list {
46+
${(p)=>
47+
!p.$auto&&
48+
`
49+
flex: 0 0 auto;
50+
`}
51+
}
52+
`;
53+
54+
2355
constStyledDragger=styled(AntdUpload.Dragger)<{
2456
$style:FileStyleType;
25-
$autoHeight:boolean;
57+
$auto:boolean;
2658
}>`
2759
&.ant-upload-drag {
28-
border-color:${(props)=>props.$style.border};
29-
border-width:${(props)=>props.$style.borderWidth};
30-
border-style:${(props)=>props.$style.borderStyle};
31-
border-radius:${(props)=>props.$style.radius};
32-
background:${(props)=>props.$style.background};
33-
${(props)=>!props.$autoHeight&&`height: 200px; display: flex; align-items: center;`}
34-
60+
border-color:${(p)=>p.$style.border};
61+
border-width:${(p)=>p.$style.borderWidth};
62+
border-style:${(p)=>p.$style.borderStyle};
63+
border-radius:${(p)=>p.$style.radius};
64+
background:${(p)=>p.$style.background};
65+
66+
${(p)=>
67+
!p.$auto&&
68+
`
69+
display: flex;
70+
align-items: center;
71+
`}
72+
73+
${(p)=>
74+
p.$auto&&
75+
`
76+
min-height: 200px;
77+
`}
78+
3579
.ant-upload-drag-container {
36-
${(props)=>!props.$autoHeight&&`display: flex; flex-direction: column; justify-content: center; height: 100%;`}
80+
${(p)=>
81+
!p.$auto&&
82+
`
83+
display: flex;
84+
flex-direction: column;
85+
justify-content: center;
86+
height: 100%;
87+
`}
3788
}
38-
89+
3990
&:hover {
40-
border-color:${(props)=>props.$style.accent};
41-
background:${(props)=>props.$style.background};
42-
}
43-
44-
.ant-upload-text {
45-
color:${(props)=>props.$style.text};
46-
font-size:${(props)=>props.$style.textSize};
47-
font-weight:${(props)=>props.$style.textWeight};
48-
font-family:${(props)=>props.$style.fontFamily};
49-
font-style:${(props)=>props.$style.fontStyle};
50-
}
51-
52-
.ant-upload-hint {
53-
color:${(props)=>props.$style.text};
54-
opacity: 0.7;
55-
}
56-
57-
.ant-upload-drag-icon {
58-
margin-bottom: 16px;
59-
60-
.anticon {
61-
color:${(props)=>props.$style.accent};
62-
font-size: 48px;
63-
}
91+
border-color:${(p)=>p.$style.accent};
6492
}
6593
}
6694
`;
6795

96+
6897
interfaceDraggerUploadProps{
6998
value:Array<string|null>;
7099
files:any[];
@@ -172,43 +201,45 @@ export const DraggerUpload = (props: DraggerUploadProps) => {
172201
};
173202

174203
return(
175-
<StyledDragger
176-
{...commonProps(props)}
177-
fileList={fileList}
178-
$style={style}
179-
$autoHeight={autoHeight}
180-
beforeUpload={(file)=>{
181-
if(!file.size||file.size<=0){
182-
messageInstance.error(`${file.name} `+trans("file.fileEmptyErrorMsg"));
183-
returnAntdUpload.LIST_IGNORE;
184-
}
185-
186-
if(
187-
(!!props.minSize&&file.size<props.minSize)||
188-
(!!props.maxSize&&file.size>props.maxSize)
189-
){
190-
messageInstance.error(`${file.name} `+trans("file.fileSizeExceedErrorMsg"));
191-
returnAntdUpload.LIST_IGNORE;
192-
}
193-
returntrue;
194-
}}
195-
onChange={handleOnChange}
196-
>
197-
<pclassName="ant-upload-drag-icon">
198-
{hasIcon(props.prefixIcon) ?(
199-
<IconWrapper>{props.prefixIcon}</IconWrapper>
200-
) :(
201-
<Buttontype="text"style={{fontSize:'48px',color:style.accent,border:'none'}}>
202-
📁
203-
</Button>
204-
)}
205-
</p>
206-
<pclassName="ant-upload-text">
207-
{props.text||trans("file.dragAreaText")}
208-
</p>
209-
<pclassName="ant-upload-hint">
210-
{trans("file.dragAreaHint")}
211-
</p>
212-
</StyledDragger>
204+
<DraggerShell$auto={autoHeight}>
205+
<StyledDragger
206+
{...commonProps(props)}
207+
fileList={fileList}
208+
$style={style}
209+
$auto={autoHeight}
210+
beforeUpload={(file)=>{
211+
if(!file.size||file.size<=0){
212+
messageInstance.error(`${file.name} `+trans("file.fileEmptyErrorMsg"));
213+
returnAntdUpload.LIST_IGNORE;
214+
}
215+
216+
if(
217+
(!!props.minSize&&file.size<props.minSize)||
218+
(!!props.maxSize&&file.size>props.maxSize)
219+
){
220+
messageInstance.error(`${file.name} `+trans("file.fileSizeExceedErrorMsg"));
221+
returnAntdUpload.LIST_IGNORE;
222+
}
223+
returntrue;
224+
}}
225+
onChange={handleOnChange}
226+
>
227+
<pclassName="ant-upload-drag-icon">
228+
{hasIcon(props.prefixIcon) ?(
229+
<IconWrapper>{props.prefixIcon}</IconWrapper>
230+
) :(
231+
<Buttontype="text"style={{fontSize:'48px',color:style.accent,border:'none'}}>
232+
📁
233+
</Button>
234+
)}
235+
</p>
236+
<pclassName="ant-upload-text">
237+
{props.text||trans("file.dragAreaText")}
238+
</p>
239+
<pclassName="ant-upload-hint">
240+
{trans("file.dragAreaHint")}
241+
</p>
242+
</StyledDragger>
243+
</DraggerShell>
213244
);
214245
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp