@sap-ux/fe-fpm-writer 0.12.0 → 0.13.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/dist/action/index.d.ts.map +1 -1
- package/dist/action/index.js +4 -7
- package/dist/action/index.js.map +1 -1
- package/dist/action/types.d.ts +2 -7
- package/dist/action/types.d.ts.map +1 -1
- package/dist/column/index.d.ts.map +1 -1
- package/dist/column/index.js +8 -9
- package/dist/column/index.js.map +1 -1
- package/dist/column/types.d.ts +2 -7
- package/dist/column/types.d.ts.map +1 -1
- package/dist/common/event-handler.d.ts +14 -0
- package/dist/common/event-handler.d.ts.map +1 -0
- package/dist/common/event-handler.js +58 -0
- package/dist/common/event-handler.js.map +1 -0
- package/dist/common/types.d.ts +51 -0
- package/dist/common/types.d.ts.map +1 -1
- package/dist/common/utils.d.ts +24 -0
- package/dist/common/utils.d.ts.map +1 -0
- package/dist/common/utils.js +56 -0
- package/dist/common/utils.js.map +1 -0
- package/dist/section/index.d.ts.map +1 -1
- package/dist/section/index.js +8 -12
- package/dist/section/index.js.map +1 -1
- package/dist/section/types.d.ts +2 -7
- package/dist/section/types.d.ts.map +1 -1
- package/dist/view/index.d.ts.map +1 -1
- package/dist/view/index.js +8 -12
- package/dist/view/index.js.map +1 -1
- package/dist/view/types.d.ts +2 -7
- package/dist/view/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/action/manifest.action.json +1 -1
- package/templates/common/EventHandler.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAwB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAwB,MAAM,SAAS,CAAC;AAiCtF;;;;;;GAMG;AACH,wBAAgB,4CAA4C,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,GAAG,GAAG,CAqB3G;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAyBtG"}
|
package/dist/action/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const path_1 = require("path");
|
|
|
8
8
|
const ejs_1 = require("ejs");
|
|
9
9
|
const validate_1 = require("../common/validate");
|
|
10
10
|
const defaults_1 = require("../common/defaults");
|
|
11
|
+
const event_handler_1 = require("../common/event-handler");
|
|
11
12
|
/**
|
|
12
13
|
* Enhances the provided custom action configuration with default data.
|
|
13
14
|
*
|
|
@@ -74,13 +75,9 @@ function generateCustomAction(basePath, actionConfig, fs) {
|
|
|
74
75
|
const manifest = fs.readJSON(manifestPath);
|
|
75
76
|
const config = enhanceConfig(actionConfig, manifestPath, manifest);
|
|
76
77
|
const root = path_1.join(__dirname, '../../templates');
|
|
77
|
-
//
|
|
78
|
-
if (config.
|
|
79
|
-
|
|
80
|
-
if (!fs.exists(controllerPath)) {
|
|
81
|
-
fs.copyTpl(path_1.join(root, 'common/EventHandler.js'), controllerPath, config);
|
|
82
|
-
}
|
|
83
|
-
config.settings.eventHandler = `${config.ns}.${config.name}.onPress`;
|
|
78
|
+
// Apply event handler
|
|
79
|
+
if (config.eventHandler) {
|
|
80
|
+
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler);
|
|
84
81
|
}
|
|
85
82
|
// enhance manifest with action definition and controller reference
|
|
86
83
|
const actions = enhanceManifestAndGetActionsElementReference(manifest, config.target);
|
package/dist/action/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,iDAAuC;AAEvC,mCAAwC;AACxC,+BAA4B;AAC5B,6BAA6B;AAC7B,iDAAuE;AAEvE,iDAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,iDAAuC;AAEvC,mCAAwC;AACxC,+BAA4B;AAC5B,6BAA6B;AAC7B,iDAAuE;AAEvE,iDAAuD;AACvD,2DAAyE;AAEzE;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,IAAkB,EAAE,YAAoB,EAAE,QAAkB;IAC/E,cAAc;IACd,MAAM,MAAM,mCACL,IAAI,KACP,MAAM,oBAAO,IAAI,CAAC,MAAM,GACxB,QAAQ,oBAAO,IAAI,CAAC,QAAQ,IAC/B,CAAC;IACF,4BAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAElD,gDAAgD;IAChD,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC;IAC1D,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC;IAE1D,OAAO,MAA8B,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,4CAA4C,CAAC,QAAa,EAAE,MAA0B;IAClG,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IAClC,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAA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CAAC;IACtF,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,YAAM,CAAC,EAAE,CAAC,IAAI,CAAC,WAAI,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACvG,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAErC,OAAO,EAAE,CAAC;AACd,CAAC;AAzBD,oDAyBC"}
|
package/dist/action/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CustomElement, InternalCustomElement, Position } from '../common/types';
|
|
1
|
+
import type { CustomElement, InternalCustomElement, Position, EventHandler } from '../common/types';
|
|
2
2
|
export declare enum TargetControl {
|
|
3
3
|
header = "header",
|
|
4
4
|
footer = "footer",
|
|
@@ -11,7 +11,7 @@ export interface CustomActionTarget {
|
|
|
11
11
|
navProperty?: string;
|
|
12
12
|
qualifier?: string;
|
|
13
13
|
}
|
|
14
|
-
export interface CustomAction extends CustomElement {
|
|
14
|
+
export interface CustomAction extends CustomElement, EventHandler {
|
|
15
15
|
target: CustomActionTarget;
|
|
16
16
|
settings: {
|
|
17
17
|
text: string;
|
|
@@ -19,11 +19,6 @@ export interface CustomAction extends CustomElement {
|
|
|
19
19
|
enabled?: string | true;
|
|
20
20
|
requiresSelection?: boolean;
|
|
21
21
|
position?: Position;
|
|
22
|
-
/**
|
|
23
|
-
* 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.
|
|
24
|
-
* If an existing event handler is to be used then its id needs to be provided as string.
|
|
25
|
-
*/
|
|
26
|
-
eventHandler?: string | true;
|
|
27
22
|
};
|
|
28
23
|
}
|
|
29
24
|
export declare type InternalCustomAction = CustomAction & InternalCustomElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/action/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/action/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpG,oBAAY,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,2CAA2C;IAClD,KAAK,yCAAyC;CACjD;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa,EAAE,YAAY;IAC7D,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACvB,CAAC;CACL;AAED,oBAAY,oBAAoB,GAAG,YAAY,GAAG,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,KAAK,EAAE,iBAAiB,EAA6B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,KAAK,EAAE,iBAAiB,EAA6B,MAAM,SAAS,CAAC;AAM5E;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ3D;AAsCD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA2B3G"}
|
package/dist/column/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const mem_fs_editor_1 = require("mem-fs-editor");
|
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const defaults_1 = require("../common/defaults");
|
|
9
9
|
const validate_1 = require("../common/validate");
|
|
10
|
+
const event_handler_1 = require("../common/event-handler");
|
|
10
11
|
/**
|
|
11
12
|
* Get the template folder for the given UI5 version.
|
|
12
13
|
*
|
|
@@ -28,18 +29,20 @@ exports.getManifestRoot = getManifestRoot;
|
|
|
28
29
|
/**
|
|
29
30
|
* Enhances the provided custom table column configuration with default data.
|
|
30
31
|
*
|
|
32
|
+
* @param {Editor} fs - the mem-fs editor instance
|
|
33
|
+
* @param {string} root - root path
|
|
31
34
|
* @param {CustomTableColumn} data - a custom column configuration object
|
|
32
35
|
* @param {string} manifestPath - path to the project's manifest.json
|
|
33
36
|
* @param {Manifest} manifest - the application manifest
|
|
34
37
|
* @returns enhanced configuration
|
|
35
38
|
*/
|
|
36
|
-
function enhanceConfig(data, manifestPath, manifest) {
|
|
39
|
+
function enhanceConfig(fs, root, data, manifestPath, manifest) {
|
|
37
40
|
// clone input and set defaults
|
|
38
41
|
const config = Object.assign({}, data);
|
|
39
42
|
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
40
|
-
//
|
|
41
|
-
if (config.eventHandler
|
|
42
|
-
config.eventHandler =
|
|
43
|
+
// Apply event handler
|
|
44
|
+
if (config.eventHandler) {
|
|
45
|
+
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler);
|
|
43
46
|
}
|
|
44
47
|
// generate column content
|
|
45
48
|
const content = config.properties && config.properties.length > 0
|
|
@@ -66,11 +69,7 @@ function generateCustomColumn(basePath, customColumn, fs) {
|
|
|
66
69
|
const manifest = fs.readJSON(manifestPath);
|
|
67
70
|
const root = path_1.join(__dirname, '../../templates');
|
|
68
71
|
// merge with defaults
|
|
69
|
-
const completeColumn = enhanceConfig(customColumn, manifestPath, manifest);
|
|
70
|
-
// add event handler if requested
|
|
71
|
-
if (completeColumn.eventHandler) {
|
|
72
|
-
fs.copyTpl(path_1.join(root, 'common/EventHandler.js'), path_1.join(completeColumn.path, `${completeColumn.name}.js`), completeColumn);
|
|
73
|
-
}
|
|
72
|
+
const completeColumn = enhanceConfig(fs, root, customColumn, manifestPath, manifest);
|
|
74
73
|
// enhance manifest with column definition
|
|
75
74
|
const manifestRoot = getManifestRoot(customColumn.ui5Version);
|
|
76
75
|
const filledTemplate = ejs_1.render(fs.read(path_1.join(manifestRoot, `manifest.json`)), completeColumn);
|
package/dist/column/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,mCAAiD;AAEjD,iDAAuC;AACvC,+BAA4B;AAE5B,iDAAkF;AAElF,iDAAuE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/column/index.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,mCAAiD;AAEjD,iDAAuC;AACvC,+BAA4B;AAE5B,iDAAkF;AAElF,iDAAuE;AACvE,2DAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,UAAmB;IAC/C,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,IAAI,EAAE;QAChD,OAAO,WAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;KACzD;SAAM,IAAI,UAAU,KAAK,IA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AAE,sBAAsB,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAa,CAAC;IAEvD,MAAM,IAAI,GAAG,WAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAEhD,sBAAsB;IACtB,MAAM,cAAc,GAAG,aAAa,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAErF,0CAA0C;IAC1C,MAAM,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,YAAM,CAAC,EAAE,CAAC,IAAI,CAAC,WAAI,CAAC,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,WAAI,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,cAAc,CAAC,IAAI,eAAe,CAAC,CAAC;IAClF,IAAI,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAChD,EAAE,CAAC,OAAO,CAAC,WAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;KAC3E;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AA3BD,oDA2BC"}
|
package/dist/column/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CustomElement, InternalCustomElement, Position } from '../common/types';
|
|
1
|
+
import type { CustomElement, InternalCustomElement, Position, EventHandler } from '../common/types';
|
|
2
2
|
export declare enum Availability {
|
|
3
3
|
'Default' = "Default",
|
|
4
4
|
'Adaptation' = "Adaptation",
|
|
@@ -14,7 +14,7 @@ export declare type ColumnPropertiesType = string[];
|
|
|
14
14
|
* Custom Column.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
export interface CustomTableColumn extends CustomElement {
|
|
17
|
+
export interface CustomTableColumn extends CustomElement, EventHandler {
|
|
18
18
|
/**
|
|
19
19
|
* Name of the routing target
|
|
20
20
|
*/
|
|
@@ -31,11 +31,6 @@ export interface CustomTableColumn extends CustomElement {
|
|
|
31
31
|
* The header is shown on the table as header, as well as in the add/remove dialog.
|
|
32
32
|
*/
|
|
33
33
|
header: string;
|
|
34
|
-
/**
|
|
35
|
-
* 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.
|
|
36
|
-
* If an existing event handler is to be used then its id needs to be provided as string.
|
|
37
|
-
*/
|
|
38
|
-
eventHandler?: string | true;
|
|
39
34
|
/**
|
|
40
35
|
* Optional control XML that will be generated into the fragment of table column. If the property isn't provided then a sample control will be generated.
|
|
41
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/column/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/column/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpG,oBAAY,YAAY;IACpB,SAAS,YAAY;IACrB,YAAY,eAAe;IAC3B,QAAQ,WAAW;CACtB;AAED,oBAAY,eAAe;IACvB,OAAO,UAAU;IACjB,QAAQ,WAAW;IACnB,KAAK,QAAQ;CAChB;AAED,oBAAY,oBAAoB,GAAG,MAAM,EAAE,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa,EAAE,YAAY;IAClE;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB,EAAE,qBAAqB;IACvF,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Editor } from 'mem-fs-editor';
|
|
2
|
+
import type { EventHandlerConfiguration, InternalCustomElement } from '../common/types';
|
|
3
|
+
/**
|
|
4
|
+
* Method creates or updates handler js file and update 'settings.eventHandler' entry with namespace path entry to method.
|
|
5
|
+
*
|
|
6
|
+
* @param {Editor} fs - the memfs editor instance
|
|
7
|
+
* @param {string} root - the root path
|
|
8
|
+
* @param {InternalCustomElement} config - configuration
|
|
9
|
+
* @param {EventHandlerConfiguration | true | string} [eventHandler] - eventHandler for creation
|
|
10
|
+
* @param {boolean} [controllerSuffix=false] - append controller suffix to new file
|
|
11
|
+
* @returns {string} full namespace path to method
|
|
12
|
+
*/
|
|
13
|
+
export declare function applyEventHandlerConfiguration(fs: Editor, root: string, config: Partial<InternalCustomElement>, eventHandler: EventHandlerConfiguration | true | string, controllerSuffix?: boolean): string;
|
|
14
|
+
//# sourceMappingURL=event-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-handler.d.ts","sourceRoot":"","sources":["../../src/common/event-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAyB,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAG/G;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC1C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACtC,YAAY,EAAE,yBAAyB,GAAG,IAAI,GAAG,MAAM,EACvD,gBAAgB,UAAQ,GACzB,MAAM,CAsCR"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyEventHandlerConfiguration = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const utils_1 = require("../common/utils");
|
|
6
|
+
/**
|
|
7
|
+
* Method creates or updates handler js file and update 'settings.eventHandler' entry with namespace path entry to method.
|
|
8
|
+
*
|
|
9
|
+
* @param {Editor} fs - the memfs editor instance
|
|
10
|
+
* @param {string} root - the root path
|
|
11
|
+
* @param {InternalCustomElement} config - configuration
|
|
12
|
+
* @param {EventHandlerConfiguration | true | string} [eventHandler] - eventHandler for creation
|
|
13
|
+
* @param {boolean} [controllerSuffix=false] - append controller suffix to new file
|
|
14
|
+
* @returns {string} full namespace path to method
|
|
15
|
+
*/
|
|
16
|
+
function applyEventHandlerConfiguration(fs, root, config, eventHandler, controllerSuffix = false) {
|
|
17
|
+
if (typeof eventHandler === 'string') {
|
|
18
|
+
// Existing event handler is passed - no need for file creation/update
|
|
19
|
+
return eventHandler;
|
|
20
|
+
}
|
|
21
|
+
// New event handler function name - 'onPress' is default
|
|
22
|
+
let eventHandlerFnName = 'onPress';
|
|
23
|
+
let insertScript;
|
|
24
|
+
// By default - use config name for js file name
|
|
25
|
+
let fileName = `${config.name}`;
|
|
26
|
+
if (typeof eventHandler === 'object') {
|
|
27
|
+
if (eventHandler.fnName) {
|
|
28
|
+
eventHandlerFnName = eventHandler.fnName;
|
|
29
|
+
}
|
|
30
|
+
insertScript = eventHandler.insertScript;
|
|
31
|
+
if (eventHandler.fileName) {
|
|
32
|
+
// Use passed file name
|
|
33
|
+
fileName = eventHandler.fileName;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const controllerPath = path_1.join(config.path || '', `${fileName}${controllerSuffix ? '.controller' : ''}.js`);
|
|
37
|
+
if (!fs.exists(controllerPath)) {
|
|
38
|
+
fs.copyTpl(path_1.join(root, 'common/EventHandler.js'), controllerPath, {
|
|
39
|
+
eventHandlerFnName
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else if (insertScript) {
|
|
43
|
+
// Read current file content
|
|
44
|
+
let content = fs.read(controllerPath);
|
|
45
|
+
// Append content with additional script fragment
|
|
46
|
+
if (typeof insertScript.position === 'object') {
|
|
47
|
+
content = utils_1.insertTextAtPosition(insertScript.fragment, content, insertScript.position);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
content = utils_1.insertTextAtAbsolutePosition(insertScript.fragment, content, insertScript.position);
|
|
51
|
+
}
|
|
52
|
+
fs.write(controllerPath, content);
|
|
53
|
+
}
|
|
54
|
+
// Return full namespace path to method
|
|
55
|
+
return `${config.ns}.${fileName}.${eventHandlerFnName}`;
|
|
56
|
+
}
|
|
57
|
+
exports.applyEventHandlerConfiguration = applyEventHandlerConfiguration;
|
|
58
|
+
//# sourceMappingURL=event-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-handler.js","sourceRoot":"","sources":["../../src/common/event-handler.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAE5B,2CAAqF;AAErF;;;;;;;;;GASG;AACH,SAAgB,8BAA8B,CAC1C,EAAU,EACV,IAAY,EACZ,MAAsC,EACtC,YAAuD,EACvD,gBAAgB,GAAG,KAAK;IAExB,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;QAClC,sEAAsE;QACtE,OAAO,YAAY,CAAC;KACvB;IACD,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AC;KACrC;IACD,uCAAuC;IACvC,OAAO,GAAG,MAAM,CAAC,EAAE,IAAI,QAAQ,IAAI,kBAAkB,EAAE,CAAC;AAC5D,CAAC;AA5CD,wEA4CC"}
|
package/dist/common/types.d.ts
CHANGED
|
@@ -94,4 +94,55 @@ export interface Ui5TargetSettings {
|
|
|
94
94
|
views?: Views;
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Represents a line and character position in file.
|
|
99
|
+
*/
|
|
100
|
+
export interface FileContentPosition {
|
|
101
|
+
/**
|
|
102
|
+
* Zero based line index.
|
|
103
|
+
*/
|
|
104
|
+
line: number;
|
|
105
|
+
/**
|
|
106
|
+
* Zero based character value.
|
|
107
|
+
*/
|
|
108
|
+
character: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Interface for text fragment insertion into existing text file.
|
|
112
|
+
*/
|
|
113
|
+
export interface TextFragmentInsertion {
|
|
114
|
+
/**
|
|
115
|
+
* Insert position for passed script fragment.
|
|
116
|
+
* Position can be line + char indices or absolute char index
|
|
117
|
+
*/
|
|
118
|
+
position: FileContentPosition | number;
|
|
119
|
+
/**
|
|
120
|
+
* Fragment of script to insert.
|
|
121
|
+
*/
|
|
122
|
+
fragment: string;
|
|
123
|
+
}
|
|
124
|
+
export interface EventHandlerConfiguration {
|
|
125
|
+
/**
|
|
126
|
+
* JS file name - existing or new.
|
|
127
|
+
*/
|
|
128
|
+
fileName?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Function name. If undefined then `onPress` is used as default value.
|
|
131
|
+
*/
|
|
132
|
+
fnName?: string;
|
|
133
|
+
/**
|
|
134
|
+
* If file exists, then existing file should be appended with passed script fragment.
|
|
135
|
+
*/
|
|
136
|
+
insertScript?: TextFragmentInsertion;
|
|
137
|
+
}
|
|
138
|
+
export interface EventHandler {
|
|
139
|
+
/**
|
|
140
|
+
* 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.
|
|
141
|
+
* If an existing event handler is to be used then its id needs to be provided as string.
|
|
142
|
+
* Object with 'EventHandlerConfiguration' provides following options:
|
|
143
|
+
* 1. Append existing js file with new action by providing script fragment;
|
|
144
|
+
* 2. Pass non-default function name(default is "onPress");
|
|
145
|
+
*/
|
|
146
|
+
eventHandler?: true | string | EventHandlerConfiguration;
|
|
147
|
+
}
|
|
97
148
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,0CAA0C,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAEjH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,oBAAY,SAAS;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACd;AAED;;GAEG;AACH,oBAAY,QAAQ,GAAG;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,MAAM;IACjE,OAAO,CAAC,EAAE,CAAC,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;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IAAI,GAAG,MAAM,GAAG,yBAAyB,CAAC;CAC5D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FileContentPosition } from '../common/types';
|
|
2
|
+
/**
|
|
3
|
+
* Method inserts passed text into content by char index position.
|
|
4
|
+
* In case if position is out of range, then whitespaces would be created.
|
|
5
|
+
* Negative positions are not supported.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} text - text to insert
|
|
8
|
+
* @param {string} content - target content for update
|
|
9
|
+
* @param {number} position - Char index position to insert in
|
|
10
|
+
* @returns new content with inserted text
|
|
11
|
+
*/
|
|
12
|
+
export declare function insertTextAtAbsolutePosition(text: string, content: string, position: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Method inserts passed text into content by line and char position.
|
|
15
|
+
* In case if position is out of range, then whitespaces would be created.
|
|
16
|
+
* Negative positions are not supported.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} text - text to insert
|
|
19
|
+
* @param {string} content - target content for update
|
|
20
|
+
* @param {FileContentPosition} position - Line and char position to insert in
|
|
21
|
+
* @returns new content with inserted text
|
|
22
|
+
*/
|
|
23
|
+
export declare function insertTextAtPosition(text: string, content: string, position: FileContentPosition): string;
|
|
24
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUpG;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAczG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.insertTextAtPosition = exports.insertTextAtAbsolutePosition = void 0;
|
|
7
|
+
const os_1 = __importDefault(require("os"));
|
|
8
|
+
/**
|
|
9
|
+
* Method inserts passed text into content by char index position.
|
|
10
|
+
* In case if position is out of range, then whitespaces would be created.
|
|
11
|
+
* Negative positions are not supported.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} text - text to insert
|
|
14
|
+
* @param {string} content - target content for update
|
|
15
|
+
* @param {number} position - Char index position to insert in
|
|
16
|
+
* @returns new content with inserted text
|
|
17
|
+
*/
|
|
18
|
+
function insertTextAtAbsolutePosition(text, content, position) {
|
|
19
|
+
if (position < 0) {
|
|
20
|
+
return content;
|
|
21
|
+
}
|
|
22
|
+
// Check if char position exist and create missing chars
|
|
23
|
+
const prepareCharIndex = Math.max(position - 1, 0);
|
|
24
|
+
while (prepareCharIndex > 0 && content[prepareCharIndex] === undefined) {
|
|
25
|
+
content += ' ';
|
|
26
|
+
}
|
|
27
|
+
return `${content.slice(0, position)}${text}${content.slice(position)}`;
|
|
28
|
+
}
|
|
29
|
+
exports.insertTextAtAbsolutePosition = insertTextAtAbsolutePosition;
|
|
30
|
+
/**
|
|
31
|
+
* Method inserts passed text into content by line and char position.
|
|
32
|
+
* In case if position is out of range, then whitespaces would be created.
|
|
33
|
+
* Negative positions are not supported.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} text - text to insert
|
|
36
|
+
* @param {string} content - target content for update
|
|
37
|
+
* @param {FileContentPosition} position - Line and char position to insert in
|
|
38
|
+
* @returns new content with inserted text
|
|
39
|
+
*/
|
|
40
|
+
function insertTextAtPosition(text, content, position) {
|
|
41
|
+
if (position.line < 0 || position.character < 0) {
|
|
42
|
+
return content;
|
|
43
|
+
}
|
|
44
|
+
const lines = content.split(/\r\n|\n/);
|
|
45
|
+
let targetLine = lines[position.line];
|
|
46
|
+
// Check if line position exist and create missing lines
|
|
47
|
+
while (targetLine === undefined) {
|
|
48
|
+
lines.push('');
|
|
49
|
+
targetLine = lines[position.line];
|
|
50
|
+
}
|
|
51
|
+
// Update line with inserting passed text
|
|
52
|
+
lines[position.line] = insertTextAtAbsolutePosition(text, lines[position.line], position.character);
|
|
53
|
+
return lines.join(os_1.default.EOL);
|
|
54
|
+
}
|
|
55
|
+
exports.insertTextAtPosition = insertTextAtPosition;
|
|
56
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAGpB;;;;;;;;;GASG;AACH,SAAgB,4BAA4B,CAAC,IAAY,EAAE,OAAe,EAAE,QAAgB;IACxF,IAAI,QAAQ,GAAG,CAAC,EAAE;QACd,OAAO,OAAO,CAAC;KAClB;IACD,wDAAwD;IACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,OAAO,gBAAgB,GAAG,CAAC,IAAI,OAAO,CAAC,gBAAgB,CAAC,KAAK,SAAS,EAAE;QACpE,OAAO,IAAI,GAAG,CAAC;KAClB;IACD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC5E,CAAC;AAVD,oEAUC;AAED;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAAC,IAAY,EAAE,OAAe,EAAE,QAA6B;IAC7F,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,QAAQ,CAAC,SAAS,GAAG,CAAC,EAAE;QAC7C,OAAO,OAAO,CAAC;KAClB;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtC,wDAAwD;IACxD,OAAO,UAAU,KAAK,SAAS,EAAE;QAC7B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KACrC;IACD,yCAAyC;IACzC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,4BAA4B,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpG,OAAO,KAAK,CAAC,IAAI,CAAC,YAAE,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAdD,oDAcC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAyB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAyB,MAAM,SAAS,CAAC;AAQpE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAOzE;AAiCD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA2BzG"}
|
package/dist/section/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const ejs_1 = require("ejs");
|
|
8
8
|
const validate_1 = require("../common/validate");
|
|
9
9
|
const defaults_1 = require("../common/defaults");
|
|
10
|
+
const event_handler_1 = require("../common/event-handler");
|
|
10
11
|
/**
|
|
11
12
|
* Get the template folder for the given UI5 version.
|
|
12
13
|
*
|
|
@@ -26,17 +27,19 @@ exports.getManifestRoot = getManifestRoot;
|
|
|
26
27
|
/**
|
|
27
28
|
* Enhances the provided custom section configuration with additonal data.
|
|
28
29
|
*
|
|
30
|
+
* @param {Editor} fs - the mem-fs editor instance
|
|
31
|
+
* @param {string} root - root path
|
|
29
32
|
* @param {CustomSection} data - a custom section configuration object
|
|
30
33
|
* @param {string} manifestPath - path to the project's manifest.json
|
|
31
34
|
* @param {Manifest} manifest - the application manifest
|
|
32
35
|
* @returns enhanced configuration
|
|
33
36
|
*/
|
|
34
|
-
function enhanceConfig(data, manifestPath, manifest) {
|
|
37
|
+
function enhanceConfig(fs, root, data, manifestPath, manifest) {
|
|
35
38
|
const config = Object.assign({}, data);
|
|
36
39
|
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
37
|
-
//
|
|
38
|
-
if (config.eventHandler
|
|
39
|
-
config.eventHandler =
|
|
40
|
+
// Apply event handler
|
|
41
|
+
if (config.eventHandler) {
|
|
42
|
+
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler);
|
|
40
43
|
}
|
|
41
44
|
// generate section content
|
|
42
45
|
config.content = config.control || defaults_1.getDefaultFragmentContent(config.name, config.eventHandler);
|
|
@@ -60,14 +63,7 @@ function generateCustomSection(basePath, customSection, fs) {
|
|
|
60
63
|
const manifest = fs.readJSON(manifestPath);
|
|
61
64
|
const root = path_1.join(__dirname, '../../templates');
|
|
62
65
|
// merge with defaults
|
|
63
|
-
const completeSection = enhanceConfig(customSection, manifestPath, manifest);
|
|
64
|
-
// add event handler if requested
|
|
65
|
-
if (completeSection.eventHandler) {
|
|
66
|
-
const controllerPath = path_1.join(completeSection.path, `${completeSection.name}.js`);
|
|
67
|
-
if (!fs.exists(controllerPath)) {
|
|
68
|
-
fs.copyTpl(path_1.join(root, 'common/EventHandler.js'), controllerPath, completeSection);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
66
|
+
const completeSection = enhanceConfig(fs, root, customSection, manifestPath, manifest);
|
|
71
67
|
// enhance manifest with section definition
|
|
72
68
|
const manifestRoot = getManifestRoot(root, customSection.ui5Version);
|
|
73
69
|
const filledTemplate = ejs_1.render(fs.read(path_1.join(manifestRoot, `manifest.json`)), completeSection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,iDAAuC;AAEvC,+BAA4B;AAC5B,6BAA6B;AAC7B,iDAAuE;AAEvE,iDAAkF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/section/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,iDAAuC;AAEvC,+BAA4B;AAC5B,6BAA6B;AAC7B,iDAAuE;AAEvE,iDAAkF;AAClF,2DAAyE;AAEzE;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,UAAmB;IAC7D,IAAI,SAAS,GAAG,MAAM,CAAC;IACvB,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,GAAG,IAAI,EAAE;QAC/C,MAAM;QACN,SAAS,GAAG,MAAM,CAAC;KACtB;IACD,OAAO,WAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC;AAPD,0CAOC;AAED;;;;;;;;;GASG;AACH,SAAS,aAAa,CAClB,EAAU,EACV,IAAY,EACZ,IAAmB,EACnB,YAAoB,EACpB,QAAkB;IAElB,MAAM,MAAM,qBAAwD,IAAI,CAAE,CAAC;IAC3E,4BAAiB,CAA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AAU,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;IAExD,eAAe;IACf,MAAM,QAAQ,GAAG,WAAI,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,eAAe,CAAC,IAAI,eAAe,CAAC,CAAC;IACpF,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QACtB,EAAE,CAAC,OAAO,CAAC,WAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;KAC5E;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AA3BD,sDA2BC"}
|
package/dist/section/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CustomElement, InternalCustomElement, Position } from '../common/types';
|
|
2
|
-
export interface CustomSection extends CustomElement {
|
|
1
|
+
import type { CustomElement, InternalCustomElement, Position, EventHandler } from '../common/types';
|
|
2
|
+
export interface CustomSection extends CustomElement, EventHandler {
|
|
3
3
|
/**
|
|
4
4
|
* Name of the routing target
|
|
5
5
|
*/
|
|
@@ -12,11 +12,6 @@ export interface CustomSection extends CustomElement {
|
|
|
12
12
|
* Defines the position of the section relative to other sections.
|
|
13
13
|
*/
|
|
14
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
15
|
/**
|
|
21
16
|
* 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
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/section/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/section/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpG,MAAM,WAAW,aAAc,SAAQ,aAAa,EAAE,YAAY;IAC9D;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa,EAAE,qBAAqB;IAC/E,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/view/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,SAAS,CAAC;AAkD9D;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA4BhG"}
|
package/dist/view/index.js
CHANGED
|
@@ -7,21 +7,24 @@ const path_1 = require("path");
|
|
|
7
7
|
const ejs_1 = require("ejs");
|
|
8
8
|
const validate_1 = require("../common/validate");
|
|
9
9
|
const defaults_1 = require("../common/defaults");
|
|
10
|
+
const event_handler_1 = require("../common/event-handler");
|
|
10
11
|
/**
|
|
11
12
|
* Enhances the provided custom view configuration with default data.
|
|
12
13
|
*
|
|
14
|
+
* @param {Editor} fs - the mem-fs editor instance
|
|
15
|
+
* @param {string} root - root path
|
|
13
16
|
* @param {CustomView} data - a custom view configuration object
|
|
14
17
|
* @param {string} manifestPath - path to the project's manifest.json
|
|
15
18
|
* @param {Manifest} manifest - the application manifest
|
|
16
19
|
* @returns enhanced configuration
|
|
17
20
|
*/
|
|
18
|
-
function enhanceConfig(data, manifestPath, manifest) {
|
|
21
|
+
function enhanceConfig(fs, root, data, manifestPath, manifest) {
|
|
19
22
|
var _a, _b, _c, _d, _e;
|
|
20
23
|
const config = Object.assign({}, data);
|
|
21
24
|
defaults_1.setCommonDefaults(config, manifestPath, manifest);
|
|
22
|
-
//
|
|
23
|
-
if (config.eventHandler
|
|
24
|
-
config.eventHandler =
|
|
25
|
+
// Apply event handler
|
|
26
|
+
if (config.eventHandler) {
|
|
27
|
+
config.eventHandler = event_handler_1.applyEventHandlerConfiguration(fs, root, config, config.eventHandler, true);
|
|
25
28
|
}
|
|
26
29
|
// existing views
|
|
27
30
|
const existingViews = (_e = (_d = ((_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.routing) === null || _b === void 0 ? void 0 : _b.targets) === null || _c === void 0 ? void 0 : _c[data.target])
|
|
@@ -56,14 +59,7 @@ function generateCustomView(basePath, customView, fs) {
|
|
|
56
59
|
const manifest = fs.readJSON(manifestPath);
|
|
57
60
|
const root = path_1.join(__dirname, '../../templates');
|
|
58
61
|
// merge with defaults
|
|
59
|
-
const completeView = enhanceConfig(customView, manifestPath, manifest);
|
|
60
|
-
// add event handler if requested
|
|
61
|
-
if (completeView.eventHandler) {
|
|
62
|
-
const controllerPath = path_1.join(completeView.path, `${completeView.name}.controller.js`);
|
|
63
|
-
if (!fs.exists(controllerPath)) {
|
|
64
|
-
fs.copyTpl(path_1.join(root, 'common/EventHandler.js'), controllerPath, completeView);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
62
|
+
const completeView = enhanceConfig(fs, root, customView, manifestPath, manifest);
|
|
67
63
|
// enhance manifest with view definition
|
|
68
64
|
const filledTemplate = ejs_1.render(fs.read(path_1.join(root, 'view', `manifest.json`)), completeView);
|
|
69
65
|
fs.extendJSON(manifestPath, JSON.parse(filledTemplate));
|
package/dist/view/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,iDAAuC;AAEvC,+BAA4B;AAC5B,6BAA6B;AAC7B,iDAAuE;AAEvE,iDAAkF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":";;;AAAA,mCAAiD;AAEjD,iDAAuC;AAEvC,+BAA4B;AAC5B,6BAA6B;AAC7B,iDAAuE;AAEvE,iDAAkF;AAClF,2DAAyE;AAEzE;;;;;;;;;GASG;AACH,SAAS,aAAa,CAClB,EAAU,EACV,IAAY,EACZ,IAAgB,EAChB,YAAoB,EACpB,QAAkB;;IAElB,MAAM,MAAM,qBAAkD,IAAI,CAAE,CAAC;IACrE,4BAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAElD,sBAAsB;IACtB,IAAI,MAAM,CAAC,YAAY,EAAE;QACrB,MAAM,CAAC,YAAY,GAAG,8CAA8B,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;KACrG;IAED,iBAAiB;IACjB,MAAM,aAAa,eAAG,CAAC,kBAAA,QAAQ,CAAC,SAAS,CAAC,0CAAE,OAAO,0CAAE,OAAO,0CAAG,IAAI,CAAC,MAAM,CAAyC,CAAA;SAC9G,OAAO,0CAAE,QAAQ,0CAAE,KAAK,CAAC;IAC9B,IAAI,aAAa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AAY,CAAC,IAAI,EAAE,GAAG,YAAY,CAAC,IAAI,eAAe,CAAC,CAAC;IAC9E,IAAI,YAAY,CAAC,OAAO,KAAK,IAAI,EAAE;QAC/B,EAAE,CAAC,OAAO,CAAC,WAAI,CAAC,IAAI,EAAE,kCAAkC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;KACtF;SAAM,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC7B,EAAE,CAAC,OAAO,CAAC,WAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;KACzE;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AA5BD,gDA4BC"}
|
package/dist/view/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CustomElement, InternalCustomElement, Views } from '../common/types';
|
|
2
|
-
export interface CustomView extends CustomElement {
|
|
1
|
+
import type { CustomElement, InternalCustomElement, Views, EventHandler } from '../common/types';
|
|
2
|
+
export interface CustomView extends CustomElement, EventHandler {
|
|
3
3
|
/**
|
|
4
4
|
* Name of the routing target.
|
|
5
5
|
*/
|
|
@@ -12,11 +12,6 @@ export interface CustomView extends CustomElement {
|
|
|
12
12
|
* Unique tab identifier.
|
|
13
13
|
*/
|
|
14
14
|
key: string;
|
|
15
|
-
/**
|
|
16
|
-
* If set to true, a new controller 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
15
|
/**
|
|
21
16
|
* Optional control XML that will be generated into the fragment of the view.
|
|
22
17
|
* If set to true, a table macro control will be generated.
|
package/dist/view/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/view/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/view/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEjG,MAAM,WAAW,UAAW,SAAQ,aAAa,EAAE,YAAY;IAC3D;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU,EAAE,qBAAqB;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"<%- name %>": {
|
|
3
|
-
"press": "<%-
|
|
3
|
+
"press": "<%- typeof eventHandler !== 'undefined' ? eventHandler : '' %>",
|
|
4
4
|
"visible": <%- settings.visible -%>,
|
|
5
5
|
"enabled": <%- settings.enabled -%><%if (settings.requiresSelection !== undefined) {%>,
|
|
6
6
|
"requiresSelection": <%- settings.requiresSelection -%><% } %>,
|