UNPKG

synapse-react-client

Version:

[![Build Status](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client.svg?branch=main)](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synaps

74 lines (73 loc) 2.77 kB
import * as React from 'react'; import { UiSchema } from '@rjsf/core'; import { FormData } from '../../utils/synapseTypes/'; import { StatusEnum } from './types'; /** * TODO: SWC-5612 - Replace token prop with SynapseContext.accessToken * * This wasn't done because Enzyme's shallow renderer is not currently * compatible with the `contextType` field in the React 16+ context API. * * This can be fixed by rewriting tests to not rely on the shallow renderer. * * See here: https://github.com/enzymejs/enzyme/issues/1553 */ export declare type UploadToolSearchParams = { formDataId?: string; dataFileHandleId?: string; submitted?: boolean; formGroupId: string; }; export declare type SynapseFormWrapperProps = { formSchemaEntityId: string; formUiSchemaEntityId: string; formNavSchemaEntityId: string; token?: string; searchParams?: UploadToolSearchParams; isWizardMode?: boolean; fileNamePath: string; formTitle: string; formClass?: string; }; declare type SynapseFormWrapperState = { notification?: Notification; isLoading?: boolean; formDataId?: string; formData?: any; formSchema?: any; formUiSchema?: UiSchema; formNavSchema?: any; status?: StatusEnum; }; declare type Error = { name?: string; message?: string; }; interface Notification extends Error { type: StatusEnum; } declare class SynapseFormWrapper extends React.Component<SynapseFormWrapperProps, SynapseFormWrapperState> { constructor(props: SynapseFormWrapperProps); componentDidMount(): Promise<void>; componentDidUpdate(prevProps: SynapseFormWrapperProps): Promise<void>; getFileEntityData: (token: string, entityId: string, versionNumber?: string | undefined) => Promise<{ version?: number; content: JSON; }>; getFileEntityDataDereferenced: (token: string, entityId: string, versionNumber?: string | undefined) => Promise<{ version?: number | undefined; content: JSON; }>; getData: (token?: string | undefined) => Promise<void>; finishedProcessing: (status: StatusEnum, message?: string | undefined) => void; onError: (error: Error) => void; submitForm: (formData: any) => Promise<void>; createOrUpdateFormDataFile: (fileName: string, fileContentsBlob: Blob) => Promise<FormData>; saveToFile: (data: any) => Promise<void>; isReadyToDisplayForm: (state: SynapseFormWrapperState) => boolean; renderLoader: (state: SynapseFormWrapperState, props: SynapseFormWrapperProps) => JSX.Element; renderNotification: (notification?: Notification | undefined) => JSX.Element; renderUnauthenticatedView: (token: string | undefined) => JSX.Element; render(): JSX.Element; } export default SynapseFormWrapper;