@sap-ux/preview-middleware 0.18.0 → 0.18.1
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/flp.d.ts +1 -1
- package/dist/base/flp.js +12 -8
- package/dist/client/adp/api-handler.js +153 -153
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
- package/dist/client/adp/controllers/ControllerExtension.controller.js +209 -209
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +125 -125
- package/dist/client/adp/init-dialogs.js +100 -100
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -55
- package/dist/client/adp/quick-actions/common/create-page-action.js +51 -51
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -36
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +48 -48
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +21 -21
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
- package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +104 -104
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -96
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
- package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
- package/dist/client/adp/quick-actions/fe-v2/registry.js +75 -75
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +73 -73
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +50 -50
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -46
- package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
- package/dist/client/adp/quick-actions/fe-v4/registry.js +58 -58
- package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +53 -53
- package/dist/client/adp/utils.js +160 -160
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +39 -39
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/feature-service.js +36 -36
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +222 -222
- 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 +138 -138
- package/dist/client/flp/WorkspaceConnector.js +86 -86
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +83 -83
- 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/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/fe-v4.js +118 -118
- package/dist/client/utils/version.js +104 -102
- package/dist/client/utils/version.ts +6 -3
- package/package.json +4 -4
- package/dist/client/tsconfig.tsbuildinfo +0 -1
package/dist/base/flp.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export declare class FlpSandbox {
|
|
|
139
139
|
/**
|
|
140
140
|
* Read the sandbox template file based on the given UI5 version.
|
|
141
141
|
*
|
|
142
|
-
* @param
|
|
142
|
+
* @param ui5Version - the UI5 version
|
|
143
143
|
* @returns the template for the sandbox HTML file
|
|
144
144
|
*/
|
|
145
145
|
private getSandboxTemplate;
|
package/dist/base/flp.js
CHANGED
|
@@ -160,7 +160,7 @@ class FlpSandbox {
|
|
|
160
160
|
if (ui5Version.major === 1 && ui5Version.minor <= 71) {
|
|
161
161
|
this.removeAsyncHintsRequests();
|
|
162
162
|
}
|
|
163
|
-
return (0, ejs_1.render)(this.getSandboxTemplate(ui5Version
|
|
163
|
+
return (0, ejs_1.render)(this.getSandboxTemplate(ui5Version), config);
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
166
|
* Sets application dependencies in the template configuration.
|
|
@@ -291,7 +291,7 @@ class FlpSandbox {
|
|
|
291
291
|
'protocol' in req
|
|
292
292
|
? req.protocol
|
|
293
293
|
: req.headers.referer?.substring(0, req.headers.referer.indexOf(':')) ?? 'http', req.headers.host, 'ui5-patched-router' in req ? req['ui5-patched-router']?.baseUrl : undefined);
|
|
294
|
-
const html = (0, ejs_1.render)(this.getSandboxTemplate(ui5Version
|
|
294
|
+
const html = (0, ejs_1.render)(this.getSandboxTemplate(ui5Version), this.templateConfig);
|
|
295
295
|
this.sendResponse(res, 'text/html', 200, html);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
@@ -335,21 +335,25 @@ class FlpSandbox {
|
|
|
335
335
|
this.logger.error('Could not get UI5 version of application. Using 1.121.0 as fallback.');
|
|
336
336
|
version = '1.121.0';
|
|
337
337
|
}
|
|
338
|
-
const [major, minor] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
|
|
338
|
+
const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
|
|
339
|
+
const label = version.split(/-(.*)/s)?.[1];
|
|
339
340
|
return {
|
|
340
341
|
major,
|
|
341
|
-
minor
|
|
342
|
+
minor,
|
|
343
|
+
patch,
|
|
344
|
+
label
|
|
342
345
|
};
|
|
343
346
|
}
|
|
344
347
|
/**
|
|
345
348
|
* Read the sandbox template file based on the given UI5 version.
|
|
346
349
|
*
|
|
347
|
-
* @param
|
|
350
|
+
* @param ui5Version - the UI5 version
|
|
348
351
|
* @returns the template for the sandbox HTML file
|
|
349
352
|
*/
|
|
350
|
-
getSandboxTemplate(
|
|
351
|
-
this.logger.info(`Using sandbox template for UI5
|
|
352
|
-
|
|
353
|
+
getSandboxTemplate(ui5Version) {
|
|
354
|
+
this.logger.info(`Using sandbox template for UI5 version ${ui5Version.major}.${ui5Version.minor}.${ui5Version.patch}${ui5Version.label ? `-${ui5Version.label}` : ''}.`);
|
|
355
|
+
const filePrefix = ui5Version.major > 1 || ui5Version.label?.includes('legacy-free') ? '2' : '';
|
|
356
|
+
return (0, fs_1.readFileSync)((0, path_1.join)(__dirname, `../../templates/flp/sandbox${filePrefix}.html`), 'utf-8');
|
|
353
357
|
}
|
|
354
358
|
/**
|
|
355
359
|
* For UI5 version 1.71 and below, the asyncHints.requests need to be removed from the template configuration
|
|
@@ -1,155 +1,155 @@
|
|
|
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["ANNOTATION_FILE"] = "/adp/api/annotation";
|
|
13
|
-
ApiEndpoints["MANIFEST_APP_DESCRIPTOR"] = "/manifest.appdescr_variant";
|
|
14
|
-
return ApiEndpoints;
|
|
15
|
-
}(ApiEndpoints || {});
|
|
16
|
-
var RequestMethod = /*#__PURE__*/function (RequestMethod) {
|
|
17
|
-
RequestMethod["GET"] = "GET";
|
|
18
|
-
RequestMethod["PUT"] = "PUT";
|
|
19
|
-
RequestMethod["POST"] = "POST";
|
|
20
|
-
RequestMethod["PATCH"] = "PATCH";
|
|
21
|
-
RequestMethod["DELETE"] = "DELETE";
|
|
22
|
-
return RequestMethod;
|
|
23
|
-
}(RequestMethod || {});
|
|
24
|
-
/**
|
|
25
|
-
* Requests a given endpoint
|
|
26
|
-
*
|
|
27
|
-
* @param endpoint API Endpoint
|
|
28
|
-
* @param method RequestMethod
|
|
29
|
-
* @param data Data to be sent to the server
|
|
30
|
-
* @returns Data from the server request
|
|
31
|
-
*/
|
|
32
|
-
async function request(endpoint, method, data) {
|
|
33
|
-
const config = {
|
|
34
|
-
method,
|
|
35
|
-
body: JSON.stringify(data),
|
|
36
|
-
headers: {
|
|
37
|
-
'content-type': 'application/json'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
try {
|
|
41
|
-
const response = await fetch(endpoint, config);
|
|
42
|
-
if (!response.ok) {
|
|
43
|
-
const errorData = await response.json();
|
|
44
|
-
const message = errorData?.message ?? '';
|
|
45
|
-
throw new Error(`Request failed, status: ${response.status}. ${message}`.trim());
|
|
46
|
-
}
|
|
47
|
-
switch (method) {
|
|
48
|
-
case RequestMethod.GET:
|
|
49
|
-
return response.json();
|
|
50
|
-
case RequestMethod.POST:
|
|
51
|
-
/**
|
|
52
|
-
* Since POST usually creates something
|
|
53
|
-
* and returns nothing (or a message) we just parse the text from res.send(msg)
|
|
54
|
-
*/
|
|
55
|
-
return response.text();
|
|
56
|
-
default:
|
|
57
|
-
return response.json();
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {
|
|
60
|
-
throw getError(e);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Retrieves all XML fragments from the project's workspace
|
|
66
|
-
*
|
|
67
|
-
* @returns Generic Promise<T>
|
|
68
|
-
*/
|
|
69
|
-
async function getFragments() {
|
|
70
|
-
return request(ApiEndpoints.FRAGMENT, RequestMethod.GET);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Writes an XML fragment to the project's workspace
|
|
75
|
-
*
|
|
76
|
-
* @param data Data to be send to the server
|
|
77
|
-
* @returns Generic Promise<T>
|
|
78
|
-
*/
|
|
79
|
-
async function writeFragment(data) {
|
|
80
|
-
return request(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Retrieves manifest.appdescr_variant from the project's workspace
|
|
85
|
-
*
|
|
86
|
-
* @returns Generic Promise<T>
|
|
87
|
-
*/
|
|
88
|
-
async function getManifestAppdescr() {
|
|
89
|
-
return request(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Retrieves all controller extensions from the project's workspace
|
|
94
|
-
*
|
|
95
|
-
* @returns Generic Promise<T>
|
|
96
|
-
*/
|
|
97
|
-
async function readControllers() {
|
|
98
|
-
return request(ApiEndpoints.CONTROLLER, RequestMethod.GET);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Writes a Controller to the project's workspace
|
|
103
|
-
*
|
|
104
|
-
* @param data Data to be send to the server
|
|
105
|
-
* @returns Generic Promise<T>
|
|
106
|
-
*/
|
|
107
|
-
async function writeController(data) {
|
|
108
|
-
return request(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Writes a new annotation file to the project's workspace
|
|
113
|
-
*
|
|
114
|
-
* @returns Generic Promise<DataSourceAnnotationMap>
|
|
115
|
-
*/
|
|
116
|
-
async function getDataSourceAnnotationFileMap() {
|
|
117
|
-
return request(ApiEndpoints.ANNOTATION_FILE, RequestMethod.GET);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Checks for existing controller in the project's workspace
|
|
122
|
-
*
|
|
123
|
-
* @param controllerName Name of the controller
|
|
124
|
-
* @returns {CodeExtResponse} Returns path to existing controller if found
|
|
125
|
-
*/
|
|
126
|
-
async function getExistingController(controllerName) {
|
|
127
|
-
return request(`${ApiEndpoints.CODE_EXT}/${controllerName}`, RequestMethod.GET);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Writes a change object to the project's workspace
|
|
132
|
-
*
|
|
133
|
-
* @param data Data to be send to the server
|
|
134
|
-
* @returns Generic Promise<T>
|
|
135
|
-
*/
|
|
136
|
-
async function writeChange(data) {
|
|
137
|
-
return request(ApiEndpoints.CHANGES, RequestMethod.POST, data);
|
|
138
|
-
}
|
|
139
|
-
var __exports = {
|
|
140
|
-
__esModule: true
|
|
141
|
-
};
|
|
142
|
-
__exports.ApiEndpoints = ApiEndpoints;
|
|
143
|
-
__exports.RequestMethod = RequestMethod;
|
|
144
|
-
__exports.request = request;
|
|
145
|
-
__exports.getFragments = getFragments;
|
|
146
|
-
__exports.writeFragment = writeFragment;
|
|
147
|
-
__exports.getManifestAppdescr = getManifestAppdescr;
|
|
148
|
-
__exports.readControllers = readControllers;
|
|
149
|
-
__exports.writeController = writeController;
|
|
150
|
-
__exports.getDataSourceAnnotationFileMap = getDataSourceAnnotationFileMap;
|
|
151
|
-
__exports.getExistingController = getExistingController;
|
|
152
|
-
__exports.writeChange = writeChange;
|
|
153
|
-
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["ANNOTATION_FILE"] = "/adp/api/annotation";
|
|
13
|
+
ApiEndpoints["MANIFEST_APP_DESCRIPTOR"] = "/manifest.appdescr_variant";
|
|
14
|
+
return ApiEndpoints;
|
|
15
|
+
}(ApiEndpoints || {});
|
|
16
|
+
var RequestMethod = /*#__PURE__*/function (RequestMethod) {
|
|
17
|
+
RequestMethod["GET"] = "GET";
|
|
18
|
+
RequestMethod["PUT"] = "PUT";
|
|
19
|
+
RequestMethod["POST"] = "POST";
|
|
20
|
+
RequestMethod["PATCH"] = "PATCH";
|
|
21
|
+
RequestMethod["DELETE"] = "DELETE";
|
|
22
|
+
return RequestMethod;
|
|
23
|
+
}(RequestMethod || {});
|
|
24
|
+
/**
|
|
25
|
+
* Requests a given endpoint
|
|
26
|
+
*
|
|
27
|
+
* @param endpoint API Endpoint
|
|
28
|
+
* @param method RequestMethod
|
|
29
|
+
* @param data Data to be sent to the server
|
|
30
|
+
* @returns Data from the server request
|
|
31
|
+
*/
|
|
32
|
+
async function request(endpoint, method, data) {
|
|
33
|
+
const config = {
|
|
34
|
+
method,
|
|
35
|
+
body: JSON.stringify(data),
|
|
36
|
+
headers: {
|
|
37
|
+
'content-type': 'application/json'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
const response = await fetch(endpoint, config);
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
const errorData = await response.json();
|
|
44
|
+
const message = errorData?.message ?? '';
|
|
45
|
+
throw new Error(`Request failed, status: ${response.status}. ${message}`.trim());
|
|
46
|
+
}
|
|
47
|
+
switch (method) {
|
|
48
|
+
case RequestMethod.GET:
|
|
49
|
+
return response.json();
|
|
50
|
+
case RequestMethod.POST:
|
|
51
|
+
/**
|
|
52
|
+
* Since POST usually creates something
|
|
53
|
+
* and returns nothing (or a message) we just parse the text from res.send(msg)
|
|
54
|
+
*/
|
|
55
|
+
return response.text();
|
|
56
|
+
default:
|
|
57
|
+
return response.json();
|
|
58
|
+
}
|
|
59
|
+
} catch (e) {
|
|
60
|
+
throw getError(e);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves all XML fragments from the project's workspace
|
|
66
|
+
*
|
|
67
|
+
* @returns Generic Promise<T>
|
|
68
|
+
*/
|
|
69
|
+
async function getFragments() {
|
|
70
|
+
return request(ApiEndpoints.FRAGMENT, RequestMethod.GET);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Writes an XML fragment to the project's workspace
|
|
75
|
+
*
|
|
76
|
+
* @param data Data to be send to the server
|
|
77
|
+
* @returns Generic Promise<T>
|
|
78
|
+
*/
|
|
79
|
+
async function writeFragment(data) {
|
|
80
|
+
return request(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Retrieves manifest.appdescr_variant from the project's workspace
|
|
85
|
+
*
|
|
86
|
+
* @returns Generic Promise<T>
|
|
87
|
+
*/
|
|
88
|
+
async function getManifestAppdescr() {
|
|
89
|
+
return request(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves all controller extensions from the project's workspace
|
|
94
|
+
*
|
|
95
|
+
* @returns Generic Promise<T>
|
|
96
|
+
*/
|
|
97
|
+
async function readControllers() {
|
|
98
|
+
return request(ApiEndpoints.CONTROLLER, RequestMethod.GET);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Writes a Controller to the project's workspace
|
|
103
|
+
*
|
|
104
|
+
* @param data Data to be send to the server
|
|
105
|
+
* @returns Generic Promise<T>
|
|
106
|
+
*/
|
|
107
|
+
async function writeController(data) {
|
|
108
|
+
return request(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Writes a new annotation file to the project's workspace
|
|
113
|
+
*
|
|
114
|
+
* @returns Generic Promise<DataSourceAnnotationMap>
|
|
115
|
+
*/
|
|
116
|
+
async function getDataSourceAnnotationFileMap() {
|
|
117
|
+
return request(ApiEndpoints.ANNOTATION_FILE, RequestMethod.GET);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Checks for existing controller in the project's workspace
|
|
122
|
+
*
|
|
123
|
+
* @param controllerName Name of the controller
|
|
124
|
+
* @returns {CodeExtResponse} Returns path to existing controller if found
|
|
125
|
+
*/
|
|
126
|
+
async function getExistingController(controllerName) {
|
|
127
|
+
return request(`${ApiEndpoints.CODE_EXT}/${controllerName}`, RequestMethod.GET);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Writes a change object to the project's workspace
|
|
132
|
+
*
|
|
133
|
+
* @param data Data to be send to the server
|
|
134
|
+
* @returns Generic Promise<T>
|
|
135
|
+
*/
|
|
136
|
+
async function writeChange(data) {
|
|
137
|
+
return request(ApiEndpoints.CHANGES, RequestMethod.POST, data);
|
|
138
|
+
}
|
|
139
|
+
var __exports = {
|
|
140
|
+
__esModule: true
|
|
141
|
+
};
|
|
142
|
+
__exports.ApiEndpoints = ApiEndpoints;
|
|
143
|
+
__exports.RequestMethod = RequestMethod;
|
|
144
|
+
__exports.request = request;
|
|
145
|
+
__exports.getFragments = getFragments;
|
|
146
|
+
__exports.writeFragment = writeFragment;
|
|
147
|
+
__exports.getManifestAppdescr = getManifestAppdescr;
|
|
148
|
+
__exports.readControllers = readControllers;
|
|
149
|
+
__exports.writeController = writeController;
|
|
150
|
+
__exports.getDataSourceAnnotationFileMap = getDataSourceAnnotationFileMap;
|
|
151
|
+
__exports.getExistingController = getExistingController;
|
|
152
|
+
__exports.writeChange = writeChange;
|
|
153
|
+
return __exports;
|
|
154
154
|
});
|
|
155
155
|
//# sourceMappingURL=api-handler.js.map
|
|
@@ -1,77 +1,77 @@
|
|
|
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
|
-
* Creates composite command without nested commands
|
|
42
|
-
*
|
|
43
|
-
* @param runtimeControl Managed object
|
|
44
|
-
*/
|
|
45
|
-
async createCompositeCommand(runtimeControl) {
|
|
46
|
-
try {
|
|
47
|
-
return await CommandFactory.getCommandFor(runtimeControl, 'composite');
|
|
48
|
-
} catch (e) {
|
|
49
|
-
const error = getError(e);
|
|
50
|
-
const msgToastErrorMsg = `Could not get composite command'. ${error.message}`;
|
|
51
|
-
error.message = msgToastErrorMsg;
|
|
52
|
-
MessageToast.show(msgToastErrorMsg);
|
|
53
|
-
throw error;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Pushed and executes the provided command
|
|
59
|
-
*
|
|
60
|
-
* @param command Command
|
|
61
|
-
*/
|
|
62
|
-
async pushAndExecuteCommand(command) {
|
|
63
|
-
try {
|
|
64
|
-
/**
|
|
65
|
-
* The change will have pending state and will only be saved to the workspace when the user clicks save icon
|
|
66
|
-
*/
|
|
67
|
-
await this.rta.getCommandStack().pushAndExecute(command);
|
|
68
|
-
} catch (e) {
|
|
69
|
-
const error = getError(e);
|
|
70
|
-
MessageToast.show(error.message);
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
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
|
+
* Creates composite command without nested commands
|
|
42
|
+
*
|
|
43
|
+
* @param runtimeControl Managed object
|
|
44
|
+
*/
|
|
45
|
+
async createCompositeCommand(runtimeControl) {
|
|
46
|
+
try {
|
|
47
|
+
return await CommandFactory.getCommandFor(runtimeControl, 'composite');
|
|
48
|
+
} catch (e) {
|
|
49
|
+
const error = getError(e);
|
|
50
|
+
const msgToastErrorMsg = `Could not get composite command'. ${error.message}`;
|
|
51
|
+
error.message = msgToastErrorMsg;
|
|
52
|
+
MessageToast.show(msgToastErrorMsg);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Pushed and executes the provided command
|
|
59
|
+
*
|
|
60
|
+
* @param command Command
|
|
61
|
+
*/
|
|
62
|
+
async pushAndExecuteCommand(command) {
|
|
63
|
+
try {
|
|
64
|
+
/**
|
|
65
|
+
* The change will have pending state and will only be saved to the workspace when the user clicks save icon
|
|
66
|
+
*/
|
|
67
|
+
await this.rta.getCommandStack().pushAndExecute(command);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
const error = getError(e);
|
|
70
|
+
MessageToast.show(error.message);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return CommandExecutor;
|
|
76
76
|
});
|
|
77
77
|
//# 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
|