@sap-ux/fiori-elements-writer 0.4.8 → 0.5.2
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.
- package/dist/data/defaults.js +6 -1
- package/dist/data/templateAttributes.js +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -12
- package/dist/types.d.ts +6 -1
- package/dist/types.js +1 -0
- package/package.json +3 -2
- package/templates/common/add/webapp/Component.ts +20 -0
package/dist/data/defaults.js
CHANGED
|
@@ -51,7 +51,7 @@ exports.setDefaultTemplateSettings = setDefaultTemplateSettings;
|
|
|
51
51
|
* @returns Fiori elements app config with updated defaults for unspecified properties
|
|
52
52
|
*/
|
|
53
53
|
function setAppDefaults(feApp) {
|
|
54
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
55
55
|
// Add template information
|
|
56
56
|
if (!((_a = feApp.app.sourceTemplate) === null || _a === void 0 ? void 0 : _a.version) || !((_b = feApp.app.sourceTemplate) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
57
57
|
const packageInfo = read_pkg_up_1.default.sync({ cwd: __dirname });
|
|
@@ -78,6 +78,11 @@ function setAppDefaults(feApp) {
|
|
|
78
78
|
if (!feApp.ui5.minUI5Version) {
|
|
79
79
|
feApp.ui5.minUI5Version = (_h = feApp.ui5.version) !== null && _h !== void 0 ? _h : templateAttributes_1.TemplateTypeAttributes[feApp.template.type].minimumUi5Version[feApp.service.version];
|
|
80
80
|
}
|
|
81
|
+
// if not explictely disabled, enable the SAP Fiori tools
|
|
82
|
+
feApp.appOptions = (_j = feApp.appOptions) !== null && _j !== void 0 ? _j : {};
|
|
83
|
+
if (feApp.appOptions.sapux !== false) {
|
|
84
|
+
feApp.appOptions.sapux = true;
|
|
85
|
+
}
|
|
81
86
|
return feApp;
|
|
82
87
|
}
|
|
83
88
|
exports.setAppDefaults = setAppDefaults;
|
|
@@ -62,6 +62,10 @@ const templateLibs = {
|
|
|
62
62
|
[types_1.TemplateType.OverviewPage]: {
|
|
63
63
|
baseComponent: appComponentLibOVP,
|
|
64
64
|
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.ovp', 'sap.ui.rta', 'sap.ui.layout']
|
|
65
|
+
},
|
|
66
|
+
[types_1.TemplateType.FlexibleProgrammingModel]: {
|
|
67
|
+
baseComponent: appComponentLibFioriElements,
|
|
68
|
+
ui5Libs: [...commonUi5Libs[types_1.OdataVersion.v4], 'sap.fe.templates']
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
};
|
|
@@ -123,6 +127,12 @@ exports.TemplateTypeAttributes = {
|
|
|
123
127
|
minimumUi5Version: {
|
|
124
128
|
[types_1.OdataVersion.v4]: '1.90.0'
|
|
125
129
|
}
|
|
130
|
+
},
|
|
131
|
+
[types_1.TemplateType.FlexibleProgrammingModel]: {
|
|
132
|
+
supportedODataVersions: [types_1.OdataVersion.v4],
|
|
133
|
+
minimumUi5Version: {
|
|
134
|
+
[types_1.OdataVersion.v4]: '1.94.0'
|
|
135
|
+
}
|
|
126
136
|
}
|
|
127
137
|
};
|
|
128
138
|
//# sourceMappingURL=templateAttributes.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
2
|
import type { App } from '@sap-ux/ui5-application-writer';
|
|
3
|
-
import { FioriElementsApp } from './types';
|
|
3
|
+
import type { FioriElementsApp } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Generate a UI5 application based on the specified Fiori Elements floorplan template.
|
|
6
6
|
*
|
package/dist/index.js
CHANGED
|
@@ -25,10 +25,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.generate = void 0;
|
|
26
26
|
const path_1 = require("path");
|
|
27
27
|
const ejs_1 = require("ejs");
|
|
28
|
+
const fe_fpm_writer_1 = require("@sap-ux/fe-fpm-writer");
|
|
28
29
|
const ui5_application_writer_1 = require("@sap-ux/ui5-application-writer");
|
|
29
30
|
const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
|
|
30
31
|
const packageConfig_1 = require("./packageConfig");
|
|
31
32
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
33
|
+
const types_1 = require("./types");
|
|
32
34
|
const validate_1 = require("./validate");
|
|
33
35
|
const defaults_1 = require("./data/defaults");
|
|
34
36
|
const templateAttributes_1 = require("./data/templateAttributes");
|
|
@@ -43,7 +45,7 @@ const semver_1 = __importDefault(require("semver"));
|
|
|
43
45
|
* @returns Reference to a mem-fs-editor
|
|
44
46
|
*/
|
|
45
47
|
function generate(basePath, data, fs) {
|
|
46
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
47
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
50
|
// Clone rather than modifying callers refs
|
|
49
51
|
const feApp = cloneDeep_1.default(data);
|
|
@@ -63,27 +65,41 @@ function generate(basePath, data, fs) {
|
|
|
63
65
|
// Add new files from templates e.g.
|
|
64
66
|
const rootTemplatesPath = path_1.join(__dirname, '..', 'templates');
|
|
65
67
|
// Add templates common to all template types
|
|
68
|
+
// Common files
|
|
69
|
+
const ignore = ((_c = feApp.appOptions) === null || _c === void 0 ? void 0 : _c.typescript) ? '**/*.js' : '**/*.ts';
|
|
66
70
|
fs.copyTpl(path_1.join(rootTemplatesPath, 'common', 'add', '**/*.*'), basePath, Object.assign(Object.assign({}, feApp), { templateOptions,
|
|
67
|
-
escapeFLPText: templateAttributes_1.escapeFLPText })
|
|
71
|
+
escapeFLPText: templateAttributes_1.escapeFLPText }), undefined, {
|
|
72
|
+
globOptions: { ignore }
|
|
73
|
+
});
|
|
68
74
|
// Extend common files
|
|
69
75
|
const packagePath = path_1.join(basePath, 'package.json');
|
|
70
76
|
// Extend package.json
|
|
71
77
|
fs.extendJSON(packagePath, JSON.parse(ejs_1.render(fs.read(path_1.join(rootTemplatesPath, 'common', 'extend', 'package.json')), feApp, {})));
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
// Special handling for FPM because it is not based on template files but used the fpm writer
|
|
79
|
+
if (feApp.template.type === types_1.TemplateType.FlexibleProgrammingModel) {
|
|
80
|
+
const config = feApp.template.settings;
|
|
81
|
+
fe_fpm_writer_1.generateCustomPage(basePath, {
|
|
82
|
+
entity: config.entityConfig.mainEntityName,
|
|
83
|
+
name: config.pageName
|
|
84
|
+
}, fs);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Copy version specific common templates and version specific, floorplan specific templates
|
|
88
|
+
const templateVersionPath = path_1.join(rootTemplatesPath, `v${(_d = feApp.service) === null || _d === void 0 ? void 0 : _d.version}`);
|
|
89
|
+
[path_1.join(templateVersionPath, 'common', 'add'), path_1.join(templateVersionPath, feApp.template.type, 'add')].forEach((templatePath) => {
|
|
90
|
+
fs.copyTpl(path_1.join(templatePath, '**/*.*'), basePath, feApp, {}, { ignoreNoMatch: true });
|
|
91
|
+
});
|
|
92
|
+
}
|
|
77
93
|
// Update manifest.json with template specific settings
|
|
78
94
|
manifestSettings_1.extendManifestJson(fs, basePath, rootTemplatesPath, feApp);
|
|
79
95
|
const packageJson = JSON.parse(fs.read(packagePath));
|
|
80
96
|
packageJson.scripts = Object.assign(packageJson.scripts, Object.assign({}, packageConfig_1.getPackageJsonTasks({
|
|
81
|
-
localOnly: !((
|
|
82
|
-
addMock: !!((
|
|
83
|
-
sapClient: (
|
|
97
|
+
localOnly: !((_e = feApp.service) === null || _e === void 0 ? void 0 : _e.url),
|
|
98
|
+
addMock: !!((_f = feApp.service) === null || _f === void 0 ? void 0 : _f.metadata),
|
|
99
|
+
sapClient: (_g = feApp.service) === null || _g === void 0 ? void 0 : _g.client,
|
|
84
100
|
flpAppId: feApp.app.flpAppId,
|
|
85
|
-
startFile: (
|
|
86
|
-
localStartFile: (
|
|
101
|
+
startFile: (_h = data === null || data === void 0 ? void 0 : data.app) === null || _h === void 0 ? void 0 : _h.startFile,
|
|
102
|
+
localStartFile: (_j = data === null || data === void 0 ? void 0 : data.app) === null || _j === void 0 ? void 0 : _j.localStartFile
|
|
87
103
|
})));
|
|
88
104
|
fs.writeJSON(packagePath, packageJson);
|
|
89
105
|
return fs;
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export declare enum TemplateType {
|
|
|
5
5
|
ListReportObjectPage = "lrop",
|
|
6
6
|
AnalyticalListPage = "alp",
|
|
7
7
|
OverviewPage = "ovp",
|
|
8
|
-
FormEntryObjectPage = "feop"
|
|
8
|
+
FormEntryObjectPage = "feop",
|
|
9
|
+
FlexibleProgrammingModel = "fpm"
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* General validation error thrown if app config options contain invalid combinations
|
|
@@ -39,6 +40,10 @@ export declare enum TableSelectionMode {
|
|
|
39
40
|
export interface LROPSettings {
|
|
40
41
|
entityConfig: EntityConfig;
|
|
41
42
|
}
|
|
43
|
+
export interface FPMSettings {
|
|
44
|
+
entityConfig: EntityConfig;
|
|
45
|
+
pageName: string;
|
|
46
|
+
}
|
|
42
47
|
export interface WorklistSettings {
|
|
43
48
|
entityConfig: EntityConfig;
|
|
44
49
|
}
|
package/dist/types.js
CHANGED
|
@@ -8,6 +8,7 @@ var TemplateType;
|
|
|
8
8
|
TemplateType["AnalyticalListPage"] = "alp";
|
|
9
9
|
TemplateType["OverviewPage"] = "ovp";
|
|
10
10
|
TemplateType["FormEntryObjectPage"] = "feop";
|
|
11
|
+
TemplateType["FlexibleProgrammingModel"] = "fpm";
|
|
11
12
|
})(TemplateType = exports.TemplateType || (exports.TemplateType = {}));
|
|
12
13
|
/**
|
|
13
14
|
* General validation error thrown if app config options contain invalid combinations
|
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.5.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@sap-ux/odata-service-writer": "0.14.6",
|
|
24
|
-
"@sap-ux/ui5-application-writer": "0.
|
|
24
|
+
"@sap-ux/ui5-application-writer": "0.15.1",
|
|
25
|
+
"@sap-ux/fe-fpm-writer": "0.14.2",
|
|
25
26
|
"@sap-ux/ui5-config": "0.14.5",
|
|
26
27
|
"ejs": "3.1.7",
|
|
27
28
|
"i18next": "20.3.2",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import BaseComponent from '<%- app.baseComponent %>';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace <%- app.id %>
|
|
5
|
+
*/
|
|
6
|
+
export default class Component extends BaseComponent {
|
|
7
|
+
|
|
8
|
+
public static metadata = {
|
|
9
|
+
manifest: "json"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
|
|
14
|
+
* @public
|
|
15
|
+
* @override
|
|
16
|
+
*/
|
|
17
|
+
//public init() : void {
|
|
18
|
+
// super.init();
|
|
19
|
+
//}
|
|
20
|
+
}
|