11import { ADDITIONAL_PROPERTY_FLAG } from "react-jsonschema-form/lib/utils" ;
22import React from "react" ;
3- import {
4- TextField ,
5- FormLabel ,
6- Typography ,
7- FormHelperText ,
8- } from "@material-ui/core" ;
3+ import { TextField , FormLabel , Typography } from "@material-ui/core" ;
94
105export default function DefaultTemplate ( props ) {
116 const {
127 id,
138 label,
149 children,
15- rawErrors,
16- help,
1710 description,
1811 hidden,
1912 required,
2013 displayLabel,
2114 onKeyChange,
2215 schema,
23- uiSchema,
2416 } = props ;
2517 if ( hidden ) {
2618 return children ;
2719 }
2820
29- let help_text = uiSchema [ "ui:help" ] ;
30- let help_is_object = typeof help_text == "object" ;
31- let actual_help = help ;
32- //console.log('help_text', typeof help_text, help_text)
33- if ( help_text && ! help_is_object ) {
34- //console.log('replacing help', help_text);
35- actual_help = (
36- < Typography variant = "caption" color = "textSecondary" >
37- { help_text }
21+ function under_text ( frag ) {
22+ return (
23+ < Typography
24+ variant = "caption"
25+ color = "textSecondary"
26+ style = { { paddingLeft : "16px" } } >
27+ { frag }
3828 </ Typography >
3929 ) ;
40- } else if ( help_is_object ) {
41- actual_help = "" ;
4230 }
4331
4432 const additional = schema . hasOwnProperty ( ADDITIONAL_PROPERTY_FLAG ) ;
4533 const keyLabel = `${ label } Key` ;
46- //console.log('schema', schema);
47- //console.log('uiSchema', uiSchema);
4834
4935 function inner ( ) {
5036 return (
@@ -62,10 +48,7 @@ export default function DefaultTemplate(props) {
6248 </ React . Fragment >
6349 ) }
6450 { children }
65- { displayLabel && description ? description : null }
66- { rawErrors &&
67- rawErrors . map ( e => < FormHelperText error = { true } > { e } </ FormHelperText > ) }
68- { actual_help }
51+ { displayLabel && description ? under_text ( description ) : null }
6952 </ React . Fragment >
7053 ) ;
7154 }
0 commit comments