UNPKG

@rjsf/fluent-ui

Version:

Fluent UI theme, fields and widgets for react-jsonschema-form

14 lines 1.59 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, } from '@rjsf/utils'; const rightJustify = { float: 'right', }; export default function ObjectFieldTemplate({ description, title, properties, required, disabled, readonly, schema, uiSchema, idSchema, formData, onAddClick, 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), schema: schema, uiSchema: uiSchema, description: description, registry: registry })), _jsxs("div", { className: 'ms-Grid', dir: 'ltr', children: [_jsx("div", { className: 'ms-Grid-row', children: properties.map((element) => element.content) }), canExpand(schema, uiSchema, formData) && (_jsx("span", { style: rightJustify, children: _jsx(AddButton, { className: 'object-property-expand', onClick: onAddClick(schema), disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }))] })] })); } //# sourceMappingURL=ObjectFieldTemplate.js.map