import React from 'react' ; import { Hidden } from '@mui/material' ; import { createCombinatorRenderInfos , findMatchingUISchema , isAllOfControl , JsonSchema , RankedTester , rankWith , resolveSubSchemas , StatePropsOfCombinator } from '@jsonforms/core' ; import { JsonFormsDispatch , withJsonFormsAllOfProps } from '@jsonforms/react' ; export const MaterialAllOfRenderer = ( { schema , rootSchema , visible , renderers , cells , path , uischemas , uischema } ) => { const _schema = resolveSubSchemas ( schema , rootSchema , 'allOf' ) ; const delegateUISchema = findMatchingUISchema ( uischemas ) ( _schema , uischema . scope , path ) ; if ( delegateUISchema ) { return ( < Hidden xsUp = { ! visible } > < JsonFormsDispatch schema = { _schema } uischema = { delegateUISchema } path = { path } renderers = { renderers } cells = { cells } / > < /Hidden>); } const allOfRenderInfos = createCombinatorRenderInfos ( ( _schema as JsonSchema ) . allOf , rootSchema , 'allOf' , uischema , path , uischemas ) ; return ( < Hidden xsUp = { ! visible } > { allOfRenderInfos . map ( ( allOfRenderInfo , allOfIndex ) => ( < JsonFormsDispatch key = { allOfIndex } schema = { allOfRenderInfo . schema } uischema = { allOfRenderInfo . uischema } path = { path } renderers = { renderers } cells = { cells } / > ) ) } < /Hidden>); } ; export const materialAllOfControlTester = rankWith ( 3 , isAllOfControl ) ; export default withJsonFormsAllOfProps ( MaterialAllOfRenderer ) ;