Fix validation value component always being an input

This commit is contained in:
Andrew Kingston 2021-08-11 16:46:01 +01:00
parent e3545bd02e
commit 25e891c189
1 changed files with 5 additions and 3 deletions

View File

@ -197,6 +197,8 @@
const removeRule = id => { const removeRule = id => {
rules = rules.filter(link => link.id !== id) rules = rules.filter(link => link.id !== id)
} }
$: console.log(fieldType)
</script> </script>
<DrawerContent> <DrawerContent>
@ -277,13 +279,13 @@
/> />
{:else} {:else}
<!-- Otherwise we render a component based on the type --> <!-- Otherwise we render a component based on the type -->
{#if ["string", "number", "options", "longform"].includes(rule.type) || ["contains"]} {#if ["string", "number", "options", "longform"].includes(rule.type)}
<Input <Input
disabled={rule.constraint === "required"} disabled={rule.constraint === "required"}
bind:value={rule.value} bind:value={rule.value}
placeholder="Constraint value" placeholder="Constraint value"
/> />
{:else if fieldType === "boolean"} {:else if rule.type === "boolean"}
<Select <Select
disabled={rule.constraint === "required"} disabled={rule.constraint === "required"}
options={[ options={[
@ -292,7 +294,7 @@
]} ]}
bind:value={rule.value} bind:value={rule.value}
/> />
{:else if fieldType === "datetime"} {:else if rule.type === "datetime"}
<DatePicker <DatePicker
enableTime={false} enableTime={false}
disabled={rule.constraint === "required"} disabled={rule.constraint === "required"}