From f49e79cc0b65bd26475dbded4068c76d7dbc8449 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:08:04 +0300 Subject: [PATCH] refactor: Migrate `FormInputs` to composition API (no-changelog) (#9756) --- .../src/components/N8nFormBox/FormBox.vue | 6 +- .../components/N8nFormInputs/FormInputs.vue | 218 ++++++++---------- 2 files changed, 101 insertions(+), 123 deletions(-) diff --git a/packages/design-system/src/components/N8nFormBox/FormBox.vue b/packages/design-system/src/components/N8nFormBox/FormBox.vue index 2c9d875dd10c8..243010b366020 100644 --- a/packages/design-system/src/components/N8nFormBox/FormBox.vue +++ b/packages/design-system/src/components/N8nFormBox/FormBox.vue @@ -56,6 +56,8 @@ interface FormBoxProps { redirectLink?: string; } +type Value = string | number | boolean | null | undefined; + defineOptions({ name: 'N8nFormBox' }); withDefaults(defineProps(), { title: '', @@ -68,8 +70,8 @@ withDefaults(defineProps(), { const formBus = createEventBus(); const $emit = defineEmits(['submit', 'update', 'secondaryClick']); -const onUpdateModelValue = (e: { name: string; value: string }) => $emit('update', e); -const onSubmit = (e: { [key: string]: string }) => $emit('submit', e); +const onUpdateModelValue = (e: { name: string; value: Value }) => $emit('update', e); +const onSubmit = (e: { [key: string]: Value }) => $emit('submit', e); const onButtonClick = () => formBus.emit('submit'); const onSecondaryButtonClick = (event: Event) => $emit('secondaryClick', event); diff --git a/packages/design-system/src/components/N8nFormInputs/FormInputs.vue b/packages/design-system/src/components/N8nFormInputs/FormInputs.vue index b49103493eb14..842879fa65dbf 100644 --- a/packages/design-system/src/components/N8nFormInputs/FormInputs.vue +++ b/packages/design-system/src/components/N8nFormInputs/FormInputs.vue @@ -1,3 +1,99 @@ + +