@gradio/file 0.7.6 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/Index.svelte +4 -0
- package/package.json +5 -5
- package/shared/FilePreview.svelte +6 -2
- package/shared/FileUpload.svelte +10 -7
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# @gradio/file
|
2
2
|
|
3
|
+
## 0.8.1
|
4
|
+
|
5
|
+
### Dependency updates
|
6
|
+
|
7
|
+
- @gradio/upload@0.11.1
|
8
|
+
- @gradio/client@1.1.0
|
9
|
+
|
10
|
+
## 0.8.0
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
- [#8417](https://github.com/gradio-app/gradio/pull/8417) [`96d8de2`](https://github.com/gradio-app/gradio/commit/96d8de231270321da5f310768643363276df3204) - add delete event to `File` component. Thanks @pngwn!
|
15
|
+
|
16
|
+
### Fixes
|
17
|
+
|
18
|
+
- [#8451](https://github.com/gradio-app/gradio/pull/8451) [`9d2d605`](https://github.com/gradio-app/gradio/commit/9d2d6051caed5c8749a26a6fa7480a5ae6e6c4f3) - Change client submit API to be an AsyncIterable and support more platforms. Thanks @pngwn!
|
19
|
+
|
20
|
+
### Dependency updates
|
21
|
+
|
22
|
+
- @gradio/statustracker@0.6.0
|
23
|
+
- @gradio/client@1.0.0
|
24
|
+
- @gradio/upload@0.11.0
|
25
|
+
|
26
|
+
## 0.7.7
|
27
|
+
|
28
|
+
### Dependency updates
|
29
|
+
|
30
|
+
- @gradio/upload@0.10.7
|
31
|
+
- @gradio/client@0.20.1
|
32
|
+
|
3
33
|
## 0.7.6
|
4
34
|
|
5
35
|
### Dependency updates
|
package/Index.svelte
CHANGED
@@ -40,6 +40,7 @@
|
|
40
40
|
clear: never;
|
41
41
|
select: SelectData;
|
42
42
|
clear_status: LoadingStatus;
|
43
|
+
delete: FileData;
|
43
44
|
}>;
|
44
45
|
export let file_count: string;
|
45
46
|
export let file_types: string[] = ["file"];
|
@@ -110,6 +111,9 @@
|
|
110
111
|
loading_status.status = "error";
|
111
112
|
gradio.dispatch("error", detail);
|
112
113
|
}}
|
114
|
+
on:delete={({ detail }) => {
|
115
|
+
gradio.dispatch("delete", detail);
|
116
|
+
}}
|
113
117
|
i18n={gradio.i18n}
|
114
118
|
>
|
115
119
|
<UploadText i18n={gradio.i18n} type="file" />
|
package/package.json
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/file",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.8.1",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
7
7
|
"license": "ISC",
|
8
8
|
"private": false,
|
9
9
|
"dependencies": {
|
10
|
-
"@gradio/client": "^0.20.0",
|
11
10
|
"@gradio/atoms": "^0.7.4",
|
12
|
-
"@gradio/
|
11
|
+
"@gradio/client": "^1.1.0",
|
13
12
|
"@gradio/icons": "^0.4.1",
|
14
|
-
"@gradio/
|
13
|
+
"@gradio/statustracker": "^0.6.0",
|
15
14
|
"@gradio/utils": "^0.4.2",
|
15
|
+
"@gradio/upload": "^0.11.1",
|
16
16
|
"@gradio/wasm": "^0.10.1"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
|
-
"@gradio/preview": "^0.9.
|
19
|
+
"@gradio/preview": "^0.9.1"
|
20
20
|
},
|
21
21
|
"main": "./Index.svelte",
|
22
22
|
"main_changeset": true,
|
@@ -8,6 +8,7 @@
|
|
8
8
|
const dispatch = createEventDispatcher<{
|
9
9
|
select: SelectData;
|
10
10
|
change: FileData[] | FileData;
|
11
|
+
delete: FileData;
|
11
12
|
}>();
|
12
13
|
export let value: FileData | FileData[];
|
13
14
|
export let selectable = false;
|
@@ -38,7 +39,9 @@
|
|
38
39
|
const tr = event.currentTarget;
|
39
40
|
const should_select =
|
40
41
|
event.target === tr || // Only select if the click is on the row itself
|
41
|
-
|
42
|
+
(tr &&
|
43
|
+
tr.firstElementChild &&
|
44
|
+
event.composedPath().includes(tr.firstElementChild)); // Or if the click is on the name column
|
42
45
|
|
43
46
|
if (should_select) {
|
44
47
|
dispatch("select", { value: normalized_files[index].orig_name, index });
|
@@ -46,9 +49,10 @@
|
|
46
49
|
}
|
47
50
|
|
48
51
|
function remove_file(index: number): void {
|
49
|
-
normalized_files.splice(index, 1);
|
52
|
+
const removed = normalized_files.splice(index, 1);
|
50
53
|
normalized_files = [...normalized_files];
|
51
54
|
value = normalized_files;
|
55
|
+
dispatch("delete", removed[0]);
|
52
56
|
dispatch("change", normalized_files);
|
53
57
|
}
|
54
58
|
</script>
|
package/shared/FileUpload.svelte
CHANGED
@@ -50,16 +50,19 @@
|
|
50
50
|
$: dispatch("drag", dragging);
|
51
51
|
</script>
|
52
52
|
|
53
|
-
<BlockLabel
|
54
|
-
{show_label}
|
55
|
-
Icon={File}
|
56
|
-
float={value === null}
|
57
|
-
label={label || "File"}
|
58
|
-
/>
|
53
|
+
<BlockLabel {show_label} Icon={File} float={!value} label={label || "File"} />
|
59
54
|
|
60
55
|
{#if value && (Array.isArray(value) ? value.length > 0 : true)}
|
61
56
|
<ModifyUpload {i18n} on:clear={handle_clear} absolute />
|
62
|
-
<FilePreview
|
57
|
+
<FilePreview
|
58
|
+
{i18n}
|
59
|
+
on:select
|
60
|
+
{selectable}
|
61
|
+
{value}
|
62
|
+
{height}
|
63
|
+
on:change
|
64
|
+
on:delete
|
65
|
+
/>
|
63
66
|
{:else}
|
64
67
|
<Upload
|
65
68
|
on:load={handle_upload}
|