diff --git a/packages/builder/src/components/common/Input.svelte b/packages/builder/src/components/common/Input.svelte index 04272c1d76..03759a1ef2 100644 --- a/packages/builder/src/components/common/Input.svelte +++ b/packages/builder/src/components/common/Input.svelte @@ -5,13 +5,24 @@ export let textAlign = "left" export let width = "160px" export let placeholder = "" + export let suffix = "" + export let onChange = val => {} let centerPlaceholder = textAlign === "center" let style = buildStyle({ width, textAlign }) + + function handleChange(val) { + value = val + let _value = suffix ? value + suffix : value + onChange(_value) + } + + $: displayValue = suffix && value.endsWith(suffix) ? value.replace(new RegExp(`${suffix}$`), "") : value + - + handleChange(e.target.value)} />