@sap-ux/preview-middleware 0.16.155 → 0.16.157
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/api-handler.js +142 -142
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +5 -6
- package/dist/client/adp/controllers/AddFragment.controller.ts +1 -2
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +0 -1
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +0 -1
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
- package/dist/client/adp/controllers/BaseDialog.controller.ts +0 -4
- package/dist/client/adp/controllers/ControllerExtension.controller.js +213 -213
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/dialog-factory.js +115 -0
- package/dist/client/adp/dialog-factory.ts +134 -0
- package/dist/client/adp/extension-point.js +6 -6
- package/dist/client/adp/extension-point.ts +2 -2
- package/dist/client/adp/init-dialogs.js +100 -157
- package/dist/client/adp/init-dialogs.ts +5 -77
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -54
- package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +5 -3
- package/dist/client/adp/quick-actions/common/create-page-action.js +50 -49
- package/dist/client/adp/quick-actions/common/create-page-action.ts +7 -4
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -35
- package/dist/client/adp/quick-actions/common/op-add-custom-section.ts +6 -3
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +48 -47
- package/dist/client/adp/quick-actions/common/op-add-header-field.ts +7 -4
- package/dist/client/adp/quick-actions/common/utils.js +20 -0
- package/dist/client/adp/quick-actions/common/utils.ts +7 -0
- package/dist/client/adp/quick-actions/control-types.js +23 -0
- package/dist/client/adp/quick-actions/control-types.ts +6 -0
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
- package/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
- package/dist/client/adp/quick-actions/enablement-validator.js +6 -0
- package/dist/client/adp/quick-actions/enablement-validator.ts +18 -0
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -100
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +11 -3
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +70 -69
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +6 -3
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -95
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +27 -21
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +60 -56
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +8 -3
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -67
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +37 -16
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +57 -57
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +95 -0
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.ts +99 -0
- package/dist/client/adp/quick-actions/fe-v2/registry.js +72 -71
- package/dist/client/adp/quick-actions/fe-v2/registry.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/utils.js +95 -86
- package/dist/client/adp/quick-actions/fe-v2/utils.ts +14 -4
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +49 -47
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +5 -1
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +47 -45
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.ts +17 -7
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -45
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +11 -12
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +55 -55
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +4 -4
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +52 -52
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +91 -0
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.ts +85 -0
- package/dist/client/adp/quick-actions/fe-v4/registry.js +56 -55
- package/dist/client/adp/quick-actions/fe-v4/registry.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.js +11 -17
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.ts +17 -18
- 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 +55 -0
- package/dist/client/adp/quick-actions/quick-action-base.ts +55 -0
- package/dist/client/adp/quick-actions/simple-quick-action-base.js +8 -13
- package/dist/client/adp/quick-actions/simple-quick-action-base.ts +10 -18
- package/dist/client/adp/quick-actions/table-quick-action-base.js +24 -29
- package/dist/client/adp/quick-actions/table-quick-action-base.ts +39 -28
- package/dist/client/adp/utils.js +160 -160
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/service.js +30 -0
- package/dist/client/cpe/changes/service.ts +46 -0
- package/dist/client/cpe/changes/validator.js +34 -34
- 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 +217 -217
- package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
- package/dist/client/cpe/quick-actions/quick-action-definition.ts +5 -1
- package/dist/client/cpe/quick-actions/quick-action-service.js +10 -4
- package/dist/client/cpe/quick-actions/quick-action-service.ts +9 -3
- 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/messagebundle.properties +5 -3
- 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 -114
- package/dist/client/utils/fe-v4.ts +19 -11
- package/dist/client/utils/version.js +102 -102
- package/package.json +4 -4
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editable", "../../utils/fe-v4"], function (____utils_version, ____utils_core, ___utils, ___editable, ____utils_fe_v4) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getUi5Version = ____utils_version["getUi5Version"];
|
|
7
|
-
const getControlById = ____utils_core["getControlById"];
|
|
8
|
-
const getOverlay = ___utils["getOverlay"];
|
|
9
|
-
const isReuseComponent = ___utils["isReuseComponent"];
|
|
10
|
-
const isEditable = ___editable["isEditable"];
|
|
11
|
-
const getConfigMapControlIdMap = ____utils_fe_v4["getConfigMapControlIdMap"];
|
|
12
|
-
const getPageName = ____utils_fe_v4["getPageName"];
|
|
13
|
-
/**
|
|
14
|
-
* Retrieves additional data for a given control ID.
|
|
15
|
-
*
|
|
16
|
-
* @param id The unique identifier of the control.
|
|
17
|
-
* @returns An object containing the text and the technical name of the control.
|
|
18
|
-
*/
|
|
19
|
-
function getAdditionalData(id) {
|
|
20
|
-
const control = getControlById(id);
|
|
21
|
-
if (!control) {
|
|
22
|
-
return {};
|
|
23
|
-
}
|
|
24
|
-
const metadata = control.getMetadata();
|
|
25
|
-
let details = {};
|
|
26
|
-
const technicalName = metadata.getElementName();
|
|
27
|
-
if (technicalName) {
|
|
28
|
-
details.technicalName = technicalName;
|
|
29
|
-
}
|
|
30
|
-
if (metadata.getProperty('text')) {
|
|
31
|
-
const text = control.getProperty('text');
|
|
32
|
-
if (typeof text === 'string' && text.trim() !== '') {
|
|
33
|
-
details.text = text;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return details;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Gets the children nodes of an aggregation type node.
|
|
41
|
-
*
|
|
42
|
-
* @param current The current node to retrieve children from
|
|
43
|
-
* @returns An array of children nodes, or an empty array if none are found
|
|
44
|
-
*/
|
|
45
|
-
function getChildren(current) {
|
|
46
|
-
return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Adds a new child node to the extension point's children array based on the given control ID.
|
|
51
|
-
*
|
|
52
|
-
* @param {string} id - The unique identifier of the control to be added as a child node.
|
|
53
|
-
* @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
|
|
54
|
-
* @param {ChangeService} changeService - Change service for change stack event handling.
|
|
55
|
-
*/
|
|
56
|
-
function addChildToExtensionPoint(id, children, changeService) {
|
|
57
|
-
const {
|
|
58
|
-
text,
|
|
59
|
-
technicalName
|
|
60
|
-
} = getAdditionalData(id);
|
|
61
|
-
const editable = isEditable(changeService, id);
|
|
62
|
-
children.push({
|
|
63
|
-
controlId: id,
|
|
64
|
-
controlType: technicalName ?? 'sap.ui.extensionpoint.child',
|
|
65
|
-
name: text ?? id,
|
|
66
|
-
visible: true,
|
|
67
|
-
editable,
|
|
68
|
-
children: [],
|
|
69
|
-
hasDefaultContent: false
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Creates conrol index for all controls in the app.
|
|
74
|
-
*
|
|
75
|
-
* @param {ControlTreeIndex} controlIndex - Control index for the ui5 app.
|
|
76
|
-
* @param {OutlineNode} node - control node added to the outline.
|
|
77
|
-
*/
|
|
78
|
-
function indexNode(controlIndex, node) {
|
|
79
|
-
const indexedControls = controlIndex[node.controlType];
|
|
80
|
-
if (indexedControls) {
|
|
81
|
-
indexedControls.push(node);
|
|
82
|
-
} else {
|
|
83
|
-
controlIndex[node.controlType] = [node];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function addToPropertyIdMap(node, propertyIdMap) {
|
|
87
|
-
const control = getControlById(node.controlId);
|
|
88
|
-
if (control) {
|
|
89
|
-
const overlay = getOverlay(control);
|
|
90
|
-
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
91
|
-
if (!overlayData?.manifestPropertyPath) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (overlayData) {
|
|
95
|
-
const path = overlayData?.manifestPropertyPath?.(control);
|
|
96
|
-
const pageName = getPageName(control);
|
|
97
|
-
const key = getConfigMapControlIdMap(pageName, path.split('/').filter(item => item));
|
|
98
|
-
if (key) {
|
|
99
|
-
if (!propertyIdMap.get(key)) {
|
|
100
|
-
propertyIdMap.set(key, []);
|
|
101
|
-
}
|
|
102
|
-
propertyIdMap.get(key)?.push(node.controlId);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Transform node.
|
|
110
|
-
*
|
|
111
|
-
* @param input outline view node
|
|
112
|
-
* @param scenario type of project
|
|
113
|
-
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
114
|
-
* @param controlIndex Control tree index
|
|
115
|
-
* @param changeService ChanegService for change stack event handling.
|
|
116
|
-
* @param propertyIdMap ChanegService for change stack event handling.
|
|
117
|
-
* @returns transformed outline tree nodes
|
|
118
|
-
*/
|
|
119
|
-
async function transformNodes(input, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) {
|
|
120
|
-
const stack = [...input];
|
|
121
|
-
const items = [];
|
|
122
|
-
const ui5VersionInfo = await getUi5Version();
|
|
123
|
-
while (stack.length) {
|
|
124
|
-
const current = stack.shift();
|
|
125
|
-
const editable = isEditable(changeService, current?.id);
|
|
126
|
-
const isAdp = scenario === 'ADAPTATION_PROJECT';
|
|
127
|
-
const isExtPoint = current?.type === 'extensionPoint';
|
|
128
|
-
if (current?.type === 'element') {
|
|
129
|
-
const children = getChildren(current);
|
|
130
|
-
const {
|
|
131
|
-
text
|
|
132
|
-
} = getAdditionalData(current.id);
|
|
133
|
-
const technicalName = current.technicalName.split('.').slice(-1)[0];
|
|
134
|
-
const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) : await transformNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap);
|
|
135
|
-
const node = {
|
|
136
|
-
controlId: current.id,
|
|
137
|
-
controlType: current.technicalName,
|
|
138
|
-
name: text ?? technicalName,
|
|
139
|
-
editable,
|
|
140
|
-
visible: current.visible ?? true,
|
|
141
|
-
children: transformedChildren
|
|
142
|
-
};
|
|
143
|
-
indexNode(controlIndex, node);
|
|
144
|
-
addToPropertyIdMap(node, propertyIdMap);
|
|
145
|
-
fillReuseComponents(reuseComponentsIds, current, scenario, ui5VersionInfo);
|
|
146
|
-
items.push(node);
|
|
147
|
-
}
|
|
148
|
-
if (isAdp && isExtPoint) {
|
|
149
|
-
const {
|
|
150
|
-
defaultContent = [],
|
|
151
|
-
createdControls = []
|
|
152
|
-
} = current.extensionPointInfo;
|
|
153
|
-
let children = [];
|
|
154
|
-
// We can combine both because there can only be either defaultContent or createdControls for one extension point node.
|
|
155
|
-
[...defaultContent, ...createdControls].forEach(id => {
|
|
156
|
-
addChildToExtensionPoint(id, children, changeService);
|
|
157
|
-
});
|
|
158
|
-
const node = {
|
|
159
|
-
controlId: current.id,
|
|
160
|
-
controlType: current.technicalName,
|
|
161
|
-
name: current.name ?? '',
|
|
162
|
-
editable,
|
|
163
|
-
visible: current.visible ?? true,
|
|
164
|
-
children,
|
|
165
|
-
hasDefaultContent: defaultContent.length > 0
|
|
166
|
-
};
|
|
167
|
-
items.push(node);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return items;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Fill reuse components ids.
|
|
175
|
-
*
|
|
176
|
-
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
177
|
-
* @param node view node
|
|
178
|
-
* @param scenario type of project
|
|
179
|
-
* @param ui5VersionInfo UI5 version information
|
|
180
|
-
*/
|
|
181
|
-
function fillReuseComponents(reuseComponentsIds, node, scenario, ui5VersionInfo) {
|
|
182
|
-
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id, ui5VersionInfo)) {
|
|
183
|
-
reuseComponentsIds.add(node.id);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Handles duplicate nodes that are retrieved from extension point default content and created controls,
|
|
188
|
-
* if they exist under an extension point these controls are removed from the children array
|
|
189
|
-
*
|
|
190
|
-
* @param children outline view node children
|
|
191
|
-
* @param scenario type of project
|
|
192
|
-
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
193
|
-
* @param controlIndex Control tree index
|
|
194
|
-
* @param changeService ChangeService for change stack event handling.
|
|
195
|
-
* @param propertyIdMap Map<string, string[]>.
|
|
196
|
-
* @returns transformed outline tree nodes
|
|
197
|
-
*/
|
|
198
|
-
async function handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) {
|
|
199
|
-
const extPointIDs = new Set();
|
|
200
|
-
children.forEach(child => {
|
|
201
|
-
if (child.type === 'extensionPoint') {
|
|
202
|
-
const {
|
|
203
|
-
defaultContent = [],
|
|
204
|
-
createdControls = []
|
|
205
|
-
} = child.extensionPointInfo;
|
|
206
|
-
[...defaultContent, ...createdControls].forEach(id => extPointIDs.add(id));
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
const uniqueChildren = children.filter(child => !extPointIDs.has(child.id));
|
|
210
|
-
return transformNodes(uniqueChildren, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap);
|
|
211
|
-
}
|
|
212
|
-
var __exports = {
|
|
213
|
-
__esModule: true
|
|
214
|
-
};
|
|
215
|
-
__exports.transformNodes = transformNodes;
|
|
216
|
-
__exports.handleDuplicateNodes = handleDuplicateNodes;
|
|
217
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../../utils/version", "../../utils/core", "../utils", "./editable", "../../utils/fe-v4"], function (____utils_version, ____utils_core, ___utils, ___editable, ____utils_fe_v4) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getUi5Version = ____utils_version["getUi5Version"];
|
|
7
|
+
const getControlById = ____utils_core["getControlById"];
|
|
8
|
+
const getOverlay = ___utils["getOverlay"];
|
|
9
|
+
const isReuseComponent = ___utils["isReuseComponent"];
|
|
10
|
+
const isEditable = ___editable["isEditable"];
|
|
11
|
+
const getConfigMapControlIdMap = ____utils_fe_v4["getConfigMapControlIdMap"];
|
|
12
|
+
const getPageName = ____utils_fe_v4["getPageName"];
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves additional data for a given control ID.
|
|
15
|
+
*
|
|
16
|
+
* @param id The unique identifier of the control.
|
|
17
|
+
* @returns An object containing the text and the technical name of the control.
|
|
18
|
+
*/
|
|
19
|
+
function getAdditionalData(id) {
|
|
20
|
+
const control = getControlById(id);
|
|
21
|
+
if (!control) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const metadata = control.getMetadata();
|
|
25
|
+
let details = {};
|
|
26
|
+
const technicalName = metadata.getElementName();
|
|
27
|
+
if (technicalName) {
|
|
28
|
+
details.technicalName = technicalName;
|
|
29
|
+
}
|
|
30
|
+
if (metadata.getProperty('text')) {
|
|
31
|
+
const text = control.getProperty('text');
|
|
32
|
+
if (typeof text === 'string' && text.trim() !== '') {
|
|
33
|
+
details.text = text;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return details;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Gets the children nodes of an aggregation type node.
|
|
41
|
+
*
|
|
42
|
+
* @param current The current node to retrieve children from
|
|
43
|
+
* @returns An array of children nodes, or an empty array if none are found
|
|
44
|
+
*/
|
|
45
|
+
function getChildren(current) {
|
|
46
|
+
return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Adds a new child node to the extension point's children array based on the given control ID.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} id - The unique identifier of the control to be added as a child node.
|
|
53
|
+
* @param {OutlineNode[]} children - The array of children nodes to which the new node will be added.
|
|
54
|
+
* @param {ChangeService} changeService - Change service for change stack event handling.
|
|
55
|
+
*/
|
|
56
|
+
function addChildToExtensionPoint(id, children, changeService) {
|
|
57
|
+
const {
|
|
58
|
+
text,
|
|
59
|
+
technicalName
|
|
60
|
+
} = getAdditionalData(id);
|
|
61
|
+
const editable = isEditable(changeService, id);
|
|
62
|
+
children.push({
|
|
63
|
+
controlId: id,
|
|
64
|
+
controlType: technicalName ?? 'sap.ui.extensionpoint.child',
|
|
65
|
+
name: text ?? id,
|
|
66
|
+
visible: true,
|
|
67
|
+
editable,
|
|
68
|
+
children: [],
|
|
69
|
+
hasDefaultContent: false
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates conrol index for all controls in the app.
|
|
74
|
+
*
|
|
75
|
+
* @param {ControlTreeIndex} controlIndex - Control index for the ui5 app.
|
|
76
|
+
* @param {OutlineNode} node - control node added to the outline.
|
|
77
|
+
*/
|
|
78
|
+
function indexNode(controlIndex, node) {
|
|
79
|
+
const indexedControls = controlIndex[node.controlType];
|
|
80
|
+
if (indexedControls) {
|
|
81
|
+
indexedControls.push(node);
|
|
82
|
+
} else {
|
|
83
|
+
controlIndex[node.controlType] = [node];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function addToPropertyIdMap(node, propertyIdMap) {
|
|
87
|
+
const control = getControlById(node.controlId);
|
|
88
|
+
if (control) {
|
|
89
|
+
const overlay = getOverlay(control);
|
|
90
|
+
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
91
|
+
if (!overlayData?.manifestPropertyPath) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (overlayData) {
|
|
95
|
+
const path = overlayData?.manifestPropertyPath?.(control);
|
|
96
|
+
const pageName = getPageName(control);
|
|
97
|
+
const key = getConfigMapControlIdMap(pageName, path.split('/').filter(item => item));
|
|
98
|
+
if (key) {
|
|
99
|
+
if (!propertyIdMap.get(key)) {
|
|
100
|
+
propertyIdMap.set(key, []);
|
|
101
|
+
}
|
|
102
|
+
propertyIdMap.get(key)?.push(node.controlId);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Transform node.
|
|
110
|
+
*
|
|
111
|
+
* @param input outline view node
|
|
112
|
+
* @param scenario type of project
|
|
113
|
+
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
114
|
+
* @param controlIndex Control tree index
|
|
115
|
+
* @param changeService ChanegService for change stack event handling.
|
|
116
|
+
* @param propertyIdMap ChanegService for change stack event handling.
|
|
117
|
+
* @returns transformed outline tree nodes
|
|
118
|
+
*/
|
|
119
|
+
async function transformNodes(input, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) {
|
|
120
|
+
const stack = [...input];
|
|
121
|
+
const items = [];
|
|
122
|
+
const ui5VersionInfo = await getUi5Version();
|
|
123
|
+
while (stack.length) {
|
|
124
|
+
const current = stack.shift();
|
|
125
|
+
const editable = isEditable(changeService, current?.id);
|
|
126
|
+
const isAdp = scenario === 'ADAPTATION_PROJECT';
|
|
127
|
+
const isExtPoint = current?.type === 'extensionPoint';
|
|
128
|
+
if (current?.type === 'element') {
|
|
129
|
+
const children = getChildren(current);
|
|
130
|
+
const {
|
|
131
|
+
text
|
|
132
|
+
} = getAdditionalData(current.id);
|
|
133
|
+
const technicalName = current.technicalName.split('.').slice(-1)[0];
|
|
134
|
+
const transformedChildren = isAdp ? await handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) : await transformNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap);
|
|
135
|
+
const node = {
|
|
136
|
+
controlId: current.id,
|
|
137
|
+
controlType: current.technicalName,
|
|
138
|
+
name: text ?? technicalName,
|
|
139
|
+
editable,
|
|
140
|
+
visible: current.visible ?? true,
|
|
141
|
+
children: transformedChildren
|
|
142
|
+
};
|
|
143
|
+
indexNode(controlIndex, node);
|
|
144
|
+
addToPropertyIdMap(node, propertyIdMap);
|
|
145
|
+
fillReuseComponents(reuseComponentsIds, current, scenario, ui5VersionInfo);
|
|
146
|
+
items.push(node);
|
|
147
|
+
}
|
|
148
|
+
if (isAdp && isExtPoint) {
|
|
149
|
+
const {
|
|
150
|
+
defaultContent = [],
|
|
151
|
+
createdControls = []
|
|
152
|
+
} = current.extensionPointInfo;
|
|
153
|
+
let children = [];
|
|
154
|
+
// We can combine both because there can only be either defaultContent or createdControls for one extension point node.
|
|
155
|
+
[...defaultContent, ...createdControls].forEach(id => {
|
|
156
|
+
addChildToExtensionPoint(id, children, changeService);
|
|
157
|
+
});
|
|
158
|
+
const node = {
|
|
159
|
+
controlId: current.id,
|
|
160
|
+
controlType: current.technicalName,
|
|
161
|
+
name: current.name ?? '',
|
|
162
|
+
editable,
|
|
163
|
+
visible: current.visible ?? true,
|
|
164
|
+
children,
|
|
165
|
+
hasDefaultContent: defaultContent.length > 0
|
|
166
|
+
};
|
|
167
|
+
items.push(node);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return items;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Fill reuse components ids.
|
|
175
|
+
*
|
|
176
|
+
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
177
|
+
* @param node view node
|
|
178
|
+
* @param scenario type of project
|
|
179
|
+
* @param ui5VersionInfo UI5 version information
|
|
180
|
+
*/
|
|
181
|
+
function fillReuseComponents(reuseComponentsIds, node, scenario, ui5VersionInfo) {
|
|
182
|
+
if (scenario === 'ADAPTATION_PROJECT' && node?.component && isReuseComponent(node.id, ui5VersionInfo)) {
|
|
183
|
+
reuseComponentsIds.add(node.id);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Handles duplicate nodes that are retrieved from extension point default content and created controls,
|
|
188
|
+
* if they exist under an extension point these controls are removed from the children array
|
|
189
|
+
*
|
|
190
|
+
* @param children outline view node children
|
|
191
|
+
* @param scenario type of project
|
|
192
|
+
* @param reuseComponentsIds ids of reuse components that are filled when outline nodes are transformed
|
|
193
|
+
* @param controlIndex Control tree index
|
|
194
|
+
* @param changeService ChangeService for change stack event handling.
|
|
195
|
+
* @param propertyIdMap Map<string, string[]>.
|
|
196
|
+
* @returns transformed outline tree nodes
|
|
197
|
+
*/
|
|
198
|
+
async function handleDuplicateNodes(children, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap) {
|
|
199
|
+
const extPointIDs = new Set();
|
|
200
|
+
children.forEach(child => {
|
|
201
|
+
if (child.type === 'extensionPoint') {
|
|
202
|
+
const {
|
|
203
|
+
defaultContent = [],
|
|
204
|
+
createdControls = []
|
|
205
|
+
} = child.extensionPointInfo;
|
|
206
|
+
[...defaultContent, ...createdControls].forEach(id => extPointIDs.add(id));
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
const uniqueChildren = children.filter(child => !extPointIDs.has(child.id));
|
|
210
|
+
return transformNodes(uniqueChildren, scenario, reuseComponentsIds, controlIndex, changeService, propertyIdMap);
|
|
211
|
+
}
|
|
212
|
+
var __exports = {
|
|
213
|
+
__esModule: true
|
|
214
|
+
};
|
|
215
|
+
__exports.transformNodes = transformNodes;
|
|
216
|
+
__exports.handleDuplicateNodes = handleDuplicateNodes;
|
|
217
|
+
return __exports;
|
|
218
218
|
});
|
|
219
219
|
//# sourceMappingURL=nodes.js.map
|
|
@@ -62,9 +62,13 @@ interface QuickActionDefinitionBase {
|
|
|
62
62
|
*/
|
|
63
63
|
isApplicable: boolean;
|
|
64
64
|
/**
|
|
65
|
-
* Initializes the action and checks if it should be
|
|
65
|
+
* Initializes the action and checks if it should be displayed in current context.
|
|
66
66
|
*/
|
|
67
67
|
initialize: () => void | Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Runs enablement validators to check if the action should be enabled.
|
|
70
|
+
*/
|
|
71
|
+
runEnablementValidators: () => void | Promise<void>;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
export interface SimpleQuickActionDefinition extends QuickActionDefinitionBase {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
sap.ui.define([
|
|
3
3
|
'sap/base/Log',
|
|
4
4
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
5
|
-
'../../i18n'
|
|
6
|
-
|
|
5
|
+
'../../i18n',
|
|
6
|
+
'../../adp/dialog-factory'
|
|
7
|
+
], function (Log, ___sap_ux_private_control_property_editor_common, ____i18n, ____adp_dialog_factory) {
|
|
7
8
|
'use strict';
|
|
8
9
|
const executeQuickAction = ___sap_ux_private_control_property_editor_common['executeQuickAction'];
|
|
9
10
|
const quickActionListChanged = ___sap_ux_private_control_property_editor_common['quickActionListChanged'];
|
|
@@ -11,6 +12,7 @@ sap.ui.define([
|
|
|
11
12
|
const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
|
|
12
13
|
const updateQuickAction = ___sap_ux_private_control_property_editor_common['updateQuickAction'];
|
|
13
14
|
const getTextBundle = ____i18n['getTextBundle'];
|
|
15
|
+
const DialogFactory = ____adp_dialog_factory['DialogFactory'];
|
|
14
16
|
class QuickActionService {
|
|
15
17
|
sendAction = () => {
|
|
16
18
|
};
|
|
@@ -47,6 +49,9 @@ sap.ui.define([
|
|
|
47
49
|
this.changeService.onStackChange(async () => {
|
|
48
50
|
await this.reloadQuickActions(this.controlTreeIndex);
|
|
49
51
|
});
|
|
52
|
+
DialogFactory.onOpenDialogStatusChange(async () => {
|
|
53
|
+
await this.reloadQuickActions(this.controlTreeIndex);
|
|
54
|
+
});
|
|
50
55
|
}
|
|
51
56
|
async reloadQuickActions(controlIndex) {
|
|
52
57
|
const context = {
|
|
@@ -74,7 +79,7 @@ sap.ui.define([
|
|
|
74
79
|
try {
|
|
75
80
|
const instance = new Definition(actionContext);
|
|
76
81
|
await instance.initialize();
|
|
77
|
-
this.addAction(group, instance);
|
|
82
|
+
await this.addAction(group, instance);
|
|
78
83
|
} catch {
|
|
79
84
|
Log.warning(`Failed to initialize ${ Definition.name } quick action.`);
|
|
80
85
|
}
|
|
@@ -84,8 +89,9 @@ sap.ui.define([
|
|
|
84
89
|
}
|
|
85
90
|
this.sendAction(quickActionListChanged(groups));
|
|
86
91
|
}
|
|
87
|
-
addAction(group, instance) {
|
|
92
|
+
async addAction(group, instance) {
|
|
88
93
|
if (instance.isApplicable) {
|
|
94
|
+
await instance.runEnablementValidators();
|
|
89
95
|
const quickAction = instance.getActionObject();
|
|
90
96
|
group.actions.push(quickAction);
|
|
91
97
|
this.actions.push(instance);
|
|
@@ -20,6 +20,7 @@ import { QuickActionDefinitionRegistry } from './registry';
|
|
|
20
20
|
import { OutlineService } from '../outline/service';
|
|
21
21
|
import { getTextBundle, TextBundle } from '../../i18n';
|
|
22
22
|
import { ChangeService } from '../changes';
|
|
23
|
+
import { DialogFactory } from '../../adp/dialog-factory';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Service providing Quick Actions.
|
|
@@ -33,7 +34,7 @@ export class QuickActionService implements Service {
|
|
|
33
34
|
private texts: TextBundle;
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* Quick action service constructor.
|
|
37
38
|
*
|
|
38
39
|
* @param rta - RTA object.
|
|
39
40
|
* @param outlineService - Outline service instance.
|
|
@@ -85,6 +86,10 @@ export class QuickActionService implements Service {
|
|
|
85
86
|
this.changeService.onStackChange(async () => {
|
|
86
87
|
await this.reloadQuickActions(this.controlTreeIndex);
|
|
87
88
|
});
|
|
89
|
+
|
|
90
|
+
DialogFactory.onOpenDialogStatusChange(async () => {
|
|
91
|
+
await this.reloadQuickActions(this.controlTreeIndex);
|
|
92
|
+
});
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
/**
|
|
@@ -119,7 +124,7 @@ export class QuickActionService implements Service {
|
|
|
119
124
|
try {
|
|
120
125
|
const instance = new Definition(actionContext);
|
|
121
126
|
await instance.initialize();
|
|
122
|
-
this.addAction(group, instance);
|
|
127
|
+
await this.addAction(group, instance);
|
|
123
128
|
} catch {
|
|
124
129
|
Log.warning(`Failed to initialize ${Definition.name} quick action.`);
|
|
125
130
|
}
|
|
@@ -131,8 +136,9 @@ export class QuickActionService implements Service {
|
|
|
131
136
|
this.sendAction(quickActionListChanged(groups));
|
|
132
137
|
}
|
|
133
138
|
|
|
134
|
-
private addAction(group: QuickActionGroup, instance: QuickActionDefinition): void {
|
|
139
|
+
private async addAction(group: QuickActionGroup, instance: QuickActionDefinition): Promise<void> {
|
|
135
140
|
if (instance.isApplicable) {
|
|
141
|
+
await instance.runEnablementValidators();
|
|
136
142
|
const quickAction = instance.getActionObject();
|
|
137
143
|
group.actions.push(quickAction);
|
|
138
144
|
this.actions.push(instance);
|