2022-02-07 22:34:53 +08:00
|
|
|
<script lang="ts">
|
2023-08-24 04:48:10 +08:00
|
|
|
import type { Gradio } from "@gradio/utils";
|
2023-08-04 06:01:18 +08:00
|
|
|
import Slider from "../shared";
|
2022-04-26 22:48:39 +08:00
|
|
|
import { Block } from "@gradio/atoms";
|
2023-08-04 06:01:18 +08:00
|
|
|
import { StatusTracker } from "@gradio/statustracker";
|
2023-08-16 02:21:41 +08:00
|
|
|
import type { LoadingStatus } from "@gradio/statustracker";
|
2023-08-18 19:36:52 +08:00
|
|
|
import { _ } from "svelte-i18n";
|
2022-03-08 21:35:42 +08:00
|
|
|
|
2023-08-04 06:01:18 +08:00
|
|
|
export let elem_id = "";
|
|
|
|
export let elem_classes: string[] = [];
|
|
|
|
export let visible = true;
|
|
|
|
export let value = 0;
|
2023-08-18 19:36:52 +08:00
|
|
|
export let label = $_("slider.slider");
|
2023-02-23 07:16:15 +08:00
|
|
|
export let info: string | undefined = undefined;
|
2023-08-04 06:01:18 +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;
|
2022-02-07 22:34:53 +08:00
|
|
|
export let minimum: number;
|
|
|
|
export let maximum: number;
|
|
|
|
export let step: number;
|
2022-04-27 18:47:15 +08:00
|
|
|
export let show_label: boolean;
|
2022-03-24 21:08:13 +08:00
|
|
|
|
2022-05-06 03:05:05 +08:00
|
|
|
export let loading_status: LoadingStatus;
|
2023-08-04 06:01:18 +08:00
|
|
|
export let value_is_output = false;
|
2023-08-24 04:48:10 +08:00
|
|
|
export let gradio: Gradio<{
|
|
|
|
change: never;
|
|
|
|
input: never;
|
|
|
|
release: number;
|
|
|
|
}>;
|
2022-02-01 21:45:55 +08:00
|
|
|
</script>
|
|
|
|
|
2023-06-08 09:35:31 +08:00
|
|
|
<Block {visible} {elem_id} {elem_classes} {container} {scale} {min_width}>
|
2022-05-06 03:05:05 +08:00
|
|
|
<StatusTracker {...loading_status} />
|
2022-04-26 22:48:39 +08:00
|
|
|
|
2023-08-04 06:01:18 +08:00
|
|
|
<Slider
|
2022-04-26 22:48:39 +08:00
|
|
|
bind:value
|
2023-05-16 09:36:57 +08:00
|
|
|
bind:value_is_output
|
2022-04-26 22:48:39 +08:00
|
|
|
{label}
|
2023-02-23 07:16:15 +08:00
|
|
|
{info}
|
2022-04-27 18:47:15 +08:00
|
|
|
{show_label}
|
2022-04-26 22:48:39 +08:00
|
|
|
{minimum}
|
|
|
|
{maximum}
|
|
|
|
{step}
|
2023-08-24 04:48:10 +08:00
|
|
|
on:input={() => gradio.dispatch("input")}
|
|
|
|
on:change={() => gradio.dispatch("change")}
|
|
|
|
on:release={(e) => gradio.dispatch("release", e.detail)}
|
2022-04-26 22:48:39 +08:00
|
|
|
/>
|
|
|
|
</Block>
|