import Button from 'antd/lib/button'; import Col from 'antd/lib/col'; import Row from 'antd/lib/row'; import { ArrayFieldTemplateItemType, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils'; const BTN_GRP_STYLE = { width: '100%', }; const BTN_STYLE = { width: 'calc(100% / 4)', }; /** 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, hasCopy, hasMoveDown, hasMoveUp, hasRemove, hasToolbar, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, registry, uiSchema, } = props; const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates; const { rowGutter = 24, toolbarAlign = 'top' } = registry.formContext; return ( {children} {hasToolbar && ( {(hasMoveUp || hasMoveDown) && ( )} {(hasMoveUp || hasMoveDown) && ( )} {hasCopy && ( )} {hasRemove && ( )} )} ); }