From 7689c9607af92b8850cdbcc5d07a7bfc01a5b013 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Thu, 15 Aug 2024 11:34:24 +0200 Subject: [PATCH] :sparkles: Simplify sub component type definition The validation structure/mechanism now makes use of the HasValidation helper type, but disables the 'plugins' validators which are not used or relevant in this context. --- src/formio/components/addressNL.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/formio/components/addressNL.ts b/src/formio/components/addressNL.ts index fb2032e..b1598a1 100644 --- a/src/formio/components/addressNL.ts +++ b/src/formio/components/addressNL.ts @@ -1,6 +1,5 @@ -import {InputComponentSchema} from '..'; -import {HasValidation} from '../base'; -import {ComponentTranslations, ErrorTranslations} from '../i18n'; +import {HasValidation, InputComponentSchema} from '..'; +import {ComponentTranslations} from '../i18n'; type Validator = 'required'; type TranslatableKeys = 'label' | 'description' | 'tooltip'; @@ -15,14 +14,9 @@ export interface AddressData { secretStreetCity?: string; } -export interface ComponentValidation { - validate: HasValidation<'pattern'>; - translatedErrors: ErrorTranslations; -} - export interface AddressComponents { - postcode?: ComponentValidation; - city?: ComponentValidation; + postcode?: HasValidation<'pattern', false>; + city?: HasValidation<'pattern', false>; } export type AddressNLInputSchema = InputComponentSchema;