File tree 6 files changed +41
-8
lines changed
6 files changed +41
-8
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @gradio/file " : patch
3
+ " @gradio/upload " : patch
4
+ " gradio " : patch
5
+ ---
6
+
7
+ fix: Ensure the ` height ` param in ` gr.File ` works as expected
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def __init__(
54
54
container : bool = True ,
55
55
scale : int | None = None ,
56
56
min_width : int = 160 ,
57
- height : int | float | None = None ,
57
+ height : int | str | float | None = None ,
58
58
interactive : bool | None = None ,
59
59
visible : bool = True ,
60
60
elem_id : str | None = None ,
Original file line number Diff line number Diff line change 1
1
<script >
2
2
import { Meta , Template , Story } from " @storybook/addon-svelte-csf" ;
3
- import FilePreview from " ./shared/FilePreview .svelte" ;
3
+ import File from " ./Index .svelte" ;
4
4
</script >
5
5
6
6
<Meta
7
7
title =" Components/File"
8
- component ={FilePreview }
8
+ component ={File }
9
9
argTypes ={{
10
10
value : {
11
11
control : " text" ,
17
17
/>
18
18
19
19
<Template let:args >
20
- <FilePreview {...args } />
20
+ <File {...args } />
21
21
</Template >
22
22
23
23
<Story
54
54
allow_reordering : true
55
55
}}
56
56
/>
57
+ <Story
58
+ name =" File upload with height set to 400px"
59
+ args ={{
60
+ interactive : true ,
61
+ value : null ,
62
+ height : 400
63
+ }}
64
+ />
Original file line number Diff line number Diff line change 13
13
}>();
14
14
export let value: FileData | FileData [];
15
15
export let selectable = false ;
16
- export let height: number | undefined = undefined ;
16
+ export let height: number | string | undefined = undefined ;
17
17
export let i18n: I18nFormatter ;
18
18
export let allow_reordering = false ;
19
19
124
124
125
125
<div
126
126
class =" file-preview-holder"
127
- style ="max-height: {typeof height === undefined ? ' auto' : height + ' px' };"
127
+ style:max-height ={height
128
+ ? typeof height === " number"
129
+ ? height + " px"
130
+ : height
131
+ : " auto" }
128
132
>
129
133
<table class =" file-preview" >
130
134
<tbody >
Original file line number Diff line number Diff line change 112
112
on:error
113
113
{stream_handler }
114
114
{upload }
115
+ {height }
115
116
>
116
117
<slot />
117
118
</Upload >
Original file line number Diff line number Diff line change 22
22
export let upload: Client [" upload" ];
23
23
export let stream_handler: Client [" stream" ];
24
24
export let icon_upload = false ;
25
+ export let height: number | string | undefined = undefined ;
25
26
26
27
let upload_id: string ;
27
28
let file_data: FileData [];
267
268
class:boundedheight
268
269
class:flex
269
270
class:icon-mode ={icon_upload }
270
- style:height ={icon_upload ? " " : " 100%" }
271
+ style:height ={icon_upload
272
+ ? " "
273
+ : height
274
+ ? typeof height === " number"
275
+ ? height + " px"
276
+ : height
277
+ : " 100%" }
271
278
tabindex ={hidden ? - 1 : 0 }
272
279
on:click ={paste_clipboard }
273
280
>
285
292
class:flex
286
293
class:disable _click
287
294
class:icon-mode ={icon_upload }
288
- style:height ={icon_upload ? " " : " 100%" }
295
+ style:height ={icon_upload
296
+ ? " "
297
+ : height
298
+ ? typeof height === " number"
299
+ ? height + " px"
300
+ : height
301
+ : " 100%" }
289
302
tabindex ={hidden ? - 1 : 0 }
290
303
on:drag |preventDefault |stopPropagation
291
304
on:dragstart |preventDefault |stopPropagation
You can’t perform that action at this time.
0 commit comments