2021-01-28 17:31:55 +01:00
|
|
|
<script>
|
2021-04-16 12:32:41 +02:00
|
|
|
import { CoreCheckbox } from "@budibase/bbui"
|
2021-02-05 11:53:25 +01:00
|
|
|
import Field from "./Field.svelte"
|
2021-01-28 17:31:55 +01:00
|
|
|
|
|
|
|
export let field
|
|
|
|
export let label
|
|
|
|
export let text
|
2021-02-17 16:16:44 +01:00
|
|
|
export let disabled = false
|
2021-01-28 17:31:55 +01:00
|
|
|
|
|
|
|
let fieldState
|
|
|
|
let fieldApi
|
|
|
|
</script>
|
|
|
|
|
2021-02-05 11:53:25 +01:00
|
|
|
<Field
|
2021-02-01 12:14:24 +01:00
|
|
|
{label}
|
|
|
|
{field}
|
2021-02-17 16:16:44 +01:00
|
|
|
{disabled}
|
2021-02-05 11:53:25 +01:00
|
|
|
type="boolean"
|
2021-02-01 12:14:24 +01:00
|
|
|
bind:fieldState
|
|
|
|
bind:fieldApi
|
2021-05-04 12:04:42 +02:00
|
|
|
defaultValue={false}
|
|
|
|
>
|
2021-01-28 17:31:55 +01:00
|
|
|
{#if fieldState}
|
2021-04-16 12:32:41 +02:00
|
|
|
<CoreCheckbox
|
|
|
|
value={$fieldState.value}
|
|
|
|
disabled={$fieldState.disabled}
|
|
|
|
error={$fieldState.error}
|
2021-04-16 15:30:33 +02:00
|
|
|
id={$fieldState.fieldId}
|
2021-05-04 12:32:22 +02:00
|
|
|
on:change={e => fieldApi.setValue(e.detail)}
|
2021-05-04 12:04:42 +02:00
|
|
|
{text}
|
|
|
|
/>
|
2021-01-28 17:31:55 +01:00
|
|
|
{/if}
|
2021-02-05 11:53:25 +01:00
|
|
|
</Field>
|