1
0
Fork 0
mirror of synced 2024-09-21 03:43:21 +12:00
budibase/packages/builder/src/userInterface/StateBindingControl.svelte

47 lines
1.1 KiB
Svelte
Raw Normal View History

2019-09-20 19:01:35 +12:00
<script>
2020-02-03 22:50:30 +13:00
import IconButton from "../common/IconButton.svelte"
import Input from "../common/Input.svelte"
2020-02-11 05:58:20 +13:00
import PropertyCascader from "./PropertyCascader.svelte"
2020-02-03 22:50:30 +13:00
import { isBinding, getBinding, setBinding } from "../common/binding"
export let value = ""
export let onChanged = () => {}
export let type = ""
export let options = []
2019-09-20 19:01:35 +12:00
</script>
2020-02-11 05:58:20 +13:00
<div class="unbound-container">
{#if type === 'bool'}
<div>
2020-02-03 22:50:30 +13:00
<IconButton
2020-02-11 05:58:20 +13:00
icon={value == true ? 'check-square' : 'square'}
size="19"
on:click={() => onChanged(!value)} />
</div>
2020-02-11 05:58:20 +13:00
{:else if type === 'options'}
<select
class="uk-select uk-form-small"
{value}
on:change={ev => onChanged(ev.target.value)}>
{#each (options || []) as option}
2020-02-11 05:58:20 +13:00
<option value={option}>{option}</option>
{/each}
</select>
{:else}
2020-02-11 06:11:22 +13:00
<PropertyCascader {onChanged} {value} />
2020-02-11 05:58:20 +13:00
{/if}
</div>
2019-09-20 19:01:35 +12:00
<style>
2020-02-03 22:50:30 +13:00
.unbound-container {
display: flex;
}
.bound-header > div:nth-child(1) {
flex: 1 0 auto;
width: 30px;
color: var(--secondary50);
padding-left: 5px;
}
</style>