dbgate/packages/web/src/forms/FormSubmit.svelte

21 lines
541 B
Svelte
Raw Normal View History

2021-03-04 09:56:58 +00:00
<script lang="ts">
2021-03-06 07:09:29 +00:00
import FormStyledButton from '../elements/FormStyledButton.svelte';
2021-03-04 09:56:58 +00:00
import { getFormContext } from './FormProviderCore.svelte';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
const { submitActionRef } = getFormContext();
2021-03-04 14:20:08 +00:00
const { values } = getFormContext();
function handleClick() {
dispatch('click', $values);
}
2021-03-04 09:56:58 +00:00
submitActionRef.current = () => {
2021-03-04 14:20:08 +00:00
handleClick();
2021-03-04 09:56:58 +00:00
};
2021-03-04 09:04:34 +00:00
</script>
2021-03-04 14:20:08 +00:00
<FormStyledButton type="submit" on:click={handleClick} {...$$props} />