@gradio/dataframe 0.24.2 → 0.24.3
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 +12 -0
- package/Dataframe.test.ts +28 -0
- package/Example.svelte +19 -10
- package/dist/Example.svelte +19 -10
- package/dist/Example.svelte.d.ts +4 -18
- package/dist/shared/EditableCell.svelte +5 -1
- package/dist/shared/Example.svelte +1 -1
- package/dist/shared/Example.svelte.d.ts +4 -18
- package/dist/shared/Table.svelte +1 -0
- package/dist/shared/tanstack/virtual.svelte.js +2 -2
- package/dist/standalone/stubs/Upload.svelte +12 -5
- package/dist/standalone/stubs/Upload.svelte.d.ts +8 -34
- package/package.json +3 -3
- package/shared/EditableCell.svelte +5 -1
- package/shared/Example.svelte +1 -1
- package/shared/Table.svelte +1 -0
- package/shared/tanstack/virtual.svelte.ts +2 -2
- package/standalone/stubs/Upload.svelte +12 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @gradio/dataframe
|
|
2
2
|
|
|
3
|
+
## 0.24.3
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- [#13744](https://github.com/gradio-app/gradio/pull/13744) [`ca9dec0`](https://github.com/gradio-app/gradio/commit/ca9dec0e2e07d33cf3551f5062ff35ab9acf3026) - Re-read the Dataframe virtual window whenever the row count changes. Thanks @abidlabs!
|
|
8
|
+
|
|
9
|
+
## 0.24.2
|
|
10
|
+
|
|
11
|
+
### Dependency updates
|
|
12
|
+
|
|
13
|
+
- @gradio/client@2.5.0
|
|
14
|
+
|
|
3
15
|
## 0.24.2
|
|
4
16
|
|
|
5
17
|
### Fixes
|
package/Dataframe.test.ts
CHANGED
|
@@ -96,6 +96,34 @@ describe("Dataframe rendering", () => {
|
|
|
96
96
|
expect(rows.length).toBe(3);
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
+
test("resets inherited table padding so headers align with body cells", async () => {
|
|
100
|
+
const global_style = document.createElement("style");
|
|
101
|
+
global_style.textContent = "table { padding: 10px; }";
|
|
102
|
+
document.head.appendChild(global_style);
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
const { container } = await render(Dataframe, default_props);
|
|
106
|
+
await wait();
|
|
107
|
+
|
|
108
|
+
const header_table = container.querySelector(
|
|
109
|
+
".header-table"
|
|
110
|
+
) as HTMLTableElement;
|
|
111
|
+
const first_header = get_header_cells(container)[0];
|
|
112
|
+
const first_body_cell = get_cell(container, 0, 0)!;
|
|
113
|
+
const header_rect = first_header.getBoundingClientRect();
|
|
114
|
+
const body_rect = first_body_cell.getBoundingClientRect();
|
|
115
|
+
|
|
116
|
+
expect(getComputedStyle(header_table).padding).toBe("0px");
|
|
117
|
+
expect(header_table.getBoundingClientRect().height).toBe(
|
|
118
|
+
header_rect.height
|
|
119
|
+
);
|
|
120
|
+
expect(header_rect.left).toBeCloseTo(body_rect.left);
|
|
121
|
+
expect(header_rect.right).toBeCloseTo(body_rect.right);
|
|
122
|
+
} finally {
|
|
123
|
+
global_style.remove();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
99
127
|
test("renders label when show_label is true", async () => {
|
|
100
128
|
const { container } = await render(Dataframe, {
|
|
101
129
|
...default_props,
|
package/Example.svelte
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
let {
|
|
3
|
+
value,
|
|
4
|
+
type,
|
|
5
|
+
selected = false,
|
|
6
|
+
index
|
|
7
|
+
}: {
|
|
8
|
+
value: (string | number)[][] | string;
|
|
9
|
+
type: "gallery" | "table";
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
index: number;
|
|
12
|
+
} = $props();
|
|
6
13
|
|
|
7
|
-
let hovered = false;
|
|
8
|
-
let loaded = Array.isArray(value);
|
|
9
|
-
let is_empty =
|
|
14
|
+
let hovered = $state(false);
|
|
15
|
+
let loaded = $derived(Array.isArray(value));
|
|
16
|
+
let is_empty = $derived(
|
|
17
|
+
loaded && (value.length === 0 || value[0].length === 0)
|
|
18
|
+
);
|
|
10
19
|
</script>
|
|
11
20
|
|
|
12
21
|
{#if loaded}
|
|
13
22
|
<!-- TODO: fix-->
|
|
14
|
-
<!-- svelte-ignore
|
|
23
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
15
24
|
<div
|
|
16
25
|
class:table={type === "table"}
|
|
17
26
|
class:gallery={type === "gallery"}
|
|
18
27
|
class:selected
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
onmouseenter={() => (hovered = true)}
|
|
29
|
+
onmouseleave={() => (hovered = false)}
|
|
21
30
|
>
|
|
22
31
|
{#if typeof value === "string"}
|
|
23
32
|
{value}
|
package/dist/Example.svelte
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
let {
|
|
3
|
+
value,
|
|
4
|
+
type,
|
|
5
|
+
selected = false,
|
|
6
|
+
index
|
|
7
|
+
}: {
|
|
8
|
+
value: (string | number)[][] | string;
|
|
9
|
+
type: "gallery" | "table";
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
index: number;
|
|
12
|
+
} = $props();
|
|
6
13
|
|
|
7
|
-
let hovered = false;
|
|
8
|
-
let loaded = Array.isArray(value);
|
|
9
|
-
let is_empty =
|
|
14
|
+
let hovered = $state(false);
|
|
15
|
+
let loaded = $derived(Array.isArray(value));
|
|
16
|
+
let is_empty = $derived(
|
|
17
|
+
loaded && (value.length === 0 || value[0].length === 0)
|
|
18
|
+
);
|
|
10
19
|
</script>
|
|
11
20
|
|
|
12
21
|
{#if loaded}
|
|
13
22
|
<!-- TODO: fix-->
|
|
14
|
-
<!-- svelte-ignore
|
|
23
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
15
24
|
<div
|
|
16
25
|
class:table={type === "table"}
|
|
17
26
|
class:gallery={type === "gallery"}
|
|
18
27
|
class:selected
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
onmouseenter={() => (hovered = true)}
|
|
29
|
+
onmouseleave={() => (hovered = false)}
|
|
21
30
|
>
|
|
22
31
|
{#if typeof value === "string"}
|
|
23
32
|
{value}
|
package/dist/Example.svelte.d.ts
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Example: $$__sveltets_2_IsomorphicComponent<{
|
|
1
|
+
type $$ComponentProps = {
|
|
15
2
|
value: (string | number)[][] | string;
|
|
16
3
|
type: "gallery" | "table";
|
|
17
4
|
selected?: boolean;
|
|
18
5
|
index: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type Example = InstanceType<typeof Example>;
|
|
6
|
+
};
|
|
7
|
+
declare const Example: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type Example = ReturnType<typeof Example>;
|
|
23
9
|
export default Example;
|
|
@@ -106,7 +106,10 @@
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// grow the edit-mode textarea to fit its content so the overlay
|
|
109
|
-
// expands the same way the display span does.
|
|
109
|
+
// expands the same way the display span does. `rows="1"` on the element
|
|
110
|
+
// matters: without it `height: auto` falls back to the HTML default of two
|
|
111
|
+
// rows, so scrollHeight reports two lines and a single-line cell renders an
|
|
112
|
+
// edit box roughly twice the row height.
|
|
110
113
|
function use_autosize(node: HTMLTextAreaElement): any {
|
|
111
114
|
function resize(): void {
|
|
112
115
|
node.style.height = "auto";
|
|
@@ -151,6 +154,7 @@
|
|
|
151
154
|
readonly={is_static}
|
|
152
155
|
aria-readonly={is_static}
|
|
153
156
|
aria-label={is_static ? "Cell is read-only" : "Edit cell"}
|
|
157
|
+
rows="1"
|
|
154
158
|
bind:this={el}
|
|
155
159
|
bind:value
|
|
156
160
|
class:header
|
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Example: $$__sveltets_2_IsomorphicComponent<{
|
|
1
|
+
type $$ComponentProps = {
|
|
15
2
|
value: (string | number)[][];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type Example = InstanceType<typeof Example>;
|
|
3
|
+
};
|
|
4
|
+
declare const Example: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type Example = ReturnType<typeof Example>;
|
|
20
6
|
export default Example;
|
package/dist/shared/Table.svelte
CHANGED
|
@@ -53,8 +53,8 @@ export function createSvelteVirtualizer(options) {
|
|
|
53
53
|
options.onChange?.(instance, sync);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
if (
|
|
57
|
-
|
|
56
|
+
if (current_count !== prev_count) {
|
|
57
|
+
version += 1;
|
|
58
58
|
}
|
|
59
59
|
prev_count = current_count;
|
|
60
60
|
});
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children
|
|
6
|
+
}: {
|
|
7
|
+
aria_label?: string;
|
|
8
|
+
root?: string;
|
|
9
|
+
upload?: any;
|
|
10
|
+
stream_handler?: any;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
} = $props();
|
|
6
13
|
</script>
|
|
7
14
|
|
|
8
15
|
<div>
|
|
9
|
-
|
|
16
|
+
{@render children?.()}
|
|
10
17
|
</div>
|
|
11
18
|
|
|
12
19
|
<style>
|
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
15
|
-
default: any;
|
|
16
|
-
} ? Props extends Record<string, never> ? any : {
|
|
17
|
-
children?: any;
|
|
18
|
-
} : {});
|
|
19
|
-
declare const Upload: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
|
-
aria_label?: "";
|
|
21
|
-
root?: "";
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
aria_label?: string;
|
|
4
|
+
root?: string;
|
|
22
5
|
upload?: any;
|
|
23
6
|
stream_handler?: any;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}, {
|
|
29
|
-
default: {};
|
|
30
|
-
}, {
|
|
31
|
-
aria_label: "";
|
|
32
|
-
root: "";
|
|
33
|
-
upload: any;
|
|
34
|
-
stream_handler: any;
|
|
35
|
-
}, string>;
|
|
36
|
-
type Upload = InstanceType<typeof Upload>;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const Upload: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
+
type Upload = ReturnType<typeof Upload>;
|
|
37
11
|
export default Upload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/dataframe",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.3",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"@tanstack/table-core": "^8.21.3",
|
|
17
17
|
"@tanstack/virtual-core": "^3.13.6",
|
|
18
18
|
"@gradio/atoms": "^0.26.1",
|
|
19
|
-
"@gradio/client": "^2.4.0",
|
|
20
19
|
"@gradio/button": "^0.8.2",
|
|
21
20
|
"@gradio/checkbox": "^0.8.2",
|
|
22
21
|
"@gradio/icons": "^0.16.0",
|
|
23
22
|
"@gradio/markdown-code": "^0.10.0",
|
|
24
|
-
"@gradio/
|
|
23
|
+
"@gradio/client": "^2.5.0",
|
|
24
|
+
"@gradio/statustracker": "^0.15.3",
|
|
25
25
|
"@gradio/upload": "^0.18.2",
|
|
26
26
|
"@gradio/utils": "^0.14.0"
|
|
27
27
|
},
|
|
@@ -106,7 +106,10 @@
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// grow the edit-mode textarea to fit its content so the overlay
|
|
109
|
-
// expands the same way the display span does.
|
|
109
|
+
// expands the same way the display span does. `rows="1"` on the element
|
|
110
|
+
// matters: without it `height: auto` falls back to the HTML default of two
|
|
111
|
+
// rows, so scrollHeight reports two lines and a single-line cell renders an
|
|
112
|
+
// edit box roughly twice the row height.
|
|
110
113
|
function use_autosize(node: HTMLTextAreaElement): any {
|
|
111
114
|
function resize(): void {
|
|
112
115
|
node.style.height = "auto";
|
|
@@ -151,6 +154,7 @@
|
|
|
151
154
|
readonly={is_static}
|
|
152
155
|
aria-readonly={is_static}
|
|
153
156
|
aria-label={is_static ? "Cell is read-only" : "Edit cell"}
|
|
157
|
+
rows="1"
|
|
154
158
|
bind:this={el}
|
|
155
159
|
bind:value
|
|
156
160
|
class:header
|
package/shared/Example.svelte
CHANGED
package/shared/Table.svelte
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children
|
|
6
|
+
}: {
|
|
7
|
+
aria_label?: string;
|
|
8
|
+
root?: string;
|
|
9
|
+
upload?: any;
|
|
10
|
+
stream_handler?: any;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
} = $props();
|
|
6
13
|
</script>
|
|
7
14
|
|
|
8
15
|
<div>
|
|
9
|
-
|
|
16
|
+
{@render children?.()}
|
|
10
17
|
</div>
|
|
11
18
|
|
|
12
19
|
<style>
|