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-18 03:31:36 +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 03:31:36 +08:00
|
|
|
<input
|
|
|
|
|
class={widget["send"] == true
|
|
|
|
|
? "widget-input border-red-500"
|
|
|
|
|
: "widget-input focus:border-indigo-500"}
|
|
|
|
|
on:change={() => (
|
|
|
|
|
(widget["send"] = true),
|
|
|
|
|
WSpush(widget.ws, widget.topic, widget.status)
|
|
|
|
|
)}
|
|
|
|
|
bind:value
|
|
|
|
|
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 03:31:36 +08:00
|
|
|
<input
|
|
|
|
|
class={widget["send"] == true
|
|
|
|
|
? "widget-input border-red-500"
|
|
|
|
|
: "widget-input focus:border-indigo-500"}
|
|
|
|
|
on:change={() => (
|
|
|
|
|
(widget["send"] = true),
|
|
|
|
|
WSpush(widget.ws, widget.topic, widget.status)
|
|
|
|
|
)}
|
|
|
|
|
bind:value
|
|
|
|
|
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 03:31:36 +08:00
|
|
|
<input
|
|
|
|
|
class={widget["send"] == true
|
|
|
|
|
? "widget-input border-red-500"
|
|
|
|
|
: "widget-input focus:border-indigo-500"}
|
|
|
|
|
on:change={() => (
|
|
|
|
|
(widget["send"] = true),
|
|
|
|
|
WSpush(widget.ws, widget.topic, widget.status)
|
|
|
|
|
)}
|
|
|
|
|
bind:value
|
|
|
|
|
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 03:31:36 +08:00
|
|
|
<input
|
|
|
|
|
class={widget["send"] == true
|
|
|
|
|
? "widget-input border-red-500"
|
|
|
|
|
: "widget-input focus:border-indigo-500"}
|
|
|
|
|
on:change={() => (
|
|
|
|
|
(widget["send"] = true),
|
|
|
|
|
WSpush(widget.ws, widget.topic, widget.status)
|
|
|
|
|
)}
|
|
|
|
|
bind:value
|
|
|
|
|
type="time" />
|
2021-09-17 23:18:06 +08:00
|
|
|
{/if}
|
2021-09-16 02:00:52 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|