@@ -4,6 +4,7 @@ import { RadioProps } from '@material-ui/core/Radio';
44import { SwitchProps } from '@material-ui/core/Switch' ;
55import Typography from '@material-ui/core/Typography/Typography' ;
66import FieldCoreBase , { IPropsFieldBase } from '@react-form-fields/core/components/FieldCoreBase' ;
7+ import ValidationContextRegister from '@react-form-fields/core/components/ValidationContextRegister' ;
78import * as React from 'react' ;
89
910import { getConfig } from '../../config' ;
@@ -59,42 +60,46 @@ export default class FieldSelectionBase extends FieldCoreBase<IProps> {
5960 const { value, label, checked, helperText, classes, disabled, Component } = this . props ;
6061
6162 return (
62- < FormControlLabel
63- className = { helperText ? classes . containerAlign : null }
64- control = {
65- checked ? //force recreation
66- < Component
67- checked = { true }
68- disabled = { disabled }
69- onChange = { this . onChange }
70- onBlur = { this . onBlur }
71- value = { ( value || '' ) . toString ( ) }
72- /> :
73- < Component
74- checked = { false }
75- disabled = { disabled }
76- onChange = { this . onChange }
77- onBlur = { this . onBlur }
78- value = { ( value || '' ) . toString ( ) }
79- />
80- }
81- label = {
82- < React . Fragment >
83- { ! ! label &&
84- < React . Fragment >
85- < Typography className = { helperText ? classes . labelAlign : null } > { label } </ Typography >
86- { ! ! helperText &&
87- < Typography className = { classes . helperText } >
88- { helperText }
89- </ Typography >
90- }
91- </ React . Fragment >
92- }
93- { this . props . children }
94- </ React . Fragment >
95- }
63+ < React . Fragment >
64+ < ValidationContextRegister field = { this } />
9665
97- />
66+ < FormControlLabel
67+ className = { helperText ? classes . containerAlign : null }
68+ control = {
69+ checked ? //force recreation
70+ < Component
71+ checked = { true }
72+ disabled = { disabled }
73+ onChange = { this . onChange }
74+ onBlur = { this . onBlur }
75+ value = { ( value || '' ) . toString ( ) }
76+ /> :
77+ < Component
78+ checked = { false }
79+ disabled = { disabled }
80+ onChange = { this . onChange }
81+ onBlur = { this . onBlur }
82+ value = { ( value || '' ) . toString ( ) }
83+ />
84+ }
85+ label = {
86+ < React . Fragment >
87+ { ! ! label &&
88+ < React . Fragment >
89+ < Typography className = { helperText ? classes . labelAlign : null } > { label } </ Typography >
90+ { ! ! helperText &&
91+ < Typography className = { classes . helperText } >
92+ { helperText }
93+ </ Typography >
94+ }
95+ </ React . Fragment >
96+ }
97+ { this . props . children }
98+ </ React . Fragment >
99+ }
100+
101+ />
102+ </ React . Fragment >
98103 ) ;
99104 }
100105}
0 commit comments