@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
14 lines • 1.84 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import Container from 'react-bootstrap/Container';
import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, } from '@rjsf/utils';
export default function ObjectFieldTemplate({ description, title, properties, required, uiSchema, idSchema, schema, formData, onAddClick, disabled, readonly, registry, }) {
const uiOptions = getUiOptions(uiSchema);
const TitleFieldTemplate = getTemplate('TitleFieldTemplate', registry, uiOptions);
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, uiOptions);
// Button templates are not overridden in the uiSchema
const { ButtonTemplates: { AddButton }, } = registry.templates;
return (_jsxs(_Fragment, { children: [title && (_jsx(TitleFieldTemplate, { id: titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs(Container, { fluid: true, className: 'p-0', children: [properties.map((element, index) => (_jsx(Row, { style: { marginBottom: '10px' }, className: element.hidden ? 'd-none' : undefined, children: _jsxs(Col, { xs: 12, children: [" ", element.content] }) }, index))), canExpand(schema, uiSchema, formData) ? (_jsx(Row, { children: _jsx(Col, { xs: { offset: 9, span: 3 }, className: 'py-4', children: _jsx(AddButton, { onClick: onAddClick(schema), disabled: disabled || readonly, className: 'object-property-expand', uiSchema: uiSchema, registry: registry }) }) })) : null] })] }));
}
//# sourceMappingURL=ObjectFieldTemplate.js.map