@sap-ux/fiori-elements-writer 2.4.19 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -34,7 +34,19 @@ function extendManifestJson(fs, targetPath, rootTemplatesPath, feApp) {
|
|
|
34
34
|
const minVersion = semver_1.default.coerce(feApp.ui5?.minUI5Version);
|
|
35
35
|
if (!minVersion || semver_1.default.gte(minVersion, '1.94.0')) {
|
|
36
36
|
const entityConfig = feApp.template.settings.entityConfig;
|
|
37
|
-
entityConfig.
|
|
37
|
+
if (entityConfig.mainEntityParameterName) {
|
|
38
|
+
// If the main entity is parameterised, clear the navigation entity configuration
|
|
39
|
+
// as we dont support the navigation entity in this scenario.
|
|
40
|
+
entityConfig.navigationEntity = undefined;
|
|
41
|
+
}
|
|
42
|
+
// Set the contextPath for the main entity
|
|
43
|
+
// If the main entity is parameterised, include the parameter name in the contextPath.
|
|
44
|
+
// Otherwise, use only the main entity name.
|
|
45
|
+
entityConfig.contextPath = entityConfig.mainEntityParameterName
|
|
46
|
+
? `/${entityConfig.mainEntityName}/${entityConfig.mainEntityParameterName}`
|
|
47
|
+
: `/${entityConfig.mainEntityName}`;
|
|
48
|
+
// Set the contextPath for the navigation entity
|
|
49
|
+
// If the navigation entity exists, append its name to the main entity's contextPath.
|
|
38
50
|
if (entityConfig.navigationEntity?.EntitySet) {
|
|
39
51
|
entityConfig.navigationEntity.contextPath = `${entityConfig.contextPath}/${entityConfig.navigationEntity.Name}`;
|
|
40
52
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -22,7 +22,44 @@ export declare class ValidationError extends Error {
|
|
|
22
22
|
constructor(message: string);
|
|
23
23
|
}
|
|
24
24
|
export interface EntityConfig {
|
|
25
|
+
/**
|
|
26
|
+
* The name of the main entity used for list page entity
|
|
27
|
+
*/
|
|
25
28
|
mainEntityName: string;
|
|
29
|
+
/**
|
|
30
|
+
* Represents a parameter used alongside the main entity to query for data.
|
|
31
|
+
* When this parameter is set, the prompt for selecting navigation properties is skipped,
|
|
32
|
+
* as the entity set is parameterised and directly linked to its target entity set.
|
|
33
|
+
* If a value is provided, navigation routes will always include it.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Example input:
|
|
37
|
+
* ```
|
|
38
|
+
* {
|
|
39
|
+
* mainEntityName: `Products`,
|
|
40
|
+
* mainEntityParameterName: 'ProductFilter'
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
* Example of the resulting routing entry:
|
|
44
|
+
* ```
|
|
45
|
+
* "routes": [
|
|
46
|
+
* {
|
|
47
|
+
* "pattern": ":?query:",
|
|
48
|
+
* "name": "ProductsList",
|
|
49
|
+
* "target": "ProductsList"
|
|
50
|
+
* },
|
|
51
|
+
* {
|
|
52
|
+
* "pattern": "Products({key})/ProductFilter({key2}):?query:",
|
|
53
|
+
* "name": "ProductsObjectPage",
|
|
54
|
+
* "target": "ProductsObjectPage"
|
|
55
|
+
* }
|
|
56
|
+
* ]
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
mainEntityParameterName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Configuration for the navigation entity used for object page navigation.
|
|
62
|
+
*/
|
|
26
63
|
navigationEntity?: {
|
|
27
64
|
EntitySet: string;
|
|
28
65
|
Name: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fiori-elements-writer",
|
|
3
3
|
"description": "SAP Fiori elements application writer",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"semver": "7.5.4",
|
|
30
30
|
"@sap-ux/odata-service-writer": "0.27.5",
|
|
31
31
|
"@sap-ux/ui5-application-writer": "1.5.3",
|
|
32
|
-
"@sap-ux/fe-fpm-writer": "0.35.
|
|
32
|
+
"@sap-ux/fe-fpm-writer": "0.35.5",
|
|
33
33
|
"@sap-ux/ui5-config": "0.28.2",
|
|
34
34
|
"@sap-ux/ui5-test-writer": "0.7.3",
|
|
35
35
|
"@sap-ux/fiori-generator-shared": "0.12.8",
|
|
36
36
|
"@sap-ux/cap-config-writer": "0.10.8",
|
|
37
|
-
"@sap-ux/annotation-generator": "0.3.
|
|
37
|
+
"@sap-ux/annotation-generator": "0.3.40",
|
|
38
38
|
"@sap-ux/logger": "0.7.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
"target": "<%- entityConfig.mainEntityName %>List"
|
|
9
9
|
},<% } %>
|
|
10
10
|
{
|
|
11
|
-
"pattern": "<%- entityConfig.mainEntityName %>({key})
|
|
11
|
+
"pattern": "<%- entityConfig.mainEntityName %>({key})<% if (entityConfig.mainEntityParameterName) { %>/<%- entityConfig.mainEntityParameterName %>({key2})<% } %>:?query:",
|
|
12
12
|
"name": "<%- entityConfig.mainEntityName %>ObjectPage",
|
|
13
13
|
"target": "<%- entityConfig.mainEntityName %>ObjectPage"
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
<% if (entityConfig.navigationEntity && entityConfig.navigationEntity.EntitySet) { %>,
|
|
15
16
|
{
|
|
16
17
|
"pattern": "<%- entityConfig.mainEntityName %>({key})/<%- entityConfig.navigationEntity.Name %>({key2}):?query:",
|
|
17
18
|
"name": "<%- entityConfig.navigationEntity.EntitySet %>ObjectPage",
|