2019-07-13 11:35:57 +02:00
|
|
|
<script>
|
2020-02-03 10:50:30 +01:00
|
|
|
import { createEventDispatcher } from "svelte"
|
|
|
|
|
|
|
|
export let selected
|
|
|
|
export let label
|
|
|
|
export let options
|
|
|
|
export let valueMember
|
|
|
|
export let textMember
|
|
|
|
export let multiple = false
|
|
|
|
export let width = "medium"
|
|
|
|
export let size = "small"
|
|
|
|
|
|
|
|
const dispatch = createEventDispatcher()
|
2019-07-13 11:35:57 +02:00
|
|
|
</script>
|
|
|
|
|
2019-08-07 10:03:49 +02:00
|
|
|
<div class="uk-margin">
|
2020-02-03 10:50:30 +01:00
|
|
|
<label class="uk-form-label">{label}</label>
|
|
|
|
<div class="uk-form-controls">
|
|
|
|
{#if multiple}
|
|
|
|
<select
|
|
|
|
class="uk-select uk-form-width-{width} uk-form-{size}"
|
|
|
|
multiple
|
|
|
|
bind:value={selected}
|
|
|
|
on:change>
|
|
|
|
{#each options as option}
|
|
|
|
<option value={!valueMember ? option : valueMember(option)}>
|
|
|
|
{!textMember ? option : textMember(option)}
|
|
|
|
</option>
|
|
|
|
{/each}
|
|
|
|
</select>
|
|
|
|
{:else}
|
|
|
|
<select
|
|
|
|
class="uk-select uk-form-width-{width} uk-form-{size}"
|
|
|
|
bind:value={selected}
|
|
|
|
on:change>
|
|
|
|
{#each options as option}
|
|
|
|
<option value={!valueMember ? option : valueMember(option)}>
|
|
|
|
{!textMember ? option : textMember(option)}
|
|
|
|
</option>
|
|
|
|
{/each}
|
|
|
|
</select>
|
|
|
|
{/if}
|
|
|
|
</div>
|
2019-07-13 11:35:57 +02:00
|
|
|
</div>
|