@openoleg/mui
Version:
Material UI 7 theme, fields and widgets for react-jsonschema-form
23 lines • 1.31 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import Box from '@mui/material/Box/index.js';
import Grid from '@mui/material/Grid/index.js';
import Paper from '@mui/material/Paper/index.js';
import { getUiOptions, getTemplate, } from '@rjsf/utils';
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
*
* @param props - The `ArrayFieldItemTemplateType` props for the component
*/
export default function ArrayFieldItemTemplate(props) {
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
const uiOptions = getUiOptions(uiSchema);
const ArrayFieldItemButtonsTemplate = getTemplate('ArrayFieldItemButtonsTemplate', registry, uiOptions);
const btnStyle = {
flex: 1,
paddingLeft: 6,
paddingRight: 6,
fontWeight: 'bold',
minWidth: 0,
};
return (_jsxs(Grid, { container: true, alignItems: 'center', children: [_jsx(Grid, { size: 'auto', style: { overflow: 'auto' }, children: _jsx(Box, { mb: 2, children: _jsx(Paper, { elevation: 2, children: _jsx(Box, { p: 2, children: children }) }) }) }), hasToolbar && (_jsx(Grid, { children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }))] }));
}
//# sourceMappingURL=ArrayFieldItemTemplate.js.map