custom DB URI support (used by Mongo)

This commit is contained in:
Jan Prochazka
2021-04-10 10:47:36 +02:00
parent e8b43820b9
commit 88b4c9daff
6 changed files with 124 additions and 57 deletions

View File

@@ -0,0 +1,22 @@
<script lang="ts">
import { getFormContext } from './FormProviderCore.svelte';
import uuidv1 from 'uuid/v1';
export let options = [];
export let name;
const { values, setFieldValue } = getFormContext();
let group = $values[name] ?? options.find(x => x.default)?.value;
$: setFieldValue(name, group);
$: optionsWithId = options.map(x => ({ ...x, id: uuidv1() }));
</script>
{#each optionsWithId as option}
<div>
<input type="radio" bind:group value={option.value} id={option.id} />
<label for={option.id}>{option.label}</label>
</div>
{/each}