From 85252de9e5916eaedf26af2b665fe2d88d39e704 Mon Sep 17 00:00:00 2001 From: Conor_Mack Date: Tue, 2 Jun 2020 14:01:25 +0100 Subject: [PATCH 1/2] Card Settings and Fix for Input Suffixes --- .../src/components/common/Input.svelte | 13 +- .../userInterface/propertyCategories.js | 6 + .../userInterface/temporaryPanelStructure.js | 30 ++- packages/server/yarn.lock | 190 +----------------- 4 files changed, 49 insertions(+), 190 deletions(-) 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)} />