From 4747265c5baf866b264e730c0690d925648b1056 Mon Sep 17 00:00:00 2001 From: wouter-adriaens Date: Wed, 24 Jan 2024 09:12:01 +0100 Subject: [PATCH] #203 Show required per field optionally and update annotation text --- src/components/smart/OeAdres.vue | 41 +++++++++++++++++--------------- src/models/adres.ts | 1 + 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/components/smart/OeAdres.vue b/src/components/smart/OeAdres.vue index 3932bab..8bcddf3 100644 --- a/src/components/smart/OeAdres.vue +++ b/src/components/smart/OeAdres.vue @@ -8,9 +8,9 @@ Land - - {{ '(verplicht)' }} - + VERPLICHT @@ -35,9 +35,9 @@ Gemeente - - {{ '(verplicht)' }} - + VERPLICHT @@ -84,9 +84,9 @@ Postcode - - {{ '(verplicht)' }} - + VERPLICHT @@ -144,9 +144,9 @@ Straat - - {{ '(verplicht)' }} - + VERPLICHT @@ -199,9 +199,9 @@ Huisnummer - - {{ '(verplicht)' }} - + VERPLICHT @@ -259,9 +259,9 @@ Busnummer - - {{ '(verplicht)' }} - + VERPLICHT @@ -342,12 +342,14 @@ import { CrabApiService } from '@services/crab-api.service'; import { requiredIf } from '@utils/i18n-validators'; const props = withDefaults(defineProps(), { + hideTitle: false, + showRequiredPerField: false, config: () => ({ land: { required: true }, gemeente: { required: true }, postcode: { required: true }, straat: { required: true }, - huisnummer: { required: false }, + huisnummer: { required: true }, busnummer: { required: false }, }), api: 'https://test-geo.onroerenderfgoed.be/', @@ -506,6 +508,7 @@ const rules = computed(() => ({ // Init validation instance const v$ = useVuelidate(rules, adres, { $lazy: true }); +defineExpose({ validate: () => v$.value.$validate() }); // Reference data const crabApiService = new CrabApiService(props.api); diff --git a/src/models/adres.ts b/src/models/adres.ts index 35159a9..cac7035 100644 --- a/src/models/adres.ts +++ b/src/models/adres.ts @@ -7,6 +7,7 @@ export interface IAdresProps { countryId?: string; adres?: ILocatieAdres; optionsLimit?: number; + showRequiredPerField?: boolean; } export interface IAdresConfig {