import React from 'react'; import Form from "@rjsf/bootstrap-4"; import { IJsonSchema } from '../../types/IJSONSchema' import { Button } from 'react-bootstrap'; export interface DynamicFormProps { schema: IJsonSchema, data?: any uiSchema?: any, onCancel: (err: any) => Promise; onSubmit: (data: T) => Promise; } export interface DynamicFormState { } /** * Uses: * https://react-jsonschema-form.readthedocs.io/en/latest/ */ class DynamicForm extends React.Component, DynamicFormState> { constructor(props) { super(props); } _submitButtonPressed(data: any){ if (typeof this.props.onSubmit == "function"){ this.props.onSubmit(data as T); } } _cancelButtonPressed(){ if (typeof this.props.onCancel == "function"){ this.props.onCancel(new Error("Input Canceled")); } } public render() { return (
this._submitButtonPressed(e.formData)}> {' '} {' '}
); } } export default DynamicForm;