Upload folder using huggingface_hub
Browse files- 6.2.0/json/Index.svelte +7 -1
- 6.2.0/json/package.json +1 -1
- 6.2.0/json/shared/JSON.svelte +13 -8
- 6.2.0/json/types.ts +3 -1
6.2.0/json/Index.svelte
CHANGED
|
@@ -68,7 +68,13 @@
|
|
| 68 |
show_indices={gradio.props.show_indices}
|
| 69 |
show_copy_button={gradio.props.buttons == null
|
| 70 |
? true
|
| 71 |
-
: gradio.props.buttons.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
{label_height}
|
| 73 |
/>
|
| 74 |
</Block>
|
|
|
|
| 68 |
show_indices={gradio.props.show_indices}
|
| 69 |
show_copy_button={gradio.props.buttons == null
|
| 70 |
? true
|
| 71 |
+
: gradio.props.buttons.some(
|
| 72 |
+
(btn) => typeof btn === "string" && btn === "copy"
|
| 73 |
+
)}
|
| 74 |
+
buttons={gradio.props.buttons}
|
| 75 |
+
on_custom_button_click={(id) => {
|
| 76 |
+
gradio.dispatch("custom_button_click", { id });
|
| 77 |
+
}}
|
| 78 |
{label_height}
|
| 79 |
/>
|
| 80 |
</Block>
|
6.2.0/json/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/json",
|
| 3 |
-
"version": "0.
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/json",
|
| 3 |
+
"version": "0.6.0",
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
6.2.0/json/shared/JSON.svelte
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
import { Empty, IconButtonWrapper, IconButton } from "@gradio/atoms";
|
| 5 |
import JSONNode from "./JSONNode.svelte";
|
| 6 |
import { Copy, Check } from "@gradio/icons";
|
|
|
|
| 7 |
|
| 8 |
export let value: any = {};
|
| 9 |
export let open = false;
|
|
@@ -12,6 +13,8 @@
|
|
| 12 |
export let label_height: number;
|
| 13 |
export let interactive = true;
|
| 14 |
export let show_copy_button = true;
|
|
|
|
|
|
|
| 15 |
|
| 16 |
$: json_max_height = `calc(100% - ${label_height}px)`;
|
| 17 |
|
|
@@ -48,14 +51,16 @@
|
|
| 48 |
</script>
|
| 49 |
|
| 50 |
{#if value && value !== '""' && !is_empty(value)}
|
| 51 |
-
{#if show_copy_button}
|
| 52 |
-
<IconButtonWrapper>
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
| 59 |
</IconButtonWrapper>
|
| 60 |
{/if}
|
| 61 |
<div class="json-holder" style:max-height={json_max_height}>
|
|
|
|
| 4 |
import { Empty, IconButtonWrapper, IconButton } from "@gradio/atoms";
|
| 5 |
import JSONNode from "./JSONNode.svelte";
|
| 6 |
import { Copy, Check } from "@gradio/icons";
|
| 7 |
+
import type { CustomButton as CustomButtonType } from "@gradio/utils";
|
| 8 |
|
| 9 |
export let value: any = {};
|
| 10 |
export let open = false;
|
|
|
|
| 13 |
export let label_height: number;
|
| 14 |
export let interactive = true;
|
| 15 |
export let show_copy_button = true;
|
| 16 |
+
export let buttons: (string | CustomButtonType)[] | null = null;
|
| 17 |
+
export let on_custom_button_click: ((id: number) => void) | null = null;
|
| 18 |
|
| 19 |
$: json_max_height = `calc(100% - ${label_height}px)`;
|
| 20 |
|
|
|
|
| 51 |
</script>
|
| 52 |
|
| 53 |
{#if value && value !== '""' && !is_empty(value)}
|
| 54 |
+
{#if show_copy_button || (buttons && buttons.some((btn) => typeof btn !== "string"))}
|
| 55 |
+
<IconButtonWrapper {buttons} {on_custom_button_click}>
|
| 56 |
+
{#if show_copy_button}
|
| 57 |
+
<IconButton
|
| 58 |
+
show_label={false}
|
| 59 |
+
label={copied ? "Copied" : "Copy"}
|
| 60 |
+
Icon={copied ? Check : Copy}
|
| 61 |
+
on:click={() => handle_copy()}
|
| 62 |
+
/>
|
| 63 |
+
{/if}
|
| 64 |
</IconButtonWrapper>
|
| 65 |
{/if}
|
| 66 |
<div class="json-holder" style:max-height={json_max_height}>
|
6.2.0/json/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import type { LoadingStatus } from "js/statustracker";
|
|
|
|
| 2 |
|
| 3 |
export interface JSONProps {
|
| 4 |
value: any;
|
|
@@ -8,10 +9,11 @@ export interface JSONProps {
|
|
| 8 |
min_height: number | string | undefined;
|
| 9 |
max_height: number | string | undefined;
|
| 10 |
theme_mode: "system" | "light" | "dark";
|
| 11 |
-
buttons: string[];
|
| 12 |
}
|
| 13 |
|
| 14 |
export interface JSONEvents {
|
| 15 |
change: never;
|
| 16 |
clear_status: LoadingStatus;
|
|
|
|
| 17 |
}
|
|
|
|
| 1 |
import type { LoadingStatus } from "js/statustracker";
|
| 2 |
+
import type { CustomButton } from "@gradio/utils";
|
| 3 |
|
| 4 |
export interface JSONProps {
|
| 5 |
value: any;
|
|
|
|
| 9 |
min_height: number | string | undefined;
|
| 10 |
max_height: number | string | undefined;
|
| 11 |
theme_mode: "system" | "light" | "dark";
|
| 12 |
+
buttons: (string | CustomButton)[];
|
| 13 |
}
|
| 14 |
|
| 15 |
export interface JSONEvents {
|
| 16 |
change: never;
|
| 17 |
clear_status: LoadingStatus;
|
| 18 |
+
custom_button_click: { id: number };
|
| 19 |
}
|