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