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:
parent
66d7845764
commit
bc0ae34098
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue