@openui5/sap.ui.rta 1.93.3 → 1.96.2
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/.reuse/dep5 +6 -11
- package/THIRDPARTY.txt +10 -16
- package/package.json +6 -6
- package/src/sap/ui/rta/.library +1 -1
- package/src/sap/ui/rta/Client.js +1 -1
- package/src/sap/ui/rta/RuntimeAuthoring.js +160 -121
- package/src/sap/ui/rta/Utils.js +73 -1
- package/src/sap/ui/rta/appVariant/AppVariantDialog.js +4 -3
- package/src/sap/ui/rta/appVariant/AppVariantManager.js +24 -17
- package/src/sap/ui/rta/appVariant/AppVariantUtils.js +107 -78
- package/src/sap/ui/rta/appVariant/Feature.js +5 -12
- package/src/sap/ui/rta/appVariant/Utils.js +10 -2
- package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +35 -20
- package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_de.properties +1 -1
- package/src/sap/ui/rta/command/AddIFrame.js +1 -1
- package/src/sap/ui/rta/command/AddProperty.js +1 -1
- package/src/sap/ui/rta/command/AddXML.js +1 -1
- package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/rta/command/AppDescriptorCommand.js +1 -1
- package/src/sap/ui/rta/command/BaseCommand.js +1 -1
- package/src/sap/ui/rta/command/BindProperty.js +1 -1
- package/src/sap/ui/rta/command/Combine.js +1 -1
- package/src/sap/ui/rta/command/CommandFactory.js +1 -1
- package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantConfigure.js +4 -4
- package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSaveAs.js +7 -4
- package/src/sap/ui/rta/command/ControlVariantSetTitle.js +7 -7
- package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/CreateContainer.js +1 -1
- package/src/sap/ui/rta/command/CustomAdd.js +1 -1
- package/src/sap/ui/rta/command/FlexCommand.js +1 -1
- package/src/sap/ui/rta/command/LREPSerializer.js +1 -1
- package/src/sap/ui/rta/command/LocalReset.js +1 -1
- package/src/sap/ui/rta/command/Move.js +1 -1
- package/src/sap/ui/rta/command/Property.js +1 -1
- package/src/sap/ui/rta/command/Remove.js +1 -1
- package/src/sap/ui/rta/command/Rename.js +1 -1
- package/src/sap/ui/rta/command/Reveal.js +1 -1
- package/src/sap/ui/rta/command/Settings.js +1 -1
- package/src/sap/ui/rta/command/Split.js +1 -1
- package/src/sap/ui/rta/command/Stack.js +1 -1
- package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
- package/src/sap/ui/rta/enablement/elementActionTest.js +1 -1
- package/src/sap/ui/rta/library.js +2 -2
- package/src/sap/ui/rta/messagebundle.properties +23 -9
- package/src/sap/ui/rta/messagebundle_ar.properties +14 -7
- package/src/sap/ui/rta/messagebundle_bg.properties +14 -7
- package/src/sap/ui/rta/messagebundle_ca.properties +14 -7
- package/src/sap/ui/rta/messagebundle_cs.properties +14 -7
- package/src/sap/ui/rta/messagebundle_cy.properties +14 -7
- package/src/sap/ui/rta/messagebundle_da.properties +14 -7
- package/src/sap/ui/rta/messagebundle_de.properties +23 -16
- package/src/sap/ui/rta/messagebundle_el.properties +14 -7
- package/src/sap/ui/rta/messagebundle_en.properties +14 -7
- package/src/sap/ui/rta/messagebundle_en_GB.properties +14 -7
- package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +14 -7
- package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +14 -7
- package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +14 -7
- package/src/sap/ui/rta/messagebundle_es.properties +14 -7
- package/src/sap/ui/rta/messagebundle_es_MX.properties +14 -7
- package/src/sap/ui/rta/messagebundle_et.properties +14 -7
- package/src/sap/ui/rta/messagebundle_fi.properties +15 -8
- package/src/sap/ui/rta/messagebundle_fr.properties +14 -7
- package/src/sap/ui/rta/messagebundle_fr_CA.properties +14 -7
- package/src/sap/ui/rta/messagebundle_hi.properties +14 -7
- package/src/sap/ui/rta/messagebundle_hr.properties +14 -7
- package/src/sap/ui/rta/messagebundle_hu.properties +14 -7
- package/src/sap/ui/rta/messagebundle_id.properties +16 -9
- package/src/sap/ui/rta/messagebundle_it.properties +14 -7
- package/src/sap/ui/rta/messagebundle_iw.properties +14 -7
- package/src/sap/ui/rta/messagebundle_ja.properties +14 -7
- package/src/sap/ui/rta/messagebundle_kk.properties +14 -7
- package/src/sap/ui/rta/messagebundle_ko.properties +14 -7
- package/src/sap/ui/rta/messagebundle_lt.properties +14 -7
- package/src/sap/ui/rta/messagebundle_lv.properties +14 -7
- package/src/sap/ui/rta/messagebundle_ms.properties +14 -7
- package/src/sap/ui/rta/messagebundle_nl.properties +14 -7
- package/src/sap/ui/rta/messagebundle_no.properties +14 -7
- package/src/sap/ui/rta/messagebundle_pl.properties +14 -7
- package/src/sap/ui/rta/messagebundle_pt.properties +14 -7
- package/src/sap/ui/rta/messagebundle_pt_PT.properties +14 -7
- package/src/sap/ui/rta/messagebundle_ro.properties +14 -7
- package/src/sap/ui/rta/messagebundle_ru.properties +14 -7
- package/src/sap/ui/rta/messagebundle_sh.properties +14 -7
- package/src/sap/ui/rta/messagebundle_sk.properties +14 -7
- package/src/sap/ui/rta/messagebundle_sl.properties +14 -7
- package/src/sap/ui/rta/messagebundle_sv.properties +16 -9
- package/src/sap/ui/rta/messagebundle_th.properties +14 -7
- package/src/sap/ui/rta/messagebundle_tr.properties +14 -7
- package/src/sap/ui/rta/messagebundle_uk.properties +14 -7
- package/src/sap/ui/rta/messagebundle_vi.properties +14 -7
- package/src/sap/ui/rta/messagebundle_zh_CN.properties +14 -7
- package/src/sap/ui/rta/messagebundle_zh_TW.properties +14 -7
- package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
- package/src/sap/ui/rta/plugin/Combine.js +1 -1
- package/src/sap/ui/rta/plugin/CompVariant.js +1 -2
- package/src/sap/ui/rta/plugin/ControlVariant.js +10 -5
- package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
- package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
- package/src/sap/ui/rta/plugin/DragDrop.js +52 -2
- package/src/sap/ui/rta/plugin/EasyAdd.js +1 -1
- package/src/sap/ui/rta/plugin/EasyRemove.js +1 -1
- package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
- package/src/sap/ui/rta/plugin/Plugin.js +1 -1
- package/src/sap/ui/rta/plugin/RTAElementMover.js +18 -61
- package/src/sap/ui/rta/plugin/Remove.js +1 -1
- package/src/sap/ui/rta/plugin/Rename.js +1 -1
- package/src/sap/ui/rta/plugin/RenameHandler.js +4 -1
- package/src/sap/ui/rta/plugin/Selection.js +35 -1
- package/src/sap/ui/rta/plugin/Settings.js +15 -14
- package/src/sap/ui/rta/plugin/Split.js +1 -1
- package/src/sap/ui/rta/plugin/Stretch.js +133 -139
- package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +505 -0
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.fragment.xml +74 -0
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +97 -260
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +4 -2
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +136 -831
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +117 -0
- package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +337 -0
- package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +8 -5
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +31 -29
- package/src/sap/ui/rta/service/Action.js +1 -1
- package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
- package/src/sap/ui/rta/service/Outline.js +109 -62
- package/src/sap/ui/rta/service/Property.js +1 -1
- package/src/sap/ui/rta/service/Selection.js +1 -1
- package/src/sap/ui/rta/themes/base/ChangeVisualization.less +16 -0
- package/src/sap/ui/rta/themes/base/Overlay.less +59 -58
- package/src/sap/ui/rta/{assets/InPageStyles.css → themes/base/OverlayWithScrollbar.less} +14 -12
- package/src/sap/ui/rta/themes/base/Toolbar.base.less +12 -1
- package/src/sap/ui/rta/themes/base/library.source.less +3 -1
- package/src/sap/ui/rta/themes/sap_hcb/Overlay.less +2 -3
- package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +67 -48
- package/src/sap/ui/rta/toolbar/Adaptation.js +43 -38
- package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +4 -5
- package/src/sap/ui/rta/toolbar/Base.js +64 -18
- package/src/sap/ui/rta/toolbar/BaseRenderer.js +2 -2
- package/src/sap/ui/rta/toolbar/Fiori.js +9 -9
- package/src/sap/ui/rta/toolbar/FioriLike.js +4 -4
- package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +98 -0
- package/src/sap/ui/rta/toolbar/Personalization.js +8 -8
- package/src/sap/ui/rta/toolbar/Standalone.js +4 -4
- package/src/sap/ui/rta/toolbar/translation/Translation.js +52 -39
- package/src/sap/ui/rta/util/BindingsExtractor.js +24 -27
- package/src/sap/ui/rta/util/PluginManager.js +2 -4
- package/src/sap/ui/rta/util/PopupManager.js +1 -1
- package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
- package/src/sap/ui/rta/util/adaptationStarter.js +3 -3
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +21 -2
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +71 -96
- package/ui5.yaml +4 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangesListPopover.fragment.xml +0 -23
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/base/util/restricted/_difference",
|
|
9
|
+
"sap/base/util/merge",
|
|
10
|
+
"sap/base/Log",
|
|
11
|
+
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
12
|
+
"sap/ui/dt/ElementUtil",
|
|
13
|
+
"sap/ui/dt/OverlayRegistry",
|
|
14
|
+
"sap/ui/fl/apply/api/DelegateMediatorAPI",
|
|
15
|
+
"sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils",
|
|
16
|
+
"sap/ui/rta/Utils"
|
|
17
|
+
], function(
|
|
18
|
+
difference,
|
|
19
|
+
merge,
|
|
20
|
+
Log,
|
|
21
|
+
JsControlTreeModifier,
|
|
22
|
+
ElementUtil,
|
|
23
|
+
OverlayRegistry,
|
|
24
|
+
DelegateMediatorAPI,
|
|
25
|
+
AdditionalElementsUtils,
|
|
26
|
+
Utils
|
|
27
|
+
) {
|
|
28
|
+
"use strict";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Helper object that collects and returns the data related to the different actions
|
|
32
|
+
* handled by the AdditionalElements Plugin (Reveal, Add Via Delegate, Add Custom)
|
|
33
|
+
*
|
|
34
|
+
* @author SAP SE
|
|
35
|
+
* @version 1.96.2
|
|
36
|
+
* @private
|
|
37
|
+
* @since 1.94
|
|
38
|
+
* @experimental Since 1.94. This class is experimental and provides only limited functionality. Also the API might be changed in future.
|
|
39
|
+
*/
|
|
40
|
+
var ActionExtractor = {};
|
|
41
|
+
|
|
42
|
+
function loadKnownDefaultDelegateLibraries() {
|
|
43
|
+
var aLoadLibraryPromises = [];
|
|
44
|
+
var aRequiredLibraries = DelegateMediatorAPI.getKnownDefaultDelegateLibraries();
|
|
45
|
+
aRequiredLibraries.forEach(function(sLibrary) {
|
|
46
|
+
var oLoadLibraryPromise = sap.ui.getCore().loadLibrary(sLibrary, { async: true })
|
|
47
|
+
.then(function() {
|
|
48
|
+
return Promise.resolve(sLibrary);
|
|
49
|
+
})
|
|
50
|
+
.catch(function(vError) {
|
|
51
|
+
Log.warning("Required library not available: ", vError);
|
|
52
|
+
// Ignore the error here as the default delegate might not be required
|
|
53
|
+
return Promise.resolve();
|
|
54
|
+
});
|
|
55
|
+
aLoadLibraryPromises.push(oLoadLibraryPromise);
|
|
56
|
+
});
|
|
57
|
+
return Promise.all(aLoadLibraryPromises);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getAddViaDelegateActionData(mAction, oDesignTimeMetadata, oPlugin) {
|
|
61
|
+
return oPlugin.hasChangeHandler(mAction.changeType, mAction.element)
|
|
62
|
+
.then(function (bHasChangeHandler) {
|
|
63
|
+
if (bHasChangeHandler) {
|
|
64
|
+
return {
|
|
65
|
+
aggregationName: mAction.aggregation,
|
|
66
|
+
addPropertyActionData: {
|
|
67
|
+
designTimeMetadata: oDesignTimeMetadata,
|
|
68
|
+
action: mAction,
|
|
69
|
+
delegateInfo: {
|
|
70
|
+
payload: mAction.delegateInfo.payload || {},
|
|
71
|
+
delegate: mAction.delegateInfo.instance,
|
|
72
|
+
modelType: mAction.delegateInfo.modelType,
|
|
73
|
+
requiredLibraries: mAction.delegateInfo.requiredLibraries
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function checkInvalidAddActions(bSibling, oSourceElementOverlay, oPlugin) {
|
|
83
|
+
var mParents = AdditionalElementsUtils.getParents(bSibling, oSourceElementOverlay, oPlugin);
|
|
84
|
+
var oDesignTimeMetadata = mParents.parentOverlay && mParents.parentOverlay.getDesignTimeMetadata();
|
|
85
|
+
var aActions = oDesignTimeMetadata ? oDesignTimeMetadata.getActionDataFromAggregations("addODataProperty", mParents.parent) : [];
|
|
86
|
+
if (aActions.length > 0) {
|
|
87
|
+
Log.error("Outdated addODataProperty action in designtime metadata in "
|
|
88
|
+
+ oDesignTimeMetadata.getData().designtimeModule
|
|
89
|
+
+ " or propagated or via instance specific designtime metadata.");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getInvisibleElements (oParentOverlay, sAggregationName, oPlugin) {
|
|
94
|
+
var oParentElement = oParentOverlay.getElement();
|
|
95
|
+
if (!oParentElement) {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Returns a list of all invisible elements belonging to an aggregation including the aggregation name
|
|
100
|
+
var aInvisibleElements = ElementUtil.getAggregation(oParentElement, sAggregationName, oPlugin).filter(function(oControl) {
|
|
101
|
+
var oOverlay = OverlayRegistry.getOverlay(oControl);
|
|
102
|
+
|
|
103
|
+
if (!oPlugin.hasStableId(oOverlay)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var oRelevantContainer = oParentOverlay.getRelevantContainer(true);
|
|
108
|
+
var oRelevantContainerOverlay = OverlayRegistry.getOverlay(oRelevantContainer);
|
|
109
|
+
var oOverlayToCheck = oParentOverlay;
|
|
110
|
+
var bAnyParentInvisible = false;
|
|
111
|
+
// check all the parents until the relevantContainerOverlay for invisibility
|
|
112
|
+
do {
|
|
113
|
+
bAnyParentInvisible = !oOverlayToCheck.getElementVisibility();
|
|
114
|
+
if (bAnyParentInvisible) {
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (oOverlayToCheck === oRelevantContainerOverlay) {
|
|
118
|
+
break;
|
|
119
|
+
} else {
|
|
120
|
+
oOverlayToCheck = oOverlayToCheck.getParentElementOverlay();
|
|
121
|
+
}
|
|
122
|
+
} while (oOverlayToCheck);
|
|
123
|
+
|
|
124
|
+
if (bAnyParentInvisible) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return oOverlay.getElementVisibility() === false;
|
|
129
|
+
}, this);
|
|
130
|
+
|
|
131
|
+
return aInvisibleElements.map(function(oInvisibleElement) {
|
|
132
|
+
return {
|
|
133
|
+
element: oInvisibleElement,
|
|
134
|
+
sourceAggregation: sAggregationName
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function defaultGetAggregationName(oParent, oChild) {
|
|
140
|
+
return oChild.sParentAggregationName;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isValidAction(oCheckElementOverlay, mParents, mAction, oPlugin) {
|
|
144
|
+
var bValidAction = mAction.changeType && oPlugin.hasStableId(oCheckElementOverlay);
|
|
145
|
+
if (bValidAction && oCheckElementOverlay !== mParents.relevantContainerOverlay) {
|
|
146
|
+
//relevant container is needed for some changes, so it must have a stable ID
|
|
147
|
+
bValidAction = oPlugin.hasStableId(mParents.relevantContainerOverlay);
|
|
148
|
+
}
|
|
149
|
+
return bValidAction;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function filterValidAddPropertyActions(aActions, mParents, oPlugin, aDefaultDelegateLibraries) {
|
|
153
|
+
function fnFilterActions(aFilteredActions, mAction) {
|
|
154
|
+
var oCheckElement = mAction.changeOnRelevantContainer ? mParents.relevantContainer : mParents.parent;
|
|
155
|
+
var oCheckElementOverlay = OverlayRegistry.getOverlay(oCheckElement);
|
|
156
|
+
var bValidAction = isValidAction(oCheckElementOverlay, mParents, mAction, oPlugin);
|
|
157
|
+
if (bValidAction) {
|
|
158
|
+
mAction.element = oCheckElement;
|
|
159
|
+
return DelegateMediatorAPI.getDelegateForControl({
|
|
160
|
+
control: mParents.relevantContainer, //delegate will always be added on the relevant container
|
|
161
|
+
modifier: JsControlTreeModifier,
|
|
162
|
+
supportsDefault: mAction.supportsDefaultDelegate
|
|
163
|
+
})
|
|
164
|
+
.then(function(mDelegateInfo) {
|
|
165
|
+
if (mDelegateInfo && mDelegateInfo.names && mDelegateInfo.names.length) {
|
|
166
|
+
var aRequiredLibraries = DelegateMediatorAPI.getRequiredLibrariesForDefaultDelegate({
|
|
167
|
+
delegateName: mDelegateInfo.names,
|
|
168
|
+
control: mParents.relevantContainer
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Check if all required libraries were successfully loaded
|
|
172
|
+
if (
|
|
173
|
+
difference(
|
|
174
|
+
aRequiredLibraries,
|
|
175
|
+
aDefaultDelegateLibraries.filter(Boolean)
|
|
176
|
+
).length === 0
|
|
177
|
+
) {
|
|
178
|
+
mAction.delegateInfo = mDelegateInfo;
|
|
179
|
+
aFilteredActions.push(mAction);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return aFilteredActions;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return aFilteredActions;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return aActions.reduce(function (oPreviousActionsPromise, mAction) {
|
|
189
|
+
return oPreviousActionsPromise
|
|
190
|
+
.then(function(aFilteredActions) {
|
|
191
|
+
return fnFilterActions(aFilteredActions, mAction);
|
|
192
|
+
});
|
|
193
|
+
}, Promise.resolve([]));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Return all elements that can be made visible in each aggregation (including elements from other aggregations)
|
|
197
|
+
function getRevealActionFromAggregations(aParents, _mReveal, sAggregationName, aAggregationNames, oPlugin) {
|
|
198
|
+
var aInvisibleElements = aParents.reduce(function(aInvisibleChildren, oParentOverlay) {
|
|
199
|
+
var aInvisibleChildrenPerAggregation = [];
|
|
200
|
+
aAggregationNames.forEach(function(sAggregation) {
|
|
201
|
+
aInvisibleChildrenPerAggregation = aInvisibleChildrenPerAggregation.concat(getInvisibleElements.call(this, oParentOverlay, sAggregation, oPlugin));
|
|
202
|
+
}.bind(this), []);
|
|
203
|
+
return oParentOverlay ? aInvisibleChildren.concat(aInvisibleChildrenPerAggregation) : aInvisibleChildren;
|
|
204
|
+
}.bind(this), []);
|
|
205
|
+
|
|
206
|
+
var oInitialRevealObject = {
|
|
207
|
+
elements: [],
|
|
208
|
+
controlTypeNames: []
|
|
209
|
+
};
|
|
210
|
+
var mRevealPromise = aInvisibleElements.reduce(function(oPreviousPromise, mInvisibleElement) {
|
|
211
|
+
return oPreviousPromise.then(function(mReveal) {
|
|
212
|
+
return checkAndEnrichReveal(mReveal, mInvisibleElement, oPlugin, sAggregationName);
|
|
213
|
+
});
|
|
214
|
+
}, Promise.resolve(oInitialRevealObject));
|
|
215
|
+
|
|
216
|
+
return mRevealPromise.then(function(mReveal) {
|
|
217
|
+
if (mReveal.elements.length > 0) {
|
|
218
|
+
_mReveal[sAggregationName] = {
|
|
219
|
+
reveal: mReveal
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return _mReveal;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function checkAndEnrichReveal(mReveal, mInvisibleElement, oPlugin, sTargetAggregation) {
|
|
227
|
+
return Promise.resolve().then(function() {
|
|
228
|
+
var oInvisibleElement = mInvisibleElement.element;
|
|
229
|
+
var oDesignTimeMetadata;
|
|
230
|
+
var mRevealAction;
|
|
231
|
+
var bRevealEnabled = false;
|
|
232
|
+
var oHasChangeHandlerPromise = Promise.resolve();
|
|
233
|
+
var sSourceAggregation = mInvisibleElement.sourceAggregation;
|
|
234
|
+
|
|
235
|
+
var oOverlay = OverlayRegistry.getOverlay(oInvisibleElement);
|
|
236
|
+
if (oOverlay) {
|
|
237
|
+
oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
|
|
238
|
+
|
|
239
|
+
mRevealAction = oDesignTimeMetadata && oDesignTimeMetadata.getAction("reveal", oInvisibleElement);
|
|
240
|
+
if (mRevealAction && mRevealAction.changeType) {
|
|
241
|
+
var oRevealSelector = oInvisibleElement;
|
|
242
|
+
if (mRevealAction.changeOnRelevantContainer) {
|
|
243
|
+
oRevealSelector = oOverlay.getRelevantContainer();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
oHasChangeHandlerPromise = oPlugin.hasChangeHandler(mRevealAction.changeType, oRevealSelector).then(function(bHasChangeHandler) {
|
|
247
|
+
var mParents = AdditionalElementsUtils.getParents(true, oOverlay, oPlugin);
|
|
248
|
+
if (bHasChangeHandler) {
|
|
249
|
+
if (mRevealAction.changeOnRelevantContainer) {
|
|
250
|
+
//we have the child overlay, so we need the parents
|
|
251
|
+
bRevealEnabled = oPlugin.hasStableId(mParents.relevantContainerOverlay)
|
|
252
|
+
&& oPlugin.hasStableId(mParents.parentOverlay);
|
|
253
|
+
} else {
|
|
254
|
+
bRevealEnabled = true;
|
|
255
|
+
}
|
|
256
|
+
if (!mRevealAction.getAggregationName) {
|
|
257
|
+
mRevealAction.getAggregationName = defaultGetAggregationName;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Check if the invisible element can be moved to the target aggregation
|
|
261
|
+
if (bRevealEnabled && (sSourceAggregation !== sTargetAggregation)) {
|
|
262
|
+
var oAggregationOverlay = mParents.parentOverlay.getAggregationOverlay(sTargetAggregation);
|
|
263
|
+
return Utils.checkTargetZone(oAggregationOverlay, oOverlay, oPlugin);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return bRevealEnabled;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return oHasChangeHandlerPromise.then(function(bIncludeReveal) {
|
|
272
|
+
if (bIncludeReveal) {
|
|
273
|
+
mReveal.elements.push({
|
|
274
|
+
element: oInvisibleElement,
|
|
275
|
+
designTimeMetadata: oDesignTimeMetadata,
|
|
276
|
+
action: mRevealAction,
|
|
277
|
+
sourceAggregation: sSourceAggregation,
|
|
278
|
+
targetAggregation: sTargetAggregation
|
|
279
|
+
});
|
|
280
|
+
var mName = oDesignTimeMetadata.getName(oInvisibleElement);
|
|
281
|
+
if (mName) {
|
|
282
|
+
mReveal.controlTypeNames.push(mName);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return mReveal;
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Calculate a structure with all "add/reveal/custom" action relevant data collected per aggregation:
|
|
292
|
+
* <pre>
|
|
293
|
+
* {
|
|
294
|
+
* <aggregationName> : {
|
|
295
|
+
* addViaDelegate : {
|
|
296
|
+
* designTimeMetadata : <sap.ui.dt.ElementDesignTimeMetadata of parent>,
|
|
297
|
+
* action : <add.delegate action section from designTimeMetadata>
|
|
298
|
+
* },
|
|
299
|
+
* reveal : {
|
|
300
|
+
* elements : [{
|
|
301
|
+
* element : <invisible element>,
|
|
302
|
+
* designTimeMetadata : <sap.ui.dt.ElementDesignTimeMetadata of invisible element>,
|
|
303
|
+
* action : <reveal action section from designTimeMetadata>,
|
|
304
|
+
* sourceAggregation: <aggregation where this element is currently located>
|
|
305
|
+
* }],
|
|
306
|
+
* controlTypeNames : string[] <all controlTypeNames collected via designTimeMetadata>
|
|
307
|
+
* },
|
|
308
|
+
* addViaCustom : {
|
|
309
|
+
* designTimeMetadata : <sap.ui.dt.ElementDesignTimeMetadata of parent>,
|
|
310
|
+
* action : <add.custom action section from designTimeMetadata>
|
|
311
|
+
* items : <add.custom action's array of items from the getItems() function>
|
|
312
|
+
* }
|
|
313
|
+
* },
|
|
314
|
+
* <aggregationName2> : ...
|
|
315
|
+
* }
|
|
316
|
+
* </pre>
|
|
317
|
+
*
|
|
318
|
+
* @param {boolean} bSibling - Indicates if the elements should be added as sibling (true) or child (false) to the overlay
|
|
319
|
+
* @param {sap.ui.dt.ElementOverlay} oSourceElementOverlay - Elements will be added in relation (sibling/parent) to this overlay
|
|
320
|
+
* @param {sap.ui.rta.plugin.additionalElements.AdditionalElementsPlugin} oPlugin - Instance of the AdditionalElementsPlugin
|
|
321
|
+
* @param {boolean} [bInvalidate] - Option to prevent cached actions to be returned
|
|
322
|
+
*
|
|
323
|
+
* @return {Promise} Resolving to a structure with all "add/reveal/custom" action relevant data collected
|
|
324
|
+
*/
|
|
325
|
+
ActionExtractor.getActions = function(bSibling, oSourceElementOverlay, oPlugin, bInvalidate) {
|
|
326
|
+
var sSiblingOrChild = bSibling ? "asSibling" : "asChild";
|
|
327
|
+
if (!bInvalidate && oSourceElementOverlay._mAddActions) {
|
|
328
|
+
return Promise.resolve(oSourceElementOverlay._mAddActions[sSiblingOrChild]);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
var oRevealActionsPromise = this._getRevealActions(bSibling, oSourceElementOverlay, oPlugin);
|
|
332
|
+
var oAddPropertyActionsPromise = this._getAddViaDelegateActions(bSibling, oSourceElementOverlay, oPlugin);
|
|
333
|
+
var oCustomAddActionsPromise = this._getCustomAddActions(bSibling, oSourceElementOverlay, oPlugin);
|
|
334
|
+
|
|
335
|
+
return Promise.all([
|
|
336
|
+
oRevealActionsPromise,
|
|
337
|
+
oAddPropertyActionsPromise,
|
|
338
|
+
oCustomAddActionsPromise,
|
|
339
|
+
checkInvalidAddActions(bSibling, oSourceElementOverlay, oPlugin)
|
|
340
|
+
]).then(function(aAllActions) {
|
|
341
|
+
//join and condense all action data
|
|
342
|
+
var mAllActions = merge(aAllActions[0], aAllActions[1], aAllActions[2]);
|
|
343
|
+
oSourceElementOverlay._mAddActions = oSourceElementOverlay._mAddActions || {asSibling: {}, asChild: {}};
|
|
344
|
+
oSourceElementOverlay._mAddActions[sSiblingOrChild] = mAllActions;
|
|
345
|
+
return mAllActions;
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Returns the already calculated actions of an Overlay, or undefined if no actions available
|
|
351
|
+
* @param {boolean} bSibling - Indicates if the elements should be added as sibling (true) or child (false) to the overlay
|
|
352
|
+
* @param {sap.ui.dt.ElementOverlay} oOverlay - Elements will be added in relation (sibling/parent) to this overlay
|
|
353
|
+
* @returns {object/undefined} - Object with all "add/reveal/custom" action relevant data collected or undefined if no actions available
|
|
354
|
+
*/
|
|
355
|
+
ActionExtractor.getActionsOrUndef = function(bSibling, oOverlay) {
|
|
356
|
+
var sSiblingOrChild = bSibling ? "asSibling" : "asChild";
|
|
357
|
+
return oOverlay._mAddActions && oOverlay._mAddActions[sSiblingOrChild];
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Returns the Reveal actions data (parameters + elements) for an Overlay
|
|
362
|
+
* @param {boolean} bSibling - If source element overlay should be sibling or parent to the newly added fields
|
|
363
|
+
* @param {sap.ui.dt.ElementOverlay} oSourceElementOverlay - Overlay where the action is triggered
|
|
364
|
+
* @param {sap.ui.rta.plugin.additionalElements.AdditionalElementsPlugin} oPlugin - Instance of the AdditionalElements plugin
|
|
365
|
+
*
|
|
366
|
+
* @returns {Promise<object>} Reveal action data
|
|
367
|
+
*/
|
|
368
|
+
ActionExtractor._getRevealActions = function(bSibling, oSourceElementOverlay, oPlugin) {
|
|
369
|
+
var mParents = AdditionalElementsUtils.getParents(bSibling, oSourceElementOverlay, oPlugin);
|
|
370
|
+
var aParents = [mParents.parentOverlay];
|
|
371
|
+
if (mParents.relevantContainer !== mParents.parent) {
|
|
372
|
+
aParents = ElementUtil.findAllSiblingsInContainer(mParents.parent, mParents.relevantContainer).map(function(oParent) {
|
|
373
|
+
return OverlayRegistry.getOverlay(oParent);
|
|
374
|
+
}).filter(function (oOverlay) {
|
|
375
|
+
return oOverlay;
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
var aAggregationNames = [];
|
|
379
|
+
if (mParents.parentOverlay) {
|
|
380
|
+
aAggregationNames = mParents.parentOverlay.getAggregationOverlays().filter(function(oAggregationOverlay) {
|
|
381
|
+
return !oAggregationOverlay.getDesignTimeMetadata().isIgnored(mParents.parent);
|
|
382
|
+
}).map(function(oAggregationOverlay) {
|
|
383
|
+
return oAggregationOverlay.getAggregationName();
|
|
384
|
+
});
|
|
385
|
+
return aAggregationNames.reduce(function(oPreviousPromise, sAggregationName) {
|
|
386
|
+
return oPreviousPromise.then(function(mReveal) {
|
|
387
|
+
return getRevealActionFromAggregations(aParents, mReveal, sAggregationName, aAggregationNames, oPlugin);
|
|
388
|
+
});
|
|
389
|
+
}, Promise.resolve({}));
|
|
390
|
+
}
|
|
391
|
+
return Promise.resolve({});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Return the AddViaDelegate action data (parameters + elements) for an Overlay.
|
|
396
|
+
* @param {boolean} bSibling - If source element overlay should be sibling or parent to the newly added fields
|
|
397
|
+
* @param {sap.ui.dt.ElementOverlay} oSourceElementOverlay - Overlay where the action is triggered
|
|
398
|
+
* @param {sap.ui.rta.plugin.additionalElements.AdditionalElementsPlugin} oPlugin - Instance of the AdditionalElementsPlugin
|
|
399
|
+
*
|
|
400
|
+
* @returns {Promise<object>} AddViaDelegate action data
|
|
401
|
+
*/
|
|
402
|
+
ActionExtractor._getAddViaDelegateActions = function(bSibling, oSourceElementOverlay, oPlugin) {
|
|
403
|
+
var mParents = AdditionalElementsUtils.getParents(bSibling, oSourceElementOverlay, oPlugin);
|
|
404
|
+
var oDesignTimeMetadata = mParents.parentOverlay && mParents.parentOverlay.getDesignTimeMetadata();
|
|
405
|
+
return Promise.resolve()
|
|
406
|
+
.then(function() {
|
|
407
|
+
var aActions = oDesignTimeMetadata ? oDesignTimeMetadata.getActionDataFromAggregations("add", mParents.parent, undefined, "delegate") : [];
|
|
408
|
+
if (aActions.length) {
|
|
409
|
+
return loadKnownDefaultDelegateLibraries()
|
|
410
|
+
.then(filterValidAddPropertyActions.bind(this, aActions, mParents, oPlugin));
|
|
411
|
+
}
|
|
412
|
+
return [];
|
|
413
|
+
}.bind(this))
|
|
414
|
+
.then(function(aActions) {
|
|
415
|
+
return aActions.reduce(function (oPreviousPromise, oAction) {
|
|
416
|
+
return oPreviousPromise
|
|
417
|
+
.then(function (oReturn) {
|
|
418
|
+
return getAddViaDelegateActionData.call(this, oAction, oDesignTimeMetadata, oPlugin)
|
|
419
|
+
.then(function (mAction) {
|
|
420
|
+
if (mAction) {
|
|
421
|
+
mAction.addPropertyActionData.relevantContainer = mParents.relevantContainer;
|
|
422
|
+
if (!oReturn[mAction.aggregationName]) {
|
|
423
|
+
oReturn[mAction.aggregationName] = {};
|
|
424
|
+
}
|
|
425
|
+
oReturn[mAction.aggregationName].addViaDelegate = mAction.addPropertyActionData;
|
|
426
|
+
}
|
|
427
|
+
return oReturn;
|
|
428
|
+
});
|
|
429
|
+
}.bind(this));
|
|
430
|
+
}.bind(this), Promise.resolve({}));
|
|
431
|
+
}.bind(this));
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Return the CustomAdd action data (parameters + elements) for an Overlay.
|
|
436
|
+
* @param {boolean} bSibling - If source element overlay should be sibling or parent to the newly added fields
|
|
437
|
+
* @param {sap.ui.dt.ElementOverlay} oOverlay - Overlay where the action is triggered
|
|
438
|
+
* @param {sap.ui.rta.plugin.additionalElements.AdditionalElementsPlugin} oPlugin - Instance of the AdditionalElementsPlugin
|
|
439
|
+
*
|
|
440
|
+
* @returns {Promise<object>} CustomAdd action data
|
|
441
|
+
*/
|
|
442
|
+
ActionExtractor._getCustomAddActions = function(bSibling, oOverlay, oPlugin) {
|
|
443
|
+
var mParents = AdditionalElementsUtils.getParents(bSibling, oOverlay, oPlugin);
|
|
444
|
+
var oDesignTimeMetadata = mParents.parentOverlay && mParents.parentOverlay.getDesignTimeMetadata();
|
|
445
|
+
var aActions = oDesignTimeMetadata && oDesignTimeMetadata.getActionDataFromAggregations("add", mParents.parent, undefined, "custom") || [];
|
|
446
|
+
|
|
447
|
+
function getAction(mAction, oCheckElement) {
|
|
448
|
+
var aItems = [];
|
|
449
|
+
return Promise.resolve()
|
|
450
|
+
.then(function () {
|
|
451
|
+
if (mAction && typeof mAction.getItems === "function") {
|
|
452
|
+
var oCheckElementOverlay = OverlayRegistry.getOverlay(oCheckElement);
|
|
453
|
+
if (oPlugin.hasStableId(oCheckElementOverlay)) {
|
|
454
|
+
return mAction.getItems(oCheckElement);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return aItems;
|
|
458
|
+
})
|
|
459
|
+
.then(function (aItemsFromAction) {
|
|
460
|
+
aItems = aItemsFromAction || [];
|
|
461
|
+
var aChangeHandlerPromises = aItems.reduce(function (aPromises, oItem) {
|
|
462
|
+
// adjust relevant container
|
|
463
|
+
if (oItem.changeSpecificData.changeOnRelevantContainer) {
|
|
464
|
+
oCheckElement = mParents.relevantContainer;
|
|
465
|
+
}
|
|
466
|
+
if (oItem.changeSpecificData.changeType) {
|
|
467
|
+
aPromises.push(oPlugin.hasChangeHandler(oItem.changeSpecificData.changeType, oCheckElement));
|
|
468
|
+
}
|
|
469
|
+
return aPromises;
|
|
470
|
+
}, []);
|
|
471
|
+
|
|
472
|
+
return Promise.all(aChangeHandlerPromises);
|
|
473
|
+
})
|
|
474
|
+
.then(function (aHasChangeHandlerForCustomItems) {
|
|
475
|
+
if (aHasChangeHandlerForCustomItems.indexOf(false) === -1) {
|
|
476
|
+
return {
|
|
477
|
+
aggregationName: mAction.aggregation,
|
|
478
|
+
addViaCustom: {
|
|
479
|
+
designTimeMetadata: oDesignTimeMetadata,
|
|
480
|
+
action: mAction,
|
|
481
|
+
items: aItems
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
return undefined;
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
var oCheckElement = mParents.parent;
|
|
490
|
+
return aActions.reduce(function(oPreviousPromise, oAction) {
|
|
491
|
+
return oPreviousPromise.then(function(oReturn) {
|
|
492
|
+
return getAction.call(this, oAction, oCheckElement).then(function(mAction) {
|
|
493
|
+
if (mAction) {
|
|
494
|
+
oReturn[mAction.aggregationName] = {
|
|
495
|
+
addViaCustom: mAction.addViaCustom
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
return oReturn;
|
|
499
|
+
});
|
|
500
|
+
}.bind(this));
|
|
501
|
+
}.bind(this), Promise.resolve({}));
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
return ActionExtractor;
|
|
505
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<core:FragmentDefinition
|
|
2
|
+
xmlns="sap.m"
|
|
3
|
+
xmlns:core="sap.ui.core"
|
|
4
|
+
xmlns:layout="sap.ui.layout">
|
|
5
|
+
|
|
6
|
+
<Dialog
|
|
7
|
+
class="sapUIRtaFieldRepositoryDialog sapUiNoContentPadding"
|
|
8
|
+
horizontalScrolling="false">
|
|
9
|
+
<buttons>
|
|
10
|
+
<Button
|
|
11
|
+
id="rta_addDialogOkButton"
|
|
12
|
+
text="{i18n>BTN_FREP_OK}"
|
|
13
|
+
press="._submitDialog"
|
|
14
|
+
type="Emphasized"/>
|
|
15
|
+
<Button
|
|
16
|
+
text="{i18n>BTN_FREP_CANCEL}"
|
|
17
|
+
press="._cancelDialog"/>
|
|
18
|
+
</buttons>
|
|
19
|
+
<content>
|
|
20
|
+
<Toolbar>
|
|
21
|
+
<SearchField
|
|
22
|
+
width="100%"
|
|
23
|
+
liveChange="._updateModelFilter"/>
|
|
24
|
+
<Button
|
|
25
|
+
text=""
|
|
26
|
+
icon="sap-icon://sort"
|
|
27
|
+
press="._resortList"/>
|
|
28
|
+
<Button
|
|
29
|
+
id="rta_customFieldButton"
|
|
30
|
+
text=""
|
|
31
|
+
icon="sap-icon://add"
|
|
32
|
+
tooltip="{/customFieldButtonTooltip}"
|
|
33
|
+
enabled="{/customFieldEnabled}"
|
|
34
|
+
visible="{/customFieldVisible}"
|
|
35
|
+
press="._redirectToCustomFieldCreation"/>
|
|
36
|
+
</Toolbar>
|
|
37
|
+
<layout:VerticalLayout
|
|
38
|
+
id="rta_businessContextContainer"
|
|
39
|
+
class="sapUIRtaBusinessContextContainer"
|
|
40
|
+
visible="{/businessContextVisible}"
|
|
41
|
+
content="{/businessContextTexts}">
|
|
42
|
+
<Text text="{text}"/>
|
|
43
|
+
</layout:VerticalLayout>
|
|
44
|
+
<ScrollContainer
|
|
45
|
+
class="sapUIRtaCCDialogScrollContainer"
|
|
46
|
+
vertical="true"
|
|
47
|
+
horizontal="false">
|
|
48
|
+
<List
|
|
49
|
+
id="rta_addElementsDialogList"
|
|
50
|
+
mode="MultiSelect"
|
|
51
|
+
includeItemInSelection="true"
|
|
52
|
+
growing="true"
|
|
53
|
+
growingScrollToLoad="true"
|
|
54
|
+
items="{ path: '/elements', sorter: { path: 'label', descending: false}, templateShareable: false }"
|
|
55
|
+
noDataText="{i18n>MSG_NO_FIELDS}">
|
|
56
|
+
<CustomListItem
|
|
57
|
+
class="sapUIRtaListItem"
|
|
58
|
+
type="Active"
|
|
59
|
+
selected="{selected}"
|
|
60
|
+
tooltip="{tooltip}">
|
|
61
|
+
<VBox>
|
|
62
|
+
<Label
|
|
63
|
+
design="Standard"
|
|
64
|
+
text="{= ${parentPropertyName} && ${duplicateName} ? ${label} + ' (' + ${parentPropertyName} + ')' : ${label} }"/>
|
|
65
|
+
<Label
|
|
66
|
+
text="{= ${originalLabel} ? ${i18n>LBL_FREP}.replace('{0}', ${originalLabel}) : ''}"
|
|
67
|
+
visible="{= !!${originalLabel} }"/>
|
|
68
|
+
</VBox>
|
|
69
|
+
</CustomListItem>
|
|
70
|
+
</List>
|
|
71
|
+
</ScrollContainer>
|
|
72
|
+
</content>
|
|
73
|
+
</Dialog>
|
|
74
|
+
</core:FragmentDefinition>
|