-
Notifications
You must be signed in to change notification settings - Fork 31
Rebuilding hideEmptyFields in Summary2
#3336
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
Conversation
|
/publish |
PR release:
|
|
/publish |
PR release:
|
a069719 to
406c666
Compare
|
/publish |
PR release:
|
…r not in Summary2, when using 'hideEmptyFields'
…ws/objects as non-empty
…ich it obviously should
…re not empty so that repeating group summaries only render their header/title when there is data in one or more child rows.
…d Summary2 components. This should in theory be better, but it's ending up toggling states back and forth. I'll have to look into how to make this another way, so committing this now before going back to the drawing board.
… same components and never changing the DOM hierarchy.
…out, so that each renderer can render it. Then making sure to conditionally show it, so that we don't end up with empty padding-only flex elements when the rendered component is empty.
…tTimeout seemed buggy in practice)
…ry2 and overridden from DevTools
…evtools and toggling hidden visibility
… slightly refactoring types
… as hidden and greyed out
…that weren't passed
…the inline styles overrode my 'display' CSS property. This wasn't really needed, a div is display:block already, and the container class already has display: flex.
…within are considered empty (thus treating them as groups). Refactoring a bit in ComponentSummary.tsx.
…asily tell which page is which in the DOM.
…they still work with DevTools overrides.
…options here, but turns out I didn't need them after all. Still keeping this, though.
…in Grid, so adding that as a property. Also, the SummaryInternalRow component was not really needed, so removing that.
…EmptyFields and outputs it in a PDF.
hideEmptyFields in Summary2hideEmptyFields in Summary2
…t-in means each component can't decide on their own if they're required or not (i.e. RepeatingGroup and FileUpload minCount properties). Leaving the old code so that it triggers an error if called incorrectly.
|
/publish |
PR release:
|
bjosttveit
left a comment
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.
Good work my man 🎉
# Conflicts: # src/layout/Summary2/CommonSummaryComponents/MultipleValueSummary.tsx
|




Description
Summary2 naively treated components with no data in any dataModelBinding as 'empty', but that's not the case for, for example,
Group(which has no support for data model bindings, but contains other components that aren't necessarily empty). This implements empty-checking for every component type that properly handles the differences between components.It's recommended to ignore whitespaces when reading the diffs here, as every Summary2 component render has been wrapped in the Summary2Flex component in this PR, so some files show quite large diffs that are primarily whitespace-only changes.
List of changes in this PR (trying to follow the natural listing as when reviewing the PR):
<SummaryFlex />or a variant of it first. This was previously automatically rendered out in<ComponentSummary />, but by moving it we get a better chance to control these things in the component themselves.CheckboxesandMultipleSelectnow use theuseMultipleValuesForSummary()to get their values and pass them on toMultipleValueSummary. This way the components themselves can tell<SummaryFlex />if they are empty or not.Gridgets a new override,hideEmptyRowsthat hides empty rows (Toggle for å automatisk skjule tomme rader i oppsummeringselement #2471)<EmptyChildrenBoundary />context has been introduced to register and control visibility when all children in a container are reported as empty. Grid uses some extra trickery to make sure header-rows are also hidden if every child component in theGridreports as being empty.ParagraphandHeaderare marked as 'presentational', so not strictly empty nor 'contentful'. If you for example have aGroupwith aHeaderandParagraphinside, but all theInputfields also inside theGroupare empty, theGroupitself is also hidden inSummary2when usinghideEmptyFields: true(solves Summary2: Støtte for komponenten "Group" #3159)SubformSummaryComponent2.tsx, to prevent the entire Summary2 for a subform to re-render (and re-generate nodes) when (for example) settings are changed in DevTools.PageSummarynow renders more then just its own children directly, so that 'empty' pages are treated just like emptyGroupcomponents. To make this look like it did before, I had to do some trickery with the Flex component.Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes grouping