From c28b8295f0df7dd6b7f568595c52d2cc33da998f Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:04:49 +0100 Subject: [PATCH 1/2] [#29] Add `address` type --- src/formio/components/address.ts | 22 ++++++++++++++++++++++ src/formio/components/index.ts | 1 + src/formio/index.ts | 3 +++ 3 files changed, 26 insertions(+) create mode 100644 src/formio/components/address.ts diff --git a/src/formio/components/address.ts b/src/formio/components/address.ts new file mode 100644 index 0000000..7eb6635 --- /dev/null +++ b/src/formio/components/address.ts @@ -0,0 +1,22 @@ +import {InputComponentSchema} from '..'; + +type Validator = 'required'; +type TranslatableKeys = 'label' | 'description' | 'tooltip'; + +export interface AddressData { + postcode: string; + housenumber: string; + houseletter?: string; + housenumberaddition?: string; +} + +export type AddressInputSchema = InputComponentSchema; + +/** + * @group Form.io components + * @category Concrete types + */ +export interface AddressComponentSchema + extends Omit { + type: 'address'; +} diff --git a/src/formio/components/index.ts b/src/formio/components/index.ts index 9597ef6..629ae61 100644 --- a/src/formio/components/index.ts +++ b/src/formio/components/index.ts @@ -18,6 +18,7 @@ export * from './checkbox'; export * from './selectboxes'; export * from './file'; export * from './radio'; +export * from './address'; // Layout components export * from './content'; diff --git a/src/formio/index.ts b/src/formio/index.ts index abc6acc..acfe4bb 100644 --- a/src/formio/index.ts +++ b/src/formio/index.ts @@ -1,4 +1,5 @@ import { + AddressComponentSchema, BsnComponentSchema, CheckboxComponentSchema, ContentComponentSchema, @@ -66,6 +67,8 @@ export type AnyComponentSchema = | LicensePlateComponentSchema | BsnComponentSchema | NpFamilyMembersComponentSchema + // Composed types + | AddressComponentSchema // layout | ContentComponentSchema; From 8079f19fd3bbc563e460bb2e7a5e8e1aef585bec Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Thu, 30 Nov 2023 14:10:56 +0100 Subject: [PATCH 2/2] PR feedback --- src/formio/components/address.ts | 8 ++++---- src/formio/index.ts | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/formio/components/address.ts b/src/formio/components/address.ts index 7eb6635..32e5839 100644 --- a/src/formio/components/address.ts +++ b/src/formio/components/address.ts @@ -5,9 +5,9 @@ type TranslatableKeys = 'label' | 'description' | 'tooltip'; export interface AddressData { postcode: string; - housenumber: string; - houseletter?: string; - housenumberaddition?: string; + houseNumber: string; + houseLetter: string; + houseNumberAddition: string; } export type AddressInputSchema = InputComponentSchema; @@ -17,6 +17,6 @@ export type AddressInputSchema = InputComponentSchema { + extends Omit { type: 'address'; } diff --git a/src/formio/index.ts b/src/formio/index.ts index acfe4bb..7b95d71 100644 --- a/src/formio/index.ts +++ b/src/formio/index.ts @@ -67,7 +67,6 @@ export type AnyComponentSchema = | LicensePlateComponentSchema | BsnComponentSchema | NpFamilyMembersComponentSchema - // Composed types | AddressComponentSchema // layout | ContentComponentSchema;