diff --git a/src/lib/components/Formly.svelte b/src/lib/components/Formly.svelte index 0966e3a..6ed44cf 100644 --- a/src/lib/components/Formly.svelte +++ b/src/lib/components/Formly.svelte @@ -65,6 +65,8 @@ // Props. export let fields: IField[] = []; + + export let defaultButtons = true; export let btnSubmit: IBtnSubmit = { text: 'Submit' }; @@ -73,7 +75,6 @@ }; export let form_name: string = ''; - export let realtime: boolean = false; let _formEl: HTMLFormElement; // Dispatch values. @@ -145,9 +146,8 @@ // Update form. storeForms.save(current_form); - if (realtime) { - dispatch('update', { ...current_form.values, valid: current_form.valid }); - } + dispatch('update', { ...current_form.values, valid: current_form.valid }); + }; // Submit form. @@ -163,6 +163,8 @@ }); await storeForms.resetValues(form_name); current_form.values = values; + + dispatch('reset', { ...values, valid: current_form.valid }); }; @@ -193,6 +195,7 @@ {/if} {/each} + {#if defaultButtons} + {/if} {/if} {/if}