From 1b4a24fe83ae06645637029d14bcc335300e87de Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 10 Aug 2021 14:37:14 +0100 Subject: [PATCH] Add custom validation support to all fields except relationships --- .../src/forms/AttachmentField.svelte | 3 +++ .../standard-components/src/forms/BooleanField.svelte | 2 ++ .../src/forms/DateTimeField.svelte | 11 ++++++++++- packages/standard-components/src/forms/Field.svelte | 8 +++++++- .../src/forms/LongFormField.svelte | 2 ++ .../standard-components/src/forms/OptionsField.svelte | 2 ++ .../src/forms/RelationshipField.svelte | 2 ++ .../standard-components/src/forms/StringField.svelte | 2 ++ 8 files changed, 30 insertions(+), 2 deletions(-) diff --git a/packages/standard-components/src/forms/AttachmentField.svelte b/packages/standard-components/src/forms/AttachmentField.svelte index 0b454f9800..f2c4a35030 100644 --- a/packages/standard-components/src/forms/AttachmentField.svelte +++ b/packages/standard-components/src/forms/AttachmentField.svelte @@ -6,6 +6,7 @@ export let field export let label export let disabled = false + export let validation let fieldState let fieldApi @@ -35,6 +36,7 @@ {label} {field} {disabled} + {validation} type="attachment" bind:fieldState bind:fieldApi @@ -44,6 +46,7 @@ { fieldApi.setValue(e.detail) }} diff --git a/packages/standard-components/src/forms/BooleanField.svelte b/packages/standard-components/src/forms/BooleanField.svelte index 17a3c563bc..4634dd1062 100644 --- a/packages/standard-components/src/forms/BooleanField.svelte +++ b/packages/standard-components/src/forms/BooleanField.svelte @@ -6,6 +6,7 @@ export let label export let text export let disabled = false + export let validation let fieldState let fieldApi @@ -15,6 +16,7 @@ {label} {field} {disabled} + {validation} type="boolean" bind:fieldState bind:fieldApi diff --git a/packages/standard-components/src/forms/DateTimeField.svelte b/packages/standard-components/src/forms/DateTimeField.svelte index 9332cfa721..9a5babae33 100644 --- a/packages/standard-components/src/forms/DateTimeField.svelte +++ b/packages/standard-components/src/forms/DateTimeField.svelte @@ -7,12 +7,21 @@ export let placeholder export let disabled = false export let enableTime = false + export let validation let fieldState let fieldApi - + {#if fieldState}