Files
IoTManagerWeb/src/widgets/Input.svelte

30 lines
1.1 KiB
Svelte
Raw Normal View History

2021-09-16 02:00:52 +08:00
<script context="module">
2021-10-17 17:48:59 +08:00
import { WSpush } from "../App.svelte";
2021-09-16 02:00:52 +08:00
</script>
<script>
2021-10-16 21:27:57 +08:00
export let widget;
2021-10-18 02:41:05 +08:00
export let value;
2021-09-16 02:00:52 +08:00
</script>
2021-09-17 23:18:06 +08:00
<div class="card-items">
<div class="md:w-2/3 lg:w-2/3 2xl:w-2/3">
<!-- svelte-ignore a11y-label-has-associated-control -->
2021-10-16 21:27:57 +08:00
<label class="widget-descr-gray-left">{!widget.descr ? "" : widget.descr}</label>
2021-09-17 23:18:06 +08:00
</div>
<div class="md:w-1/3 lg:w-1/3 2xl:w-1/3">
2021-10-16 21:27:57 +08:00
{#if widget.type == "number"}
2021-10-18 02:41:05 +08:00
<input on:change={WSpush(widget.ws, widget.topic, widget.status)} bind:value class="widget-input-indigo text-right" step="0.1" type="number" />
2021-09-17 23:18:06 +08:00
{/if}
2021-10-16 21:27:57 +08:00
{#if widget.type == "text"}
2021-10-18 02:41:05 +08:00
<input on:change={WSpush(widget.ws, widget.topic, widget.status)} bind:value class="widget-input-indigo text-right" type="text" />
2021-09-17 23:18:06 +08:00
{/if}
2021-10-16 21:27:57 +08:00
{#if widget.type == "date"}
2021-10-18 02:41:05 +08:00
<input on:change={WSpush(widget.ws, widget.topic, widget.status)} bind:value class="widget-input-indigo text-right" type="date" />
2021-09-17 23:18:06 +08:00
{/if}
2021-10-16 21:27:57 +08:00
{#if widget.type == "time"}
2021-10-18 02:41:05 +08:00
<input on:change={WSpush(widget.ws, widget.topic, widget.status)} bind:value class="widget-input-indigo text-right" type="time" />
2021-09-17 23:18:06 +08:00
{/if}
2021-09-16 02:00:52 +08:00
</div>
</div>