budibase/packages/builder/src/userInterface/StateBindingControl.svelte

71 lines
1.5 KiB
Svelte
Raw Normal View History

2019-09-20 09:01:35 +02:00
<script>
2020-02-03 10:50:30 +01:00
import IconButton from "../common/IconButton.svelte"
import Input from "../common/Input.svelte"
2020-02-10 17:58:20 +01:00
import PropertyCascader from "./PropertyCascader.svelte"
2020-02-03 10:50:30 +01:00
import { isBinding, getBinding, setBinding } from "../common/binding"
export let value = ""
export let onChanged = () => {}
export let type = ""
export let options = []
2019-09-20 09:01:35 +02:00
</script>
2020-02-10 17:58:20 +01:00
<div class="unbound-container">
{#if type === 'bool'}
<div>
2020-02-03 10:50:30 +01:00
<IconButton
2020-02-10 17:58:20 +01:00
icon={value == true ? 'check-square' : 'square'}
size="19"
on:click={() => onChanged(!value)} />
</div>
2020-02-10 17:58:20 +01:00
{:else if type === 'options'}
<select
class="uk-select uk-form-small"
{value}
on:change={ev => onChanged(ev.target.value)}>
{#each options as option}
<option value={option}>{option}</option>
{/each}
</select>
{:else}
<PropertyCascader
{onChanged}
{type}
on:change={ev => onChanged(ev.target.value)}
/>
{/if}
</div>
2019-09-20 09:01:35 +02:00
<style>
2020-02-03 10:50:30 +01:00
.unbound-container {
display: flex;
}
2020-02-10 17:58:20 +01:00
/* .bound-header {
2020-02-03 10:50:30 +01:00
display: flex;
2020-02-10 17:58:20 +01:00
} */
2020-02-03 10:50:30 +01:00
.bound-header > div:nth-child(1) {
flex: 1 0 auto;
width: 30px;
color: var(--secondary50);
padding-left: 5px;
}
2020-02-10 17:58:20 +01:00
/* .binding-prop-label {
2020-02-03 10:50:30 +01:00
color: var(--secondary50);
}
input {
font-size: 12px;
font-weight: 700;
color: #163057;
opacity: 0.7;
padding: 5px 10px;
box-sizing: border-box;
border: 1px solid #dbdbdb;
border-radius: 2px;
outline: none;
2020-02-10 17:58:20 +01:00
} */
</style>