@gradio/dataframe 0.5.1 → 0.6.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 +18 -1
- package/Dataframe.stories.svelte +38 -0
- package/Index.svelte +2 -0
- package/package.json +8 -8
- package/shared/EditableCell.svelte +4 -0
- package/shared/Table.svelte +5 -5
- package/shared/VirtualTable.svelte +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @gradio/dataframe
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- [#7354](https://github.com/gradio-app/gradio/pull/7354) [`a7fa47a`](https://github.com/gradio-app/gradio/commit/a7fa47a175fbcf0fd6573ca19334a3a55b55bb24) - ensure Dataframes in background tabs are visible when the tab is selected. Thanks [@pngwn](https://github.com/pngwn)!
|
|
8
|
+
|
|
9
|
+
## 0.6.0
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- [#7298](https://github.com/gradio-app/gradio/pull/7298) [`e5344ba`](https://github.com/gradio-app/gradio/commit/e5344ba0cd63d21dbb525330bbc07ca2eca57832) - chore(deps): update dependency marked to v12. Thanks [@renovate](https://github.com/apps/renovate)!
|
|
14
|
+
- [#7154](https://github.com/gradio-app/gradio/pull/7154) [`aab2a75`](https://github.com/gradio-app/gradio/commit/aab2a75f0610dd7ed0b481264c6b9f01cfe92094) - Allow selecting texts in dataframe cells. Thanks [@shubhamofbce](https://github.com/shubhamofbce)!
|
|
15
|
+
|
|
16
|
+
### Fixes
|
|
17
|
+
|
|
18
|
+
- [#7283](https://github.com/gradio-app/gradio/pull/7283) [`757dba6`](https://github.com/gradio-app/gradio/commit/757dba66baf624eae11ff076f0e8d6bfc2314630) - Add `show_label` check to `gr.Dataframe`. Thanks [@hannahblair](https://github.com/hannahblair)!
|
|
19
|
+
|
|
3
20
|
## 0.5.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -326,4 +343,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
|
|
|
326
343
|
|
|
327
344
|
- Updated dependencies [[`667875b2`](https://github.com/gradio-app/gradio/commit/667875b2441753e74d25bd9d3c8adedd8ede11cd), [`37caa2e0`](https://github.com/gradio-app/gradio/commit/37caa2e0fe95d6cab8beb174580fb557904f137f)]:
|
|
328
345
|
- @gradio/upload@0.0.3
|
|
329
|
-
- @gradio/button@0.1.0
|
|
346
|
+
- @gradio/button@0.1.0
|
package/Dataframe.stories.svelte
CHANGED
|
@@ -39,6 +39,44 @@
|
|
|
39
39
|
}}
|
|
40
40
|
/>
|
|
41
41
|
|
|
42
|
+
<Story
|
|
43
|
+
name="Interactive dataframe with label"
|
|
44
|
+
args={{
|
|
45
|
+
value: {
|
|
46
|
+
data: [
|
|
47
|
+
["Cat", 5],
|
|
48
|
+
["Horse", 3],
|
|
49
|
+
["Snake", 1]
|
|
50
|
+
],
|
|
51
|
+
headers: ["Animal", "Votes"],
|
|
52
|
+
metadata: null
|
|
53
|
+
},
|
|
54
|
+
label: "Animals",
|
|
55
|
+
show_label: true,
|
|
56
|
+
col_count: [2, "dynamic"],
|
|
57
|
+
row_count: [3, "dynamic"]
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<Story
|
|
62
|
+
name="Interactive dataframe no label"
|
|
63
|
+
args={{
|
|
64
|
+
value: {
|
|
65
|
+
data: [
|
|
66
|
+
["Cat", 5],
|
|
67
|
+
["Horse", 3],
|
|
68
|
+
["Snake", 1]
|
|
69
|
+
],
|
|
70
|
+
headers: ["Animal", "Votes"],
|
|
71
|
+
metadata: null
|
|
72
|
+
},
|
|
73
|
+
label: "Animals",
|
|
74
|
+
show_label: false,
|
|
75
|
+
col_count: [2, "dynamic"],
|
|
76
|
+
row_count: [3, "dynamic"]
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
|
|
42
80
|
<Story
|
|
43
81
|
name="Static dataframe"
|
|
44
82
|
args={{
|
package/Index.svelte
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
export let col_count: [number, "fixed" | "dynamic"];
|
|
26
26
|
export let row_count: [number, "fixed" | "dynamic"];
|
|
27
27
|
export let label: string | null = null;
|
|
28
|
+
export let show_label = true;
|
|
28
29
|
export let wrap: boolean;
|
|
29
30
|
export let datatype: Datatype | Datatype[];
|
|
30
31
|
export let scale: number | null = null;
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
<Table
|
|
96
97
|
{root}
|
|
97
98
|
{label}
|
|
99
|
+
{show_label}
|
|
98
100
|
{row_count}
|
|
99
101
|
{col_count}
|
|
100
102
|
{value}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/dataframe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"dequal": "^2.0.2",
|
|
17
17
|
"dompurify": "^3.0.3",
|
|
18
18
|
"katex": "^0.16.7",
|
|
19
|
-
"marked": "^
|
|
20
|
-
"@gradio/atoms": "^0.5.
|
|
21
|
-
"@gradio/
|
|
22
|
-
"@gradio/
|
|
23
|
-
"@gradio/
|
|
24
|
-
"@gradio/
|
|
25
|
-
"@gradio/
|
|
19
|
+
"marked": "^12.0.0",
|
|
20
|
+
"@gradio/atoms": "^0.5.1",
|
|
21
|
+
"@gradio/button": "^0.2.20",
|
|
22
|
+
"@gradio/markdown": "^0.6.2",
|
|
23
|
+
"@gradio/utils": "^0.2.2",
|
|
24
|
+
"@gradio/upload": "^0.7.2",
|
|
25
|
+
"@gradio/statustracker": "^0.4.5"
|
|
26
26
|
},
|
|
27
27
|
"exports": {
|
|
28
28
|
".": "./Index.svelte",
|
package/shared/Table.svelte
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
export let datatype: Datatype | Datatype[];
|
|
21
21
|
export let label: string | null = null;
|
|
22
|
+
export let show_label = true;
|
|
22
23
|
export let headers: Headers = [];
|
|
23
24
|
let values: (string | number)[][];
|
|
24
25
|
export let value: { data: Data; headers: Headers; metadata: Metadata } | null;
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
let selected: false | [number, number] = false;
|
|
43
44
|
let display_value: string[][] | null = value?.metadata?.display_value ?? null;
|
|
44
45
|
let styling: string[][] | null = value?.metadata?.styling ?? null;
|
|
46
|
+
let t_rect: DOMRectReadOnly;
|
|
45
47
|
|
|
46
48
|
$: {
|
|
47
49
|
if (value) {
|
|
@@ -522,8 +524,6 @@
|
|
|
522
524
|
|
|
523
525
|
let dragging = false;
|
|
524
526
|
|
|
525
|
-
let t_width = 0;
|
|
526
|
-
|
|
527
527
|
function get_max(
|
|
528
528
|
_d: { value: any; id: string }[][]
|
|
529
529
|
): { value: any; id: string }[] {
|
|
@@ -616,6 +616,7 @@
|
|
|
616
616
|
$: selected_index = !!selected && selected[0];
|
|
617
617
|
|
|
618
618
|
let is_visible = false;
|
|
619
|
+
|
|
619
620
|
onMount(() => {
|
|
620
621
|
const observer = new IntersectionObserver((entries, observer) => {
|
|
621
622
|
entries.forEach((entry) => {
|
|
@@ -643,7 +644,7 @@
|
|
|
643
644
|
/>
|
|
644
645
|
|
|
645
646
|
<div class:label={label && label.length !== 0} use:copy>
|
|
646
|
-
{#if label && label.length !== 0}
|
|
647
|
+
{#if label && label.length !== 0 && show_label}
|
|
647
648
|
<p>
|
|
648
649
|
{label}
|
|
649
650
|
</p>
|
|
@@ -659,7 +660,7 @@
|
|
|
659
660
|
tabindex="0"
|
|
660
661
|
>
|
|
661
662
|
<table
|
|
662
|
-
bind:
|
|
663
|
+
bind:contentRect={t_rect}
|
|
663
664
|
bind:this={table}
|
|
664
665
|
class:fixed-layout={column_widths.length != 0}
|
|
665
666
|
>
|
|
@@ -734,7 +735,6 @@
|
|
|
734
735
|
>
|
|
735
736
|
<VirtualTable
|
|
736
737
|
bind:items={data}
|
|
737
|
-
table_width={t_width}
|
|
738
738
|
max_height={height}
|
|
739
739
|
bind:actual_height={table_height}
|
|
740
740
|
bind:table_scrollbar_width={scrollbar_width}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
export let items: any[][] = [];
|
|
6
6
|
|
|
7
|
-
export let table_width: number;
|
|
8
7
|
export let max_height: number;
|
|
9
8
|
export let actual_height: number;
|
|
10
9
|
export let table_scrollbar_width: number;
|
|
@@ -25,12 +24,15 @@
|
|
|
25
24
|
let viewport: HTMLTableElement;
|
|
26
25
|
let viewport_height = 0;
|
|
27
26
|
let visible: { index: number; data: any[] }[] = [];
|
|
27
|
+
let viewport_box: DOMRectReadOnly;
|
|
28
|
+
|
|
29
|
+
$: viewport_height = viewport_box?.height || 0;
|
|
28
30
|
|
|
29
31
|
$: if (mounted) requestAnimationFrame(() => refresh_height_map(sortedItems));
|
|
30
32
|
|
|
31
33
|
let content_height = 0;
|
|
32
34
|
async function refresh_height_map(_items: typeof items): Promise<void> {
|
|
33
|
-
if (viewport_height === 0
|
|
35
|
+
if (viewport_height === 0) {
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
38
|
const { scrollTop } = viewport;
|
|
@@ -83,6 +85,7 @@
|
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
$: scroll_and_render(selected);
|
|
88
|
+
|
|
86
89
|
async function scroll_and_render(n: number | false): Promise<void> {
|
|
87
90
|
requestAnimationFrame(async () => {
|
|
88
91
|
if (typeof n !== "number") return;
|
|
@@ -244,7 +247,7 @@
|
|
|
244
247
|
<table
|
|
245
248
|
class="table"
|
|
246
249
|
bind:this={viewport}
|
|
247
|
-
bind:
|
|
250
|
+
bind:contentRect={viewport_box}
|
|
248
251
|
on:scroll={handle_scroll}
|
|
249
252
|
style="height: {height}; --bw-svt-p-top: {top}px; --bw-svt-p-bottom: {bottom}px; --bw-svt-head-height: {head_height}px; --bw-svt-foot-height: {foot_height}px; --bw-svt-avg-row-height: {average_height}px"
|
|
250
253
|
>
|