2019-07-13 11:35:57 +02:00
|
|
|
<script>
|
|
|
|
import {createEventDispatcher} from "svelte";
|
|
|
|
|
|
|
|
export let selected;
|
|
|
|
export let label;
|
|
|
|
export let options;
|
|
|
|
export let valueMember;
|
|
|
|
export let textMember;
|
|
|
|
export let multiple=false;
|
2019-08-07 10:03:49 +02:00
|
|
|
export let width = "medium";
|
|
|
|
export let size = "small";
|
2019-07-13 11:35:57 +02:00
|
|
|
|
|
|
|
const dispatch =createEventDispatcher();
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
2019-08-07 10:03:49 +02:00
|
|
|
<div class="uk-margin">
|
|
|
|
<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>
|