Describe the bug
Annotating an inline attachment with @UI.Hidden reuslts in an empty facet beeing displayed on the object page instead of the facet beeing hidden as well.
To Reproduce
Steps to reproduce the behavior:
- Create an entity with an inline attachment.
using {cuid} from '@sap/cds/common';
using {Attachment, Attachments} from '@cap-js/attachments';
namespace sample
entity Invoices : cuid {
documentNumber : String;
// annotation causes empty facet
attachment : Attachment @UI.Hidden;
// Required to trigger UI enhancement for attachments due to a different bug.
attachments : Composition of many Attachments @UI.Hidden;
}
annotate Invoices with @(
UI.LineItem: [ {Value: attachment_filename}],
UI.Facets : [] // Required for plugin to add facets
)
(Note: the attachments composition is only required to add the facet for the inline attachment. see: #470 )
- Expose the entity through a service definition
service AccountinService {
@odata.draft.enabled
entity Invoices as projection on my.Invoices;
}
- Start development preview with
cds watch
- Open Fiori preview for
AccountingService.Invoices
- Create a new entity to open the object page
- The objec page shows an empty facet with title
"Attachment"
Likey caused by:
// lib/plugin.js
336 facets.push({
337 $Type: "UI.ReferenceFacet",
338 ID: `${prefix}_attachment`,
339 Target: fieldGroupKey,
340 Label: label,
341 })
Possible solution:
- Copy
@UI.Hidden from content element to fact.
// lib/plugin.js
336 facets.push({
337 $Type: "UI.ReferenceFacet",
338 ID: `${prefix}_attachment`,
339 Target: fieldGroupKey,
340 Label: label,
341 "@UI.Hidden": contentElement["@UI.Hidden"],
342 })
Expected behavior
When using @UI.Hidden with an inline attachment, the facet should inherit the content of the annotation, and should be hidden as well.
The facets for inline attachments should behave like the facets for attachment compositions.
Screenshots
Empty facet:
Customer Info
Company: TUM project with SAP.
Describe the bug
Annotating an inline attachment with
@UI.Hiddenreuslts in an empty facet beeing displayed on the object page instead of the facet beeing hidden as well.To Reproduce
Steps to reproduce the behavior:
(Note: the
attachmentscomposition is only required to add the facet for the inline attachment. see: #470 )cds watchAccountingService.Invoices"Attachment"Likey caused by:
Possible solution:
@UI.Hiddenfrom content element to fact.Expected behavior
When using
@UI.Hiddenwith an inline attachment, the facet should inherit the content of the annotation, and should be hidden as well.The facets for inline attachments should behave like the facets for attachment compositions.
Screenshots
Empty facet:
Customer Info
Company: TUM project with SAP.