From 4af4470aefa8c9d60daf25cda4a2ba48d3c3c1e6 Mon Sep 17 00:00:00 2001 From: Javier Romero Caatro Date: Wed, 31 Jul 2024 12:54:16 +0200 Subject: [PATCH] customfields: allow hidding section name * closes https://github.com/CERNDocumentServer/cds-rdm/issues/143 --- .../widgets/custom_fields/CustomFields.js | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/lib/forms/widgets/custom_fields/CustomFields.js b/src/lib/forms/widgets/custom_fields/CustomFields.js index afa607d6..2280684a 100644 --- a/src/lib/forms/widgets/custom_fields/CustomFields.js +++ b/src/lib/forms/widgets/custom_fields/CustomFields.js @@ -10,6 +10,7 @@ import PropTypes from "prop-types"; import { DiscoverFieldsSection } from "./DiscoverFieldsSection"; import { AccordionField } from "../../AccordionField"; import { loadWidgetsFromConfig } from "../loader"; +import { Container } from "semantic-ui-react"; export class CustomFields extends Component { constructor(props) { @@ -77,16 +78,26 @@ export class CustomFields extends Component { return ( <> {sections && - sections.map(({ fields, paths, ...sectionConfig }) => ( - - {fields} - - ))} + sections.map((section) => { + const { + fields, + paths, + displaySection, + section: sectionName = "", + } = section; + return displaySection ? ( + {fields} + ) : ( + + {fields} + + ); + })} {discoverFieldsSections && discoverFieldsSections.length > 0 && (