From b22fc2d0f8de010cf061c38d322575631479fd6d Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 28 Sep 2022 19:52:25 +0200 Subject: [PATCH] fix: change string default input behavior for input arg --- frontend/src/lib/components/ArgInput.svelte | 29 ++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/frontend/src/lib/components/ArgInput.svelte b/frontend/src/lib/components/ArgInput.svelte index c0c2521a1c..542bad3ac4 100644 --- a/frontend/src/lib/components/ArgInput.svelte +++ b/frontend/src/lib/components/ArgInput.svelte @@ -108,7 +108,7 @@ } function validateInput(pattern: string | undefined, v: any): void { - if (required && (v == undefined || v == null)) { + if (required && (v == undefined || v == null || v === '')) { error = 'This field is required' valid = false } else { @@ -132,8 +132,11 @@ } $: { - if (value == undefined) { + if (value == undefined || value == null) { value = defaultValue + if ((defaultValue === undefined || defaultValue === null) && inputCat === 'string') { + value = '' + } } } @@ -181,21 +184,14 @@ {/if} - Preview: + Input preview: {/if} -
- {#if description || error} -
- {description} -
-
- {error === '' ? '...' : error} -
- {:else} -
- {/if} -
+ {#if description} +
+ {description} +
+ {/if}
{#if inputCat == 'number'} @@ -359,5 +355,8 @@ {/if}
+
+ {error === '' ? '...' : error} +