@sap-ux/fe-fpm-writer 0.18.4 → 0.18.6
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/action/index.js +8 -8
- package/dist/action/types.d.ts +1 -1
- package/dist/app/index.js +6 -6
- package/dist/building-block/index.js +15 -11
- package/dist/building-block/types.d.ts +1 -1
- package/dist/column/index.js +15 -15
- package/dist/column/types.d.ts +1 -1
- package/dist/common/defaults.js +1 -1
- package/dist/common/event-handler.js +4 -4
- package/dist/common/file.d.ts +2 -2
- package/dist/common/types.d.ts +2 -2
- package/dist/common/utils.js +3 -3
- package/dist/common/validate.js +3 -3
- package/dist/controller-extension/index.js +9 -9
- package/dist/page/common.d.ts +1 -1
- package/dist/page/common.js +6 -6
- package/dist/page/custom.js +17 -17
- package/dist/page/list.js +2 -2
- package/dist/page/object.js +2 -2
- package/dist/page/types.d.ts +3 -3
- package/dist/section/index.js +15 -15
- package/dist/templates.js +1 -1
- package/dist/view/index.js +12 -12
- package/package.json +2 -2
package/dist/action/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const file_1 = require("../common/file");
|
|
|
22
22
|
function enhanceConfig(data, manifestPath, manifest) {
|
|
23
23
|
// clone input
|
|
24
24
|
const config = Object.assign(Object.assign({}, data), { target: Object.assign({}, data.target), settings: Object.assign({}, data.settings) });
|
|
25
|
-
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
25
|
+
(0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
|
|
26
26
|
// set default values for visibility and enabled
|
|
27
27
|
config.settings.enabled = config.settings.enabled || true;
|
|
28
28
|
config.settings.visible = config.settings.visible || true;
|
|
@@ -68,22 +68,22 @@ exports.enhanceManifestAndGetActionsElementReference = enhanceManifestAndGetActi
|
|
|
68
68
|
* @returns {Promise<Editor>} the updated memfs editor instance
|
|
69
69
|
*/
|
|
70
70
|
function generateCustomAction(basePath, actionConfig, fs) {
|
|
71
|
-
validate_1.validateVersion(actionConfig.minUI5Version);
|
|
71
|
+
(0, validate_1.validateVersion)(actionConfig.minUI5Version);
|
|
72
72
|
if (!fs) {
|
|
73
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
73
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
74
74
|
}
|
|
75
|
-
validate_1.validateBasePath(basePath, fs);
|
|
76
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
75
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
76
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
77
77
|
const manifest = fs.readJSON(manifestPath);
|
|
78
78
|
const config = enhanceConfig(actionConfig, manifestPath, manifest);
|
|
79
79
|
// Apply event handler
|
|
80
80
|
if (config.eventHandler) {
|
|
81
|
-
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, config, config.eventHandler, false, config.typescript, event_handler_1.contextParameter);
|
|
81
|
+
config.eventHandler = (0, event_handler_1.applyEventHandlerConfiguration)(fs, config, config.eventHandler, false, config.typescript, event_handler_1.contextParameter);
|
|
82
82
|
}
|
|
83
83
|
// enhance manifest with action definition and controller reference
|
|
84
84
|
const actions = enhanceManifestAndGetActionsElementReference(manifest, config.target);
|
|
85
|
-
Object.assign(actions, JSON.parse(ejs_1.render(fs.read(templates_1.getTemplatePath(`action/manifest.action.json`)), config, {})));
|
|
86
|
-
fs.writeJSON(manifestPath, manifest, undefined, file_1.getJsonSpace(fs, manifestPath, actionConfig.tabInfo));
|
|
85
|
+
Object.assign(actions, JSON.parse((0, ejs_1.render)(fs.read((0, templates_1.getTemplatePath)(`action/manifest.action.json`)), config, {})));
|
|
86
|
+
fs.writeJSON(manifestPath, manifest, undefined, (0, file_1.getJsonSpace)(fs, manifestPath, actionConfig.tabInfo));
|
|
87
87
|
return fs;
|
|
88
88
|
}
|
|
89
89
|
exports.generateCustomAction = generateCustomAction;
|
package/dist/action/types.d.ts
CHANGED
|
@@ -21,5 +21,5 @@ export interface CustomAction extends CustomElement, EventHandler {
|
|
|
21
21
|
position?: Position;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type InternalCustomAction = CustomAction & InternalCustomElement;
|
|
25
25
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/app/index.js
CHANGED
|
@@ -20,9 +20,9 @@ exports.MIN_VERSION = '1.94.0';
|
|
|
20
20
|
function enableFPM(basePath, config = {}, fs) {
|
|
21
21
|
var _a, _b, _c, _d, _e, _f;
|
|
22
22
|
if (!fs) {
|
|
23
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
23
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
24
24
|
}
|
|
25
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
25
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
26
26
|
if (!fs.exists(manifestPath)) {
|
|
27
27
|
throw new Error(`Invalid project folder. Cannot find required file ${manifestPath}`);
|
|
28
28
|
}
|
|
@@ -41,7 +41,7 @@ function enableFPM(basePath, config = {}, fs) {
|
|
|
41
41
|
}
|
|
42
42
|
// if a minUI5Version is set and it is smaller than the minimum required, increase it
|
|
43
43
|
const minUI5Version = (_e = (_d = manifest['sap.ui5']) === null || _d === void 0 ? void 0 : _d.dependencies) === null || _e === void 0 ? void 0 : _e.minUI5Version;
|
|
44
|
-
if (minUI5Version && semver_1.valid(minUI5Version) && semver_1.lt(minUI5Version, exports.MIN_VERSION)) {
|
|
44
|
+
if (minUI5Version && (0, semver_1.valid)(minUI5Version) && (0, semver_1.lt)(minUI5Version, exports.MIN_VERSION)) {
|
|
45
45
|
fs.extendJSON(manifestPath, {
|
|
46
46
|
'sap.ui5': {
|
|
47
47
|
dependencies: {
|
|
@@ -52,7 +52,7 @@ function enableFPM(basePath, config = {}, fs) {
|
|
|
52
52
|
}
|
|
53
53
|
// add type extensions if required
|
|
54
54
|
if (config.typescript) {
|
|
55
|
-
utils_1.addExtensionTypes(basePath, (_f = manifest['sap.ui5']) === null || _f === void 0 ? void 0 : _f.dependencies.minUI5Version, fs);
|
|
55
|
+
(0, utils_1.addExtensionTypes)(basePath, (_f = manifest['sap.ui5']) === null || _f === void 0 ? void 0 : _f.dependencies.minUI5Version, fs);
|
|
56
56
|
}
|
|
57
57
|
// enable FCL if requested
|
|
58
58
|
if (config.fcl) {
|
|
@@ -75,8 +75,8 @@ function enableFPM(basePath, config = {}, fs) {
|
|
|
75
75
|
// replace Component.js
|
|
76
76
|
if (config.replaceAppComponent) {
|
|
77
77
|
const ext = config.typescript ? 'ts' : 'js';
|
|
78
|
-
const componentTemplate = templates_1.getTemplatePath(`/app/Component.${ext}`);
|
|
79
|
-
fs.copyTpl(componentTemplate, path_1.join(basePath, `webapp/Component.${ext}`), manifest['sap.app']);
|
|
78
|
+
const componentTemplate = (0, templates_1.getTemplatePath)(`/app/Component.${ext}`);
|
|
79
|
+
fs.copyTpl(componentTemplate, (0, path_1.join)(basePath, `webapp/Component.${ext}`), manifest['sap.app']);
|
|
80
80
|
}
|
|
81
81
|
return fs;
|
|
82
82
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -43,10 +47,10 @@ const templates_1 = require("../templates");
|
|
|
43
47
|
function generateBuildingBlock(basePath, config, fs) {
|
|
44
48
|
// Validate the base and view paths
|
|
45
49
|
if (!fs) {
|
|
46
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
50
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
47
51
|
}
|
|
48
|
-
validate_1.validateBasePath(basePath, fs);
|
|
49
|
-
if (!fs.exists(path_1.join(basePath, config.viewOrFragmentPath))) {
|
|
52
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
53
|
+
if (!fs.exists((0, path_1.join)(basePath, config.viewOrFragmentPath))) {
|
|
50
54
|
throw new Error(`Invalid view path ${config.viewOrFragmentPath}.`);
|
|
51
55
|
}
|
|
52
56
|
// Read the view xml and template files and update contents of the view xml file
|
|
@@ -67,10 +71,10 @@ exports.generateBuildingBlock = generateBuildingBlock;
|
|
|
67
71
|
function getUI5XmlDocument(basePath, viewPath, fs) {
|
|
68
72
|
let viewContent;
|
|
69
73
|
try {
|
|
70
|
-
viewContent = fs.read(path_1.join(basePath, viewPath));
|
|
74
|
+
viewContent = fs.read((0, path_1.join)(basePath, viewPath));
|
|
71
75
|
}
|
|
72
76
|
catch (error) {
|
|
73
|
-
throw new Error(`Unable to read xml view file. Details: ${validate_1.getErrorMessage(error)}`);
|
|
77
|
+
throw new Error(`Unable to read xml view file. Details: ${(0, validate_1.getErrorMessage)(error)}`);
|
|
74
78
|
}
|
|
75
79
|
const errorHandler = (level, message) => {
|
|
76
80
|
throw new Error(`Unable to parse xml view file. Details: [${level}] - ${message}`);
|
|
@@ -81,7 +85,7 @@ function getUI5XmlDocument(basePath, viewPath, fs) {
|
|
|
81
85
|
viewDocument = new xmldom_1.DOMParser({ errorHandler }).parseFromString(viewContent);
|
|
82
86
|
}
|
|
83
87
|
catch (error) {
|
|
84
|
-
throw new Error(`Unable to parse xml view file. Details: ${validate_1.getErrorMessage(error)}`);
|
|
88
|
+
throw new Error(`Unable to parse xml view file. Details: ${(0, validate_1.getErrorMessage)(error)}`);
|
|
85
89
|
}
|
|
86
90
|
return viewDocument;
|
|
87
91
|
}
|
|
@@ -110,8 +114,8 @@ function getOrAddMacrosNamespace(ui5XmlDocument) {
|
|
|
110
114
|
*/
|
|
111
115
|
function getTemplateDocument(buildingBlockData, viewDocument, fs) {
|
|
112
116
|
const templateFolderName = buildingBlockData.buildingBlockType;
|
|
113
|
-
const templateFilePath = templates_1.getTemplatePath(`/building-block/${templateFolderName}/View.xml`);
|
|
114
|
-
const templateContent = ejs_1.render(fs.read(templateFilePath), {
|
|
117
|
+
const templateFilePath = (0, templates_1.getTemplatePath)(`/building-block/${templateFolderName}/View.xml`);
|
|
118
|
+
const templateContent = (0, ejs_1.render)(fs.read(templateFilePath), {
|
|
115
119
|
macrosNamespace: getOrAddMacrosNamespace(viewDocument),
|
|
116
120
|
data: buildingBlockData
|
|
117
121
|
}, {});
|
|
@@ -124,7 +128,7 @@ function getTemplateDocument(buildingBlockData, viewDocument, fs) {
|
|
|
124
128
|
templateDocument = new xmldom_1.DOMParser({ errorHandler }).parseFromString(templateContent);
|
|
125
129
|
}
|
|
126
130
|
catch (error) {
|
|
127
|
-
throw new Error(`Unable to parse template file with building block data. Details: ${validate_1.getErrorMessage(error)}`);
|
|
131
|
+
throw new Error(`Unable to parse template file with building block data. Details: ${(0, validate_1.getErrorMessage)(error)}`);
|
|
128
132
|
}
|
|
129
133
|
return templateDocument;
|
|
130
134
|
}
|
|
@@ -149,7 +153,7 @@ function updateViewFile(basePath, viewPath, aggregationPath, viewDocument, templ
|
|
|
149
153
|
targetNode.appendChild(sourceNode);
|
|
150
154
|
// Serialize and format new view xml document
|
|
151
155
|
const newXmlContent = new xmldom_1.XMLSerializer().serializeToString(viewDocument);
|
|
152
|
-
fs.write(path_1.join(basePath, viewPath), xml_formatter_1.default(newXmlContent));
|
|
156
|
+
fs.write((0, path_1.join)(basePath, viewPath), (0, xml_formatter_1.default)(newXmlContent));
|
|
153
157
|
}
|
|
154
158
|
else {
|
|
155
159
|
throw new Error(`Aggregation control not found ${aggregationPath}.`);
|
|
@@ -227,7 +227,7 @@ export interface MicroChart extends BuildingBlock {
|
|
|
227
227
|
* <macro:Paginator id="someID" />
|
|
228
228
|
* @extends {BuildingBlock}
|
|
229
229
|
*/
|
|
230
|
-
export
|
|
230
|
+
export type Paginator = BuildingBlock;
|
|
231
231
|
/**
|
|
232
232
|
* Building block used to create the share functionality.
|
|
233
233
|
* Please note that the 'Share in SAP Jam' option is only available on platforms that are integrated with SAP Jam.
|
package/dist/column/index.js
CHANGED
|
@@ -18,15 +18,15 @@ const semver_1 = require("semver");
|
|
|
18
18
|
* @returns path to the template folder containing the manifest.json ejs template
|
|
19
19
|
*/
|
|
20
20
|
function getManifestRoot(ui5Version) {
|
|
21
|
-
const minVersion = semver_1.coerce(ui5Version);
|
|
21
|
+
const minVersion = (0, semver_1.coerce)(ui5Version);
|
|
22
22
|
if (!minVersion || minVersion.minor >= 86) {
|
|
23
|
-
return templates_1.getTemplatePath('/column/1.86');
|
|
23
|
+
return (0, templates_1.getTemplatePath)('/column/1.86');
|
|
24
24
|
}
|
|
25
25
|
else if (minVersion.minor >= 85) {
|
|
26
|
-
return templates_1.getTemplatePath('/column/1.85');
|
|
26
|
+
return (0, templates_1.getTemplatePath)('/column/1.85');
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
return templates_1.getTemplatePath('column/1.84');
|
|
29
|
+
return (0, templates_1.getTemplatePath)('column/1.84');
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.getManifestRoot = getManifestRoot;
|
|
@@ -42,16 +42,16 @@ exports.getManifestRoot = getManifestRoot;
|
|
|
42
42
|
function enhanceConfig(fs, data, manifestPath, manifest) {
|
|
43
43
|
// clone input and set defaults
|
|
44
44
|
const config = Object.assign({}, data);
|
|
45
|
-
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
45
|
+
(0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
|
|
46
46
|
// Apply event handler
|
|
47
47
|
if (config.eventHandler) {
|
|
48
|
-
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, config, config.eventHandler, false, config.typescript);
|
|
48
|
+
config.eventHandler = (0, event_handler_1.applyEventHandlerConfiguration)(fs, config, config.eventHandler, false, config.typescript);
|
|
49
49
|
}
|
|
50
50
|
// generate column content
|
|
51
51
|
const content = config.properties && config.properties.length > 0
|
|
52
52
|
? `{=%{${config.properties.join("} + ' ' + %{")}}}`
|
|
53
53
|
: 'Sample Text';
|
|
54
|
-
config.content = config.control || defaults_1.getDefaultFragmentContent(content, config.eventHandler);
|
|
54
|
+
config.content = config.control || (0, defaults_1.getDefaultFragmentContent)(content, config.eventHandler);
|
|
55
55
|
return config;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
@@ -63,27 +63,27 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
|
|
|
63
63
|
* @param {Editor} [fs] - the mem-fs editor instance
|
|
64
64
|
*/
|
|
65
65
|
function generateCustomColumn(basePath, customColumn, fs) {
|
|
66
|
-
validate_1.validateVersion(customColumn.minUI5Version);
|
|
66
|
+
(0, validate_1.validateVersion)(customColumn.minUI5Version);
|
|
67
67
|
if (!fs) {
|
|
68
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
68
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
69
69
|
}
|
|
70
|
-
validate_1.validateBasePath(basePath, fs);
|
|
71
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
70
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
71
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
72
72
|
const manifest = fs.readJSON(manifestPath);
|
|
73
73
|
// merge with defaults
|
|
74
74
|
const completeColumn = enhanceConfig(fs, customColumn, manifestPath, manifest);
|
|
75
75
|
// enhance manifest with column definition
|
|
76
76
|
const manifestRoot = getManifestRoot(customColumn.minUI5Version);
|
|
77
|
-
const filledTemplate = ejs_1.render(fs.read(path_1.join(manifestRoot, `manifest.json`)), completeColumn, {});
|
|
78
|
-
file_1.extendJSON(fs, {
|
|
77
|
+
const filledTemplate = (0, ejs_1.render)(fs.read((0, path_1.join)(manifestRoot, `manifest.json`)), completeColumn, {});
|
|
78
|
+
(0, file_1.extendJSON)(fs, {
|
|
79
79
|
filepath: manifestPath,
|
|
80
80
|
content: filledTemplate,
|
|
81
81
|
tabInfo: customColumn.tabInfo
|
|
82
82
|
});
|
|
83
83
|
// add fragment
|
|
84
|
-
const viewPath = path_1.join(completeColumn.path, `${completeColumn.name}.fragment.xml`);
|
|
84
|
+
const viewPath = (0, path_1.join)(completeColumn.path, `${completeColumn.name}.fragment.xml`);
|
|
85
85
|
if (completeColumn.control || !fs.exists(viewPath)) {
|
|
86
|
-
fs.copyTpl(templates_1.getTemplatePath('common/Fragment.xml'), viewPath, completeColumn);
|
|
86
|
+
fs.copyTpl((0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeColumn);
|
|
87
87
|
}
|
|
88
88
|
return fs;
|
|
89
89
|
}
|
package/dist/column/types.d.ts
CHANGED
package/dist/common/defaults.js
CHANGED
|
@@ -16,7 +16,7 @@ function setCommonDefaults(config, manifestPath, manifest) {
|
|
|
16
16
|
config.folder = config.folder || `ext/${config.name[0].toLocaleLowerCase() + config.name.substring(1)}`;
|
|
17
17
|
// calculate namespace and path for generated artifacts
|
|
18
18
|
config.ns = `${manifest['sap.app'].id}.${config.folder.replace(/[\/\\]/g, '.')}`;
|
|
19
|
-
config.path = path_1.join(path_1.dirname(manifestPath), config.folder);
|
|
19
|
+
config.path = (0, path_1.join)((0, path_1.dirname)(manifestPath), config.folder);
|
|
20
20
|
return config;
|
|
21
21
|
}
|
|
22
22
|
exports.setCommonDefaults = setCommonDefaults;
|
|
@@ -54,9 +54,9 @@ function applyEventHandlerConfiguration(fs, config, eventHandler, controllerSuff
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
const ext = typescript ? 'ts' : 'js';
|
|
57
|
-
const controllerPath = path_1.join(config.path || '', `${fileName}${controllerSuffix ? '.controller' : ''}.${ext}`);
|
|
57
|
+
const controllerPath = (0, path_1.join)(config.path || '', `${fileName}${controllerSuffix ? '.controller' : ''}.${ext}`);
|
|
58
58
|
if (!fs.exists(controllerPath)) {
|
|
59
|
-
fs.copyTpl(templates_1.getTemplatePath(`common/EventHandler.${ext}`), controllerPath, {
|
|
59
|
+
fs.copyTpl((0, templates_1.getTemplatePath)(`common/EventHandler.${ext}`), controllerPath, {
|
|
60
60
|
eventHandlerFnName,
|
|
61
61
|
parameters
|
|
62
62
|
});
|
|
@@ -66,10 +66,10 @@ function applyEventHandlerConfiguration(fs, config, eventHandler, controllerSuff
|
|
|
66
66
|
let content = fs.read(controllerPath);
|
|
67
67
|
// Append content with additional script fragment
|
|
68
68
|
if (typeof insertScript.position === 'object') {
|
|
69
|
-
content = utils_1.insertTextAtPosition(insertScript.fragment, content, insertScript.position);
|
|
69
|
+
content = (0, utils_1.insertTextAtPosition)(insertScript.fragment, content, insertScript.position);
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
|
-
content = utils_1.insertTextAtAbsolutePosition(insertScript.fragment, content, insertScript.position);
|
|
72
|
+
content = (0, utils_1.insertTextAtAbsolutePosition)(insertScript.fragment, content, insertScript.position);
|
|
73
73
|
}
|
|
74
74
|
fs.write(controllerPath, content);
|
|
75
75
|
}
|
package/dist/common/file.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
2
|
import type { TabInfo } from '../common/types';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type WriteJsonReplacer = ((key: string, value: any) => any) | Array<string | number>;
|
|
4
|
+
type WriteJsonSpace = number | string;
|
|
5
5
|
interface ExtendJsonParams {
|
|
6
6
|
filepath: string;
|
|
7
7
|
content: string;
|
package/dist/common/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
2
|
-
export
|
|
2
|
+
export type Manifest = ManifestNamespace.SAPJSONSchemaForWebApplicationManifestFile & {
|
|
3
3
|
[key: string]: unknown;
|
|
4
4
|
};
|
|
5
5
|
export interface TabInfo {
|
|
@@ -45,7 +45,7 @@ export declare enum Placement {
|
|
|
45
45
|
/**
|
|
46
46
|
* Position of a custom element relative to an anchor element.
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export type Position = {
|
|
49
49
|
/**
|
|
50
50
|
* The key of another element to be used as placement anchor.
|
|
51
51
|
*/
|
package/dist/common/utils.js
CHANGED
|
@@ -66,10 +66,10 @@ exports.insertTextAtPosition = insertTextAtPosition;
|
|
|
66
66
|
*/
|
|
67
67
|
function addExtensionTypes(basePath, minUI5Version, fs) {
|
|
68
68
|
var _a;
|
|
69
|
-
const version = semver_1.minor((_a = semver_1.coerce(minUI5Version)) !== null && _a !== void 0 ? _a : '1.108.0');
|
|
70
|
-
const path = path_1.join(basePath, '/webapp/ext/sap.fe.d.ts');
|
|
69
|
+
const version = (0, semver_1.minor)((_a = (0, semver_1.coerce)(minUI5Version)) !== null && _a !== void 0 ? _a : '1.108.0');
|
|
70
|
+
const path = (0, path_1.join)(basePath, '/webapp/ext/sap.fe.d.ts');
|
|
71
71
|
if (version < 108 && version !== 102 && !fs.exists(path)) {
|
|
72
|
-
fs.copyTpl(templates_1.getTemplatePath('common/sap.fe.d.ts'), path, { version });
|
|
72
|
+
fs.copyTpl((0, templates_1.getTemplatePath)('common/sap.fe.d.ts'), path, { version });
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
exports.addExtensionTypes = addExtensionTypes;
|
package/dist/common/validate.js
CHANGED
|
@@ -12,7 +12,7 @@ const semver_1 = require("semver");
|
|
|
12
12
|
* @returns true if the version is supported otherwise throws an error
|
|
13
13
|
*/
|
|
14
14
|
function validateVersion(ui5Version) {
|
|
15
|
-
const minVersion = semver_1.coerce(ui5Version);
|
|
15
|
+
const minVersion = (0, semver_1.coerce)(ui5Version);
|
|
16
16
|
if (minVersion && minVersion.minor < 84) {
|
|
17
17
|
throw new Error('SAP Fiori elements for OData v4 is only supported starting with SAPUI5 1.84.');
|
|
18
18
|
}
|
|
@@ -29,9 +29,9 @@ exports.validateVersion = validateVersion;
|
|
|
29
29
|
function validateBasePath(basePath, fs) {
|
|
30
30
|
var _a, _b, _c;
|
|
31
31
|
if (!fs) {
|
|
32
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
32
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
33
33
|
}
|
|
34
|
-
const manifestPath = path_1.join(basePath, 'webapp', 'manifest.json');
|
|
34
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp', 'manifest.json');
|
|
35
35
|
if (!fs.exists(manifestPath)) {
|
|
36
36
|
throw new Error(`Invalid project folder. Cannot find required file ${manifestPath}`);
|
|
37
37
|
}
|
|
@@ -109,7 +109,7 @@ function enhanceConfig(data, manifestPath, manifest) {
|
|
|
109
109
|
// clone input
|
|
110
110
|
const config = Object.assign({}, data);
|
|
111
111
|
// Apply default data
|
|
112
|
-
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
112
|
+
(0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
|
|
113
113
|
// Create `controllerName` with full path/namespace
|
|
114
114
|
config.controllerName = `${config.ns}.${config.name}`;
|
|
115
115
|
// Resolve controller extension id/key
|
|
@@ -175,16 +175,16 @@ function getManifestReplacer(config) {
|
|
|
175
175
|
function generateControllerExtension(basePath, controllerConfig, fs) {
|
|
176
176
|
// Validate the base and view paths
|
|
177
177
|
if (!fs) {
|
|
178
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
178
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
179
179
|
}
|
|
180
|
-
validate_1.validateBasePath(basePath, fs);
|
|
181
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
180
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
181
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
182
182
|
const manifest = fs.readJSON(manifestPath);
|
|
183
183
|
// merge with defaults
|
|
184
184
|
const internalConfig = enhanceConfig(controllerConfig, manifestPath, manifest);
|
|
185
185
|
// enhance manifest with view definition
|
|
186
|
-
const filledTemplate = ejs_1.render(fs.read(templates_1.getTemplatePath('controller-extension/manifest.json')), internalConfig, {});
|
|
187
|
-
file_1.extendJSON(fs, {
|
|
186
|
+
const filledTemplate = (0, ejs_1.render)(fs.read((0, templates_1.getTemplatePath)('controller-extension/manifest.json')), internalConfig, {});
|
|
187
|
+
(0, file_1.extendJSON)(fs, {
|
|
188
188
|
filepath: manifestPath,
|
|
189
189
|
content: filledTemplate,
|
|
190
190
|
replacer: getManifestReplacer(internalConfig),
|
|
@@ -192,12 +192,12 @@ function generateControllerExtension(basePath, controllerConfig, fs) {
|
|
|
192
192
|
});
|
|
193
193
|
// add controller js file
|
|
194
194
|
const ext = controllerConfig.typescript ? 'ts' : 'js';
|
|
195
|
-
const viewPath = path_1.join(internalConfig.path, `${internalConfig.name}.controller.${ext}`);
|
|
195
|
+
const viewPath = (0, path_1.join)(internalConfig.path, `${internalConfig.name}.controller.${ext}`);
|
|
196
196
|
if (!fs.exists(viewPath)) {
|
|
197
|
-
fs.copyTpl(templates_1.getTemplatePath(`controller-extension/Controller.${ext}`), viewPath, internalConfig);
|
|
197
|
+
fs.copyTpl((0, templates_1.getTemplatePath)(`controller-extension/Controller.${ext}`), viewPath, internalConfig);
|
|
198
198
|
}
|
|
199
199
|
if (controllerConfig.typescript) {
|
|
200
|
-
utils_1.addExtensionTypes(basePath, controllerConfig.minUI5Version, fs);
|
|
200
|
+
(0, utils_1.addExtensionTypes)(basePath, controllerConfig.minUI5Version, fs);
|
|
201
201
|
}
|
|
202
202
|
return fs;
|
|
203
203
|
}
|
package/dist/page/common.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Editor } from 'mem-fs-editor';
|
|
|
2
2
|
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
3
3
|
import type { CustomPage, FCL, InternalCustomPage, InternalObjectPage, ObjectPage, ListReport, Navigation, InternalListReport } from './types';
|
|
4
4
|
import type { Manifest } from '../common/types';
|
|
5
|
-
|
|
5
|
+
type EnhancePageConfigFunction = (data: ObjectPage | ListReport, manifest: Manifest) => InternalObjectPage | InternalListReport;
|
|
6
6
|
/**
|
|
7
7
|
* Suffix for patterns to support arbitrary paramters
|
|
8
8
|
*/
|
package/dist/page/common.js
CHANGED
|
@@ -135,10 +135,10 @@ exports.getFclConfig = getFclConfig;
|
|
|
135
135
|
function validatePageConfig(basePath, config, fs) {
|
|
136
136
|
// common validators
|
|
137
137
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
138
|
-
validate_1.validateBasePath(basePath, fs);
|
|
138
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
139
139
|
// validate config against the manifest
|
|
140
140
|
if ((_a = config.navigation) === null || _a === void 0 ? void 0 : _a.sourcePage) {
|
|
141
|
-
const manifest = fs.readJSON(path_1.join(basePath, 'webapp/manifest.json'));
|
|
141
|
+
const manifest = fs.readJSON((0, path_1.join)(basePath, 'webapp/manifest.json'));
|
|
142
142
|
if (!((_d = (_c = (_b = manifest['sap.ui5']) === null || _b === void 0 ? void 0 : _b.routing) === null || _c === void 0 ? void 0 : _c.targets) === null || _d === void 0 ? void 0 : _d[config.navigation.sourcePage])) {
|
|
143
143
|
throw new Error(`Could not find navigation source ${config.navigation.sourcePage}!`);
|
|
144
144
|
}
|
|
@@ -172,16 +172,16 @@ exports.validatePageConfig = validatePageConfig;
|
|
|
172
172
|
*/
|
|
173
173
|
function extendPageJSON(basePath, data, enhanceDataFn, templatePath, fs) {
|
|
174
174
|
if (!fs) {
|
|
175
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
175
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
176
176
|
}
|
|
177
177
|
validatePageConfig(basePath, data, fs);
|
|
178
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
178
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
179
179
|
const manifest = fs.readJSON(manifestPath);
|
|
180
180
|
const config = enhanceDataFn(data, manifest);
|
|
181
181
|
// enhance manifest.json
|
|
182
|
-
file_1.extendJSON(fs, {
|
|
182
|
+
(0, file_1.extendJSON)(fs, {
|
|
183
183
|
filepath: manifestPath,
|
|
184
|
-
content: ejs_1.render(fs.read(templates_1.getTemplatePath(templatePath)), config, {}),
|
|
184
|
+
content: (0, ejs_1.render)(fs.read((0, templates_1.getTemplatePath)(templatePath)), config, {}),
|
|
185
185
|
replacer: getManifestJsonExtensionHelper(config),
|
|
186
186
|
tabInfo: data.tabInfo
|
|
187
187
|
});
|
package/dist/page/custom.js
CHANGED
|
@@ -23,9 +23,9 @@ const file_1 = require("../common/file");
|
|
|
23
23
|
function enhanceData(data, manifestPath, fs) {
|
|
24
24
|
const manifest = fs.readJSON(manifestPath);
|
|
25
25
|
// set common defaults
|
|
26
|
-
const config = defaults_1.setCommonDefaults(data, manifestPath, manifest);
|
|
26
|
+
const config = (0, defaults_1.setCommonDefaults)(data, manifestPath, manifest);
|
|
27
27
|
// set FCL configuration
|
|
28
|
-
const fclConfig = common_1.getFclConfig(manifest, config.navigation);
|
|
28
|
+
const fclConfig = (0, common_1.getFclConfig)(manifest, config.navigation);
|
|
29
29
|
config.fcl = fclConfig.fcl;
|
|
30
30
|
config.controlAggregation = fclConfig.controlAggregation;
|
|
31
31
|
if (config.view === undefined) {
|
|
@@ -43,12 +43,12 @@ exports.enhanceData = enhanceData;
|
|
|
43
43
|
* @returns root folder containg the templates if the version is supported otherwise throws an error
|
|
44
44
|
*/
|
|
45
45
|
function getTemplateRoot(ui5Version) {
|
|
46
|
-
const minVersion = semver_1.coerce(ui5Version);
|
|
46
|
+
const minVersion = (0, semver_1.coerce)(ui5Version);
|
|
47
47
|
if (!minVersion || minVersion.minor >= 94) {
|
|
48
|
-
return templates_1.getTemplatePath('/page/custom/1.94');
|
|
48
|
+
return (0, templates_1.getTemplatePath)('/page/custom/1.94');
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
return templates_1.getTemplatePath('/page/custom/1.84');
|
|
51
|
+
return (0, templates_1.getTemplatePath)('/page/custom/1.84');
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
exports.getTemplateRoot = getTemplateRoot;
|
|
@@ -62,33 +62,33 @@ exports.getTemplateRoot = getTemplateRoot;
|
|
|
62
62
|
*/
|
|
63
63
|
function generate(basePath, data, fs) {
|
|
64
64
|
if (!fs) {
|
|
65
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
65
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
66
66
|
}
|
|
67
|
-
validate_1.validateVersion(data.minUI5Version);
|
|
68
|
-
common_1.validatePageConfig(basePath, data, fs);
|
|
69
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
67
|
+
(0, validate_1.validateVersion)(data.minUI5Version);
|
|
68
|
+
(0, common_1.validatePageConfig)(basePath, data, fs);
|
|
69
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
70
70
|
const config = enhanceData(data, manifestPath, fs);
|
|
71
71
|
// merge content into existing files
|
|
72
72
|
const root = getTemplateRoot(data.minUI5Version);
|
|
73
73
|
// enhance manifest.json
|
|
74
|
-
file_1.extendJSON(fs, {
|
|
74
|
+
(0, file_1.extendJSON)(fs, {
|
|
75
75
|
filepath: manifestPath,
|
|
76
|
-
content: ejs_1.render(fs.read(path_1.join(root, `manifest.json`)), config, {}),
|
|
77
|
-
replacer: common_1.getManifestJsonExtensionHelper(config),
|
|
76
|
+
content: (0, ejs_1.render)(fs.read((0, path_1.join)(root, `manifest.json`)), config, {}),
|
|
77
|
+
replacer: (0, common_1.getManifestJsonExtensionHelper)(config),
|
|
78
78
|
tabInfo: data.tabInfo
|
|
79
79
|
});
|
|
80
80
|
// add extension content
|
|
81
|
-
const viewPath = path_1.join(config.path, `${config.name}.view.xml`);
|
|
81
|
+
const viewPath = (0, path_1.join)(config.path, `${config.name}.view.xml`);
|
|
82
82
|
if (!fs.exists(viewPath)) {
|
|
83
|
-
fs.copyTpl(path_1.join(root, 'ext/View.xml'), viewPath, config);
|
|
83
|
+
fs.copyTpl((0, path_1.join)(root, 'ext/View.xml'), viewPath, config);
|
|
84
84
|
}
|
|
85
85
|
const ext = data.typescript ? 'ts' : 'js';
|
|
86
|
-
const controllerPath = path_1.join(config.path, `${config.name}.controller.${ext}`);
|
|
86
|
+
const controllerPath = (0, path_1.join)(config.path, `${config.name}.controller.${ext}`);
|
|
87
87
|
if (!fs.exists(controllerPath)) {
|
|
88
|
-
fs.copyTpl(path_1.join(root, `ext/Controller.${ext}`), controllerPath, config);
|
|
88
|
+
fs.copyTpl((0, path_1.join)(root, `ext/Controller.${ext}`), controllerPath, config);
|
|
89
89
|
}
|
|
90
90
|
if (data.typescript) {
|
|
91
|
-
utils_1.addExtensionTypes(basePath, data.minUI5Version, fs);
|
|
91
|
+
(0, utils_1.addExtensionTypes)(basePath, data.minUI5Version, fs);
|
|
92
92
|
}
|
|
93
93
|
return fs;
|
|
94
94
|
}
|
package/dist/page/list.js
CHANGED
|
@@ -11,7 +11,7 @@ const common_1 = require("./common");
|
|
|
11
11
|
*/
|
|
12
12
|
function enhanceData(data, manifest) {
|
|
13
13
|
var _a, _b;
|
|
14
|
-
const config = Object.assign(Object.assign(Object.assign({ settings: {} }, data), { name: 'ListReport' }), common_1.getFclConfig(manifest));
|
|
14
|
+
const config = Object.assign(Object.assign(Object.assign({ settings: {} }, data), { name: 'ListReport' }), (0, common_1.getFclConfig)(manifest));
|
|
15
15
|
// move settings into correct possition in the manifest
|
|
16
16
|
config.settings.entitySet = data.entity;
|
|
17
17
|
config.settings.navigation = {};
|
|
@@ -39,7 +39,7 @@ function enhanceData(data, manifest) {
|
|
|
39
39
|
* @returns the updated memfs editor instance
|
|
40
40
|
*/
|
|
41
41
|
function generate(basePath, data, fs) {
|
|
42
|
-
return common_1.extendPageJSON(basePath, data, enhanceData, 'page/list/manifest.json', fs);
|
|
42
|
+
return (0, common_1.extendPageJSON)(basePath, data, enhanceData, 'page/list/manifest.json', fs);
|
|
43
43
|
}
|
|
44
44
|
exports.generate = generate;
|
|
45
45
|
//# sourceMappingURL=list.js.map
|
package/dist/page/object.js
CHANGED
|
@@ -10,7 +10,7 @@ const common_1 = require("./common");
|
|
|
10
10
|
* @returns enhanced configuration
|
|
11
11
|
*/
|
|
12
12
|
function enhanceData(data, manifest) {
|
|
13
|
-
const config = Object.assign(Object.assign(Object.assign({ settings: {} }, data), { name: 'ObjectPage' }), common_1.getFclConfig(manifest));
|
|
13
|
+
const config = Object.assign(Object.assign(Object.assign({ settings: {} }, data), { name: 'ObjectPage' }), (0, common_1.getFclConfig)(manifest));
|
|
14
14
|
// move settings into correct possition in the manifest
|
|
15
15
|
config.settings.entitySet = data.entity;
|
|
16
16
|
config.settings.navigation = {};
|
|
@@ -29,7 +29,7 @@ function enhanceData(data, manifest) {
|
|
|
29
29
|
* @returns the updated memfs editor instance
|
|
30
30
|
*/
|
|
31
31
|
function generate(basePath, data, fs) {
|
|
32
|
-
return common_1.extendPageJSON(basePath, data, enhanceData, '/page/object/manifest.json', fs);
|
|
32
|
+
return (0, common_1.extendPageJSON)(basePath, data, enhanceData, '/page/object/manifest.json', fs);
|
|
33
33
|
}
|
|
34
34
|
exports.generate = generate;
|
|
35
35
|
//# sourceMappingURL=object.js.map
|
package/dist/page/types.d.ts
CHANGED
|
@@ -101,13 +101,13 @@ export interface FCL {
|
|
|
101
101
|
/**
|
|
102
102
|
* Additional internal configuration options that will be calculated based on the provided input as well as the target application.
|
|
103
103
|
*/
|
|
104
|
-
export
|
|
105
|
-
export
|
|
104
|
+
export type InternalCustomPage = CustomPage & InternalCustomElement & FCL;
|
|
105
|
+
export type InternalListReport = ListReport & FCL & {
|
|
106
106
|
name: 'ListReport';
|
|
107
107
|
navigation?: Navigation;
|
|
108
108
|
settings: any;
|
|
109
109
|
};
|
|
110
|
-
export
|
|
110
|
+
export type InternalObjectPage = ObjectPage & FCL & {
|
|
111
111
|
name: 'ObjectPage';
|
|
112
112
|
settings: any;
|
|
113
113
|
};
|
package/dist/section/index.js
CHANGED
|
@@ -18,12 +18,12 @@ const semver_1 = require("semver");
|
|
|
18
18
|
* @returns path to the template folder containing the manifest.json ejs template
|
|
19
19
|
*/
|
|
20
20
|
function getManifestRoot(ui5Version) {
|
|
21
|
-
const minVersion = semver_1.coerce(ui5Version);
|
|
21
|
+
const minVersion = (0, semver_1.coerce)(ui5Version);
|
|
22
22
|
if (!minVersion || minVersion.minor >= 86) {
|
|
23
|
-
return templates_1.getTemplatePath('/section/1.86');
|
|
23
|
+
return (0, templates_1.getTemplatePath)('/section/1.86');
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
return templates_1.getTemplatePath('/section/1.85');
|
|
26
|
+
return (0, templates_1.getTemplatePath)('/section/1.85');
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
exports.getManifestRoot = getManifestRoot;
|
|
@@ -34,7 +34,7 @@ exports.getManifestRoot = getManifestRoot;
|
|
|
34
34
|
* @returns Additional dependencies for fragment.xml
|
|
35
35
|
*/
|
|
36
36
|
function getAdditionalDependencies(ui5Version) {
|
|
37
|
-
const minVersion = semver_1.coerce(ui5Version);
|
|
37
|
+
const minVersion = (0, semver_1.coerce)(ui5Version);
|
|
38
38
|
return !minVersion || minVersion.minor >= 90 ? { 'xmlns:macros': 'sap.fe.macros' } : undefined;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -48,13 +48,13 @@ function getAdditionalDependencies(ui5Version) {
|
|
|
48
48
|
*/
|
|
49
49
|
function enhanceConfig(fs, data, manifestPath, manifest) {
|
|
50
50
|
const config = Object.assign({}, data);
|
|
51
|
-
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
51
|
+
(0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
|
|
52
52
|
// Apply event handler
|
|
53
53
|
if (config.eventHandler) {
|
|
54
|
-
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, config, config.eventHandler, false, config.typescript);
|
|
54
|
+
config.eventHandler = (0, event_handler_1.applyEventHandlerConfiguration)(fs, config, config.eventHandler, false, config.typescript);
|
|
55
55
|
}
|
|
56
56
|
// generate section content
|
|
57
|
-
config.content = config.control || defaults_1.getDefaultFragmentContent(config.name, config.eventHandler);
|
|
57
|
+
config.content = config.control || (0, defaults_1.getDefaultFragmentContent)(config.name, config.eventHandler);
|
|
58
58
|
// Additional dependencies to include into 'Fragment.xml'
|
|
59
59
|
config.dependencies = getAdditionalDependencies(config.minUI5Version);
|
|
60
60
|
return config;
|
|
@@ -68,27 +68,27 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
|
|
|
68
68
|
* @returns {Promise<Editor>} the updated mem-fs editor instance
|
|
69
69
|
*/
|
|
70
70
|
function generateCustomSection(basePath, customSection, fs) {
|
|
71
|
-
validate_1.validateVersion(customSection.minUI5Version);
|
|
71
|
+
(0, validate_1.validateVersion)(customSection.minUI5Version);
|
|
72
72
|
if (!fs) {
|
|
73
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
73
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
74
74
|
}
|
|
75
|
-
validate_1.validateBasePath(basePath, fs);
|
|
76
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
75
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
76
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
77
77
|
const manifest = fs.readJSON(manifestPath);
|
|
78
78
|
// merge with defaults
|
|
79
79
|
const completeSection = enhanceConfig(fs, customSection, manifestPath, manifest);
|
|
80
80
|
// enhance manifest with section definition
|
|
81
81
|
const manifestRoot = getManifestRoot(customSection.minUI5Version);
|
|
82
|
-
const filledTemplate = ejs_1.render(fs.read(path_1.join(manifestRoot, `manifest.json`)), completeSection, {});
|
|
83
|
-
file_1.extendJSON(fs, {
|
|
82
|
+
const filledTemplate = (0, ejs_1.render)(fs.read((0, path_1.join)(manifestRoot, `manifest.json`)), completeSection, {});
|
|
83
|
+
(0, file_1.extendJSON)(fs, {
|
|
84
84
|
filepath: manifestPath,
|
|
85
85
|
content: filledTemplate,
|
|
86
86
|
tabInfo: customSection.tabInfo
|
|
87
87
|
});
|
|
88
88
|
// add fragment
|
|
89
|
-
const viewPath = path_1.join(completeSection.path, `${completeSection.name}.fragment.xml`);
|
|
89
|
+
const viewPath = (0, path_1.join)(completeSection.path, `${completeSection.name}.fragment.xml`);
|
|
90
90
|
if (!fs.exists(viewPath)) {
|
|
91
|
-
fs.copyTpl(templates_1.getTemplatePath('common/Fragment.xml'), viewPath, completeSection);
|
|
91
|
+
fs.copyTpl((0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeSection);
|
|
92
92
|
}
|
|
93
93
|
return fs;
|
|
94
94
|
}
|
package/dist/templates.js
CHANGED
|
@@ -10,7 +10,7 @@ const path_1 = require("path");
|
|
|
10
10
|
* @returns the path of the template specified or templates root folder
|
|
11
11
|
*/
|
|
12
12
|
function getTemplatePath(relativeTemplatePath = '') {
|
|
13
|
-
return path_1.join(__dirname, '../templates', relativeTemplatePath);
|
|
13
|
+
return (0, path_1.join)(__dirname, '../templates', relativeTemplatePath);
|
|
14
14
|
}
|
|
15
15
|
exports.getTemplatePath = getTemplatePath;
|
|
16
16
|
//# sourceMappingURL=templates.js.map
|
package/dist/view/index.js
CHANGED
|
@@ -53,10 +53,10 @@ function mergeViews(config, manifest) {
|
|
|
53
53
|
*/
|
|
54
54
|
function enhanceConfig(fs, data, manifestPath, manifest) {
|
|
55
55
|
const config = Object.assign({}, data);
|
|
56
|
-
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
56
|
+
(0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
|
|
57
57
|
// apply event handler
|
|
58
58
|
if (config.eventHandler) {
|
|
59
|
-
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, config, config.eventHandler, true, config.typescript);
|
|
59
|
+
config.eventHandler = (0, event_handler_1.applyEventHandlerConfiguration)(fs, config, config.eventHandler, true, config.typescript);
|
|
60
60
|
}
|
|
61
61
|
// fill config.views, merge new data into existing views
|
|
62
62
|
mergeViews(config, manifest);
|
|
@@ -65,7 +65,7 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
|
|
|
65
65
|
config.content = config.control;
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
|
-
config.content = defaults_1.getDefaultFragmentContent(config.name, config.eventHandler, true);
|
|
68
|
+
config.content = (0, defaults_1.getDefaultFragmentContent)(config.name, config.eventHandler, true);
|
|
69
69
|
}
|
|
70
70
|
return config;
|
|
71
71
|
}
|
|
@@ -78,30 +78,30 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
|
|
|
78
78
|
* @returns {Promise<Editor>} the updated mem-fs editor instance
|
|
79
79
|
*/
|
|
80
80
|
function generateCustomView(basePath, customView, fs) {
|
|
81
|
-
validate_1.validateVersion(customView.minUI5Version);
|
|
81
|
+
(0, validate_1.validateVersion)(customView.minUI5Version);
|
|
82
82
|
if (!fs) {
|
|
83
|
-
fs = mem_fs_editor_1.create(mem_fs_1.create());
|
|
83
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
84
84
|
}
|
|
85
|
-
validate_1.validateBasePath(basePath, fs);
|
|
86
|
-
const manifestPath = path_1.join(basePath, 'webapp/manifest.json');
|
|
85
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
86
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
87
87
|
const manifest = fs.readJSON(manifestPath);
|
|
88
88
|
// merge with defaults
|
|
89
89
|
const completeView = enhanceConfig(fs, customView, manifestPath, manifest);
|
|
90
90
|
// enhance manifest with view definition
|
|
91
|
-
const filledTemplate = ejs_1.render(fs.read(templates_1.getTemplatePath('view/manifest.json')), completeView, {});
|
|
92
|
-
file_1.extendJSON(fs, {
|
|
91
|
+
const filledTemplate = (0, ejs_1.render)(fs.read((0, templates_1.getTemplatePath)('view/manifest.json')), completeView, {});
|
|
92
|
+
(0, file_1.extendJSON)(fs, {
|
|
93
93
|
filepath: manifestPath,
|
|
94
94
|
content: filledTemplate,
|
|
95
95
|
tabInfo: customView.tabInfo
|
|
96
96
|
});
|
|
97
97
|
// add fragment
|
|
98
98
|
if (customView.viewUpdate !== false) {
|
|
99
|
-
const viewPath = path_1.join(completeView.path, `${completeView.name}.fragment.xml`);
|
|
99
|
+
const viewPath = (0, path_1.join)(completeView.path, `${completeView.name}.fragment.xml`);
|
|
100
100
|
if (completeView.control === true) {
|
|
101
|
-
fs.copyTpl(templates_1.getTemplatePath('view/ext/CustomViewWithTable.xml'), viewPath, completeView);
|
|
101
|
+
fs.copyTpl((0, templates_1.getTemplatePath)('view/ext/CustomViewWithTable.xml'), viewPath, completeView);
|
|
102
102
|
}
|
|
103
103
|
else if (!fs.exists(viewPath)) {
|
|
104
|
-
fs.copyTpl(templates_1.getTemplatePath('common/Fragment.xml'), viewPath, completeView);
|
|
104
|
+
fs.copyTpl((0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeView);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
return fs;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fe-fpm-writer",
|
|
3
3
|
"description": "SAP Fiori elements flexible programming model writer",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.6",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"xpath": "0.0.32"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@sap-ux/project-access": "1.
|
|
32
|
+
"@sap-ux/project-access": "1.1.3",
|
|
33
33
|
"@types/ejs": "3.1.0",
|
|
34
34
|
"@types/mem-fs": "1.1.2",
|
|
35
35
|
"@types/mem-fs-editor": "7.0.1",
|