File tree Expand file tree Collapse file tree 5 files changed +27
-1
lines changed
frontend/packages/pydantic-forms/src Expand file tree Collapse file tree 5 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -18,4 +18,5 @@ __pycache__/
1818.vscode
1919test
2020.idea
21- todo.md
21+ todo.md
22+ venv
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 LabelField ,
1212 RadioField ,
1313 TextAreaField ,
14+ CheckboxField
1415} from '@/components/fields' ;
1516import {
1617 PydanticComponentMatcher ,
@@ -115,5 +116,6 @@ const defaultComponentMatchers: PydanticComponentMatcher[] = [
115116 } ,
116117 } ,
117118] ;
119+
118120// If nothing matches, it defaults to Text field in the mapToComponent function
119121export default defaultComponentMatchers ;
Original file line number Diff line number Diff line change 1+ import { PydanticFormControlledElementProps } from '@/types' ;
2+
3+ export const CheckboxField = ( {
4+ onChange,
5+ onBlur,
6+ value,
7+ name,
8+ pydanticFormField
9+ } : PydanticFormControlledElementProps ) => {
10+ console . log ( pydanticFormField ) ;
11+ return (
12+ < input
13+ type = "checkbox"
14+ checked = { value }
15+ onChange = { ( ) => onChange ( ! value ) }
16+ onBlur = { onBlur }
17+ name = { name }
18+ />
19+ ) ;
20+ } ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export * from './FormRow';
33export * from './TextField' ;
44export * from './IntegerField' ;
55export * from './TextAreaField' ;
6+ export * from './CheckboxField' ;
67export * from './LabelField' ;
78export * from './DividerField' ;
89export * from './HiddenField' ;
Original file line number Diff line number Diff line change @@ -84,9 +84,11 @@ export const getComponentMatcher = (
8484 return matcher ( field ) ;
8585 } ) ;
8686
87+ console . log ( 'Matched component __' + matchedComponent ?. matcher )
8788 if ( matchedComponent ) return matchedComponent ;
8889
8990 // Defaults to textField when there are no matches
91+ console . log ( 'No match found for field ' + field . id ) ;
9092 return {
9193 id : 'textfield' ,
9294 ElementMatch : {
You can’t perform that action at this time.
0 commit comments