import * as React from 'react' ; import { ReactElement , ReactNode , HtmlHTMLAttributes } from 'react' ; import PropTypes from 'prop-types' ; import { FormWithRedirect , FormWithRedirectProps , MutationMode } from 'ra-core' ; import { SimpleFormView } from './SimpleFormView' ; example typedef Props prop { ReactElement [ ] } children prop { Object } initialValues prop { Function } validate prop { boolean } submitOnEnter prop { string } redirect prop { ReactElement } toolbar prop { string } variant prop { string } margin prop { boolean } sanitizeEmptyValues param { Props } props const SimpleForm = ( props ) => ( < FormWithRedirect { ... props } render = { formProps => < SimpleFormView { ... formProps } / > } />); SimpleForm . propTypes = { children : PropTypes . node , initialValues : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . func ] ) , mutationMode : PropTypes . oneOf ( [ 'pessimistic' , 'optimistic' , 'undoable' ] ) , record : PropTypes . object , redirect : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . bool , PropTypes . func , ] ) , save : PropTypes . func , saving : PropTypes . bool , submitOnEnter : PropTypes . bool , toolbar : PropTypes . oneOfType ( [ PropTypes . element , PropTypes . oneOf ( [ false ] ) ] ) , undoable : PropTypes . bool , validate : PropTypes . func , version : PropTypes . number , sanitizeEmptyValues : PropTypes . bool , } ; export interface SimpleFormProps extends Omit < FormWithRedirectProps , 'render' > , Omit < HtmlHTMLAttributes < HTMLFormElement > , 'defaultValue' | 'onSubmit' | 'children' > { basePath ? : string ; children : ReactNode ; className ? : string ; component ? : React . ComponentType < any > ; initialValues ? : any ; margin ? : 'none' | 'normal' | 'dense' ; mutationMode ? : MutationMode ; resource ? : string ; submitOnEnter ? : boolean ; toolbar ? : ReactElement | false ; deprecated undoable ? : boolean ; variant ? : 'standard' | 'outlined' | 'filled' ; } export default SimpleForm ;