Skip to content

Commit 291351f

Browse files
Doc(eslint-plugin-fiori-tools): update DataField rule documentation with semantic link information (#4506)
* chore: update rule doc * chore: changeset * fix: update text in the md doc * Update packages/eslint-plugin-fiori-tools/docs/rules/sap-no-data-field-intent-based-navigation.md Co-authored-by: Hitesh Parmar <[email protected]> * fix: code snippet --------- Co-authored-by: Hitesh Parmar <[email protected]>
1 parent 3df1f1a commit 291351f

2 files changed

Lines changed: 53 additions & 4 deletions

File tree

.changeset/fresh-weeks-brush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sap-ux/eslint-plugin-fiori-tools': patch
3+
---
4+
5+
Update sap-no-data-field-intent-based-navigation rule documentation with information on semantic link navigation.

packages/eslint-plugin-fiori-tools/docs/rules/sap-no-data-field-intent-based-navigation.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,59 @@ Using `UI.DataFieldForIntentBasedNavigation` or `UI.DataFieldWithIntentBasedNavi
4545
</Annotation>
4646
```
4747

48-
#### Correct: Semantic Link or Smart Link Navigation Is Used
48+
### Correct: Semantic Link or Smart Link Navigation Is Used Using `Common.SemanticObject` on the Entity Property
4949

50-
The `sap.ui.comp.navpopover.SmartLink` control provides a popover with navigation links to related applications, for example, more detailed information about customer data.
51-
For more information about this control, see the [API Reference](https://ui5.sap.com/#/api/sap.ui.comp.navpopover.SmartLink) and the [samples](https://ui5.sap.com/#/entity/sap.ui.comp.navpopover.SmartLink).
50+
Annotate the entity property, for example,`CustomerId`, with the `Common.SemanticObject` annotation before using it in a `UI.LineItem` or `UI.FieldGroup`. SAP Fiori elements automatically detects this and renders the field as a semantic link.
51+
52+
#### Step 1: Annotate the Entity Property:
53+
54+
```xml
55+
<!-- Applied to the actual OData property, NOT inside DataField -->
56+
<Annotations Target="YourEntityType/CustomerId">
57+
<Annotation Term="Common.SemanticObject" String="Customer"/>
58+
</Annotations>
59+
```
60+
61+
#### Step 2: Reference the Property in Your UI Annotations:
62+
Note: No navigation annotation is needed.
63+
64+
For a table column using the `UI.LineItem` annotation:
65+
66+
```xml
67+
<Annotation Term="UI.LineItem">
68+
<Collection>
69+
<Record Type="UI.DataField">
70+
<PropertyValue Property="Value" Path="CustomerId"/>
71+
<PropertyValue Property="Label" String="Customer"/>
72+
<!-- Semantic Link rendered automatically due to Common.SemanticObject on CustomerId property -->
73+
</Record>
74+
</Collection>
75+
</Annotation>
76+
```
77+
78+
For a form field using the `UI.FieldGroup` annotation:
79+
80+
```xml
81+
<Annotation Term="UI.FieldGroup" Qualifier="GeneralInformation">
82+
<Record Type="UI.FieldGroupType">
83+
<PropertyValue Property="Data">
84+
<Collection>
85+
<Record Type="UI.DataField">
86+
<PropertyValue Property="Value" Path="CustomerId"/>
87+
<PropertyValue Property="Label" String="Customer"/>
88+
<!-- Semantic Link rendered automatically due to Common.SemanticObject on CustomerId property -->
89+
</Record>
90+
</Collection>
91+
</PropertyValue>
92+
</Record>
93+
</Annotation>
94+
```
5295

5396
## Bug Report
5497

5598
If you encounter an issue with this rule, please open a [GitHub issue](https://github.com/SAP/open-ux-tools/issues).
5699

57100
## Further Reading
58101

59-
- [UI5 UI Adaptation Documentation: Smart Link](https://ui5.sap.com/#/topic/f638884d0d624ad8a243f4005f8e9972)
102+
- [Semantic Link Implementation in SAP Fiori Elements](https://ui5.sap.com/#/topic/c18ada4bc56e427a9a2df2d1898f28a5)
103+
- [Smart Link and Navigation Intents](https://ui5.sap.com/#/topic/d782acf8bfd74107ad6a04f0361c5f62)

0 commit comments

Comments
 (0)