@sap-ux/preview-middleware 0.16.78 → 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 -1
- 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 +5 -5
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/Component", "../../../utils/core"], function (Component, _____utils_core) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const isA = _____utils_core["isA"];
|
|
7
|
-
/**
|
|
8
|
-
* Get the containing app component of a control.
|
|
9
|
-
*
|
|
10
|
-
* @param control - UI5 control instance.
|
|
11
|
-
* @returns App component to which the control belongs.
|
|
12
|
-
*/
|
|
13
|
-
function getAppComponent(control) {
|
|
14
|
-
const ownerComponent = Component.getOwnerComponentFor(control);
|
|
15
|
-
if (isA('sap.fe.core.TemplateComponent', ownerComponent)) {
|
|
16
|
-
return ownerComponent.getAppComponent();
|
|
17
|
-
}
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Get the containing page name of a control.
|
|
22
|
-
*
|
|
23
|
-
* @param control - UI5 control instance.
|
|
24
|
-
* @returns Page name to which the control belongs.
|
|
25
|
-
*/
|
|
26
|
-
function getPageName(control) {
|
|
27
|
-
const component = Component.getOwnerComponentFor(control);
|
|
28
|
-
if (!isA('sap.fe.core.TemplateComponent', component)) {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
const view = component.getRootControl();
|
|
32
|
-
return view.getId().split('::').pop();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Gets a reference id for a control.
|
|
37
|
-
*
|
|
38
|
-
* @param control - UI5 control instance.
|
|
39
|
-
* @returns Reference id.
|
|
40
|
-
*/
|
|
41
|
-
function getReference(control) {
|
|
42
|
-
// probably same as flex setting id or base id TODO: CONFIRM
|
|
43
|
-
const manifest = getAppComponent(control)?.getManifest();
|
|
44
|
-
return manifest?.['sap.app']?.id ?? '';
|
|
45
|
-
}
|
|
46
|
-
var __exports = {
|
|
47
|
-
__esModule: true
|
|
48
|
-
};
|
|
49
|
-
__exports.getAppComponent = getAppComponent;
|
|
50
|
-
__exports.getPageName = getPageName;
|
|
51
|
-
__exports.getReference = getReference;
|
|
52
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Component", "../../../utils/core"], function (Component, _____utils_core) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const isA = _____utils_core["isA"];
|
|
7
|
+
/**
|
|
8
|
+
* Get the containing app component of a control.
|
|
9
|
+
*
|
|
10
|
+
* @param control - UI5 control instance.
|
|
11
|
+
* @returns App component to which the control belongs.
|
|
12
|
+
*/
|
|
13
|
+
function getAppComponent(control) {
|
|
14
|
+
const ownerComponent = Component.getOwnerComponentFor(control);
|
|
15
|
+
if (isA('sap.fe.core.TemplateComponent', ownerComponent)) {
|
|
16
|
+
return ownerComponent.getAppComponent();
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the containing page name of a control.
|
|
22
|
+
*
|
|
23
|
+
* @param control - UI5 control instance.
|
|
24
|
+
* @returns Page name to which the control belongs.
|
|
25
|
+
*/
|
|
26
|
+
function getPageName(control) {
|
|
27
|
+
const component = Component.getOwnerComponentFor(control);
|
|
28
|
+
if (!isA('sap.fe.core.TemplateComponent', component)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const view = component.getRootControl();
|
|
32
|
+
return view.getId().split('::').pop();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Gets a reference id for a control.
|
|
37
|
+
*
|
|
38
|
+
* @param control - UI5 control instance.
|
|
39
|
+
* @returns Reference id.
|
|
40
|
+
*/
|
|
41
|
+
function getReference(control) {
|
|
42
|
+
// probably same as flex setting id or base id TODO: CONFIRM
|
|
43
|
+
const manifest = getAppComponent(control)?.getManifest();
|
|
44
|
+
return manifest?.['sap.app']?.id ?? '';
|
|
45
|
+
}
|
|
46
|
+
var __exports = {
|
|
47
|
+
__esModule: true
|
|
48
|
+
};
|
|
49
|
+
__exports.getAppComponent = getAppComponent;
|
|
50
|
+
__exports.getPageName = getPageName;
|
|
51
|
+
__exports.getReference = getReference;
|
|
52
|
+
return __exports;
|
|
53
53
|
});
|
|
54
54
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function __ui5_require_async(path) {
|
|
7
|
-
return new Promise(function (resolve, reject) {
|
|
8
|
-
sap.ui.require([path], function (module) {
|
|
9
|
-
if (!(module && module.__esModule)) {
|
|
10
|
-
module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
|
|
11
|
-
default: module
|
|
12
|
-
} : module;
|
|
13
|
-
Object.defineProperty(module, "__esModule", {
|
|
14
|
-
value: true
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
resolve(module);
|
|
18
|
-
}, function (err) {
|
|
19
|
-
reject(err);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Loads the appropriate Quick Action registries for the given application type.
|
|
25
|
-
*
|
|
26
|
-
* @param appType - Application type.
|
|
27
|
-
* @returns Quick Action registries.
|
|
28
|
-
*/
|
|
29
|
-
async function loadDefinitions(appType) {
|
|
30
|
-
// eslint-disable-next-line fiori-custom/sap-no-localstorage
|
|
31
|
-
if (localStorage.getItem('com.sap.ux.control-property-editor.features.quick-actions') !== 'true') {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
if (appType === 'fe-v2') {
|
|
35
|
-
const FEV2QuickActionRegistry = (await __ui5_require_async('open/ux/preview/client/adp/quick-actions/fe-v2/registry')).default;
|
|
36
|
-
return [new FEV2QuickActionRegistry()];
|
|
37
|
-
}
|
|
38
|
-
if (appType === 'fe-v4') {
|
|
39
|
-
const FEV4QuickActionRegistry = (await __ui5_require_async('open/ux/preview/client/adp/quick-actions/fe-v4/registry')).default;
|
|
40
|
-
return [new FEV4QuickActionRegistry()];
|
|
41
|
-
}
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
var __exports = {
|
|
45
|
-
__esModule: true
|
|
46
|
-
};
|
|
47
|
-
__exports.loadDefinitions = loadDefinitions;
|
|
48
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function __ui5_require_async(path) {
|
|
7
|
+
return new Promise(function (resolve, reject) {
|
|
8
|
+
sap.ui.require([path], function (module) {
|
|
9
|
+
if (!(module && module.__esModule)) {
|
|
10
|
+
module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
|
|
11
|
+
default: module
|
|
12
|
+
} : module;
|
|
13
|
+
Object.defineProperty(module, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
resolve(module);
|
|
18
|
+
}, function (err) {
|
|
19
|
+
reject(err);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Loads the appropriate Quick Action registries for the given application type.
|
|
25
|
+
*
|
|
26
|
+
* @param appType - Application type.
|
|
27
|
+
* @returns Quick Action registries.
|
|
28
|
+
*/
|
|
29
|
+
async function loadDefinitions(appType) {
|
|
30
|
+
// eslint-disable-next-line fiori-custom/sap-no-localstorage
|
|
31
|
+
if (localStorage.getItem('com.sap.ux.control-property-editor.features.quick-actions') !== 'true') {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
if (appType === 'fe-v2') {
|
|
35
|
+
const FEV2QuickActionRegistry = (await __ui5_require_async('open/ux/preview/client/adp/quick-actions/fe-v2/registry')).default;
|
|
36
|
+
return [new FEV2QuickActionRegistry()];
|
|
37
|
+
}
|
|
38
|
+
if (appType === 'fe-v4') {
|
|
39
|
+
const FEV4QuickActionRegistry = (await __ui5_require_async('open/ux/preview/client/adp/quick-actions/fe-v4/registry')).default;
|
|
40
|
+
return [new FEV4QuickActionRegistry()];
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
var __exports = {
|
|
45
|
+
__esModule: true
|
|
46
|
+
};
|
|
47
|
+
__exports.loadDefinitions = loadDefinitions;
|
|
48
|
+
return __exports;
|
|
49
49
|
});
|
|
50
50
|
//# sourceMappingURL=load.js.map
|
package/dist/client/adp/utils.js
CHANGED
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_error, ___utils_version) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function __ui5_require_async(path) {
|
|
7
|
-
return new Promise(function (resolve, reject) {
|
|
8
|
-
sap.ui.require([path], function (module) {
|
|
9
|
-
if (!(module && module.__esModule)) {
|
|
10
|
-
module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
|
|
11
|
-
default: module
|
|
12
|
-
} : module;
|
|
13
|
-
Object.defineProperty(module, "__esModule", {
|
|
14
|
-
value: true
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
resolve(module);
|
|
18
|
-
}, function (err) {
|
|
19
|
-
reject(err);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const getError = ___utils_error["getError"];
|
|
24
|
-
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
25
|
-
/**
|
|
26
|
-
* Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
|
|
27
|
-
*
|
|
28
|
-
* @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
|
|
29
|
-
*
|
|
30
|
-
* @returns {Deferred} Deferred object
|
|
31
|
-
*/
|
|
32
|
-
function createDeferred() {
|
|
33
|
-
let resolve = null;
|
|
34
|
-
let reject = null;
|
|
35
|
-
const promise = new Promise((res, rej) => {
|
|
36
|
-
resolve = res;
|
|
37
|
-
reject = rej;
|
|
38
|
-
});
|
|
39
|
-
if (resolve === null || reject === null) {
|
|
40
|
-
throw new Error('Failed to initialize resolve and reject functions.');
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
promise,
|
|
44
|
-
resolve,
|
|
45
|
-
reject
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Checks if the fragment name associated with a command matches the specified fragment name.
|
|
51
|
-
*
|
|
52
|
-
* @param {FlexCommand} command - The command object containing the prepared change to be examined.
|
|
53
|
-
* @param {string} fragmentName - The name of the fragment to match against the command's change.
|
|
54
|
-
* @returns {boolean} Returns true if the command's change contains a fragment path that matches
|
|
55
|
-
* the specified fragment name; otherwise, returns false.
|
|
56
|
-
*/
|
|
57
|
-
function matchesFragmentName(command, fragmentName) {
|
|
58
|
-
if (typeof command.getPreparedChange !== 'function') {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
const change = command.getPreparedChange().getDefinition();
|
|
62
|
-
return change.content?.fragmentPath?.includes(`${fragmentName}.fragment.xml`) || false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Displays a message to the user indicating that an XML fragment will be created upon saving a change.
|
|
67
|
-
*
|
|
68
|
-
* @param {string} message - The message to be shown in the message toast.
|
|
69
|
-
* @param {number} duration - The duration during which message toast will be active.
|
|
70
|
-
*/
|
|
71
|
-
function notifyUser(message) {
|
|
72
|
-
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
|
|
73
|
-
MessageToast.show(message, {
|
|
74
|
-
duration
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Check if element is sync view
|
|
80
|
-
*
|
|
81
|
-
* @param element Design time Element
|
|
82
|
-
* @returns boolean if element is sync view or not
|
|
83
|
-
*/
|
|
84
|
-
function isSyncView(element) {
|
|
85
|
-
return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Get Ids for all sync views
|
|
90
|
-
*
|
|
91
|
-
* @param ui5VersionInfo UI5 Version Information
|
|
92
|
-
*
|
|
93
|
-
* @returns array of Ids for application sync views
|
|
94
|
-
*/
|
|
95
|
-
async function getAllSyncViewsIds(ui5VersionInfo) {
|
|
96
|
-
const syncViewIds = [];
|
|
97
|
-
try {
|
|
98
|
-
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
99
|
-
major: 1,
|
|
100
|
-
minor: 120
|
|
101
|
-
})) {
|
|
102
|
-
const elements = Element.registry.filter(() => true);
|
|
103
|
-
elements.forEach(ui5Element => {
|
|
104
|
-
if (isSyncView(ui5Element)) {
|
|
105
|
-
syncViewIds.push(ui5Element.getId());
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
} else {
|
|
109
|
-
const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
|
|
110
|
-
const elements = ElementRegistry.all();
|
|
111
|
-
Object.entries(elements).forEach(_ref => {
|
|
112
|
-
let [key, ui5Element] = _ref;
|
|
113
|
-
if (isSyncView(ui5Element)) {
|
|
114
|
-
syncViewIds.push(key);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
} catch (error) {
|
|
119
|
-
Log.error('Could not get application sync views', getError(error));
|
|
120
|
-
}
|
|
121
|
-
return syncViewIds;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Gets controller name and view ID for the given UI5 control.
|
|
125
|
-
*
|
|
126
|
-
* @param control UI5 control.
|
|
127
|
-
* @returns The controller name and view ID.
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
function getControllerInfoForControl(control) {
|
|
131
|
-
const view = FlexUtils.getViewForControl(control);
|
|
132
|
-
const controllerName = view.getController().getMetadata().getName();
|
|
133
|
-
const viewId = view.getId();
|
|
134
|
-
return {
|
|
135
|
-
controllerName,
|
|
136
|
-
viewId
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Gets controller name and view ID for the given overlay control.
|
|
142
|
-
*
|
|
143
|
-
* @param overlayControl The overlay control.
|
|
144
|
-
* @returns The controller name and view ID.
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
function getControllerInfo(overlayControl) {
|
|
148
|
-
const control = overlayControl.getElement();
|
|
149
|
-
return getControllerInfoForControl(control);
|
|
150
|
-
}
|
|
151
|
-
var __exports = {
|
|
152
|
-
__esModule: true
|
|
153
|
-
};
|
|
154
|
-
__exports.createDeferred = createDeferred;
|
|
155
|
-
__exports.matchesFragmentName = matchesFragmentName;
|
|
156
|
-
__exports.notifyUser = notifyUser;
|
|
157
|
-
__exports.getAllSyncViewsIds = getAllSyncViewsIds;
|
|
158
|
-
__exports.getControllerInfoForControl = getControllerInfoForControl;
|
|
159
|
-
__exports.getControllerInfo = getControllerInfo;
|
|
160
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_error, ___utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function __ui5_require_async(path) {
|
|
7
|
+
return new Promise(function (resolve, reject) {
|
|
8
|
+
sap.ui.require([path], function (module) {
|
|
9
|
+
if (!(module && module.__esModule)) {
|
|
10
|
+
module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
|
|
11
|
+
default: module
|
|
12
|
+
} : module;
|
|
13
|
+
Object.defineProperty(module, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
resolve(module);
|
|
18
|
+
}, function (err) {
|
|
19
|
+
reject(err);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const getError = ___utils_error["getError"];
|
|
24
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
25
|
+
/**
|
|
26
|
+
* Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
|
|
27
|
+
*
|
|
28
|
+
* @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
|
|
29
|
+
*
|
|
30
|
+
* @returns {Deferred} Deferred object
|
|
31
|
+
*/
|
|
32
|
+
function createDeferred() {
|
|
33
|
+
let resolve = null;
|
|
34
|
+
let reject = null;
|
|
35
|
+
const promise = new Promise((res, rej) => {
|
|
36
|
+
resolve = res;
|
|
37
|
+
reject = rej;
|
|
38
|
+
});
|
|
39
|
+
if (resolve === null || reject === null) {
|
|
40
|
+
throw new Error('Failed to initialize resolve and reject functions.');
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
promise,
|
|
44
|
+
resolve,
|
|
45
|
+
reject
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the fragment name associated with a command matches the specified fragment name.
|
|
51
|
+
*
|
|
52
|
+
* @param {FlexCommand} command - The command object containing the prepared change to be examined.
|
|
53
|
+
* @param {string} fragmentName - The name of the fragment to match against the command's change.
|
|
54
|
+
* @returns {boolean} Returns true if the command's change contains a fragment path that matches
|
|
55
|
+
* the specified fragment name; otherwise, returns false.
|
|
56
|
+
*/
|
|
57
|
+
function matchesFragmentName(command, fragmentName) {
|
|
58
|
+
if (typeof command.getPreparedChange !== 'function') {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
const change = command.getPreparedChange().getDefinition();
|
|
62
|
+
return change.content?.fragmentPath?.includes(`${fragmentName}.fragment.xml`) || false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Displays a message to the user indicating that an XML fragment will be created upon saving a change.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} message - The message to be shown in the message toast.
|
|
69
|
+
* @param {number} duration - The duration during which message toast will be active.
|
|
70
|
+
*/
|
|
71
|
+
function notifyUser(message) {
|
|
72
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
|
|
73
|
+
MessageToast.show(message, {
|
|
74
|
+
duration
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Check if element is sync view
|
|
80
|
+
*
|
|
81
|
+
* @param element Design time Element
|
|
82
|
+
* @returns boolean if element is sync view or not
|
|
83
|
+
*/
|
|
84
|
+
function isSyncView(element) {
|
|
85
|
+
return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get Ids for all sync views
|
|
90
|
+
*
|
|
91
|
+
* @param ui5VersionInfo UI5 Version Information
|
|
92
|
+
*
|
|
93
|
+
* @returns array of Ids for application sync views
|
|
94
|
+
*/
|
|
95
|
+
async function getAllSyncViewsIds(ui5VersionInfo) {
|
|
96
|
+
const syncViewIds = [];
|
|
97
|
+
try {
|
|
98
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
99
|
+
major: 1,
|
|
100
|
+
minor: 120
|
|
101
|
+
})) {
|
|
102
|
+
const elements = Element.registry.filter(() => true);
|
|
103
|
+
elements.forEach(ui5Element => {
|
|
104
|
+
if (isSyncView(ui5Element)) {
|
|
105
|
+
syncViewIds.push(ui5Element.getId());
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} else {
|
|
109
|
+
const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
|
|
110
|
+
const elements = ElementRegistry.all();
|
|
111
|
+
Object.entries(elements).forEach(_ref => {
|
|
112
|
+
let [key, ui5Element] = _ref;
|
|
113
|
+
if (isSyncView(ui5Element)) {
|
|
114
|
+
syncViewIds.push(key);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
Log.error('Could not get application sync views', getError(error));
|
|
120
|
+
}
|
|
121
|
+
return syncViewIds;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Gets controller name and view ID for the given UI5 control.
|
|
125
|
+
*
|
|
126
|
+
* @param control UI5 control.
|
|
127
|
+
* @returns The controller name and view ID.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
function getControllerInfoForControl(control) {
|
|
131
|
+
const view = FlexUtils.getViewForControl(control);
|
|
132
|
+
const controllerName = view.getController().getMetadata().getName();
|
|
133
|
+
const viewId = view.getId();
|
|
134
|
+
return {
|
|
135
|
+
controllerName,
|
|
136
|
+
viewId
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Gets controller name and view ID for the given overlay control.
|
|
142
|
+
*
|
|
143
|
+
* @param overlayControl The overlay control.
|
|
144
|
+
* @returns The controller name and view ID.
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
function getControllerInfo(overlayControl) {
|
|
148
|
+
const control = overlayControl.getElement();
|
|
149
|
+
return getControllerInfoForControl(control);
|
|
150
|
+
}
|
|
151
|
+
var __exports = {
|
|
152
|
+
__esModule: true
|
|
153
|
+
};
|
|
154
|
+
__exports.createDeferred = createDeferred;
|
|
155
|
+
__exports.matchesFragmentName = matchesFragmentName;
|
|
156
|
+
__exports.notifyUser = notifyUser;
|
|
157
|
+
__exports.getAllSyncViewsIds = getAllSyncViewsIds;
|
|
158
|
+
__exports.getControllerInfoForControl = getControllerInfoForControl;
|
|
159
|
+
__exports.getControllerInfo = getControllerInfo;
|
|
160
|
+
return __exports;
|
|
161
161
|
});
|
|
162
162
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/rta/command/CommandFactory", "./validator"], function (CommandFactory, ___validator) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const validateBindingModel = ___validator["validateBindingModel"];
|
|
7
|
-
/**
|
|
8
|
-
* Function to check a give value is a binding expression.
|
|
9
|
-
*
|
|
10
|
-
* @param value value to be checked.
|
|
11
|
-
* @returns boolean
|
|
12
|
-
*/
|
|
13
|
-
function isBindingExpression(value) {
|
|
14
|
-
return value.includes('{') && value.includes('}') && value.indexOf('{') < value.indexOf('}');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param options UI5 adaptation options
|
|
20
|
-
* @param change changed property of a control
|
|
21
|
-
*/
|
|
22
|
-
async function applyChange(options, change) {
|
|
23
|
-
const {
|
|
24
|
-
rta
|
|
25
|
-
} = options;
|
|
26
|
-
const modifiedControl = sap.ui.getCore().byId(change.controlId);
|
|
27
|
-
if (!modifiedControl) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
|
|
31
|
-
const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
|
|
32
|
-
const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
|
|
33
|
-
const flexSettings = rta.getFlexSettings();
|
|
34
|
-
const changeType = isBindingString ? 'BindProperty' : 'Property';
|
|
35
|
-
if (isBindingModel) {
|
|
36
|
-
validateBindingModel(modifiedControl, change.value);
|
|
37
|
-
}
|
|
38
|
-
const property = isBindingString ? 'newBinding' : 'newValue';
|
|
39
|
-
const modifiedValue = {
|
|
40
|
-
generator: flexSettings.generator,
|
|
41
|
-
propertyName: change.propertyName,
|
|
42
|
-
[property]: change.value
|
|
43
|
-
};
|
|
44
|
-
const command = await CommandFactory.getCommandFor(modifiedControl, changeType, modifiedValue, null, flexSettings);
|
|
45
|
-
await rta.getCommandStack().pushAndExecute(command);
|
|
46
|
-
}
|
|
47
|
-
var __exports = {
|
|
48
|
-
__esModule: true
|
|
49
|
-
};
|
|
50
|
-
__exports.applyChange = applyChange;
|
|
51
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/rta/command/CommandFactory", "./validator"], function (CommandFactory, ___validator) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const validateBindingModel = ___validator["validateBindingModel"];
|
|
7
|
+
/**
|
|
8
|
+
* Function to check a give value is a binding expression.
|
|
9
|
+
*
|
|
10
|
+
* @param value value to be checked.
|
|
11
|
+
* @returns boolean
|
|
12
|
+
*/
|
|
13
|
+
function isBindingExpression(value) {
|
|
14
|
+
return value.includes('{') && value.includes('}') && value.indexOf('{') < value.indexOf('}');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param options UI5 adaptation options
|
|
20
|
+
* @param change changed property of a control
|
|
21
|
+
*/
|
|
22
|
+
async function applyChange(options, change) {
|
|
23
|
+
const {
|
|
24
|
+
rta
|
|
25
|
+
} = options;
|
|
26
|
+
const modifiedControl = sap.ui.getCore().byId(change.controlId);
|
|
27
|
+
if (!modifiedControl) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
|
|
31
|
+
const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
|
|
32
|
+
const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
|
|
33
|
+
const flexSettings = rta.getFlexSettings();
|
|
34
|
+
const changeType = isBindingString ? 'BindProperty' : 'Property';
|
|
35
|
+
if (isBindingModel) {
|
|
36
|
+
validateBindingModel(modifiedControl, change.value);
|
|
37
|
+
}
|
|
38
|
+
const property = isBindingString ? 'newBinding' : 'newValue';
|
|
39
|
+
const modifiedValue = {
|
|
40
|
+
generator: flexSettings.generator,
|
|
41
|
+
propertyName: change.propertyName,
|
|
42
|
+
[property]: change.value
|
|
43
|
+
};
|
|
44
|
+
const command = await CommandFactory.getCommandFor(modifiedControl, changeType, modifiedValue, null, flexSettings);
|
|
45
|
+
await rta.getCommandStack().pushAndExecute(command);
|
|
46
|
+
}
|
|
47
|
+
var __exports = {
|
|
48
|
+
__esModule: true
|
|
49
|
+
};
|
|
50
|
+
__exports.applyChange = applyChange;
|
|
51
|
+
return __exports;
|
|
52
52
|
});
|
|
53
53
|
//# sourceMappingURL=flex-change.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["./service"], function (___service) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
var __exports = {
|
|
7
|
-
__esModule: true
|
|
8
|
-
};
|
|
9
|
-
__exports.ChangeService = ___service.ChangeService;
|
|
10
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["./service"], function (___service) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
var __exports = {
|
|
7
|
+
__esModule: true
|
|
8
|
+
};
|
|
9
|
+
__exports.ChangeService = ___service.ChangeService;
|
|
10
|
+
return __exports;
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=index.js.map
|