2022-05-04 05:49:51 +08:00
|
|
|
<script lang="ts">
|
2023-01-18 04:47:40 +08:00
|
|
|
import { Block } from "@gradio/atoms";
|
2023-08-04 06:01:18 +08:00
|
|
|
import Gallery from "./Gallery.svelte";
|
|
|
|
import type { LoadingStatus } from "@gradio/statustracker/types";
|
|
|
|
import { StatusTracker } from "@gradio/statustracker";
|
2022-10-07 13:08:30 +08:00
|
|
|
import type { FileData } from "@gradio/upload";
|
2022-05-04 05:49:51 +08:00
|
|
|
|
2022-05-06 03:05:05 +08:00
|
|
|
export let loading_status: LoadingStatus;
|
2022-05-04 05:49:51 +08:00
|
|
|
export let show_label: boolean;
|
|
|
|
export let label: string;
|
2022-10-07 13:08:30 +08:00
|
|
|
export let root: string;
|
2022-11-04 03:35:56 +08:00
|
|
|
export let root_url: null | string;
|
2023-07-25 22:02:44 +08:00
|
|
|
export let elem_id = "";
|
|
|
|
export let elem_classes: string[] = [];
|
|
|
|
export let visible = true;
|
2023-07-06 08:50:17 +08:00
|
|
|
export let value: (FileData | string | [FileData | string, string])[] | null =
|
|
|
|
null;
|
2023-07-25 22:02:44 +08:00
|
|
|
export let container = true;
|
2023-06-22 03:34:12 +08:00
|
|
|
export let scale: number | null = null;
|
2023-06-08 09:35:31 +08:00
|
|
|
export let min_width: number | undefined = undefined;
|
2023-07-25 22:02:44 +08:00
|
|
|
export let grid_cols: number | number[] | undefined = [2];
|
|
|
|
export let grid_rows: number | number[] | undefined = undefined;
|
2023-06-08 09:35:31 +08:00
|
|
|
export let height: number | "auto" = "auto";
|
|
|
|
export let preview: boolean;
|
2023-07-25 22:02:44 +08:00
|
|
|
export let allow_preview = true;
|
2023-06-08 09:35:31 +08:00
|
|
|
export let object_fit: "contain" | "cover" | "fill" | "none" | "scale-down" =
|
|
|
|
"cover";
|
2023-07-25 22:02:44 +08:00
|
|
|
export let show_share_button = false;
|
2023-08-01 01:31:49 +08:00
|
|
|
export let show_download_button = false;
|
2022-05-04 05:49:51 +08:00
|
|
|
</script>
|
|
|
|
|
2022-06-02 01:02:18 +08:00
|
|
|
<Block
|
2022-06-17 07:49:54 +08:00
|
|
|
{visible}
|
2022-06-02 01:02:18 +08:00
|
|
|
variant="solid"
|
|
|
|
padding={false}
|
|
|
|
{elem_id}
|
2023-03-16 05:01:53 +08:00
|
|
|
{elem_classes}
|
2023-06-08 09:35:31 +08:00
|
|
|
{container}
|
|
|
|
{scale}
|
|
|
|
{min_width}
|
2023-07-06 08:50:17 +08:00
|
|
|
allow_overflow={false}
|
2023-06-08 09:35:31 +08:00
|
|
|
height={typeof height === "number" ? height : undefined}
|
2022-06-02 01:02:18 +08:00
|
|
|
>
|
2022-05-06 03:05:05 +08:00
|
|
|
<StatusTracker {...loading_status} />
|
2023-06-08 09:35:31 +08:00
|
|
|
<Gallery
|
|
|
|
on:select
|
2023-07-06 08:50:17 +08:00
|
|
|
on:share
|
|
|
|
on:error
|
2023-06-08 09:35:31 +08:00
|
|
|
{label}
|
|
|
|
{value}
|
|
|
|
{show_label}
|
|
|
|
{root}
|
|
|
|
{root_url}
|
|
|
|
{grid_cols}
|
|
|
|
{grid_rows}
|
|
|
|
{height}
|
|
|
|
{preview}
|
|
|
|
{object_fit}
|
2023-06-13 05:11:41 +08:00
|
|
|
{allow_preview}
|
2023-07-06 08:50:17 +08:00
|
|
|
{show_share_button}
|
2023-08-01 01:31:49 +08:00
|
|
|
{show_download_button}
|
2023-06-08 09:35:31 +08:00
|
|
|
/>
|
2022-05-04 05:49:51 +08:00
|
|
|
</Block>
|