mirror of
https://github.com/dbgate/dbgate
synced 2024-11-08 12:47:25 +00:00
25 lines
608 B
Svelte
25 lines
608 B
Svelte
<script lang="ts">
|
|
import FormStyledButton from '../elements/FormStyledButton.svelte';
|
|
import { getFormContext } from './FormProviderCore.svelte';
|
|
import { createEventDispatcher } from 'svelte';
|
|
|
|
export let disabled = false;
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
const { submitActionRef } = getFormContext();
|
|
const { values } = getFormContext();
|
|
|
|
function handleClick() {
|
|
dispatch('click', $values);
|
|
}
|
|
|
|
submitActionRef.set(() => {
|
|
if (!disabled) {
|
|
handleClick();
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<FormStyledButton type="submit" {disabled} on:click={handleClick} {...$$props} />
|