Skip to content

Commit ac09d43

Browse files
committed
remove debug statements
add react to scope implement disabled
1 parent 606f659 commit ac09d43

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

frontend/packages/pydantic-forms/src/components/defaultComponentMatchers.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* We will search for the first field that returns a positive match
55
*/
66
import {
7+
CheckboxField,
78
DividerField,
89
HiddenField,
910
IntegerField,
1011
LabelField,
1112
TextAreaField,
12-
CheckboxField
1313
} from '@/components/fields';
1414
import {
1515
PydanticComponentMatcher,
@@ -91,10 +91,8 @@ const defaultComponentMatchers: PydanticComponentMatcher[] = [
9191
isControlledElement: true,
9292
},
9393
matcher(field) {
94-
return (
95-
field.type === PydanticFormFieldType.BOOLEAN
96-
);
97-
}
94+
return field.type === PydanticFormFieldType.BOOLEAN;
95+
},
9896
},
9997
];
10098

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1+
import React from 'react';
2+
13
import { PydanticFormControlledElementProps } from '@/types';
24

3-
export const CheckboxField = ({
4-
onChange,
5-
onBlur,
6-
value,
7-
name,
8-
pydanticFormField
5+
export const CheckboxField = ({
6+
onChange,
7+
onBlur,
8+
value,
9+
name,
10+
disabled,
911
}: 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-
};
12+
return (
13+
<input
14+
type="checkbox"
15+
checked={value}
16+
onChange={() => onChange(!value)}
17+
onBlur={onBlur}
18+
name={name}
19+
disabled={disabled}
20+
/>
21+
);
22+
};

frontend/packages/pydantic-forms/src/core/mapFieldToComponent.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ export const getComponentMatcher = (
8484
return matcher(field);
8585
});
8686

87-
console.log('Matched component __' + matchedComponent?.matcher)
8887
if (matchedComponent) return matchedComponent;
8988

9089
// Defaults to textField when there are no matches
91-
console.log('No match found for field ' + field.id);
9290
return {
9391
id: 'textfield',
9492
ElementMatch: {

0 commit comments

Comments
 (0)