synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
93 lines • 4.05 kB
TypeScript
import Form from '@rjsf/core';
import { ErrorListProps, RJSFValidationError, UiSchema } from '@rjsf/utils';
import { Component, RefObject } from 'react';
import { FormSchema, NavActionEnum, StatusEnum, Step } from './types';
export interface IFormData {
[key: string]: {
included?: boolean;
[key: string]: any;
};
}
export type SynapseFormProps = {
schema: FormSchema;
uiSchema: UiSchema;
navSchema: {
steps: any[];
};
formData: IFormData;
onSubmit: (formData: IFormData) => void;
onSave: (formData: IFormData) => void;
formTitle: string;
formClass?: string;
isWizardMode?: boolean;
callbackStatus?: StatusEnum;
isSubmitted?: boolean;
};
type SynapseFormState = {
formData: IFormData;
currentStep: Step;
nextStep?: Step;
steps: Step[];
previousStepIds: string[];
hasValidated?: boolean;
doShowErrors: boolean;
doShowHelp: boolean;
modalContext?: {
action: (...args: any[]) => void;
arguments: any[];
};
hasUnsavedChanges: boolean;
isSubmitted?: boolean;
isLoadingSaved: boolean;
};
export interface SummaryFormat {
label: string;
value: string;
}
export default class SynapseForm extends Component<SynapseFormProps, SynapseFormState> {
excludeWarningText: import("react/jsx-runtime").JSX.Element;
excludeWarningHeader: string;
unsavedDataWarning: string;
formRef: RefObject<Form<IFormData> | null>;
submitButtonRef: RefObject<HTMLButtonElement | null>;
formDivRef: any;
navAction: NavActionEnum;
uiSchema: UiSchema;
nextStep: Step | undefined;
extraErrors: RJSFValidationError[];
isNewForm: (formData: IFormData) => boolean;
getFirstStep: (steps: Step[], formData: IFormData) => Step;
constructor(props: SynapseFormProps);
onUnload: (ev: any) => string | undefined;
setupBeforeUnloadListener: () => void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: SynapseFormProps): void;
_setIncludedPropInFormDataNonWizard: (currentState: SynapseFormState, schemaScreens: any) => IFormData;
_setIncludedPropInFormDataWizard: (currentState: SynapseFormState) => IFormData;
componentDidMount(): void;
getSchema: ({ id, final }: Step) => FormSchema;
getNextStepId: (currentStep: Step, formData: any, nextStepId?: string) => Promise<string>;
moveStep: (formData: any, nextStepId: string | undefined, isError: boolean, previousStack?: string[]) => Promise<void>;
saveStepState: (previousStepIds: string[], steps: Step[], currentStep: Step, formData: any) => void;
goPrevious: (formData: any, isError: boolean) => Promise<void>;
triggerAction: (navAction: NavActionEnum) => Promise<void>;
triggerStepChange: (step: Step) => void;
onError: (args: any) => void;
setStepStatusForFailedValidation: (errors: RJSFValidationError[], steps: Step[], isWizard: boolean, formData: IFormData, currentSchemaProperties: any) => Step[];
handleOnChange({ formData }: any): void;
performAction(navAction: NavActionEnum, hasError: boolean): Promise<void> | undefined;
onSubmit: () => any;
isSubmitScreen: () => boolean;
showExcludeStateWarningDialog: (stepId: string, isUpdateFlattenedData?: boolean) => void;
toggleExcludeStep: (stepId: string, isExclude: boolean) => void;
private renderNotification;
private renderTextForStaticScreen;
renderOptionalFormSubheader: (isWizard?: boolean) => import("react/jsx-runtime").JSX.Element;
renderHelpToggle: (currentStep: Step, showHelp: boolean, callbackFn: () => void) => import("react/jsx-runtime").JSX.Element;
runCustomValidation: (formData: IFormData, currentStep: Step, allSteps: Step[]) => Promise<RJSFValidationError[]>;
transformErrors: (errors: RJSFValidationError[]) => RJSFValidationError[];
renderErrorListTemplate: (props: ErrorListProps) => import("react/jsx-runtime").JSX.Element;
render(): import("react/jsx-runtime").JSX.Element;
}
export {};
//# sourceMappingURL=SynapseForm.d.ts.map