@aokiapp/rjsf-mantine-theme
Version:
Mantine theme, fields and widgets for react-jsonschema-form
12 lines • 1.75 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Group, Box } from '@mantine/core';
/** 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(props) {
const { children, className, disabled, hasToolbar, hasCopy, hasMoveDown, hasMoveUp, hasRemove, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, uiSchema, registry, } = props;
const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
return (_jsxs(Box, { className: `armt-template-arrayfielditem ${className}`, children: [children, hasToolbar && (hasMoveUp || hasMoveDown || hasRemove || hasCopy) && (_jsxs(Group, { justify: 'flex-end', children: [(hasMoveUp || hasMoveDown) && (_jsx(MoveUpButton, { className: 'armt-template-afit-move-up', disabled: disabled || readonly || !hasMoveUp, onClick: onReorderClick(index, index - 1), uiSchema: uiSchema, registry: registry })), (hasMoveUp || hasMoveDown) && (_jsx(MoveDownButton, { className: 'armt-template-afit-move-down', disabled: disabled || readonly || !hasMoveDown, onClick: onReorderClick(index, index + 1), uiSchema: uiSchema, registry: registry })), hasCopy && (_jsx(CopyButton, { className: 'armt-template-afit-copy', disabled: disabled || readonly, onClick: onCopyIndexClick(index), uiSchema: uiSchema, registry: registry })), hasRemove && (_jsx(RemoveButton, { className: 'armt-template-afit-remove', disabled: disabled || readonly, onClick: onDropIndexClick(index), uiSchema: uiSchema, registry: registry }))] }))] }));
}
//# sourceMappingURL=ArrayFieldItemTemplate.js.map