@sap-ux/fiori-elements-writer 0.14.2 → 0.15.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.
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.extendManifestJson = void 0;
|
|
4
7
|
const types_1 = require("../types");
|
|
5
8
|
const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
|
|
6
9
|
const path_1 = require("path");
|
|
7
10
|
const ejs_1 = require("ejs");
|
|
11
|
+
const semver_1 = __importDefault(require("semver"));
|
|
8
12
|
/**
|
|
9
13
|
* Extend the manifest.json file passed via the fs reference with the template and settings specified.
|
|
10
14
|
* This extends by combining the version specific common manifest with the floorplan/template type
|
|
@@ -16,8 +20,9 @@ const ejs_1 = require("ejs");
|
|
|
16
20
|
* @param feApp - The application config to be used by the manifest templates
|
|
17
21
|
*/
|
|
18
22
|
function extendManifestJson(fs, targetPath, rootTemplatesPath, feApp) {
|
|
23
|
+
var _a, _b;
|
|
19
24
|
let templatePath = feApp.template.type;
|
|
20
|
-
// FEOP and ALP v4 are variants of LROP and so we use the same template
|
|
25
|
+
// FEOP and ALP v4 are variants of LROP and so we use the same template and settings
|
|
21
26
|
if (feApp.service.version === odata_service_writer_1.OdataVersion.v4 &&
|
|
22
27
|
[
|
|
23
28
|
types_1.TemplateType.FormEntryObjectPage,
|
|
@@ -26,6 +31,15 @@ function extendManifestJson(fs, targetPath, rootTemplatesPath, feApp) {
|
|
|
26
31
|
types_1.TemplateType.Worklist
|
|
27
32
|
].includes(feApp.template.type)) {
|
|
28
33
|
templatePath = types_1.TemplateType.ListReportObjectPage;
|
|
34
|
+
// starting with UI5 v1.94.0, contextPath should be used instead of 'entitySet' in manifest for v4 LROP based apps
|
|
35
|
+
const minVersion = semver_1.default.coerce((_a = feApp.ui5) === null || _a === void 0 ? void 0 : _a.minUI5Version);
|
|
36
|
+
if (!minVersion || semver_1.default.gte(minVersion, '1.94.0')) {
|
|
37
|
+
const entityConfig = feApp.template.settings.entityConfig;
|
|
38
|
+
entityConfig.contextPath = `/${entityConfig.mainEntityName}`;
|
|
39
|
+
if ((_b = entityConfig.navigationEntity) === null || _b === void 0 ? void 0 : _b.EntitySet) {
|
|
40
|
+
entityConfig.navigationEntity.contextPath = `${entityConfig.contextPath}/${entityConfig.navigationEntity.Name}`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
29
43
|
}
|
|
30
44
|
// Enhance template settings
|
|
31
45
|
const templateSettings = Object.assign(Object.assign({}, feApp.template.settings), { defaultModel: feApp.service.model, type: feApp.template.type });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal types, not exported for consumer use
|
|
3
|
+
*/
|
|
4
|
+
import type { EntityConfig } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Internal interface used to write entity settings while maintaining a stable external interface
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export interface ManifestEntitySettings extends EntityConfig {
|
|
10
|
+
contextPath?: string;
|
|
11
|
+
navigationEntity?: EntityConfig['navigationEntity'] & {
|
|
12
|
+
contextPath?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -124,7 +124,7 @@ function generate(basePath, data, fs) {
|
|
|
124
124
|
}, fs);
|
|
125
125
|
}
|
|
126
126
|
else {
|
|
127
|
-
// Copy version specific common templates and version specific, floorplan specific templates
|
|
127
|
+
// Copy odata version specific common templates and version specific, floorplan specific templates
|
|
128
128
|
const templateVersionPath = (0, path_1.join)(rootTemplatesPath, `v${(_f = feApp.service) === null || _f === void 0 ? void 0 : _f.version}`);
|
|
129
129
|
[(0, path_1.join)(templateVersionPath, 'common', 'add'), (0, path_1.join)(templateVersionPath, feApp.template.type, 'add')].forEach((templatePath) => {
|
|
130
130
|
fs.copyTpl((0, path_1.join)(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true, globOptions: { ignore, dot: true } });
|
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": "0.
|
|
4
|
+
"version": "0.15.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"semver": "7.5.4",
|
|
30
30
|
"@sap-ux/odata-service-writer": "0.14.33",
|
|
31
31
|
"@sap-ux/ui5-application-writer": "0.25.6",
|
|
32
|
-
"@sap-ux/fe-fpm-writer": "0.23.
|
|
32
|
+
"@sap-ux/fe-fpm-writer": "0.23.7",
|
|
33
33
|
"@sap-ux/ui5-config": "0.19.3",
|
|
34
34
|
"@sap-ux/ui5-test-writer": "0.1.11"
|
|
35
35
|
},
|
|
@@ -25,8 +25,9 @@
|
|
|
25
25
|
"id": "<%- entityConfig.mainEntityName %>List",
|
|
26
26
|
"name": "sap.fe.templates.ListReport",
|
|
27
27
|
"options": {
|
|
28
|
-
"settings": {
|
|
29
|
-
"
|
|
28
|
+
"settings": {<% if (entityConfig.contextPath) { %>
|
|
29
|
+
"contextPath": "<%- entityConfig.contextPath %>"<% } else { %>
|
|
30
|
+
"entitySet": "<%- entityConfig.mainEntityName %>"<% } %>,
|
|
30
31
|
"variantManagement": "Page",
|
|
31
32
|
<% if (type === 'worklist') { %>
|
|
32
33
|
"hideFilterBar": true,<% } %>
|
|
@@ -69,8 +70,9 @@
|
|
|
69
70
|
"name": "sap.fe.templates.ObjectPage",
|
|
70
71
|
"options": {
|
|
71
72
|
"settings": {
|
|
72
|
-
"editableHeaderContent": false
|
|
73
|
-
"
|
|
73
|
+
"editableHeaderContent": false,<% if (entityConfig.contextPath) { %>
|
|
74
|
+
"contextPath": "<%- entityConfig.contextPath %>"<% } else { %>
|
|
75
|
+
"entitySet": "<%- entityConfig.mainEntityName %>"<% } %><% if (type === 'feop') { %>,
|
|
74
76
|
"content": {
|
|
75
77
|
"header": {
|
|
76
78
|
"visible": false,
|
|
@@ -93,8 +95,9 @@
|
|
|
93
95
|
"name": "sap.fe.templates.ObjectPage",
|
|
94
96
|
"options": {
|
|
95
97
|
"settings": {
|
|
96
|
-
"editableHeaderContent": false
|
|
97
|
-
"
|
|
98
|
+
"editableHeaderContent": false,<% if (entityConfig.navigationEntity.contextPath) { %>
|
|
99
|
+
"contextPath": "<%- entityConfig.navigationEntity.contextPath %>"<% } else { %>
|
|
100
|
+
"entitySet": "<%- entityConfig.navigationEntity.EntitySet %>"<% } %>
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
}<%
|