2022-05-04 05:49:51 +08:00
|
|
|
<script lang="ts">
|
2023-01-18 04:47:40 +08:00
|
|
|
import { Block } from "@gradio/atoms";
|
|
|
|
import { Gallery } from "@gradio/gallery";
|
2022-05-06 03:05:05 +08:00
|
|
|
import type { LoadingStatus } from "../StatusTracker/types";
|
|
|
|
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
|
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;
|
2022-05-12 12:40:41 +08:00
|
|
|
export let elem_id: string = "";
|
2023-03-16 05:01:53 +08:00
|
|
|
export let elem_classes: Array<string> = [];
|
2022-06-17 07:49:54 +08:00
|
|
|
export let visible: boolean = true;
|
2022-10-07 13:08:30 +08:00
|
|
|
export let value: Array<string> | Array<FileData> | null = null;
|
2023-06-08 09:35:31 +08:00
|
|
|
export let container: boolean = false;
|
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;
|
|
|
|
export let grid_cols: number | Array<number> | undefined = [2];
|
|
|
|
export let grid_rows: number | Array<number> | undefined = undefined;
|
|
|
|
export let height: number | "auto" = "auto";
|
|
|
|
export let preview: boolean;
|
2023-06-13 05:11:41 +08:00
|
|
|
export let allow_preview: boolean = true;
|
2023-06-08 09:35:31 +08:00
|
|
|
export let object_fit: "contain" | "cover" | "fill" | "none" | "scale-down" =
|
|
|
|
"cover";
|
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}
|
|
|
|
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
|
|
|
|
{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-06-08 09:35:31 +08:00
|
|
|
/>
|
2022-05-04 05:49:51 +08:00
|
|
|
</Block>
|