@sap-ux/preview-middleware 0.19.38 → 0.19.39
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/client/adp/add-fragment.js +46 -46
- package/dist/client/adp/api-handler.js +159 -159
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +135 -135
- package/dist/client/adp/init-dialogs.js +163 -163
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
- package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +23 -23
- 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/add-new-subpage.js +81 -81
- package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
- 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 +107 -107
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
- 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 +77 -77
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
- package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
- 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 +84 -84
- 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 +60 -60
- package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
- package/dist/client/adp/utils.js +218 -218
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
- 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 +203 -203
- 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 +111 -111
- package/dist/client/flp/WorkspaceConnector.js +92 -92
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +89 -89
- package/dist/client/flp/homepage/Component.js +14 -14
- package/dist/client/flp/initCdm.js +117 -117
- package/dist/client/flp/initConnectors.js +28 -28
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- package/dist/client/utils/additional-change-info.js +54 -54
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +84 -84
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +140 -140
- package/dist/client/utils/version.js +104 -104
- package/package.json +6 -6
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/base/Log"], function (Log) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function getString(message) {
|
|
7
|
-
if (typeof message === 'object') {
|
|
8
|
-
return JSON.stringify(message).toString();
|
|
9
|
-
}
|
|
10
|
-
return message;
|
|
11
|
-
}
|
|
12
|
-
const logger = {
|
|
13
|
-
info: message => {
|
|
14
|
-
Log.info(getString(message));
|
|
15
|
-
},
|
|
16
|
-
debug: message => {
|
|
17
|
-
Log.debug(getString(message));
|
|
18
|
-
},
|
|
19
|
-
warn: message => {
|
|
20
|
-
Log.warning(getString(message));
|
|
21
|
-
},
|
|
22
|
-
error: message => {
|
|
23
|
-
Log.error(getString(message));
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var __exports = {
|
|
27
|
-
__esModule: true
|
|
28
|
-
};
|
|
29
|
-
__exports.logger = logger;
|
|
30
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/base/Log"], function (Log) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function getString(message) {
|
|
7
|
+
if (typeof message === 'object') {
|
|
8
|
+
return JSON.stringify(message).toString();
|
|
9
|
+
}
|
|
10
|
+
return message;
|
|
11
|
+
}
|
|
12
|
+
const logger = {
|
|
13
|
+
info: message => {
|
|
14
|
+
Log.info(getString(message));
|
|
15
|
+
},
|
|
16
|
+
debug: message => {
|
|
17
|
+
Log.debug(getString(message));
|
|
18
|
+
},
|
|
19
|
+
warn: message => {
|
|
20
|
+
Log.warning(getString(message));
|
|
21
|
+
},
|
|
22
|
+
error: message => {
|
|
23
|
+
Log.error(getString(message));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var __exports = {
|
|
27
|
+
__esModule: true
|
|
28
|
+
};
|
|
29
|
+
__exports.logger = logger;
|
|
30
|
+
return __exports;
|
|
31
31
|
});
|
|
32
32
|
//# sourceMappingURL=logger.js.map
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../../utils/core"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ____utils_core) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const buildControlData = ___control_data["buildControlData"];
|
|
7
|
-
const getRuntimeControl = ___utils["getRuntimeControl"];
|
|
8
|
-
const getComponent = ____utils_core["getComponent"];
|
|
9
|
-
const isEditable = function (changeService) {
|
|
10
|
-
let id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
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, changeService, controlOverlay);
|
|
27
|
-
const prop = controlData.properties.find(item => item.isEnabled === true);
|
|
28
|
-
editable = prop !== undefined;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return editable;
|
|
32
|
-
};
|
|
33
|
-
var __exports = {
|
|
34
|
-
__esModule: true
|
|
35
|
-
};
|
|
36
|
-
__exports.isEditable = isEditable;
|
|
37
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../../utils/core"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ____utils_core) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const buildControlData = ___control_data["buildControlData"];
|
|
7
|
+
const getRuntimeControl = ___utils["getRuntimeControl"];
|
|
8
|
+
const getComponent = ____utils_core["getComponent"];
|
|
9
|
+
const isEditable = function (changeService) {
|
|
10
|
+
let id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
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, changeService, controlOverlay);
|
|
27
|
+
const prop = controlData.properties.find(item => item.isEnabled === true);
|
|
28
|
+
editable = prop !== undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return editable;
|
|
32
|
+
};
|
|
33
|
+
var __exports = {
|
|
34
|
+
__esModule: true
|
|
35
|
+
};
|
|
36
|
+
__exports.isEditable = isEditable;
|
|
37
|
+
return __exports;
|
|
38
38
|
});
|
|
39
39
|
//# sourceMappingURL=editable.js.map
|
|
@@ -1,205 +1,205 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/base/Log", "../../utils/core", "../../utils/error", "../utils", "./editable", "../../utils/fe-v4"], function (Log, ____utils_core, ____utils_error, ___utils, ___editable, ____utils_fe_v4) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getControlById = ____utils_core["getControlById"];
|
|
7
|
-
const getError = ____utils_error["getError"];
|
|
8
|
-
const getOverlay = ___utils["getOverlay"];
|
|
9
|
-
const isEditable = ___editable["isEditable"];
|
|
10
|
-
const getConfigMapControlIdMap = ____utils_fe_v4["getConfigMapControlIdMap"];
|
|
11
|
-
const getPageName = ____utils_fe_v4["getPageName"];
|
|
12
|
-
/**
|
|
13
|
-
* Retrieves additional data for a given control ID.
|
|
14
|
-
*
|
|
15
|
-
* @param id The unique identifier of the control.
|
|
16
|
-
* @returns An object containing the text and the technical name of the control.
|
|
17
|
-
*/
|
|
18
|
-
function getAdditionalData(id) {
|
|
19
|
-
const control = getControlById(id);
|
|
20
|
-
if (!control) {
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
const metadata = control.getMetadata();
|
|
24
|
-
let details = {};
|
|
25
|
-
const technicalName = metadata.getElementName();
|
|
26
|
-
if (technicalName) {
|
|
27
|
-
details.technicalName = technicalName;
|
|
28
|
-
}
|
|
29
|
-
if (metadata.getProperty('text')) {
|
|
30
|
-
const text = control.getProperty('text');
|
|
31
|
-
if (typeof text === 'string' && text.trim() !== '') {
|
|
32
|
-
details.text = text;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return details;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Gets the children nodes of an aggregation type node.
|
|
40
|
-
*
|
|
41
|
-
* @param current The current node to retrieve children from
|
|
42
|
-
* @returns An array of children nodes, or an empty array if none are found
|
|
43
|
-
*/
|
|
44
|
-
function getChildren(current) {
|
|
45
|
-
return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Adds a new child node to the extension point's children array based on the given control ID.
|
|
50
|
-
*
|
|
51
|
-
* @param {string} id - The unique identifier of the control to be added as a child node.
|
|
52
|
-
* @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
|
|
53
|
-
* @param {ChangeService} changeService - Change service for change stack event handling.
|
|
54
|
-
*/
|
|
55
|
-
function addChildToExtensionPoint(id, children, changeService) {
|
|
56
|
-
const {
|
|
57
|
-
text,
|
|
58
|
-
technicalName
|
|
59
|
-
} = getAdditionalData(id);
|
|
60
|
-
const editable = isEditable(changeService, id);
|
|
61
|
-
children.push({
|
|
62
|
-
controlId: id,
|
|
63
|
-
controlType: technicalName ?? 'sap.ui.extensionpoint.child',
|
|
64
|
-
name: text ?? id,
|
|
65
|
-
visible: true,
|
|
66
|
-
editable,
|
|
67
|
-
children: [],
|
|
68
|
-
hasDefaultContent: false
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Creates control index for all controls in the app.
|
|
73
|
-
*
|
|
74
|
-
* @param {ControlTreeIndex} controlIndex - Control index for the ui5 app.
|
|
75
|
-
* @param {OutlineNode} node - control node added to the outline.
|
|
76
|
-
*/
|
|
77
|
-
function indexNode(controlIndex, node) {
|
|
78
|
-
const indexedControls = controlIndex[node.controlType];
|
|
79
|
-
if (indexedControls) {
|
|
80
|
-
indexedControls.push(node);
|
|
81
|
-
} else {
|
|
82
|
-
controlIndex[node.controlType] = [node];
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function addToPropertyIdMap(node, propertyIdMap) {
|
|
86
|
-
const control = getControlById(node.controlId);
|
|
87
|
-
if (control) {
|
|
88
|
-
const overlay = getOverlay(control);
|
|
89
|
-
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
90
|
-
if (!overlayData?.manifestPropertyPath) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (overlayData) {
|
|
94
|
-
const path = overlayData?.manifestPropertyPath?.(control);
|
|
95
|
-
const pageName = getPageName(control);
|
|
96
|
-
const key = getConfigMapControlIdMap(pageName, path.split('/').filter(item => item));
|
|
97
|
-
if (key) {
|
|
98
|
-
if (!propertyIdMap.get(key)) {
|
|
99
|
-
propertyIdMap.set(key, []);
|
|
100
|
-
}
|
|
101
|
-
propertyIdMap.get(key)?.push(node.controlId);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Transform node.
|
|
109
|
-
*
|
|
110
|
-
* @param input outline view node
|
|
111
|
-
* @param scenario type of project
|
|
112
|
-
* @param controlIndex Control tree index
|
|
113
|
-
* @param changeService ChangeService for change stack event handling.
|
|
114
|
-
* @param propertyIdMap ChangeService for change stack event handling.
|
|
115
|
-
* @returns transformed outline tree nodes
|
|
116
|
-
*/
|
|
117
|
-
async function transformNodes(input, scenario, controlIndex, changeService, propertyIdMap) {
|
|
118
|
-
const stack = [...input];
|
|
119
|
-
const items = [];
|
|
120
|
-
while (stack.length) {
|
|
121
|
-
try {
|
|
122
|
-
const current = stack.shift();
|
|
123
|
-
const editable = isEditable(changeService, current?.id);
|
|
124
|
-
const isAdp = scenario === 'ADAPTATION_PROJECT';
|
|
125
|
-
const isExtPoint = current?.type === 'extensionPoint';
|
|
126
|
-
if (current?.type === 'element') {
|
|
127
|
-
const children = getChildren(current);
|
|
128
|
-
const {
|
|
129
|
-
text
|
|
130
|
-
} = getAdditionalData(current.id);
|
|
131
|
-
const technicalName = current.technicalName.split('.').slice(-1)[0];
|
|
132
|
-
const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, controlIndex, changeService, propertyIdMap) : await transformNodes(children, scenario, controlIndex, changeService, propertyIdMap);
|
|
133
|
-
const node = {
|
|
134
|
-
controlId: current.id,
|
|
135
|
-
controlType: current.technicalName,
|
|
136
|
-
name: text ?? technicalName,
|
|
137
|
-
editable,
|
|
138
|
-
visible: current.visible ?? true,
|
|
139
|
-
children: transformedChildren
|
|
140
|
-
};
|
|
141
|
-
indexNode(controlIndex, node);
|
|
142
|
-
addToPropertyIdMap(node, propertyIdMap);
|
|
143
|
-
items.push(node);
|
|
144
|
-
}
|
|
145
|
-
if (isAdp && isExtPoint) {
|
|
146
|
-
const {
|
|
147
|
-
defaultContent = [],
|
|
148
|
-
createdControls = []
|
|
149
|
-
} = current.extensionPointInfo;
|
|
150
|
-
let children = [];
|
|
151
|
-
// We can combine both because there can only be either defaultContent or createdControls for one extension point node.
|
|
152
|
-
[...defaultContent, ...createdControls].forEach(id => {
|
|
153
|
-
addChildToExtensionPoint(id, children, changeService);
|
|
154
|
-
});
|
|
155
|
-
const node = {
|
|
156
|
-
controlId: current.id,
|
|
157
|
-
controlType: current.technicalName,
|
|
158
|
-
name: current.name ?? '',
|
|
159
|
-
editable,
|
|
160
|
-
visible: current.visible ?? true,
|
|
161
|
-
children,
|
|
162
|
-
hasDefaultContent: defaultContent.length > 0
|
|
163
|
-
};
|
|
164
|
-
items.push(node);
|
|
165
|
-
}
|
|
166
|
-
} catch (error) {
|
|
167
|
-
Log.error('Failed to transform outline node!', getError(error));
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return items;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Handles duplicate nodes that are retrieved from extension point default content and created controls,
|
|
175
|
-
* if they exist under an extension point these controls are removed from the children array
|
|
176
|
-
*
|
|
177
|
-
* @param children outline view node children
|
|
178
|
-
* @param scenario type of project
|
|
179
|
-
* @param controlIndex Control tree index
|
|
180
|
-
* @param changeService ChangeService for change stack event handling.
|
|
181
|
-
* @param propertyIdMap Map<string, string[]>.
|
|
182
|
-
* @returns transformed outline tree nodes
|
|
183
|
-
*/
|
|
184
|
-
async function handleDuplicateNodes(children, scenario, controlIndex, changeService, propertyIdMap) {
|
|
185
|
-
const extPointIDs = new Set();
|
|
186
|
-
children.forEach(child => {
|
|
187
|
-
if (child.type === 'extensionPoint') {
|
|
188
|
-
const {
|
|
189
|
-
defaultContent = [],
|
|
190
|
-
createdControls = []
|
|
191
|
-
} = child.extensionPointInfo;
|
|
192
|
-
[...defaultContent, ...createdControls].forEach(id => extPointIDs.add(id));
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
const uniqueChildren = children.filter(child => !extPointIDs.has(child.id));
|
|
196
|
-
return transformNodes(uniqueChildren, scenario, controlIndex, changeService, propertyIdMap);
|
|
197
|
-
}
|
|
198
|
-
var __exports = {
|
|
199
|
-
__esModule: true
|
|
200
|
-
};
|
|
201
|
-
__exports.transformNodes = transformNodes;
|
|
202
|
-
__exports.handleDuplicateNodes = handleDuplicateNodes;
|
|
203
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/base/Log", "../../utils/core", "../../utils/error", "../utils", "./editable", "../../utils/fe-v4"], function (Log, ____utils_core, ____utils_error, ___utils, ___editable, ____utils_fe_v4) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getControlById = ____utils_core["getControlById"];
|
|
7
|
+
const getError = ____utils_error["getError"];
|
|
8
|
+
const getOverlay = ___utils["getOverlay"];
|
|
9
|
+
const isEditable = ___editable["isEditable"];
|
|
10
|
+
const getConfigMapControlIdMap = ____utils_fe_v4["getConfigMapControlIdMap"];
|
|
11
|
+
const getPageName = ____utils_fe_v4["getPageName"];
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves additional data for a given control ID.
|
|
14
|
+
*
|
|
15
|
+
* @param id The unique identifier of the control.
|
|
16
|
+
* @returns An object containing the text and the technical name of the control.
|
|
17
|
+
*/
|
|
18
|
+
function getAdditionalData(id) {
|
|
19
|
+
const control = getControlById(id);
|
|
20
|
+
if (!control) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
const metadata = control.getMetadata();
|
|
24
|
+
let details = {};
|
|
25
|
+
const technicalName = metadata.getElementName();
|
|
26
|
+
if (technicalName) {
|
|
27
|
+
details.technicalName = technicalName;
|
|
28
|
+
}
|
|
29
|
+
if (metadata.getProperty('text')) {
|
|
30
|
+
const text = control.getProperty('text');
|
|
31
|
+
if (typeof text === 'string' && text.trim() !== '') {
|
|
32
|
+
details.text = text;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return details;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets the children nodes of an aggregation type node.
|
|
40
|
+
*
|
|
41
|
+
* @param current The current node to retrieve children from
|
|
42
|
+
* @returns An array of children nodes, or an empty array if none are found
|
|
43
|
+
*/
|
|
44
|
+
function getChildren(current) {
|
|
45
|
+
return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Adds a new child node to the extension point's children array based on the given control ID.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} id - The unique identifier of the control to be added as a child node.
|
|
52
|
+
* @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
|
|
53
|
+
* @param {ChangeService} changeService - Change service for change stack event handling.
|
|
54
|
+
*/
|
|
55
|
+
function addChildToExtensionPoint(id, children, changeService) {
|
|
56
|
+
const {
|
|
57
|
+
text,
|
|
58
|
+
technicalName
|
|
59
|
+
} = getAdditionalData(id);
|
|
60
|
+
const editable = isEditable(changeService, id);
|
|
61
|
+
children.push({
|
|
62
|
+
controlId: id,
|
|
63
|
+
controlType: technicalName ?? 'sap.ui.extensionpoint.child',
|
|
64
|
+
name: text ?? id,
|
|
65
|
+
visible: true,
|
|
66
|
+
editable,
|
|
67
|
+
children: [],
|
|
68
|
+
hasDefaultContent: false
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates control index for all controls in the app.
|
|
73
|
+
*
|
|
74
|
+
* @param {ControlTreeIndex} controlIndex - Control index for the ui5 app.
|
|
75
|
+
* @param {OutlineNode} node - control node added to the outline.
|
|
76
|
+
*/
|
|
77
|
+
function indexNode(controlIndex, node) {
|
|
78
|
+
const indexedControls = controlIndex[node.controlType];
|
|
79
|
+
if (indexedControls) {
|
|
80
|
+
indexedControls.push(node);
|
|
81
|
+
} else {
|
|
82
|
+
controlIndex[node.controlType] = [node];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function addToPropertyIdMap(node, propertyIdMap) {
|
|
86
|
+
const control = getControlById(node.controlId);
|
|
87
|
+
if (control) {
|
|
88
|
+
const overlay = getOverlay(control);
|
|
89
|
+
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
90
|
+
if (!overlayData?.manifestPropertyPath) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (overlayData) {
|
|
94
|
+
const path = overlayData?.manifestPropertyPath?.(control);
|
|
95
|
+
const pageName = getPageName(control);
|
|
96
|
+
const key = getConfigMapControlIdMap(pageName, path.split('/').filter(item => item));
|
|
97
|
+
if (key) {
|
|
98
|
+
if (!propertyIdMap.get(key)) {
|
|
99
|
+
propertyIdMap.set(key, []);
|
|
100
|
+
}
|
|
101
|
+
propertyIdMap.get(key)?.push(node.controlId);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Transform node.
|
|
109
|
+
*
|
|
110
|
+
* @param input outline view node
|
|
111
|
+
* @param scenario type of project
|
|
112
|
+
* @param controlIndex Control tree index
|
|
113
|
+
* @param changeService ChangeService for change stack event handling.
|
|
114
|
+
* @param propertyIdMap ChangeService for change stack event handling.
|
|
115
|
+
* @returns transformed outline tree nodes
|
|
116
|
+
*/
|
|
117
|
+
async function transformNodes(input, scenario, controlIndex, changeService, propertyIdMap) {
|
|
118
|
+
const stack = [...input];
|
|
119
|
+
const items = [];
|
|
120
|
+
while (stack.length) {
|
|
121
|
+
try {
|
|
122
|
+
const current = stack.shift();
|
|
123
|
+
const editable = isEditable(changeService, current?.id);
|
|
124
|
+
const isAdp = scenario === 'ADAPTATION_PROJECT';
|
|
125
|
+
const isExtPoint = current?.type === 'extensionPoint';
|
|
126
|
+
if (current?.type === 'element') {
|
|
127
|
+
const children = getChildren(current);
|
|
128
|
+
const {
|
|
129
|
+
text
|
|
130
|
+
} = getAdditionalData(current.id);
|
|
131
|
+
const technicalName = current.technicalName.split('.').slice(-1)[0];
|
|
132
|
+
const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, controlIndex, changeService, propertyIdMap) : await transformNodes(children, scenario, controlIndex, changeService, propertyIdMap);
|
|
133
|
+
const node = {
|
|
134
|
+
controlId: current.id,
|
|
135
|
+
controlType: current.technicalName,
|
|
136
|
+
name: text ?? technicalName,
|
|
137
|
+
editable,
|
|
138
|
+
visible: current.visible ?? true,
|
|
139
|
+
children: transformedChildren
|
|
140
|
+
};
|
|
141
|
+
indexNode(controlIndex, node);
|
|
142
|
+
addToPropertyIdMap(node, propertyIdMap);
|
|
143
|
+
items.push(node);
|
|
144
|
+
}
|
|
145
|
+
if (isAdp && isExtPoint) {
|
|
146
|
+
const {
|
|
147
|
+
defaultContent = [],
|
|
148
|
+
createdControls = []
|
|
149
|
+
} = current.extensionPointInfo;
|
|
150
|
+
let children = [];
|
|
151
|
+
// We can combine both because there can only be either defaultContent or createdControls for one extension point node.
|
|
152
|
+
[...defaultContent, ...createdControls].forEach(id => {
|
|
153
|
+
addChildToExtensionPoint(id, children, changeService);
|
|
154
|
+
});
|
|
155
|
+
const node = {
|
|
156
|
+
controlId: current.id,
|
|
157
|
+
controlType: current.technicalName,
|
|
158
|
+
name: current.name ?? '',
|
|
159
|
+
editable,
|
|
160
|
+
visible: current.visible ?? true,
|
|
161
|
+
children,
|
|
162
|
+
hasDefaultContent: defaultContent.length > 0
|
|
163
|
+
};
|
|
164
|
+
items.push(node);
|
|
165
|
+
}
|
|
166
|
+
} catch (error) {
|
|
167
|
+
Log.error('Failed to transform outline node!', getError(error));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return items;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Handles duplicate nodes that are retrieved from extension point default content and created controls,
|
|
175
|
+
* if they exist under an extension point these controls are removed from the children array
|
|
176
|
+
*
|
|
177
|
+
* @param children outline view node children
|
|
178
|
+
* @param scenario type of project
|
|
179
|
+
* @param controlIndex Control tree index
|
|
180
|
+
* @param changeService ChangeService for change stack event handling.
|
|
181
|
+
* @param propertyIdMap Map<string, string[]>.
|
|
182
|
+
* @returns transformed outline tree nodes
|
|
183
|
+
*/
|
|
184
|
+
async function handleDuplicateNodes(children, scenario, controlIndex, changeService, propertyIdMap) {
|
|
185
|
+
const extPointIDs = new Set();
|
|
186
|
+
children.forEach(child => {
|
|
187
|
+
if (child.type === 'extensionPoint') {
|
|
188
|
+
const {
|
|
189
|
+
defaultContent = [],
|
|
190
|
+
createdControls = []
|
|
191
|
+
} = child.extensionPointInfo;
|
|
192
|
+
[...defaultContent, ...createdControls].forEach(id => extPointIDs.add(id));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const uniqueChildren = children.filter(child => !extPointIDs.has(child.id));
|
|
196
|
+
return transformNodes(uniqueChildren, scenario, controlIndex, changeService, propertyIdMap);
|
|
197
|
+
}
|
|
198
|
+
var __exports = {
|
|
199
|
+
__esModule: true
|
|
200
|
+
};
|
|
201
|
+
__exports.transformNodes = transformNodes;
|
|
202
|
+
__exports.handleDuplicateNodes = handleDuplicateNodes;
|
|
203
|
+
return __exports;
|
|
204
204
|
});
|
|
205
205
|
//# sourceMappingURL=nodes.js.map
|