From 4ff843289db81c109b260cba1f97d2de0effb0fe Mon Sep 17 00:00:00 2001 From: Harald Mack Date: Fri, 18 Oct 2024 15:16:00 +0200 Subject: [PATCH] add 'change' and 'disable when done' functionality to data inptu --- .../lib/components/DataInput/DataInput.svelte | 7 +++-- .../src/lib/components/UserDataInput.svelte | 28 ++++++++++++++----- frontend/src/locales/de.json | 1 + 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/frontend/src/lib/components/DataInput/DataInput.svelte b/frontend/src/lib/components/DataInput/DataInput.svelte index 09edb483..965eb63f 100644 --- a/frontend/src/lib/components/DataInput/DataInput.svelte +++ b/frontend/src/lib/components/DataInput/DataInput.svelte @@ -13,7 +13,7 @@ export let textTrigger: string = 'noAdditionalText'; export let showTextField: boolean = false; export let additionalInput: any = null; - + export let disabled: boolean = false; // data to display and event handlers for dynamcis. export let properties: any = {}; @@ -53,6 +53,7 @@ $: valid = evalValid(value); $: highlight = !valid && properties.required === true; $: showTextField = checkShowTextfield(value); + $: console.log('value in datainput: ', value); {#if label} @@ -62,8 +63,9 @@
{ - done = false; - element?.onchange(); + 'on:change': (e) => { + if (element.onchange) { + element.onchange(e); + } }, 'on:blur': element.onblur, 'on:click': element.onclick }} additionalEventHandlers={{ - 'on:change': () => { - done = false; + 'on:change': (e) => { + if (element.additionalOnChange) { + element.additionalOnChange(e); + } }, 'on:blur': element.onblur, 'on:click': element.onclick @@ -74,10 +78,20 @@ /> {/each} {#if done} -
- +
+ {$_('userData.submitSuccessMessage')}
+ + {:else}