2021-03-31 11:59:07 +02:00
|
|
|
<script>
|
|
|
|
import { createEventDispatcher } from "svelte"
|
2021-04-15 20:28:08 +02:00
|
|
|
import Multiselect from "./Core/Multiselect.svelte"
|
2021-04-15 12:50:56 +02:00
|
|
|
import Field from "./Field.svelte"
|
2021-03-31 11:59:07 +02:00
|
|
|
|
2021-04-19 15:04:07 +02:00
|
|
|
export let value = []
|
|
|
|
export let label = null
|
2021-03-31 11:59:07 +02:00
|
|
|
export let disabled = false
|
2021-04-19 15:04:07 +02:00
|
|
|
export let readonly = false
|
2021-04-15 12:50:56 +02:00
|
|
|
export let labelPosition = "above"
|
|
|
|
export let error = null
|
|
|
|
export let placeholder = null
|
|
|
|
export let options = []
|
|
|
|
export let getOptionLabel = option => option
|
|
|
|
export let getOptionValue = option => option
|
2021-08-20 11:03:21 +02:00
|
|
|
export let sort = false
|
2021-03-31 11:59:07 +02:00
|
|
|
|
2021-04-15 12:50:56 +02:00
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
const onChange = e => {
|
|
|
|
value = e.detail
|
2021-04-20 13:49:02 +02:00
|
|
|
dispatch("change", e.detail)
|
2021-03-31 11:59:07 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-04-29 16:24:59 +02:00
|
|
|
<Field {label} {labelPosition} {error}>
|
2021-04-15 12:50:56 +02:00
|
|
|
<Multiselect
|
|
|
|
{error}
|
|
|
|
{disabled}
|
2021-06-15 20:36:56 +02:00
|
|
|
{readonly}
|
2021-04-15 12:50:56 +02:00
|
|
|
{value}
|
|
|
|
{options}
|
|
|
|
{placeholder}
|
2021-08-20 11:03:21 +02:00
|
|
|
{sort}
|
2021-04-15 12:50:56 +02:00
|
|
|
{getOptionLabel}
|
|
|
|
{getOptionValue}
|
2021-04-19 15:04:07 +02:00
|
|
|
on:change={onChange}
|
2021-05-04 12:04:42 +02:00
|
|
|
on:click
|
|
|
|
/>
|
2021-04-15 12:50:56 +02:00
|
|
|
</Field>
|