Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#29] Add address type #30

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/formio/components/address.ts
Original file line number Diff line number Diff line change
@@ -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;
Viicos marked this conversation as resolved.
Show resolved Hide resolved
}

export type AddressInputSchema = InputComponentSchema<AddressData, Validator, TranslatableKeys>;

/**
* @group Form.io components
* @category Concrete types
*/
export interface AddressComponentSchema
extends Omit<AddressInputSchema, 'hideLabel' | 'placeholder' | 'disabled'> {
Viicos marked this conversation as resolved.
Show resolved Hide resolved
Viicos marked this conversation as resolved.
Show resolved Hide resolved
type: 'address';
}
1 change: 1 addition & 0 deletions src/formio/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export * from './checkbox';
export * from './selectboxes';
export * from './file';
export * from './radio';
export * from './address';

// Layout components
export * from './content';
3 changes: 3 additions & 0 deletions src/formio/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
AddressComponentSchema,
BsnComponentSchema,
CheckboxComponentSchema,
ContentComponentSchema,
Expand Down Expand Up @@ -66,6 +67,8 @@ export type AnyComponentSchema =
| LicensePlateComponentSchema
| BsnComponentSchema
| NpFamilyMembersComponentSchema
// Composed types
| AddressComponentSchema
Viicos marked this conversation as resolved.
Show resolved Hide resolved
// layout
| ContentComponentSchema;

Expand Down