-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly hide rows when ui:widget is hidden (bootstrap-4) #2175
Conversation
Related to #1683. |
@@ -33,7 +33,7 @@ const ObjectFieldTemplate = ({ | |||
)} | |||
<Container fluid className="p-0"> | |||
{properties.map((element: any, index: number) => ( | |||
<Row key={index} style={{ marginBottom: "10px" }}> | |||
<Row key={index} style={{ marginBottom: "10px" }} className={(element.content.props.uiSchema["ui:widget"] === "hidden")?"d-none":undefined} > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the analogous code in @rjsf/core just says:
{props.properties.map(prop => prop.content)} |
When ui:widget is hidden, is element.content
equal to null / undefined? I'm trying to see if we can achieve the same effect without having to explicitly check for ui:widget
equal to hidden
, such as something like the following:
{element.content && <Row>...</Row>}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
element.content
exists for the hidden fields.- The row object contains the hidden input element, and removing the entire row means no hidden input element is included in the form.
bump |
…ss hidden prop to ObjectFieldTemplate (#2405) * material-ui: hide grid for hidden fields Implementations follows the one that already exists for ant design. Closes #1974 * Update test snapshot to latest master * Add comment * Move ui:widget evaluation into core * Add test for hidden in antd * Hide hidden fields in bootstrap Closes #2175 * Improve tests * Remove whitespace for hidden in fluent-ui * Update custom-templates.md Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
Reasons for making this change
When
ui:widget
ishidden
, add classd-none
toRow
so that the corresponding row is properly hided. This fix is forbootstrap-4
, but basically the other themes can also be patched in the same way.Checklist