-
Notifications
You must be signed in to change notification settings - Fork 33
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
base: main
Are you sure you want to change the base?
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.
…at groups with a Header inside will be hidden if all the _other_ components inside the Group are empty.
…ll always just be a boolean. Removing that fixes some grid rows that were mistakenly shown even though they were empty. Adding some debugging info in GridSummary cells as well, since I found one case where a reference to a Header component was used. This works, but it's counted as 'not empty' even though it's just showing the header text (which seems weird, as other text-cells are considered empty). This debug info can be useful if we get reports about this.
/publish |
PR release:
|
…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.
|
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.Checkboxes
andMultipleSelect
now 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.Grid
gets a new override,hideEmptyRows
that 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 theGrid
reports as being empty.Paragraph
andHeader
are marked as 'presentational', so not strictly empty nor 'contentful'. If you for example have aGroup
with aHeader
andParagraph
inside, but all theInput
fields also inside theGroup
are empty, theGroup
itself is also hidden inSummary2
when 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.PageSummary
now renders more then just its own children directly, so that 'empty' pages are treated just like emptyGroup
components. 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