@sap-ux/fe-fpm-writer 0.2.1 → 0.3.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.
- package/CHANGELOG.md +6 -0
- package/dist/column/index.d.ts.map +1 -1
- package/dist/column/index.js +5 -18
- package/dist/column/index.js.map +1 -1
- package/dist/common/defaults.d.ts +10 -0
- package/dist/common/defaults.d.ts.map +1 -1
- package/dist/common/defaults.js +24 -1
- package/dist/common/defaults.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/section/index.d.ts +12 -0
- package/dist/section/index.d.ts.map +1 -0
- package/dist/section/index.js +61 -0
- package/dist/section/index.js.map +1 -0
- package/dist/section/types.d.ts +28 -0
- package/dist/section/types.d.ts.map +1 -0
- package/dist/section/types.js +3 -0
- package/dist/section/types.js.map +1 -0
- package/package.json +1 -1
- package/templates/common/Fragment.xml +3 -0
- package/templates/section/manifest.section.json +32 -0
- package/templates/column/ext/CustomColumnFragment.xml +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAA6B,MAAM,SAAS,CAAC;AAMvE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ3D;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAA6B,MAAM,SAAS,CAAC;AAMvE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ3D;AA8BD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAkC3G"}
|
package/dist/column/index.js
CHANGED
|
@@ -42,23 +42,10 @@ function enhanceConfig(data, manifestPath, manifest) {
|
|
|
42
42
|
config.eventHandler = `${config.ns}.${config.name}.onPress`;
|
|
43
43
|
}
|
|
44
44
|
// generate column content
|
|
45
|
-
|
|
46
|
-
config.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const content = config.properties && config.properties.length > 0
|
|
50
|
-
? `{=%{${config.properties.join("} + ' ' + %{")}}}`
|
|
51
|
-
: 'Sample Text';
|
|
52
|
-
if (config.eventHandler) {
|
|
53
|
-
const parts = config.eventHandler.split('.');
|
|
54
|
-
const method = parts.pop();
|
|
55
|
-
const handler = parts.join('/');
|
|
56
|
-
config.content = `<Button core:require="{ handler: '${handler}'}" text="${content}" press="handler.${method}" />`;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
config.content = `<Text text="${content}" />`;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
45
|
+
const content = config.properties && config.properties.length > 0
|
|
46
|
+
? `{=%{${config.properties.join("} + ' ' + %{")}}}`
|
|
47
|
+
: 'Sample Text';
|
|
48
|
+
config.content = config.control || (0, defaults_1.getDefaultFragmentContent)(content, config.eventHandler);
|
|
62
49
|
return config;
|
|
63
50
|
}
|
|
64
51
|
/**
|
|
@@ -90,7 +77,7 @@ function generateCustomColumn(basePath, customColumn, fs) {
|
|
|
90
77
|
fs.extendJSON(manifestPath, JSON.parse(filledTemplate));
|
|
91
78
|
// add fragment
|
|
92
79
|
const viewPath = (0, path_1.join)(completeColumn.path, `${completeColumn.name}.fragment.xml`);
|
|
93
|
-
fs.copyTpl((0, path_1.join)(root, '
|
|
80
|
+
fs.copyTpl((0, path_1.join)(root, 'common/Fragment.xml'), viewPath, completeColumn);
|
|
94
81
|
return fs;
|
|
95
82
|
}
|
|
96
83
|
exports.generateCustomColumn = generateCustomColumn;
|
package/dist/column/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuE;AACvE,mCAAiD;AACjD,iDAA+C;AAE/C,+BAA4B;AAC5B,6BAA6B;AAE7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuE;AACvE,mCAAiD;AACjD,iDAA+C;AAE/C,+BAA4B;AAC5B,6BAA6B;AAE7B,iDAAkF;AAElF;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,UAAmB;IAC/C,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,IAAI,EAAE;QAChD,OAAO,IAAA,WAAI,EAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;KACzD;SAAM,IAAI,UAAU,KAAK,IAAI,EAAE;QAC5B,OAAO,IAAA,WAAI,EAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;KACzD;SAAM;QACH,OAAO,IAAA,WAAI,EAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;KACzD;AACL,CAAC;AARD,0CAQC;AAED;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,IAAuB,EAAE,YAAoB,EAAE,QAAkB;IACpF,+BAA+B;IAC/B,MAAM,MAAM,qBAAgE,IAAI,CAAE,CAAC;IACnF,IAAA,4BAAiB,EAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAElD,mDAAmD;IACnD,IAAI,MAAM,CAAC,YAAY,KAAK,IAAI,EAAE;QAC9B,MAAM,CAAC,YAAY,GAAG,GAAG,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,UAAU,CAAC;KAC/D;IAED,0BAA0B;IAC1B,MAA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,eAAe,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,IAAA,YAAM,EAAC,EAAE,CAAC,IAAI,CAAC,IAAA,WAAI,EAAC,YAAY,EAAE,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IAC5F,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAExD,eAAe;IACf,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,cAAc,CAAC,IAAI,EAAE,GAAG,cAAc,CAAC,IAAI,eAAe,CAAC,CAAC;IAClF,EAAE,CAAC,OAAO,CAAC,IAAA,WAAI,EAAC,IAAI,EAAE,qBAAqB,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;IAExE,OAAO,EAAE,CAAC;AACd,CAAC;AAlCD,oDAkCC"}
|
|
@@ -8,4 +8,14 @@ import { CustomElement, InternalCustomElement, Manifest } from './types';
|
|
|
8
8
|
* @returns enhanced configuration
|
|
9
9
|
*/
|
|
10
10
|
export declare function setCommonDefaults<T extends CustomElement & Partial<InternalCustomElement>>(config: T, manifestPath: string, manifest: Manifest): InternalCustomElement & T;
|
|
11
|
+
/**
|
|
12
|
+
* Method to generate default content for xml fragment.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} text - text of button or label
|
|
15
|
+
* @param {string} [eventHandler] - event handler path
|
|
16
|
+
* if value is passed then "Button" control with 'press' event would be generated
|
|
17
|
+
* if value is not passed then "Text" control would be generated
|
|
18
|
+
* @returns default content for fragment
|
|
19
|
+
*/
|
|
20
|
+
export declare function getDefaultFragmentContent(text: string, eventHandler?: string): string;
|
|
11
21
|
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/common/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,EACtF,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,QAAQ,GACnB,qBAAqB,GAAG,CAAC,CAa3B"}
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/common/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,EACtF,MAAM,EAAE,CAAC,EACT,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,QAAQ,GACnB,qBAAqB,GAAG,CAAC,CAa3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAWrF"}
|
package/dist/common/defaults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setCommonDefaults = void 0;
|
|
3
|
+
exports.getDefaultFragmentContent = exports.setCommonDefaults = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
/**
|
|
6
6
|
* Sets the common default values for all custom elements.
|
|
@@ -22,4 +22,27 @@ function setCommonDefaults(config, manifestPath, manifest) {
|
|
|
22
22
|
return config;
|
|
23
23
|
}
|
|
24
24
|
exports.setCommonDefaults = setCommonDefaults;
|
|
25
|
+
/**
|
|
26
|
+
* Method to generate default content for xml fragment.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} text - text of button or label
|
|
29
|
+
* @param {string} [eventHandler] - event handler path
|
|
30
|
+
* if value is passed then "Button" control with 'press' event would be generated
|
|
31
|
+
* if value is not passed then "Text" control would be generated
|
|
32
|
+
* @returns default content for fragment
|
|
33
|
+
*/
|
|
34
|
+
function getDefaultFragmentContent(text, eventHandler) {
|
|
35
|
+
let content;
|
|
36
|
+
if (eventHandler) {
|
|
37
|
+
const parts = eventHandler.split('.');
|
|
38
|
+
const method = parts.pop();
|
|
39
|
+
const handler = parts.join('/');
|
|
40
|
+
content = `<Button core:require="{ handler: '${handler}'}" text="${text}" press="handler.${method}" />`;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
content = `<Text text="${text}" />`;
|
|
44
|
+
}
|
|
45
|
+
return content;
|
|
46
|
+
}
|
|
47
|
+
exports.getDefaultFragmentContent = getDefaultFragmentContent;
|
|
25
48
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/common/defaults.ts"],"names":[],"mappings":";;;AACA,+BAAqC;AAErC;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC7B,MAAS,EACT,YAAoB,EACpB,QAAkB;IAElB,6BAA6B;IAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAEjE,oCAAoC;IACpC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,SAAS,CAAC,iBAAiB,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnG,uDAAuD;IACvD,MAAM,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG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,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,qCAAqC,OAAO,aAAa,IAAI,oBAAoB,MAAM,MAAM,CAAC;KAC3G;SAAM;QACH,OAAO,GAAG,eAAe,IAAI,MAAM,CAAC;KACvC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAXD,8DAWC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,7 @@ export { CustomAction, TargetControl } from './action/types';
|
|
|
4
4
|
export { generateCustomAction } from './action';
|
|
5
5
|
export { CustomTableColumn } from './column/types';
|
|
6
6
|
export { generateCustomColumn } from './column';
|
|
7
|
+
export { CustomSection } from './section/types';
|
|
8
|
+
export { generateCustomSection } from './section';
|
|
7
9
|
export { validateBasePath, validateVersion } from './common/validate';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateVersion = exports.validateBasePath = exports.generateCustomColumn = exports.generateCustomAction = exports.TargetControl = exports.generateCustomPage = void 0;
|
|
3
|
+
exports.validateVersion = exports.validateBasePath = exports.generateCustomSection = exports.generateCustomColumn = exports.generateCustomAction = exports.TargetControl = exports.generateCustomPage = void 0;
|
|
4
4
|
var page_1 = require("./page");
|
|
5
5
|
Object.defineProperty(exports, "generateCustomPage", { enumerable: true, get: function () { return page_1.generateCustomPage; } });
|
|
6
6
|
var types_1 = require("./action/types");
|
|
@@ -9,6 +9,8 @@ var action_1 = require("./action");
|
|
|
9
9
|
Object.defineProperty(exports, "generateCustomAction", { enumerable: true, get: function () { return action_1.generateCustomAction; } });
|
|
10
10
|
var column_1 = require("./column");
|
|
11
11
|
Object.defineProperty(exports, "generateCustomColumn", { enumerable: true, get: function () { return column_1.generateCustomColumn; } });
|
|
12
|
+
var section_1 = require("./section");
|
|
13
|
+
Object.defineProperty(exports, "generateCustomSection", { enumerable: true, get: function () { return section_1.generateCustomSection; } });
|
|
12
14
|
var validate_1 = require("./common/validate");
|
|
13
15
|
Object.defineProperty(exports, "validateBasePath", { enumerable: true, get: function () { return validate_1.validateBasePath; } });
|
|
14
16
|
Object.defineProperty(exports, "validateVersion", { enumerable: true, get: function () { return validate_1.validateVersion; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,+BAA4C;AAAnC,0GAAA,kBAAkB,OAAA;AAE3B,wCAA6D;AAAtC,sGAAA,aAAa,OAAA;AACpC,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;AAG7B,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,+BAA4C;AAAnC,0GAAA,kBAAkB,OAAA;AAE3B,wCAA6D;AAAtC,sGAAA,aAAa,OAAA;AACpC,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;AAG7B,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA;AAG7B,qCAAkD;AAAzC,gHAAA,qBAAqB,OAAA;AAE9B,8CAAsE;AAA7D,4GAAA,gBAAgB,OAAA;AAAE,2GAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Editor } from 'mem-fs-editor';
|
|
2
|
+
import { CustomSection } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Add a custom section to an existing UI5 application.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} basePath - the base path
|
|
7
|
+
* @param {CustomSection} customSection - the custom section configuration
|
|
8
|
+
* @param {Editor} [fs] - the mem-fs editor instance
|
|
9
|
+
* @returns {Promise<Editor>} the updated mem-fs editor instance
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateCustomSection(basePath: string, customSection: CustomSection, fs?: Editor): Editor;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAyB,MAAM,SAAS,CAAC;AA8B/D;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAiCzG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateCustomSection = void 0;
|
|
4
|
+
const mem_fs_1 = require("mem-fs");
|
|
5
|
+
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const ejs_1 = require("ejs");
|
|
8
|
+
const validate_1 = require("../common/validate");
|
|
9
|
+
const defaults_1 = require("../common/defaults");
|
|
10
|
+
/**
|
|
11
|
+
* Enhances the provided custom section configuration with additonal data.
|
|
12
|
+
*
|
|
13
|
+
* @param {CustomSection} data - a custom section configuration object
|
|
14
|
+
* @param {string} manifestPath - path to the project's manifest.json
|
|
15
|
+
* @param {Manifest} manifest - the application manifest
|
|
16
|
+
* @returns enhanced configuration
|
|
17
|
+
*/
|
|
18
|
+
function enhanceConfig(data, manifestPath, manifest) {
|
|
19
|
+
const config = Object.assign({}, data);
|
|
20
|
+
(0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
|
|
21
|
+
// set default event handler if it is to be created
|
|
22
|
+
if (config.eventHandler === true) {
|
|
23
|
+
config.eventHandler = `${config.ns}.${config.name}.onPress`;
|
|
24
|
+
}
|
|
25
|
+
// generate section content
|
|
26
|
+
config.content = config.control || (0, defaults_1.getDefaultFragmentContent)(config.name, config.eventHandler);
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Add a custom section to an existing UI5 application.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} basePath - the base path
|
|
33
|
+
* @param {CustomSection} customSection - the custom section configuration
|
|
34
|
+
* @param {Editor} [fs] - the mem-fs editor instance
|
|
35
|
+
* @returns {Promise<Editor>} the updated mem-fs editor instance
|
|
36
|
+
*/
|
|
37
|
+
function generateCustomSection(basePath, customSection, fs) {
|
|
38
|
+
(0, validate_1.validateVersion)(customSection.ui5Version);
|
|
39
|
+
if (!fs) {
|
|
40
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
41
|
+
}
|
|
42
|
+
(0, validate_1.validateBasePath)(basePath, fs);
|
|
43
|
+
const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
|
|
44
|
+
const manifest = fs.readJSON(manifestPath);
|
|
45
|
+
const root = (0, path_1.join)(__dirname, '../../templates');
|
|
46
|
+
// merge with defaults
|
|
47
|
+
const completeSection = enhanceConfig(customSection, manifestPath, manifest);
|
|
48
|
+
// add event handler if requested
|
|
49
|
+
if (completeSection.eventHandler) {
|
|
50
|
+
fs.copyTpl((0, path_1.join)(root, 'common/EventHandler.js'), (0, path_1.join)(completeSection.path, `${completeSection.name}.js`), completeSection);
|
|
51
|
+
}
|
|
52
|
+
// enhance manifest with section definition
|
|
53
|
+
const filledTemplate = (0, ejs_1.render)(fs.read((0, path_1.join)(root, `section/manifest.section.json`)), completeSection);
|
|
54
|
+
fs.extendJSON(manifestPath, JSON.parse(filledTemplate));
|
|
55
|
+
// add fragment
|
|
56
|
+
const viewPath = (0, path_1.join)(completeSection.path, `${completeSection.name}.fragment.xml`);
|
|
57
|
+
fs.copyTpl((0, path_1.join)(root, 'common/Fragment.xml'), viewPath, completeSection);
|
|
58
|
+
return fs;
|
|
59
|
+
}
|
|
60
|
+
exports.generateCustomSection = generateCustomSection;
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","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a,CAAC,aAAa,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAE7E,iCAAiC;IACjC,IAAI,eAAe,CAAC,YAAY,EAAE;QAC9B,EAAE,CAAC,OAAO,CACN,IAAA,WAAI,EAAC,IAAI,EAAE,wBAAwB,CAAC,EACpC,IAAA,WAAI,EAAC,eAAe,CAAC,IAAI,EAAE,GAAG,eAAe,CAAC,IAAI,KAAK,CAAC,EACxD,eAAe,CAClB,CAAC;KACL;IAED,2CAA2C;IAC3C,MAAM,cAAc,GAAG,IAAA,YAAM,EAAC,EAAE,CAAC,IAAI,CAAC,IAAA,WAAI,EAAC,IAAI,EAAE,+BAA+B,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;IACrG,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAExD,eAAe;IACf,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,eAAe,CAAC,IAAI,EAAE,GAAG,eAAe,CAAC,IAAI,eAAe,CAAC,CAAC;IACpF,EAAE,CAAC,OAAO,CAAC,IAAA,WAAI,EAAC,IAAI,EAAE,qBAAqB,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;IAEzE,OAAO,EAAE,CAAC;AACd,CAAC;AAjCD,sDAiCC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CustomElement, InternalCustomElement, Position } from '../common/types';
|
|
2
|
+
export interface CustomSection extends CustomElement {
|
|
3
|
+
/**
|
|
4
|
+
* Name of the routing target
|
|
5
|
+
*/
|
|
6
|
+
target: string;
|
|
7
|
+
/**
|
|
8
|
+
* The header is shown on the section as header, as well as in tab item.
|
|
9
|
+
*/
|
|
10
|
+
title: string;
|
|
11
|
+
/**
|
|
12
|
+
* Defines the position of the section relative to other sections.
|
|
13
|
+
*/
|
|
14
|
+
position: Position;
|
|
15
|
+
/**
|
|
16
|
+
* If not set (i.e. undefined) then no event handler is linked. If it is set true, a new one is created and linked to the action.
|
|
17
|
+
* If an existing event handler is to be used then its id needs to be provided as string.
|
|
18
|
+
*/
|
|
19
|
+
eventHandler?: string | true;
|
|
20
|
+
/**
|
|
21
|
+
* Optional control XML that will be generated into the fragment of section. If the property isn't provided then a sample control will be generated.
|
|
22
|
+
*/
|
|
23
|
+
control?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface InternalCustomSection extends CustomSection, InternalCustomElement {
|
|
26
|
+
content: string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/section/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEjF,MAAM,WAAW,aAAc,SAAQ,aAAa;IAChD;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa,EAAE,qBAAqB;IAC/E,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/section/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sap.ui5": {
|
|
3
|
+
"routing": {
|
|
4
|
+
"targets": {
|
|
5
|
+
"<%- target %>": {
|
|
6
|
+
"options": {
|
|
7
|
+
"settings": {
|
|
8
|
+
"content": {
|
|
9
|
+
"body": {
|
|
10
|
+
"sections": {
|
|
11
|
+
"<%- name %>": {
|
|
12
|
+
"name": "<%- ns %>.<%- name %>",
|
|
13
|
+
"position": {
|
|
14
|
+
<% if (position.placement) { %>
|
|
15
|
+
"placement": "<%- position.placement %>",
|
|
16
|
+
<% } %>
|
|
17
|
+
<% if (position.anchor) { %>
|
|
18
|
+
"anchor": "<%- position.anchor %>"
|
|
19
|
+
<% } %>
|
|
20
|
+
},
|
|
21
|
+
"title": "<%- title %>"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|