drf-react-by-schema
Version:
Components and Tools for building a React App having Django Rest Framework (DRF) as server
38 lines • 2.28 kB
TypeScript
import React from 'react';
import { AxiosError } from 'axios';
import { UseFormRegister } from 'react-hook-form';
import { AutocompleteItem, CommonFieldProps, ExtraSxCommonFieldProps, FormFieldLayout, GenericValue, Id, Item, OptionsAC } from '../../@types';
import { FormActionsProps } from './FormActions';
interface FormProps extends CommonFieldProps {
model: string;
objId?: Id;
basePath?: string;
defaults?: Record<string, GenericValue>;
objTitleField?: string;
onCancel?: React.MouseEventHandler<HTMLButtonElement>;
onSave?: (currentId: Id, newId: Id | AxiosError) => void;
onSaveExit?: (currentId: Id, newId: Id) => void;
onSaveCreateNew?: (currentId: Id, newId: Id) => void;
onDelete?: (removedId: Id) => void;
saveAndContinue?: boolean;
title?: string;
labelSave?: string;
labelSaveAndContinue?: string;
labelSaveAndCreateNew?: string;
labelCancel?: string;
labelRemove?: string;
fieldsLayout?: FormFieldLayout[];
customFieldFormLayouts?: Record<string, FormFieldLayout[]>;
hiddenFields?: string[];
register?: UseFormRegister<Item>;
setOptionsAC?: (x: OptionsAC) => void;
isolatedGetAutoComplete?: (model: string) => Promise<AutocompleteItem[] | AxiosError>;
fieldsProps?: Record<string, CommonFieldProps>;
relatedEditable?: boolean;
autoFocusField?: string;
elevation?: number;
CustomFormActions?: (props: FormActionsProps) => React.JSX.Element;
}
export default function Form({ model, objId, basePath, defaults, objTitleField, onCancel, onSave, onSaveExit, onSaveCreateNew, onDelete, saveAndContinue, title, labelSave, labelSaveAndContinue, labelSaveAndCreateNew, labelCancel, labelRemove, multiline, fieldKey, labelKey, optionsAC, setOptionsAC, optionsModel, getOptionLabel, renderOption, onEditModel, options, isSemaphoric, label, decimalScale, fieldsLayout, customFieldFormLayouts, fieldsProps, hiddenFields, isolatedGetAutoComplete, relatedEditable, autoFocusField, elevation, CustomFormActions, sxRow, sxRowMultiple, sxSection, sxSectionTitle, }: FormProps & Omit<ExtraSxCommonFieldProps, 'sx' | 'sxField' | 'sxLabel' | 'sxValue' | 'sxValueList' | 'sxValueListItem' | 'sxValueListItemText'>): React.JSX.Element;
export {};
//# sourceMappingURL=Form.d.ts.map