Bug 37762: VueJS framework: Add attribute.format check in empty groups check

This keeps the same functionality as before, i.e. hide the whole group
if all attributes within are empty. However it now also checks for
'format' as some resources may want to format the display of empty attributes.

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2026-03-02 15:29:34 -01:00 committed by Lucas Gass
parent 66d7845764
commit bc0ae34098
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 16 additions and 3 deletions

View File

@ -507,11 +507,24 @@ export function useBaseResource(resourceConfig) {
}
if (component === "Show" && resource) {
groupFields.forEach(field => {
if (
const hasStandardData =
resource[field.name] != null &&
(field.type !== "relationshipWidget" ||
resource[field.name].length > 0)
) {
resource[field.name].length > 0);
let hasFormattedData = false;
if (field.format && typeof field.format === "function") {
const formatted = field.format(
resource[field.name],
resource
);
hasFormattedData =
formatted !== null &&
formatted !== undefined &&
formatted !== "";
}
if (hasStandardData || hasFormattedData) {
groupInfo.hasDataToDisplay = true;
}
});