import { MutableRefObject } from 'react'; import { Location } from 'history'; import { matchPath } from 'react-router-dom'; import { RedirectionSideEffect } from '../../sideEffect'; import { SetOnSuccess, SetOnFailure, TransformData, SetTransformData } from '../saveModifiers'; import { Record, OnSuccess, OnFailure } from '../../types'; export interface CreateProps = Record> { basePath?: string; hasCreate?: boolean; hasEdit?: boolean; hasList?: boolean; hasShow?: boolean; location?: Location; match?: typeof matchPath; record?: Partial; resource?: string; onSuccess?: OnSuccess; onFailure?: OnFailure; transform?: TransformData; successMessage?: string; } export interface CreateControllerProps = Record> { basePath?: string; data?: RecordType; defaultTitle: string; loading: boolean; loaded: boolean; hasCreate?: boolean; hasEdit?: boolean; hasList?: boolean; hasShow?: boolean; onSuccessRef: MutableRefObject; onFailureRef: MutableRefObject; transformRef: MutableRefObject; save: (record: Partial, redirect: RedirectionSideEffect, callbacks?: { onSuccess?: OnSuccess; onFailure?: OnFailure; transform?: TransformData; }) => void; saving: boolean; setOnSuccess: SetOnSuccess; setOnFailure: SetOnFailure; setTransform: SetTransformData; successMessage?: string; record?: Partial; redirect: RedirectionSideEffect; resource: string; version: number; } /** * Prepare data for the Create view * * @param {Object} props The props passed to the Create component. * * @return {Object} controllerProps Fetched data and callbacks for the Create view * * @example * * import { useCreateController } from '../app'; * import CreateView from './CreateView'; * * const MyCreate = props => { * const controllerProps = useCreateController(props); * return ; * } */ export declare const useCreateController: = Record>(props: CreateProps) => CreateControllerProps; export declare const getRecord: ({ state, search }: { state: any; search: any; }, record?: any) => any;