UNPKG

drf-react-by-schema

Version:

Components and Tools for building a React App having Django Rest Framework (DRF) as server

72 lines (71 loc) 1.71 kB
import React from 'react'; import { Id, Item, SchemaType } from '../utils'; export interface LoadSinglePageDataProps { model: string; objId?: Id; objTitleField?: string; optionsACModels: string[]; basePath?: string; formPath?: string | null; extraValidators?: Item; } export interface PageFormType { id: Id; schema: SchemaType | null; initialValues: Item | null; validationSchema: Item | null; } export interface OnEditModelType { fieldKey: string; index: string; model: string; id: Id; labelKey: string; setValue: (p: any) => void; getValues: (p: any) => any; } export interface OnEditRelatedModelType { model: string; id: Id; relatedModel: string; relatedModelId: Id; newRow: Item; schema: SchemaType; onlyAddExisting: boolean; } export interface OnDeleteRelatedModelType { model: string; id: Id; relatedModel: string; relatedModelId: Id; } export interface SnackBarType { open?: boolean; msg?: string; severity?: string; } export interface DialogType { open: boolean; loading?: boolean; title?: string; Body?: React.ReactNode; Actions?: React.ReactNode; } export interface FormContextType { model: string; id: Id; objTitleField: string; optionsACModels: string[]; cancelBtn?: (e: React.BaseSyntheticEvent) => any; cancelBtnLabel: any; deleteBtnLabel: any; saveAndCreateNewBtnLabel: any; saveAndContinueBtnLabel: any; saveBtnLabel: any; onSuccess: any; borderBottom: any; saveAndContinue: any; formButtonsSx: any; children: any; } export declare const FormContext: React.Context<FormContextType | null>;