import * as React from 'react' ; import { ReactNode } from 'react' ; import Datagrid from '../list/datagrid/Datagrid' ; import ArrayField from '../field/ArrayField' ; import BooleanField from '../field/BooleanField' ; import DateField from '../field/DateField' ; import EmailField from '../field/EmailField' ; import NumberField from '../field/NumberField' ; import ReferenceField , { ReferenceFieldProps } from '../field/ReferenceField' ; import ReferenceArrayField from '../field/ReferenceArrayField' ; import RichTextField from '../field/RichTextField' ; import SimpleShowLayout , { SimpleShowLayoutProps } from './SimpleShowLayout' ; import TextField from '../field/TextField' ; import UrlField from '../field/UrlField' ; import { InferredElement , InferredTypeMap , InputProps } from 'ra-core' ; const showFieldTypes = { show : { component : ( props ) => ( < SimpleShowLayout { ... props } / > ) , representation : ( _ , children ) => `        <SimpleShowLayout>
${ children . map ( child => `            ${ child . getRepresentation ( ) }` ) . join ( '\n' ) }
        </SimpleShowLayout>` , } , array : { component : ( { children , ... props } ) => ( < ArrayField { ... props } > < Datagrid > { children } < /Datagrid> < /ArrayField>), representation : ( props , children ) => `<ArrayField source="${ props . source }"><Datagrid>${ children . map ( child => child . getRepresentation ( ) ) . join ( '\n' ) }</Datagrid></ArrayField>` , } , boolean : { component : BooleanField , representation : ( props ) => `<BooleanField source="${ props . source }" />` , } , date : { component : DateField , representation : ( props ) => `<DateField source="${ props . source }" />` , } , email : { component : EmailField , representation : ( props ) => `<EmailField source="${ props . source }" />` , } , id : { component : TextField , representation : ( props ) => `<TextField source="${ props . source }" />` , } , number : { component : NumberField , representation : ( props ) => `<NumberField source="${ props . source }" />` , } , reference : { component : ReferenceField , representation : ( props ) => `<ReferenceField source="${ props . source }" reference="${ props . reference }"><TextField source="id" /></ReferenceField>` , } , referenceChild : { component : ( props ) => ( < TextField source = "id" { ... props } />), representation : ( ) => `<TextField source="id" />` , } , referenceArray : { component : ReferenceArrayField , representation : ( props ) => `<ReferenceArrayField source="${ props . source }" reference="${ props . reference }"><TextField source="id" /></ReferenceArrayField>` , } , referenceArrayChild : { component : ( props ) => ( < TextField source = "id" { ... props } />), representation : ( ) => `<TextField source="id" />` , } , richText : { component : RichTextField , representation : ( props ) => `<RichTextField source="${ props . source }" />` , } , string : { component : TextField , representation : ( props ) => `<TextField source="${ props . source }" />` , } , url : { component : UrlField , representation : ( props ) => `<UrlField source="${ props . source }" />` , } , } ; export default showFieldTypes ;