@gradio/file 0.7.3 → 0.7.5

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # @gradio/file
2
2
 
3
+ ## 0.7.5
4
+
5
+ ### Fixes
6
+
7
+ - [#8334](https://github.com/gradio-app/gradio/pull/8334) [`0236b1a`](https://github.com/gradio-app/gradio/commit/0236b1ab12149ddd11b03e1382ceb09d19ac0d48) - fix: prevent triggering gr.File.select on delete. Thanks @gtm-nayan!
8
+ - [#8341](https://github.com/gradio-app/gradio/pull/8341) [`82ba397`](https://github.com/gradio-app/gradio/commit/82ba3975921760c727875948fb7275c2f5f9ea2b) - add missing orig_name (follow up to #8334). Thanks @gtm-nayan!
9
+
10
+ ### Dependency updates
11
+
12
+ - @gradio/utils@0.4.2
13
+ - @gradio/atoms@0.7.4
14
+ - @gradio/statustracker@0.5.5
15
+ - @gradio/upload@0.10.5
16
+ - @gradio/client@0.19.4
17
+
18
+ ## 0.7.4
19
+
20
+ ### Dependency updates
21
+
22
+ - @gradio/client@0.19.3
23
+ - @gradio/statustracker@0.5.4
24
+ - @gradio/upload@0.10.4
25
+
3
26
  ## 0.7.3
4
27
 
5
28
  ### Dependency updates
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@gradio/file",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
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/atoms": "^0.7.3",
11
- "@gradio/client": "^0.19.2",
12
- "@gradio/statustracker": "^0.5.3",
10
+ "@gradio/client": "^0.19.4",
11
+ "@gradio/atoms": "^0.7.4",
13
12
  "@gradio/icons": "^0.4.1",
14
- "@gradio/utils": "^0.4.1",
15
- "@gradio/upload": "^0.10.3",
13
+ "@gradio/statustracker": "^0.5.5",
14
+ "@gradio/utils": "^0.4.2",
15
+ "@gradio/upload": "^0.10.5",
16
16
  "@gradio/wasm": "^0.10.1"
17
17
  },
18
18
  "devDependencies": {
@@ -31,6 +31,20 @@
31
31
  };
32
32
  });
33
33
 
34
+ function handle_row_click(
35
+ event: MouseEvent & { currentTarget: HTMLTableRowElement },
36
+ index: number
37
+ ): void {
38
+ const tr = event.currentTarget;
39
+ const should_select =
40
+ event.target === tr || // Only select if the click is on the row itself
41
+ event.composedPath().includes(tr.firstElementChild); // Or if the click is on the name column
42
+
43
+ if (should_select) {
44
+ dispatch("select", { value: normalized_files[index].orig_name, index });
45
+ }
46
+ }
47
+
34
48
  function remove_file(index: number): void {
35
49
  normalized_files.splice(index, 1);
36
50
  normalized_files = [...normalized_files];
@@ -45,15 +59,13 @@
45
59
  >
46
60
  <table class="file-preview">
47
61
  <tbody>
48
- {#each normalized_files as file, i}
62
+ {#each normalized_files as file, i (file)}
49
63
  <tr
50
64
  class="file"
51
65
  class:selectable
52
- on:click={() =>
53
- dispatch("select", {
54
- value: file.orig_name,
55
- index: i
56
- })}
66
+ on:click={(event) => {
67
+ handle_row_click(event, i);
68
+ }}
57
69
  >
58
70
  <td class="filename" aria-label={file.orig_name}>
59
71
  <span class="stem">{file.filename_stem}</span>
@@ -74,12 +86,15 @@
74
86
  {i18n("file.uploading")}
75
87
  {/if}
76
88
  </td>
89
+
77
90
  {#if normalized_files.length > 1}
78
91
  <td>
79
92
  <button
80
93
  class="label-clear-button"
81
94
  aria-label="Remove this file"
82
- on:click={() => remove_file(i)}
95
+ on:click={() => {
96
+ remove_file(i);
97
+ }}
83
98
  on:keydown={(event) => {
84
99
  if (event.key === "Enter") {
85
100
  remove_file(i);