import { CSSProperties } from 'react'; import Box from '@mui/material/Box'; import Grid2 from '@mui/material/Grid2'; import Paper from '@mui/material/Paper'; import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; import Stack from "@mui/material/Stack"; /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array. * * @param props - The `ArrayFieldTemplateItemType` props for the component */ export default function ArrayFieldItemTemplate< T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any >(props: ArrayFieldTemplateItemType) { const { children, disabled, hasToolbar, hasCopy, hasMoveDown, hasMoveUp, hasRemove, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, uiSchema, registry, } = props; const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates; const btnStyle: CSSProperties = { flex: 1, paddingLeft: 6, paddingRight: 6, fontWeight: 'bold', minWidth: 0, }; const displayToolbar = hasToolbar && !props.readonly; return ( {children} {displayToolbar && ( {(hasMoveUp || hasMoveDown) && ( )} {(hasMoveUp || hasMoveDown) && ( )} {hasCopy && ( )} {hasRemove && ( )} )} ); }