Skip to content

Conversation

@nlunets
Copy link
Member

@nlunets nlunets commented Dec 19, 2025

With this change we would introduce a new experimental annotation UI.RenderingHint, that can be applied to a property or a parameter.

The goal is to be able to tag some specific properties in the backend with a 'hint' to allow the frontend code to react to it in a specific manner.

For instance, consider a property containing rich text, we need to display that in a specific way on the frontend in different contexts (and yes, i'm aware of Common.TextFormat for this one, it's more to illustrate the concept).

In the end we might want to allow application to tag their specific repeating data structure in the backend and have dedicated controls / flow on the UI that should always be applied, thus why a generic term would be beneficial.

Copy link
Contributor

@HeikoTheissen HeikoTheissen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description is contradictory:

  • A human-readable text should be read by humans, not interpreted by the frontend logic.
  • If the frontend shall render the element in a special way, I would expect one annotation term for each such way, not one term with many possible meanings. Or at least a pre-defined list of allowed values for the term.

@nlunets
Copy link
Member Author

nlunets commented Dec 19, 2025

A human-readable text should be read by humans, not interpreted by the frontend logic.

Good point :)

If the frontend shall render the element in a special way, I would expect one annotation term for each such way, not one term with many possible meanings. Or at least a pre-defined list of allowed values for the term.

The definition might come from consumers themselves, so they would be responsible for establishing the key-function pair between client and backend, as such we don't really have a way to know or maintain that list. Nor do we want to.

@HeikoTheissen
Copy link
Contributor

The definition might come from consumers themselves, so they would be responsible for establishing the key-function pair between client and backend, as such we don't really have a way to know or maintain that list. Nor do we want to.

Can you give an example how a consumer would achieve a particular rendering? For example, a decimal property Temperature shall be rendered as a mercury-filled thermometer.

@nlunets
Copy link
Member Author

nlunets commented Dec 19, 2025

Sure, I'll make some adjustments

<Term Name="RenderingHint" Type="Edm.String" Nullable="false" AppliesTo="Property Parameter">
<Annotation Term="Common.Experimental" />
<Annotation Term="Core.Description" String="A short text, that gives a hint that the frontend logic can use to render specific UI elements." />
<Annotation Term="Core.LongDescription">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would the UI interpret these values given that they do not come from a fixed list of allowed values but are arbitrary? Is there a BAdI-like mechanism in the UI code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how BAdi works :)
But the idea is that a reusable element of sort would register itself itself on the UI with the same name that should be then used for the RenderingHint.

UICode.registerHint("Thermometer", MyThermometer)

@HeikoTheissen
Copy link
Contributor

Is this the same as the CSS property appearance? Then it could be expressed by adding a new property apperance to the term HTML.CssDefaults.

@nlunets
Copy link
Member Author

nlunets commented Jan 12, 2026

It's related in purpose but it's not the same, so setting this here would be potentially misleading

@uhlmannm
Copy link
Member

Discussion in Albatross: How about using custom vocabularies for that purpose?
These are already supported by CAP, see https://cap.cloud.sap/docs/advanced/odata#additional-vocabularies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants