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-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">
|
|
|
|
|
<!-- on:change={WSpush(ws, topic, value)} -->
|
2021-10-16 21:27:57 +08:00
|
|
|
{#if widget.type == "number"}
|
2021-10-17 20:03:47 +08:00
|
|
|
<input class="widget-input-indigo widget-input-red={widget['send'] == true} text-right" step="0.1" on:change={((widget["send"] = true), WSpush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} 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-17 20:03:47 +08:00
|
|
|
<input class="widget-input-indigo text-right" on:change={((widget["send"] = true), WSpush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} 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-17 20:03:47 +08:00
|
|
|
<input class="widget-input-indigo text-right" on:change={((widget["send"] = true), WSpush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} 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-17 20:03:47 +08:00
|
|
|
<input class="widget-input-indigo text-right" on:change={((widget["send"] = true), WSpush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} type="time" />
|
2021-09-17 23:18:06 +08:00
|
|
|
{/if}
|
2021-09-16 02:00:52 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|