From a8ff90584e28258c1b14cbd89c561adcf18e3910 Mon Sep 17 00:00:00 2001 From: Jim Moffet Date: Wed, 5 Jun 2024 17:10:40 -0700 Subject: [PATCH] formSummary-defaultValue (#162) * ensure formSummary inputs have defaultValue * remove build artifacts * remove build artifacts --- .gitignore | 1 + .../FormEdit/components/FormSummaryEdit.tsx | 15 ++++++++++----- .../FormManager/FormEdit/components/PageEdit.tsx | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 5a9bd3ae3..c48272c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ node_modules/ NOTES.md tsconfig.tsbuildinfo *storybook.log +packages/form-service \ No newline at end of file diff --git a/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx b/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx index b6e912b4d..fa32322cc 100644 --- a/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx +++ b/packages/design/src/FormManager/FormEdit/components/FormSummaryEdit.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { type FormSummaryProps, type PatternId } from '@atj/forms'; +import { type FormSummaryProps } from '@atj/forms'; +import { type Pattern } from '@atj/forms/src/pattern'; import FormSummary from '../../../Form/components/FormSummary'; import { PatternEditComponent } from '../types'; @@ -17,7 +18,7 @@ const FormSummaryEdit: PatternEditComponent = ({ {focus ? ( } + editComponent={} > ) : ( @@ -26,26 +27,30 @@ const FormSummaryEdit: PatternEditComponent = ({ ); }; -const EditComponent = ({ patternId }: { patternId: PatternId }) => { +const EditComponent = ({ pattern }: { pattern: Pattern }) => { + const patternId = pattern.id; const { register } = usePatternEditFormContext(patternId); + return (
-
+
-
+
diff --git a/packages/design/src/FormManager/FormEdit/components/PageEdit.tsx b/packages/design/src/FormManager/FormEdit/components/PageEdit.tsx index bba98e7df..6910e904e 100644 --- a/packages/design/src/FormManager/FormEdit/components/PageEdit.tsx +++ b/packages/design/src/FormManager/FormEdit/components/PageEdit.tsx @@ -19,7 +19,7 @@ export const PageEdit: PatternEditComponent = props => { {props.focus ? ( } + editComponent={} > ) : (
= props => { ); }; -const PageEditComopnent = ({ pattern }: { pattern: PagePattern }) => { +const PageEditComponent = ({ pattern }: { pattern: PagePattern }) => { const { fieldId, getFieldState, register } = usePatternEditFormContext(pattern.id); const title = getFieldState('title');