Rebuilding hideEmptyFields in Summary2#3336
Merged
olemartinorg merged 52 commits intomainfrom May 28, 2025
Merged
Conversation
Contributor
Author
|
/publish |
Contributor
PR release:
|
Contributor
Author
|
/publish |
Contributor
PR release:
|
a069719 to
406c666
Compare
Contributor
Author
|
/publish |
Contributor
PR release:
|
added 21 commits
May 14, 2025 13:48
…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.
added 10 commits
May 16, 2025 12:47
…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.
19 tasks
hideEmptyFields in Summary2hideEmptyFields in Summary2
bjosttveit
reviewed
May 23, 2025
added 2 commits
May 23, 2025 11:16
…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.
Contributor
Author
|
/publish |
Contributor
PR release:
|
# Conflicts: # src/layout/Summary2/CommonSummaryComponents/MultipleValueSummary.tsx
|
This was referenced Jun 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




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