From 4c78d1da66536e2999858293bec5e75f4e9e7803 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Mon, 3 Apr 2023 22:59:20 +0200 Subject: [PATCH] Nice form (#11) * wip * vee-validate experiments * get test enabled form working * Make PillBar Properly work with ModelValue * Register NumberBox Globally * Rework NiceForm * Use new form props * Rework Definitions for new Form --- client/src/components/NiceForm.vue | 56 ++++++++++----- client/src/components/inputs/PillBar.vue | 18 ++--- client/src/definitions.ts | 71 ++++++++++--------- client/src/main.ts | 18 +++++ .../pages/edit/[subsystem]/[entity]/[id].vue | 4 +- .../pages/edit/[subsystem]/[entity]/index.vue | 4 +- client/src/pages/index.vue | 56 ++++++++++++--- 7 files changed, 153 insertions(+), 74 deletions(-) diff --git a/client/src/components/NiceForm.vue b/client/src/components/NiceForm.vue index f2aa438..f91aeb9 100644 --- a/client/src/components/NiceForm.vue +++ b/client/src/components/NiceForm.vue @@ -2,38 +2,60 @@ const props = defineModel<{ title: string - fields: { - key: string, - label: string, - component: () => Component, - props: any, - }[] + sections: { + title: string + fields: { + key: string, + label: string, + as: string, + props: any, + default: any, + enabled?: (values: Record) => Boolean, + rules?: (value: any) => true | string, + }[], + }[], + modelValue: any, }>(); -let { title, fields } = $(props); + +let { sections } = $(props);