1
1
import * as React from 'react' ;
2
- import { ReactNode } from 'react' ;
2
+ import { ReactNode , ReactElement } from 'react' ;
3
3
import SimpleForm from '../form/SimpleForm' ;
4
4
import SimpleFormIterator from '../form/SimpleFormIterator' ;
5
5
import ArrayInput from '../input/ArrayInput' ;
@@ -12,9 +12,9 @@ import ReferenceArrayInput, {
12
12
} from '../input/ReferenceArrayInput' ;
13
13
import SelectInput from '../input/SelectInput' ;
14
14
import TextInput from '../input/TextInput' ;
15
- import { InferredElement , InputProps } from 'ra-core' ;
15
+ import { InferredElement , InferredTypeMap , InputProps } from 'ra-core' ;
16
16
17
- export default {
17
+ const editFieldTypes : InferredTypeMap = {
18
18
form : {
19
19
component : SimpleForm ,
20
20
representation : (
@@ -74,7 +74,7 @@ ${children.map(child => ` ${child.getRepresentation()}`).join('\n')}
74
74
} ">${ children . getRepresentation ( ) } </ReferenceInput>`,
75
75
} ,
76
76
referenceChild : {
77
- component : ( props : InputProps ) => (
77
+ component : ( props : { children : ReactNode } & InputProps ) => (
78
78
< SelectInput optionText = "id" { ...props } />
79
79
) , // eslint-disable-line react/display-name
80
80
representation : ( ) => `<SelectInput optionText="id" />` ,
@@ -85,9 +85,9 @@ ${children.map(child => ` ${child.getRepresentation()}`).join('\n')}
85
85
`<ReferenceArrayInput source="${ props . source } " reference="${ props . reference } "><TextInput source="id" /></ReferenceArrayInput>` ,
86
86
} ,
87
87
referenceArrayChild : {
88
- component : ( props : InputProps ) => (
89
- < SelectInput optionText = "id" { ... props } />
90
- ) , // eslint-disable-line react/display-name
88
+ component : (
89
+ props : { children : ReactNode } & InputProps
90
+ ) : ReactElement => < SelectInput optionText = "id" { ... props } /> , // eslint-disable-line react/display-name
91
91
representation : ( ) => `<SelectInput optionText="id" />` ,
92
92
} ,
93
93
richText : {
@@ -106,3 +106,5 @@ ${children.map(child => ` ${child.getRepresentation()}`).join('\n')}
106
106
`<TextInput source="${ props . source } " />` ,
107
107
} ,
108
108
} ;
109
+
110
+ export default editFieldTypes ;
0 commit comments