@sap-ux/preview-middleware 0.16.79 → 0.16.80
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/base/config.js +8 -8
- package/dist/base/flex.d.ts +0 -1
- package/dist/base/flex.js +3 -4
- package/dist/base/flp.d.ts +0 -1
- package/dist/base/flp.js +2 -2
- package/dist/base/test.d.ts +0 -1
- package/dist/base/test.js +2 -3
- package/dist/client/adp/api-handler.js +142 -142
- package/dist/client/adp/command-executor.js +58 -58
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/BaseDialog.controller.js +105 -105
- package/dist/client/adp/controllers/ControllerExtension.controller.js +213 -213
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/init-dialogs.js +159 -159
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +35 -35
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +47 -47
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +98 -98
- package/dist/client/adp/quick-actions/fe-v2/create-page-action.js +35 -35
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +57 -57
- package/dist/client/adp/quick-actions/fe-v2/registry.js +60 -60
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/registry.js +50 -50
- package/dist/client/adp/quick-actions/fe-v4/utils.js +52 -52
- package/dist/client/adp/quick-actions/load.js +48 -48
- package/dist/client/adp/utils.js +160 -160
- package/dist/client/cpe/changes/flex-change.js +51 -51
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +34 -34
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +187 -187
- package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
- package/dist/client/cpe/quick-actions/registry.js +143 -143
- package/dist/client/cpe/quick-actions/utils.js +92 -92
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +33 -33
- package/dist/client/cpe/utils.js +97 -97
- package/dist/client/flp/WorkspaceConnector.js +87 -87
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +84 -84
- package/dist/client/flp/initConnectors.js +30 -30
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +5 -8
- package/dist/client/tsconfig.tsbuildinfo +1 -0
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +68 -68
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/version.js +68 -68
- package/package.json +4 -4
package/dist/base/config.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_INTENT = exports.DEFAULT_PATH = exports.DEFAULT_THEME = exports.PREVIEW_URL = void 0;
|
|
4
|
+
exports.getFlpConfigWithDefaults = getFlpConfigWithDefaults;
|
|
5
|
+
exports.sanitizeConfig = sanitizeConfig;
|
|
6
|
+
exports.addApp = addApp;
|
|
7
|
+
exports.createFlpTemplateConfig = createFlpTemplateConfig;
|
|
8
|
+
exports.createTestTemplateConfig = createTestTemplateConfig;
|
|
9
|
+
exports.getPreviewPaths = getPreviewPaths;
|
|
10
|
+
exports.generatePreviewFiles = generatePreviewFiles;
|
|
4
11
|
const logger_1 = require("@sap-ux/logger");
|
|
5
12
|
const ejs_1 = require("ejs");
|
|
6
13
|
const path_1 = require("path");
|
|
@@ -103,7 +110,6 @@ function getFlpConfigWithDefaults(config = {}) {
|
|
|
103
110
|
}
|
|
104
111
|
return flpConfig;
|
|
105
112
|
}
|
|
106
|
-
exports.getFlpConfigWithDefaults = getFlpConfigWithDefaults;
|
|
107
113
|
/**
|
|
108
114
|
* The developer mode is only supported for adaptation projects, therefore, notify the user if it is wrongly configured and then disable it.
|
|
109
115
|
*
|
|
@@ -122,7 +128,6 @@ function sanitizeConfig(config, logger) {
|
|
|
122
128
|
});
|
|
123
129
|
}
|
|
124
130
|
}
|
|
125
|
-
exports.sanitizeConfig = sanitizeConfig;
|
|
126
131
|
/**
|
|
127
132
|
* Retrieves the configuration settings for UI5 flexibility services.
|
|
128
133
|
*
|
|
@@ -168,7 +173,6 @@ async function addApp(templateConfig, manifest, app, logger) {
|
|
|
168
173
|
applicationDependencies: { manifest: true }
|
|
169
174
|
};
|
|
170
175
|
}
|
|
171
|
-
exports.addApp = addApp;
|
|
172
176
|
/**
|
|
173
177
|
* Get the i18n text of the given property.
|
|
174
178
|
*
|
|
@@ -226,7 +230,6 @@ function createFlpTemplateConfig(config, manifest, resources = {}) {
|
|
|
226
230
|
locateReuseLibsScript: config.libs
|
|
227
231
|
};
|
|
228
232
|
}
|
|
229
|
-
exports.createFlpTemplateConfig = createFlpTemplateConfig;
|
|
230
233
|
/**
|
|
231
234
|
* Creates the configuration object for the test template.
|
|
232
235
|
*
|
|
@@ -244,7 +247,6 @@ function createTestTemplateConfig(config, id, theme) {
|
|
|
244
247
|
theme
|
|
245
248
|
};
|
|
246
249
|
}
|
|
247
|
-
exports.createTestTemplateConfig = createTestTemplateConfig;
|
|
248
250
|
/**
|
|
249
251
|
* Returns the preview paths.
|
|
250
252
|
*
|
|
@@ -274,7 +276,6 @@ function getPreviewPaths(config, logger = new logger_1.ToolsLogger()) {
|
|
|
274
276
|
}
|
|
275
277
|
return urls;
|
|
276
278
|
}
|
|
277
|
-
exports.getPreviewPaths = getPreviewPaths;
|
|
278
279
|
const TEMPLATE_PATH = (0, path_1.join)(__dirname, '../../templates');
|
|
279
280
|
/**
|
|
280
281
|
* Generate test runners.
|
|
@@ -360,5 +361,4 @@ async function generatePreviewFiles(basePath, config, fs, logger = new logger_1.
|
|
|
360
361
|
fs.write(flpPath, (0, ejs_1.render)(flpTemplate, flpTemplConfig));
|
|
361
362
|
return fs;
|
|
362
363
|
}
|
|
363
|
-
exports.generatePreviewFiles = generatePreviewFiles;
|
|
364
364
|
//# sourceMappingURL=config.js.map
|
package/dist/base/flex.d.ts
CHANGED
package/dist/base/flex.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.readChanges = readChanges;
|
|
4
|
+
exports.writeChange = writeChange;
|
|
5
|
+
exports.deleteChange = deleteChange;
|
|
4
6
|
const fs_1 = require("fs");
|
|
5
7
|
const path_1 = require("path");
|
|
6
8
|
/**
|
|
@@ -25,7 +27,6 @@ async function readChanges(project, logger) {
|
|
|
25
27
|
}
|
|
26
28
|
return changes;
|
|
27
29
|
}
|
|
28
|
-
exports.readChanges = readChanges;
|
|
29
30
|
/**
|
|
30
31
|
* Writes flex changes to the user's workspace.
|
|
31
32
|
*
|
|
@@ -51,7 +52,6 @@ function writeChange(data, webappPath, fs, logger) {
|
|
|
51
52
|
return { success: false };
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
exports.writeChange = writeChange;
|
|
55
55
|
/**
|
|
56
56
|
* Deletes an existing flex change from the file system if it exists.
|
|
57
57
|
*
|
|
@@ -78,5 +78,4 @@ function deleteChange(data, webappPath, logger) {
|
|
|
78
78
|
}
|
|
79
79
|
return { success: false };
|
|
80
80
|
}
|
|
81
|
-
exports.deleteChange = deleteChange;
|
|
82
81
|
//# sourceMappingURL=flex.js.map
|
package/dist/base/flp.d.ts
CHANGED
package/dist/base/flp.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FlpSandbox = void 0;
|
|
4
|
+
exports.initAdp = initAdp;
|
|
4
5
|
const mem_fs_1 = require("mem-fs");
|
|
5
6
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
6
7
|
const ejs_1 = require("ejs");
|
|
@@ -466,5 +467,4 @@ async function initAdp(rootProject, config, flp, util, logger) {
|
|
|
466
467
|
throw new Error('ADP configured but no manifest.appdescr_variant found.');
|
|
467
468
|
}
|
|
468
469
|
}
|
|
469
|
-
exports.initAdp = initAdp;
|
|
470
470
|
//# sourceMappingURL=flp.js.map
|
package/dist/base/test.d.ts
CHANGED
package/dist/base/test.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mergeTestConfigDefaults = mergeTestConfigDefaults;
|
|
4
|
+
exports.generateImportList = generateImportList;
|
|
4
5
|
const DEFAULTS = {
|
|
5
6
|
qunit: {
|
|
6
7
|
path: '/test/unitTests.qunit.html',
|
|
@@ -38,7 +39,6 @@ function mergeTestConfigDefaults(config) {
|
|
|
38
39
|
}
|
|
39
40
|
return merged;
|
|
40
41
|
}
|
|
41
|
-
exports.mergeTestConfigDefaults = mergeTestConfigDefaults;
|
|
42
42
|
/**
|
|
43
43
|
* Generate a list of imports from a list of resources.
|
|
44
44
|
*
|
|
@@ -55,5 +55,4 @@ function generateImportList(ns, resourceList) {
|
|
|
55
55
|
})
|
|
56
56
|
: [];
|
|
57
57
|
}
|
|
58
|
-
exports.generateImportList = generateImportList;
|
|
59
58
|
//# sourceMappingURL=test.js.map
|
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["../utils/error"], function (___utils_error) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getError = ___utils_error["getError"];
|
|
7
|
-
var ApiEndpoints = /*#__PURE__*/function (ApiEndpoints) {
|
|
8
|
-
ApiEndpoints["CHANGES"] = "/preview/api/changes";
|
|
9
|
-
ApiEndpoints["FRAGMENT"] = "/adp/api/fragment";
|
|
10
|
-
ApiEndpoints["CONTROLLER"] = "/adp/api/controller";
|
|
11
|
-
ApiEndpoints["CODE_EXT"] = "/adp/api/code_ext";
|
|
12
|
-
ApiEndpoints["MANIFEST_APP_DESCRIPTOR"] = "/manifest.appdescr_variant";
|
|
13
|
-
return ApiEndpoints;
|
|
14
|
-
}(ApiEndpoints || {});
|
|
15
|
-
var RequestMethod = /*#__PURE__*/function (RequestMethod) {
|
|
16
|
-
RequestMethod["GET"] = "GET";
|
|
17
|
-
RequestMethod["PUT"] = "PUT";
|
|
18
|
-
RequestMethod["POST"] = "POST";
|
|
19
|
-
RequestMethod["PATCH"] = "PATCH";
|
|
20
|
-
RequestMethod["DELETE"] = "DELETE";
|
|
21
|
-
return RequestMethod;
|
|
22
|
-
}(RequestMethod || {});
|
|
23
|
-
/**
|
|
24
|
-
* Requests a given endpoint
|
|
25
|
-
*
|
|
26
|
-
* @param endpoint API Endpoint
|
|
27
|
-
* @param method RequestMethod
|
|
28
|
-
* @param data Data to be sent to the server
|
|
29
|
-
* @returns Data from the server request
|
|
30
|
-
*/
|
|
31
|
-
async function request(endpoint, method, data) {
|
|
32
|
-
const config = {
|
|
33
|
-
method,
|
|
34
|
-
body: JSON.stringify(data),
|
|
35
|
-
headers: {
|
|
36
|
-
'content-type': 'application/json'
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
try {
|
|
40
|
-
const response = await fetch(endpoint, config);
|
|
41
|
-
if (!response.ok) {
|
|
42
|
-
const errorData = await response.json();
|
|
43
|
-
const message = errorData?.message ?? '';
|
|
44
|
-
throw new Error(`Request failed, status: ${response.status}. ${message}`.trim());
|
|
45
|
-
}
|
|
46
|
-
switch (method) {
|
|
47
|
-
case RequestMethod.GET:
|
|
48
|
-
return response.json();
|
|
49
|
-
case RequestMethod.POST:
|
|
50
|
-
/**
|
|
51
|
-
* Since POST usually creates something
|
|
52
|
-
* and returns nothing (or a message) we just parse the text from res.send(msg)
|
|
53
|
-
*/
|
|
54
|
-
return response.text();
|
|
55
|
-
default:
|
|
56
|
-
return response.json();
|
|
57
|
-
}
|
|
58
|
-
} catch (e) {
|
|
59
|
-
throw getError(e);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves all XML fragments from the project's workspace
|
|
65
|
-
*
|
|
66
|
-
* @returns Generic Promise<T>
|
|
67
|
-
*/
|
|
68
|
-
async function getFragments() {
|
|
69
|
-
return request(ApiEndpoints.FRAGMENT, RequestMethod.GET);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Writes an XML fragment to the project's workspace
|
|
74
|
-
*
|
|
75
|
-
* @param data Data to be send to the server
|
|
76
|
-
* @returns Generic Promise<T>
|
|
77
|
-
*/
|
|
78
|
-
async function writeFragment(data) {
|
|
79
|
-
return request(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Retrieves manifest.appdescr_variant from the project's workspace
|
|
84
|
-
*
|
|
85
|
-
* @returns Generic Promise<T>
|
|
86
|
-
*/
|
|
87
|
-
async function getManifestAppdescr() {
|
|
88
|
-
return request(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Retrieves all controller extensions from the project's workspace
|
|
93
|
-
*
|
|
94
|
-
* @returns Generic Promise<T>
|
|
95
|
-
*/
|
|
96
|
-
async function readControllers() {
|
|
97
|
-
return request(ApiEndpoints.CONTROLLER, RequestMethod.GET);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Writes a Controller to the project's workspace
|
|
102
|
-
*
|
|
103
|
-
* @param data Data to be send to the server
|
|
104
|
-
* @returns Generic Promise<T>
|
|
105
|
-
*/
|
|
106
|
-
async function writeController(data) {
|
|
107
|
-
return request(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Checks for existing controller in the project's workspace
|
|
112
|
-
*
|
|
113
|
-
* @param controllerName Name of the controller
|
|
114
|
-
* @returns {CodeExtResponse} Returns path to existing controller if found
|
|
115
|
-
*/
|
|
116
|
-
async function getExistingController(controllerName) {
|
|
117
|
-
return request(`${ApiEndpoints.CODE_EXT}/${controllerName}`, RequestMethod.GET);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Writes a change object to the project's workspace
|
|
122
|
-
*
|
|
123
|
-
* @param data Data to be send to the server
|
|
124
|
-
* @returns Generic Promise<T>
|
|
125
|
-
*/
|
|
126
|
-
async function writeChange(data) {
|
|
127
|
-
return request(ApiEndpoints.CHANGES, RequestMethod.POST, data);
|
|
128
|
-
}
|
|
129
|
-
var __exports = {
|
|
130
|
-
__esModule: true
|
|
131
|
-
};
|
|
132
|
-
__exports.ApiEndpoints = ApiEndpoints;
|
|
133
|
-
__exports.RequestMethod = RequestMethod;
|
|
134
|
-
__exports.request = request;
|
|
135
|
-
__exports.getFragments = getFragments;
|
|
136
|
-
__exports.writeFragment = writeFragment;
|
|
137
|
-
__exports.getManifestAppdescr = getManifestAppdescr;
|
|
138
|
-
__exports.readControllers = readControllers;
|
|
139
|
-
__exports.writeController = writeController;
|
|
140
|
-
__exports.getExistingController = getExistingController;
|
|
141
|
-
__exports.writeChange = writeChange;
|
|
142
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../utils/error"], function (___utils_error) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getError = ___utils_error["getError"];
|
|
7
|
+
var ApiEndpoints = /*#__PURE__*/function (ApiEndpoints) {
|
|
8
|
+
ApiEndpoints["CHANGES"] = "/preview/api/changes";
|
|
9
|
+
ApiEndpoints["FRAGMENT"] = "/adp/api/fragment";
|
|
10
|
+
ApiEndpoints["CONTROLLER"] = "/adp/api/controller";
|
|
11
|
+
ApiEndpoints["CODE_EXT"] = "/adp/api/code_ext";
|
|
12
|
+
ApiEndpoints["MANIFEST_APP_DESCRIPTOR"] = "/manifest.appdescr_variant";
|
|
13
|
+
return ApiEndpoints;
|
|
14
|
+
}(ApiEndpoints || {});
|
|
15
|
+
var RequestMethod = /*#__PURE__*/function (RequestMethod) {
|
|
16
|
+
RequestMethod["GET"] = "GET";
|
|
17
|
+
RequestMethod["PUT"] = "PUT";
|
|
18
|
+
RequestMethod["POST"] = "POST";
|
|
19
|
+
RequestMethod["PATCH"] = "PATCH";
|
|
20
|
+
RequestMethod["DELETE"] = "DELETE";
|
|
21
|
+
return RequestMethod;
|
|
22
|
+
}(RequestMethod || {});
|
|
23
|
+
/**
|
|
24
|
+
* Requests a given endpoint
|
|
25
|
+
*
|
|
26
|
+
* @param endpoint API Endpoint
|
|
27
|
+
* @param method RequestMethod
|
|
28
|
+
* @param data Data to be sent to the server
|
|
29
|
+
* @returns Data from the server request
|
|
30
|
+
*/
|
|
31
|
+
async function request(endpoint, method, data) {
|
|
32
|
+
const config = {
|
|
33
|
+
method,
|
|
34
|
+
body: JSON.stringify(data),
|
|
35
|
+
headers: {
|
|
36
|
+
'content-type': 'application/json'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
const response = await fetch(endpoint, config);
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
const errorData = await response.json();
|
|
43
|
+
const message = errorData?.message ?? '';
|
|
44
|
+
throw new Error(`Request failed, status: ${response.status}. ${message}`.trim());
|
|
45
|
+
}
|
|
46
|
+
switch (method) {
|
|
47
|
+
case RequestMethod.GET:
|
|
48
|
+
return response.json();
|
|
49
|
+
case RequestMethod.POST:
|
|
50
|
+
/**
|
|
51
|
+
* Since POST usually creates something
|
|
52
|
+
* and returns nothing (or a message) we just parse the text from res.send(msg)
|
|
53
|
+
*/
|
|
54
|
+
return response.text();
|
|
55
|
+
default:
|
|
56
|
+
return response.json();
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
throw getError(e);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves all XML fragments from the project's workspace
|
|
65
|
+
*
|
|
66
|
+
* @returns Generic Promise<T>
|
|
67
|
+
*/
|
|
68
|
+
async function getFragments() {
|
|
69
|
+
return request(ApiEndpoints.FRAGMENT, RequestMethod.GET);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Writes an XML fragment to the project's workspace
|
|
74
|
+
*
|
|
75
|
+
* @param data Data to be send to the server
|
|
76
|
+
* @returns Generic Promise<T>
|
|
77
|
+
*/
|
|
78
|
+
async function writeFragment(data) {
|
|
79
|
+
return request(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Retrieves manifest.appdescr_variant from the project's workspace
|
|
84
|
+
*
|
|
85
|
+
* @returns Generic Promise<T>
|
|
86
|
+
*/
|
|
87
|
+
async function getManifestAppdescr() {
|
|
88
|
+
return request(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Retrieves all controller extensions from the project's workspace
|
|
93
|
+
*
|
|
94
|
+
* @returns Generic Promise<T>
|
|
95
|
+
*/
|
|
96
|
+
async function readControllers() {
|
|
97
|
+
return request(ApiEndpoints.CONTROLLER, RequestMethod.GET);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Writes a Controller to the project's workspace
|
|
102
|
+
*
|
|
103
|
+
* @param data Data to be send to the server
|
|
104
|
+
* @returns Generic Promise<T>
|
|
105
|
+
*/
|
|
106
|
+
async function writeController(data) {
|
|
107
|
+
return request(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Checks for existing controller in the project's workspace
|
|
112
|
+
*
|
|
113
|
+
* @param controllerName Name of the controller
|
|
114
|
+
* @returns {CodeExtResponse} Returns path to existing controller if found
|
|
115
|
+
*/
|
|
116
|
+
async function getExistingController(controllerName) {
|
|
117
|
+
return request(`${ApiEndpoints.CODE_EXT}/${controllerName}`, RequestMethod.GET);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Writes a change object to the project's workspace
|
|
122
|
+
*
|
|
123
|
+
* @param data Data to be send to the server
|
|
124
|
+
* @returns Generic Promise<T>
|
|
125
|
+
*/
|
|
126
|
+
async function writeChange(data) {
|
|
127
|
+
return request(ApiEndpoints.CHANGES, RequestMethod.POST, data);
|
|
128
|
+
}
|
|
129
|
+
var __exports = {
|
|
130
|
+
__esModule: true
|
|
131
|
+
};
|
|
132
|
+
__exports.ApiEndpoints = ApiEndpoints;
|
|
133
|
+
__exports.RequestMethod = RequestMethod;
|
|
134
|
+
__exports.request = request;
|
|
135
|
+
__exports.getFragments = getFragments;
|
|
136
|
+
__exports.writeFragment = writeFragment;
|
|
137
|
+
__exports.getManifestAppdescr = getManifestAppdescr;
|
|
138
|
+
__exports.readControllers = readControllers;
|
|
139
|
+
__exports.writeController = writeController;
|
|
140
|
+
__exports.getExistingController = getExistingController;
|
|
141
|
+
__exports.writeChange = writeChange;
|
|
142
|
+
return __exports;
|
|
143
143
|
});
|
|
144
144
|
//# sourceMappingURL=api-handler.js.map
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/m/MessageToast", "sap/ui/rta/command/CommandFactory", "../utils/error"], function (MessageToast, CommandFactory, ___utils_error) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getError = ___utils_error["getError"];
|
|
7
|
-
/**
|
|
8
|
-
* Class responsible for handling rta calls
|
|
9
|
-
*/
|
|
10
|
-
class CommandExecutor {
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param rta Runtime Authoring
|
|
14
|
-
*/
|
|
15
|
-
constructor(rta) {
|
|
16
|
-
this.rta = rta;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Generates command based on given values
|
|
21
|
-
*
|
|
22
|
-
* @param runtimeControl Managed object
|
|
23
|
-
* @param commandName Command name
|
|
24
|
-
* @param modifiedValue Modified value/s
|
|
25
|
-
* @param designMetadata Design time metadata
|
|
26
|
-
* @param flexSettings Additional flex settings
|
|
27
|
-
*/
|
|
28
|
-
async getCommand(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings) {
|
|
29
|
-
try {
|
|
30
|
-
return await CommandFactory.getCommandFor(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings);
|
|
31
|
-
} catch (e) {
|
|
32
|
-
const error = getError(e);
|
|
33
|
-
const msgToastErrorMsg = `Could not get command for '${commandName}'. ${error.message}`;
|
|
34
|
-
error.message = msgToastErrorMsg;
|
|
35
|
-
MessageToast.show(msgToastErrorMsg);
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Pushed and executes the provided command
|
|
42
|
-
*
|
|
43
|
-
* @param command Command
|
|
44
|
-
*/
|
|
45
|
-
async pushAndExecuteCommand(command) {
|
|
46
|
-
try {
|
|
47
|
-
/**
|
|
48
|
-
* The change will have pending state and will only be saved to the workspace when the user clicks save icon
|
|
49
|
-
*/
|
|
50
|
-
await this.rta.getCommandStack().pushAndExecute(command);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
const error = getError(e);
|
|
53
|
-
MessageToast.show(error.message);
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return CommandExecutor;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/m/MessageToast", "sap/ui/rta/command/CommandFactory", "../utils/error"], function (MessageToast, CommandFactory, ___utils_error) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getError = ___utils_error["getError"];
|
|
7
|
+
/**
|
|
8
|
+
* Class responsible for handling rta calls
|
|
9
|
+
*/
|
|
10
|
+
class CommandExecutor {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param rta Runtime Authoring
|
|
14
|
+
*/
|
|
15
|
+
constructor(rta) {
|
|
16
|
+
this.rta = rta;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generates command based on given values
|
|
21
|
+
*
|
|
22
|
+
* @param runtimeControl Managed object
|
|
23
|
+
* @param commandName Command name
|
|
24
|
+
* @param modifiedValue Modified value/s
|
|
25
|
+
* @param designMetadata Design time metadata
|
|
26
|
+
* @param flexSettings Additional flex settings
|
|
27
|
+
*/
|
|
28
|
+
async getCommand(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings) {
|
|
29
|
+
try {
|
|
30
|
+
return await CommandFactory.getCommandFor(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
const error = getError(e);
|
|
33
|
+
const msgToastErrorMsg = `Could not get command for '${commandName}'. ${error.message}`;
|
|
34
|
+
error.message = msgToastErrorMsg;
|
|
35
|
+
MessageToast.show(msgToastErrorMsg);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Pushed and executes the provided command
|
|
42
|
+
*
|
|
43
|
+
* @param command Command
|
|
44
|
+
*/
|
|
45
|
+
async pushAndExecuteCommand(command) {
|
|
46
|
+
try {
|
|
47
|
+
/**
|
|
48
|
+
* The change will have pending state and will only be saved to the workspace when the user clicks save icon
|
|
49
|
+
*/
|
|
50
|
+
await this.rta.getCommandStack().pushAndExecute(command);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
const error = getError(e);
|
|
53
|
+
MessageToast.show(error.message);
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return CommandExecutor;
|
|
59
59
|
});
|
|
60
60
|
//# sourceMappingURL=command-executor.js.map
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Handles calling control specific functions for retrieving control data
|
|
8
|
-
*/
|
|
9
|
-
class ControlUtils {
|
|
10
|
-
/**
|
|
11
|
-
* Returns ManagedObject runtime control
|
|
12
|
-
*
|
|
13
|
-
* @param overlayControl Overlay
|
|
14
|
-
* @returns {ManagedObject} Managed Object instance
|
|
15
|
-
*/
|
|
16
|
-
static getRuntimeControl(overlayControl) {
|
|
17
|
-
let runtimeControl;
|
|
18
|
-
if (overlayControl.getElementInstance) {
|
|
19
|
-
runtimeControl = overlayControl.getElementInstance();
|
|
20
|
-
} else {
|
|
21
|
-
runtimeControl = overlayControl.getElement();
|
|
22
|
-
}
|
|
23
|
-
return runtimeControl;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns control aggregation names in an array
|
|
28
|
-
*
|
|
29
|
-
* @param control Managed Object runtime control
|
|
30
|
-
* @param name Aggregation name
|
|
31
|
-
* @returns Array of control aggregations
|
|
32
|
-
*/
|
|
33
|
-
static getControlAggregationByName(control, name) {
|
|
34
|
-
let result = [];
|
|
35
|
-
const aggregation = (control ? control.getMetadata().getAllAggregations() : {})[name];
|
|
36
|
-
if (aggregation) {
|
|
37
|
-
// This executes a _sGetter function that can vary from control to control (_sGetter can be: getContent, getItems, etc)
|
|
38
|
-
const names = aggregation._sGetter && control[aggregation._sGetter]() || [];
|
|
39
|
-
result = Array.isArray(names) ? names : [names];
|
|
40
|
-
}
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return ControlUtils;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Handles calling control specific functions for retrieving control data
|
|
8
|
+
*/
|
|
9
|
+
class ControlUtils {
|
|
10
|
+
/**
|
|
11
|
+
* Returns ManagedObject runtime control
|
|
12
|
+
*
|
|
13
|
+
* @param overlayControl Overlay
|
|
14
|
+
* @returns {ManagedObject} Managed Object instance
|
|
15
|
+
*/
|
|
16
|
+
static getRuntimeControl(overlayControl) {
|
|
17
|
+
let runtimeControl;
|
|
18
|
+
if (overlayControl.getElementInstance) {
|
|
19
|
+
runtimeControl = overlayControl.getElementInstance();
|
|
20
|
+
} else {
|
|
21
|
+
runtimeControl = overlayControl.getElement();
|
|
22
|
+
}
|
|
23
|
+
return runtimeControl;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns control aggregation names in an array
|
|
28
|
+
*
|
|
29
|
+
* @param control Managed Object runtime control
|
|
30
|
+
* @param name Aggregation name
|
|
31
|
+
* @returns Array of control aggregations
|
|
32
|
+
*/
|
|
33
|
+
static getControlAggregationByName(control, name) {
|
|
34
|
+
let result = [];
|
|
35
|
+
const aggregation = (control ? control.getMetadata().getAllAggregations() : {})[name];
|
|
36
|
+
if (aggregation) {
|
|
37
|
+
// This executes a _sGetter function that can vary from control to control (_sGetter can be: getContent, getItems, etc)
|
|
38
|
+
const names = aggregation._sGetter && control[aggregation._sGetter]() || [];
|
|
39
|
+
result = Array.isArray(names) ? names : [names];
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return ControlUtils;
|
|
45
45
|
});
|
|
46
46
|
//# sourceMappingURL=control-utils.js.map
|