UNPKG

@astarte-platform/react-bootstrap

Version:

React Bootstrap theme, fields and widgets for react-jsonschema-form, powered by react-bootstrap, this is a package from a fork of official project

15 lines 1.93 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; export default function ArrayFieldItemTemplate(props) { const { children, disabled, hasToolbar, hasCopy, hasMoveDown, hasMoveUp, hasRemove, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, registry, uiSchema, } = props; const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates; const btnStyle = { flex: 1, paddingLeft: 6, paddingRight: 6, fontWeight: 'bold', }; return (_jsx("div", { children: _jsxs(Row, { className: 'mb-2 d-flex align-items-center', children: [_jsx(Col, { xs: '9', lg: '9', children: children }), _jsx(Col, { xs: '3', lg: '3', className: 'py-4', children: hasToolbar && (_jsxs("div", { className: 'd-flex flex-row', children: [(hasMoveUp || hasMoveDown) && (_jsx("div", { className: 'm-0 p-0', children: _jsx(MoveUpButton, { className: 'array-item-move-up', style: btnStyle, disabled: disabled || readonly || !hasMoveUp, onClick: onReorderClick(index, index - 1), uiSchema: uiSchema, registry: registry }) })), (hasMoveUp || hasMoveDown) && (_jsx("div", { className: 'm-0 p-0', children: _jsx(MoveDownButton, { style: btnStyle, disabled: disabled || readonly || !hasMoveDown, onClick: onReorderClick(index, index + 1), uiSchema: uiSchema, registry: registry }) })), hasCopy && (_jsx("div", { className: 'm-0 p-0', children: _jsx(CopyButton, { style: btnStyle, disabled: disabled || readonly, onClick: onCopyIndexClick(index), uiSchema: uiSchema, registry: registry }) })), hasRemove && (_jsx("div", { className: 'm-0 p-0', children: _jsx(RemoveButton, { style: btnStyle, disabled: disabled || readonly, onClick: onDropIndexClick(index), uiSchema: uiSchema, registry: registry }) }))] })) })] }) })); } //# sourceMappingURL=ArrayFieldItemTemplate.js.map