@sap-ux/preview-middleware 0.16.9 → 0.16.11
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/README.md +7 -0
- 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/AddFragment.controller.js +219 -219
- package/dist/client/adp/controllers/BaseDialog.controller.js +105 -105
- package/dist/client/adp/controllers/ControllerExtension.controller.js +228 -228
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/init-dialogs.js +138 -138
- package/dist/client/adp/ui5-version-utils.js +63 -63
- package/dist/client/adp/utils.js +61 -61
- 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/error-utils.js +19 -19
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/nodes.js +172 -172
- package/dist/client/cpe/outline/utils.js +60 -60
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +49 -49
- package/dist/client/cpe/utils.js +48 -48
- package/dist/client/flp/WorkspaceConnector.js +84 -84
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +84 -84
- package/dist/client/flp/initConnectors.js +33 -33
- package/dist/client/flp/initRta.js +178 -178
- package/package.json +4 -4
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["./utils", "sap/ui/VersionInfo"], function (___utils, VersionInfo) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const isEditable = ___utils["isEditable"];
|
|
7
|
-
const isReuseComponent = ___utils["isReuseComponent"];
|
|
8
|
-
/**
|
|
9
|
-
* Retrieves additional data for a given control ID.
|
|
10
|
-
*
|
|
11
|
-
* @param id The unique identifier of the control.
|
|
12
|
-
* @returns An object containing the text and the technical name of the control.
|
|
13
|
-
*/
|
|
14
|
-
function getAdditionalData(id) {
|
|
15
|
-
const control = sap.ui.getCore().byId(id);
|
|
16
|
-
if (!control) {
|
|
17
|
-
return {};
|
|
18
|
-
}
|
|
19
|
-
const metadata = control.getMetadata();
|
|
20
|
-
let details = {};
|
|
21
|
-
const technicalName = metadata.getElementName();
|
|
22
|
-
if (technicalName) {
|
|
23
|
-
details.technicalName = technicalName;
|
|
24
|
-
}
|
|
25
|
-
if (metadata.getProperty('text')) {
|
|
26
|
-
const text = control.getProperty('text');
|
|
27
|
-
if (typeof text === 'string' && text.trim() !== '') {
|
|
28
|
-
details.text = text;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return details;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Gets the children nodes of an aggregation type node.
|
|
36
|
-
*
|
|
37
|
-
* @param current The current node to retrieve children from
|
|
38
|
-
* @returns An array of children nodes, or an empty array if none are found
|
|
39
|
-
*/
|
|
40
|
-
function getChildren(current) {
|
|
41
|
-
return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Adds a new child node to the extension point's children array based on the given control ID.
|
|
46
|
-
*
|
|
47
|
-
* @param {string} id - The unique identifier of the control to be added as a child node.
|
|
48
|
-
* @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
|
|
49
|
-
*/
|
|
50
|
-
function addChildToExtensionPoint(id, children) {
|
|
51
|
-
const {
|
|
52
|
-
text,
|
|
53
|
-
technicalName
|
|
54
|
-
} = getAdditionalData(id);
|
|
55
|
-
const editable = isEditable(id);
|
|
56
|
-
children.push({
|
|
57
|
-
controlId: id,
|
|
58
|
-
controlType: technicalName ?? 'sap.ui.extensionpoint.child',
|
|
59
|
-
name: text ?? id,
|
|
60
|
-
visible: true,
|
|
61
|
-
editable,
|
|
62
|
-
children: [],
|
|
63
|
-
hasDefaultContent: false
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Transform node.
|
|
69
|
-
*
|
|
70
|
-
* @param input outline view node
|
|
71
|
-
* @param scenario type of project
|
|
72
|
-
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
73
|
-
* @returns {Promise<OutlineNode[]>} transformed outline tree nodes
|
|
74
|
-
*/
|
|
75
|
-
async function transformNodes(input, scenario, reuseComponentsIds) {
|
|
76
|
-
const stack = [...input];
|
|
77
|
-
const items = [];
|
|
78
|
-
const {
|
|
79
|
-
version
|
|
80
|
-
} = await VersionInfo.load();
|
|
81
|
-
const versionParts = version.split('.');
|
|
82
|
-
const minor = parseInt(versionParts[1], 10);
|
|
83
|
-
while (stack.length) {
|
|
84
|
-
const current = stack.shift();
|
|
85
|
-
const editable = isEditable(current?.id);
|
|
86
|
-
const isAdp = scenario === 'ADAPTATION_PROJECT';
|
|
87
|
-
const isExtPoint = current?.type === 'extensionPoint';
|
|
88
|
-
if (current?.type === 'element') {
|
|
89
|
-
const children = getChildren(current);
|
|
90
|
-
const {
|
|
91
|
-
text
|
|
92
|
-
} = getAdditionalData(current.id);
|
|
93
|
-
const technicalName = current.technicalName.split('.').slice(-1)[0];
|
|
94
|
-
const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, reuseComponentsIds) : await transformNodes(children, scenario, reuseComponentsIds);
|
|
95
|
-
const node = {
|
|
96
|
-
controlId: current.id,
|
|
97
|
-
controlType: current.technicalName,
|
|
98
|
-
name: text ?? technicalName,
|
|
99
|
-
editable,
|
|
100
|
-
visible: current.visible ?? true,
|
|
101
|
-
children: transformedChildren
|
|
102
|
-
};
|
|
103
|
-
fillReuseComponents(reuseComponentsIds, current, scenario, minor);
|
|
104
|
-
items.push(node);
|
|
105
|
-
}
|
|
106
|
-
if (isAdp && isExtPoint) {
|
|
107
|
-
const {
|
|
108
|
-
defaultContent,
|
|
109
|
-
createdControls
|
|
110
|
-
} = current.extensionPointInfo;
|
|
111
|
-
let children = [];
|
|
112
|
-
// We can combine both because there can only be either defaultContent or createdControls for one extension point node.
|
|
113
|
-
[...defaultContent, ...createdControls].forEach(id => {
|
|
114
|
-
addChildToExtensionPoint(id, children);
|
|
115
|
-
});
|
|
116
|
-
const node = {
|
|
117
|
-
controlId: current.id,
|
|
118
|
-
controlType: current.technicalName,
|
|
119
|
-
name: current.name ?? '',
|
|
120
|
-
editable,
|
|
121
|
-
visible: current.visible ?? true,
|
|
122
|
-
children,
|
|
123
|
-
hasDefaultContent: defaultContent.length > 0
|
|
124
|
-
};
|
|
125
|
-
items.push(node);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return items;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Fill reuse components ids.
|
|
133
|
-
*
|
|
134
|
-
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
135
|
-
* @param node view node
|
|
136
|
-
* @param scenario type of project
|
|
137
|
-
* @param minorUI5Version miner UI5 version
|
|
138
|
-
*/
|
|
139
|
-
function fillReuseComponents(reuseComponentsIds, node, scenario, minorUI5Version) {
|
|
140
|
-
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id, minorUI5Version)) {
|
|
141
|
-
reuseComponentsIds.add(node.id);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Handles duplicate nodes that are retrieved from extension point default content and created controls,
|
|
146
|
-
* if they exist under an extension point these controls are removed from the children array
|
|
147
|
-
*
|
|
148
|
-
* @param children outline view node children
|
|
149
|
-
* @param scenario type of project
|
|
150
|
-
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
151
|
-
* @returns transformed outline tree nodes
|
|
152
|
-
*/
|
|
153
|
-
async function handleDuplicateNodes(children, scenario, reuseComponentsIds) {
|
|
154
|
-
const extPointIDs = new Set();
|
|
155
|
-
children.forEach(child => {
|
|
156
|
-
if (child.type === 'extensionPoint') {
|
|
157
|
-
const {
|
|
158
|
-
defaultContent,
|
|
159
|
-
createdControls
|
|
160
|
-
} = child.extensionPointInfo;
|
|
161
|
-
[...defaultContent, ...createdControls].forEach(id => extPointIDs.add(id));
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
const uniqueChildren = children.filter(child => !extPointIDs.has(child.id));
|
|
165
|
-
return transformNodes(uniqueChildren, scenario, reuseComponentsIds);
|
|
166
|
-
}
|
|
167
|
-
var __exports = {
|
|
168
|
-
__esModule: true
|
|
169
|
-
};
|
|
170
|
-
__exports.transformNodes = transformNodes;
|
|
171
|
-
__exports.handleDuplicateNodes = handleDuplicateNodes;
|
|
172
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["./utils", "sap/ui/VersionInfo"], function (___utils, VersionInfo) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const isEditable = ___utils["isEditable"];
|
|
7
|
+
const isReuseComponent = ___utils["isReuseComponent"];
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves additional data for a given control ID.
|
|
10
|
+
*
|
|
11
|
+
* @param id The unique identifier of the control.
|
|
12
|
+
* @returns An object containing the text and the technical name of the control.
|
|
13
|
+
*/
|
|
14
|
+
function getAdditionalData(id) {
|
|
15
|
+
const control = sap.ui.getCore().byId(id);
|
|
16
|
+
if (!control) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
const metadata = control.getMetadata();
|
|
20
|
+
let details = {};
|
|
21
|
+
const technicalName = metadata.getElementName();
|
|
22
|
+
if (technicalName) {
|
|
23
|
+
details.technicalName = technicalName;
|
|
24
|
+
}
|
|
25
|
+
if (metadata.getProperty('text')) {
|
|
26
|
+
const text = control.getProperty('text');
|
|
27
|
+
if (typeof text === 'string' && text.trim() !== '') {
|
|
28
|
+
details.text = text;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return details;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets the children nodes of an aggregation type node.
|
|
36
|
+
*
|
|
37
|
+
* @param current The current node to retrieve children from
|
|
38
|
+
* @returns An array of children nodes, or an empty array if none are found
|
|
39
|
+
*/
|
|
40
|
+
function getChildren(current) {
|
|
41
|
+
return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Adds a new child node to the extension point's children array based on the given control ID.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} id - The unique identifier of the control to be added as a child node.
|
|
48
|
+
* @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
|
|
49
|
+
*/
|
|
50
|
+
function addChildToExtensionPoint(id, children) {
|
|
51
|
+
const {
|
|
52
|
+
text,
|
|
53
|
+
technicalName
|
|
54
|
+
} = getAdditionalData(id);
|
|
55
|
+
const editable = isEditable(id);
|
|
56
|
+
children.push({
|
|
57
|
+
controlId: id,
|
|
58
|
+
controlType: technicalName ?? 'sap.ui.extensionpoint.child',
|
|
59
|
+
name: text ?? id,
|
|
60
|
+
visible: true,
|
|
61
|
+
editable,
|
|
62
|
+
children: [],
|
|
63
|
+
hasDefaultContent: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Transform node.
|
|
69
|
+
*
|
|
70
|
+
* @param input outline view node
|
|
71
|
+
* @param scenario type of project
|
|
72
|
+
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
73
|
+
* @returns {Promise<OutlineNode[]>} transformed outline tree nodes
|
|
74
|
+
*/
|
|
75
|
+
async function transformNodes(input, scenario, reuseComponentsIds) {
|
|
76
|
+
const stack = [...input];
|
|
77
|
+
const items = [];
|
|
78
|
+
const {
|
|
79
|
+
version
|
|
80
|
+
} = await VersionInfo.load();
|
|
81
|
+
const versionParts = version.split('.');
|
|
82
|
+
const minor = parseInt(versionParts[1], 10);
|
|
83
|
+
while (stack.length) {
|
|
84
|
+
const current = stack.shift();
|
|
85
|
+
const editable = isEditable(current?.id);
|
|
86
|
+
const isAdp = scenario === 'ADAPTATION_PROJECT';
|
|
87
|
+
const isExtPoint = current?.type === 'extensionPoint';
|
|
88
|
+
if (current?.type === 'element') {
|
|
89
|
+
const children = getChildren(current);
|
|
90
|
+
const {
|
|
91
|
+
text
|
|
92
|
+
} = getAdditionalData(current.id);
|
|
93
|
+
const technicalName = current.technicalName.split('.').slice(-1)[0];
|
|
94
|
+
const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, reuseComponentsIds) : await transformNodes(children, scenario, reuseComponentsIds);
|
|
95
|
+
const node = {
|
|
96
|
+
controlId: current.id,
|
|
97
|
+
controlType: current.technicalName,
|
|
98
|
+
name: text ?? technicalName,
|
|
99
|
+
editable,
|
|
100
|
+
visible: current.visible ?? true,
|
|
101
|
+
children: transformedChildren
|
|
102
|
+
};
|
|
103
|
+
fillReuseComponents(reuseComponentsIds, current, scenario, minor);
|
|
104
|
+
items.push(node);
|
|
105
|
+
}
|
|
106
|
+
if (isAdp && isExtPoint) {
|
|
107
|
+
const {
|
|
108
|
+
defaultContent,
|
|
109
|
+
createdControls
|
|
110
|
+
} = current.extensionPointInfo;
|
|
111
|
+
let children = [];
|
|
112
|
+
// We can combine both because there can only be either defaultContent or createdControls for one extension point node.
|
|
113
|
+
[...defaultContent, ...createdControls].forEach(id => {
|
|
114
|
+
addChildToExtensionPoint(id, children);
|
|
115
|
+
});
|
|
116
|
+
const node = {
|
|
117
|
+
controlId: current.id,
|
|
118
|
+
controlType: current.technicalName,
|
|
119
|
+
name: current.name ?? '',
|
|
120
|
+
editable,
|
|
121
|
+
visible: current.visible ?? true,
|
|
122
|
+
children,
|
|
123
|
+
hasDefaultContent: defaultContent.length > 0
|
|
124
|
+
};
|
|
125
|
+
items.push(node);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return items;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Fill reuse components ids.
|
|
133
|
+
*
|
|
134
|
+
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
135
|
+
* @param node view node
|
|
136
|
+
* @param scenario type of project
|
|
137
|
+
* @param minorUI5Version miner UI5 version
|
|
138
|
+
*/
|
|
139
|
+
function fillReuseComponents(reuseComponentsIds, node, scenario, minorUI5Version) {
|
|
140
|
+
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id, minorUI5Version)) {
|
|
141
|
+
reuseComponentsIds.add(node.id);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Handles duplicate nodes that are retrieved from extension point default content and created controls,
|
|
146
|
+
* if they exist under an extension point these controls are removed from the children array
|
|
147
|
+
*
|
|
148
|
+
* @param children outline view node children
|
|
149
|
+
* @param scenario type of project
|
|
150
|
+
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
151
|
+
* @returns transformed outline tree nodes
|
|
152
|
+
*/
|
|
153
|
+
async function handleDuplicateNodes(children, scenario, reuseComponentsIds) {
|
|
154
|
+
const extPointIDs = new Set();
|
|
155
|
+
children.forEach(child => {
|
|
156
|
+
if (child.type === 'extensionPoint') {
|
|
157
|
+
const {
|
|
158
|
+
defaultContent,
|
|
159
|
+
createdControls
|
|
160
|
+
} = child.extensionPointInfo;
|
|
161
|
+
[...defaultContent, ...createdControls].forEach(id => extPointIDs.add(id));
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
const uniqueChildren = children.filter(child => !extPointIDs.has(child.id));
|
|
165
|
+
return transformNodes(uniqueChildren, scenario, reuseComponentsIds);
|
|
166
|
+
}
|
|
167
|
+
var __exports = {
|
|
168
|
+
__esModule: true
|
|
169
|
+
};
|
|
170
|
+
__exports.transformNodes = transformNodes;
|
|
171
|
+
__exports.handleDuplicateNodes = handleDuplicateNodes;
|
|
172
|
+
return __exports;
|
|
173
173
|
});
|
|
174
174
|
//# sourceMappingURL=nodes.js.map
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils", "sap/ui/core/Component"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils, Component) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const buildControlData = ___control_data["buildControlData"];
|
|
7
|
-
const getRuntimeControl = ___utils["getRuntimeControl"];
|
|
8
|
-
const getComponent = ___ui5_utils["getComponent"];
|
|
9
|
-
const isEditable = function () {
|
|
10
|
-
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
-
let editable = false;
|
|
12
|
-
const control = sap.ui.getCore().byId(id);
|
|
13
|
-
if (!control) {
|
|
14
|
-
const component = getComponent(id);
|
|
15
|
-
if (component) {
|
|
16
|
-
return editable;
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
let controlOverlay = OverlayRegistry.getOverlay(control);
|
|
20
|
-
if (!controlOverlay?.getDomRef()) {
|
|
21
|
-
//look for closest control
|
|
22
|
-
controlOverlay = OverlayUtil.getClosestOverlayFor(control);
|
|
23
|
-
}
|
|
24
|
-
if (controlOverlay) {
|
|
25
|
-
const runtimeControl = getRuntimeControl(controlOverlay);
|
|
26
|
-
const controlData = buildControlData(runtimeControl, controlOverlay);
|
|
27
|
-
const prop = controlData.properties.find(item => item.isEnabled === true);
|
|
28
|
-
editable = prop !== undefined;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return editable;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Function that checks if control is reuse component
|
|
36
|
-
*
|
|
37
|
-
* @param controlId id control
|
|
38
|
-
* @param minorUI5Version minor UI5 version
|
|
39
|
-
* @returns boolean if control is from reused component view
|
|
40
|
-
*/
|
|
41
|
-
const isReuseComponent = (controlId, minorUI5Version) => {
|
|
42
|
-
if (minorUI5Version <= 114) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
const component = Component.getComponentById(controlId);
|
|
46
|
-
if (!component) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
const manifest = component.getManifest();
|
|
50
|
-
if (!manifest) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return manifest['sap.app']?.type === 'component';
|
|
54
|
-
};
|
|
55
|
-
var __exports = {
|
|
56
|
-
__esModule: true
|
|
57
|
-
};
|
|
58
|
-
__exports.isEditable = isEditable;
|
|
59
|
-
__exports.isReuseComponent = isReuseComponent;
|
|
60
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils", "sap/ui/core/Component"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils, Component) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const buildControlData = ___control_data["buildControlData"];
|
|
7
|
+
const getRuntimeControl = ___utils["getRuntimeControl"];
|
|
8
|
+
const getComponent = ___ui5_utils["getComponent"];
|
|
9
|
+
const isEditable = function () {
|
|
10
|
+
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
+
let editable = false;
|
|
12
|
+
const control = sap.ui.getCore().byId(id);
|
|
13
|
+
if (!control) {
|
|
14
|
+
const component = getComponent(id);
|
|
15
|
+
if (component) {
|
|
16
|
+
return editable;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
let controlOverlay = OverlayRegistry.getOverlay(control);
|
|
20
|
+
if (!controlOverlay?.getDomRef()) {
|
|
21
|
+
//look for closest control
|
|
22
|
+
controlOverlay = OverlayUtil.getClosestOverlayFor(control);
|
|
23
|
+
}
|
|
24
|
+
if (controlOverlay) {
|
|
25
|
+
const runtimeControl = getRuntimeControl(controlOverlay);
|
|
26
|
+
const controlData = buildControlData(runtimeControl, controlOverlay);
|
|
27
|
+
const prop = controlData.properties.find(item => item.isEnabled === true);
|
|
28
|
+
editable = prop !== undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return editable;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Function that checks if control is reuse component
|
|
36
|
+
*
|
|
37
|
+
* @param controlId id control
|
|
38
|
+
* @param minorUI5Version minor UI5 version
|
|
39
|
+
* @returns boolean if control is from reused component view
|
|
40
|
+
*/
|
|
41
|
+
const isReuseComponent = (controlId, minorUI5Version) => {
|
|
42
|
+
if (minorUI5Version <= 114) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const component = Component.getComponentById(controlId);
|
|
46
|
+
if (!component) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const manifest = component.getManifest();
|
|
50
|
+
if (!manifest) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return manifest['sap.app']?.type === 'component';
|
|
54
|
+
};
|
|
55
|
+
var __exports = {
|
|
56
|
+
__esModule: true
|
|
57
|
+
};
|
|
58
|
+
__exports.isEditable = isEditable;
|
|
59
|
+
__exports.isReuseComponent = isReuseComponent;
|
|
60
|
+
return __exports;
|
|
61
61
|
});
|
|
62
62
|
//# sourceMappingURL=utils.js.map
|
package/dist/client/cpe/types.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/Component", "sap/ui/core/IconPool"], function (Component, IconPool) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Gets Component by id.
|
|
8
|
-
*
|
|
9
|
-
* @param id - unique identifier for control
|
|
10
|
-
* @returns Component | undefined
|
|
11
|
-
*/
|
|
12
|
-
function getComponent(id) {
|
|
13
|
-
if (Component?.get) {
|
|
14
|
-
return Component.get(id);
|
|
15
|
-
} else {
|
|
16
|
-
// Older version must be still supported until maintenance period.
|
|
17
|
-
return sap.ui.getCore().getComponent(id); // NOSONAR
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Get ui5 icons.
|
|
23
|
-
*
|
|
24
|
-
* @returns IconDetails[]
|
|
25
|
-
*/
|
|
26
|
-
function getIcons() {
|
|
27
|
-
return IconPool.getIconNames('undefined').map(icon => {
|
|
28
|
-
const iconInfo = IconPool.getIconInfo(icon);
|
|
29
|
-
return {
|
|
30
|
-
name: icon.toLowerCase(),
|
|
31
|
-
content: iconInfo.content,
|
|
32
|
-
fontFamily: iconInfo.fontFamily
|
|
33
|
-
};
|
|
34
|
-
}).sort((item1, item2) => {
|
|
35
|
-
if (item1.name < item2.name) {
|
|
36
|
-
return -1;
|
|
37
|
-
}
|
|
38
|
-
if (item1.name > item2.name) {
|
|
39
|
-
return 1;
|
|
40
|
-
}
|
|
41
|
-
return 0;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
var __exports = {
|
|
45
|
-
__esModule: true
|
|
46
|
-
};
|
|
47
|
-
__exports.getComponent = getComponent;
|
|
48
|
-
__exports.getIcons = getIcons;
|
|
49
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Component", "sap/ui/core/IconPool"], function (Component, IconPool) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Gets Component by id.
|
|
8
|
+
*
|
|
9
|
+
* @param id - unique identifier for control
|
|
10
|
+
* @returns Component | undefined
|
|
11
|
+
*/
|
|
12
|
+
function getComponent(id) {
|
|
13
|
+
if (Component?.get) {
|
|
14
|
+
return Component.get(id);
|
|
15
|
+
} else {
|
|
16
|
+
// Older version must be still supported until maintenance period.
|
|
17
|
+
return sap.ui.getCore().getComponent(id); // NOSONAR
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get ui5 icons.
|
|
23
|
+
*
|
|
24
|
+
* @returns IconDetails[]
|
|
25
|
+
*/
|
|
26
|
+
function getIcons() {
|
|
27
|
+
return IconPool.getIconNames('undefined').map(icon => {
|
|
28
|
+
const iconInfo = IconPool.getIconInfo(icon);
|
|
29
|
+
return {
|
|
30
|
+
name: icon.toLowerCase(),
|
|
31
|
+
content: iconInfo.content,
|
|
32
|
+
fontFamily: iconInfo.fontFamily
|
|
33
|
+
};
|
|
34
|
+
}).sort((item1, item2) => {
|
|
35
|
+
if (item1.name < item2.name) {
|
|
36
|
+
return -1;
|
|
37
|
+
}
|
|
38
|
+
if (item1.name > item2.name) {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
return 0;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
var __exports = {
|
|
45
|
+
__esModule: true
|
|
46
|
+
};
|
|
47
|
+
__exports.getComponent = getComponent;
|
|
48
|
+
__exports.getIcons = getIcons;
|
|
49
|
+
return __exports;
|
|
50
50
|
});
|
|
51
51
|
//# sourceMappingURL=ui5-utils.js.map
|