form provider

This commit is contained in:
Jan Prochazka
2021-03-04 10:56:58 +01:00
parent 593e61abb9
commit 7acea0f4ac
7 changed files with 98 additions and 11 deletions

View File

@@ -1,5 +1,15 @@
<script>
<script lang="ts">
import FormStyledButton from '../widgets/FormStyledButton.svelte';
import { getFormContext } from './FormProviderCore.svelte';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
const { submitActionRef } = getFormContext();
submitActionRef.current = () => {
dispatch('click');
};
</script>
<FormStyledButton type="submit" on:click {...$$props} />