@openui5/sap.ui.rta 1.131.1 → 1.132.1
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/.eslintrc.json +1 -2
- package/THIRDPARTY.txt +1 -1
- package/package.json +6 -6
- package/src/sap/ui/rta/.library +2 -2
- package/src/sap/ui/rta/Client.js +2 -2
- package/src/sap/ui/rta/RuntimeAuthoring.js +26 -10
- package/src/sap/ui/rta/Utils.js +2 -2
- package/src/sap/ui/rta/api/startAdaptation.js +1 -1
- package/src/sap/ui/rta/api/startKeyUserAdaptation.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantDialog.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantManager.js +2 -2
- package/src/sap/ui/rta/appVariant/AppVariantOverviewDialog.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantUtils.js +1 -1
- package/src/sap/ui/rta/appVariant/Feature.js +1 -1
- package/src/sap/ui/rta/appVariant/S4HanaCloudBackend.js +1 -1
- package/src/sap/ui/rta/appVariant/Utils.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/Component.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_en_US_saptrc.properties +27 -27
- package/src/sap/ui/rta/appVariant/manageApps/webapp/index.html +3 -3
- package/src/sap/ui/rta/appVariant/manageApps/webapp/index.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/model/models.js +1 -1
- package/src/sap/ui/rta/command/AddIFrame.js +2 -2
- package/src/sap/ui/rta/command/AddProperty.js +2 -2
- package/src/sap/ui/rta/command/AddXML.js +2 -2
- package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +2 -2
- package/src/sap/ui/rta/command/AnnotationCommand.js +79 -0
- package/src/sap/ui/rta/command/AppDescriptorCommand.js +2 -2
- package/src/sap/ui/rta/command/BaseCommand.js +2 -2
- package/src/sap/ui/rta/command/BindProperty.js +6 -8
- package/src/sap/ui/rta/command/Combine.js +2 -2
- package/src/sap/ui/rta/command/CommandFactory.js +3 -3
- package/src/sap/ui/rta/command/CompositeCommand.js +2 -2
- package/src/sap/ui/rta/command/ControlVariantConfigure.js +9 -5
- package/src/sap/ui/rta/command/ControlVariantSave.js +2 -2
- package/src/sap/ui/rta/command/ControlVariantSaveAs.js +8 -6
- package/src/sap/ui/rta/command/ControlVariantSetTitle.js +14 -11
- package/src/sap/ui/rta/command/ControlVariantSwitch.js +6 -4
- package/src/sap/ui/rta/command/CreateContainer.js +2 -2
- package/src/sap/ui/rta/command/CustomAdd.js +2 -2
- package/src/sap/ui/rta/command/FlexCommand.js +2 -2
- package/src/sap/ui/rta/command/LREPSerializer.js +2 -2
- package/src/sap/ui/rta/command/LocalReset.js +2 -2
- package/src/sap/ui/rta/command/Move.js +2 -2
- package/src/sap/ui/rta/command/Property.js +2 -2
- package/src/sap/ui/rta/command/Remove.js +2 -2
- package/src/sap/ui/rta/command/Rename.js +2 -2
- package/src/sap/ui/rta/command/Resize.js +2 -2
- package/src/sap/ui/rta/command/Reveal.js +2 -2
- package/src/sap/ui/rta/command/Settings.js +2 -2
- package/src/sap/ui/rta/command/Split.js +2 -2
- package/src/sap/ui/rta/command/Stack.js +2 -2
- package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +14 -2
- package/src/sap/ui/rta/enablement/TestDelegate.js +1 -1
- package/src/sap/ui/rta/enablement/elementActionTest.js +15 -16
- package/src/sap/ui/rta/library.js +3 -3
- package/src/sap/ui/rta/messagebundle.properties +18 -0
- package/src/sap/ui/rta/messagebundle_ar.properties +10 -0
- package/src/sap/ui/rta/messagebundle_bg.properties +13 -3
- package/src/sap/ui/rta/messagebundle_ca.properties +10 -0
- package/src/sap/ui/rta/messagebundle_cnr.properties +10 -0
- package/src/sap/ui/rta/messagebundle_cs.properties +10 -0
- package/src/sap/ui/rta/messagebundle_cy.properties +10 -0
- package/src/sap/ui/rta/messagebundle_da.properties +10 -0
- package/src/sap/ui/rta/messagebundle_de.properties +10 -0
- package/src/sap/ui/rta/messagebundle_el.properties +10 -0
- package/src/sap/ui/rta/messagebundle_en.properties +10 -0
- package/src/sap/ui/rta/messagebundle_en_GB.properties +10 -0
- package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +10 -0
- package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +347 -325
- package/src/sap/ui/rta/messagebundle_es.properties +10 -0
- package/src/sap/ui/rta/messagebundle_es_MX.properties +18 -8
- package/src/sap/ui/rta/messagebundle_et.properties +10 -0
- package/src/sap/ui/rta/messagebundle_fi.properties +10 -0
- package/src/sap/ui/rta/messagebundle_fr.properties +10 -0
- package/src/sap/ui/rta/messagebundle_fr_CA.properties +10 -0
- package/src/sap/ui/rta/messagebundle_hi.properties +10 -0
- package/src/sap/ui/rta/messagebundle_hr.properties +10 -0
- package/src/sap/ui/rta/messagebundle_hu.properties +10 -0
- package/src/sap/ui/rta/messagebundle_id.properties +10 -0
- package/src/sap/ui/rta/messagebundle_it.properties +10 -0
- package/src/sap/ui/rta/messagebundle_iw.properties +10 -0
- package/src/sap/ui/rta/messagebundle_ja.properties +10 -0
- package/src/sap/ui/rta/messagebundle_kk.properties +10 -0
- package/src/sap/ui/rta/messagebundle_ko.properties +10 -0
- package/src/sap/ui/rta/messagebundle_lt.properties +10 -0
- package/src/sap/ui/rta/messagebundle_lv.properties +10 -0
- package/src/sap/ui/rta/messagebundle_mk.properties +10 -0
- package/src/sap/ui/rta/messagebundle_ms.properties +14 -4
- package/src/sap/ui/rta/messagebundle_nl.properties +10 -0
- package/src/sap/ui/rta/messagebundle_no.properties +10 -0
- package/src/sap/ui/rta/messagebundle_pl.properties +10 -0
- package/src/sap/ui/rta/messagebundle_pt.properties +10 -0
- package/src/sap/ui/rta/messagebundle_pt_PT.properties +10 -0
- package/src/sap/ui/rta/messagebundle_ro.properties +10 -0
- package/src/sap/ui/rta/messagebundle_ru.properties +10 -0
- package/src/sap/ui/rta/messagebundle_sh.properties +10 -0
- package/src/sap/ui/rta/messagebundle_sk.properties +10 -0
- package/src/sap/ui/rta/messagebundle_sl.properties +10 -0
- package/src/sap/ui/rta/messagebundle_sr.properties +10 -0
- package/src/sap/ui/rta/messagebundle_sv.properties +10 -0
- package/src/sap/ui/rta/messagebundle_th.properties +10 -0
- package/src/sap/ui/rta/messagebundle_tr.properties +10 -0
- package/src/sap/ui/rta/messagebundle_uk.properties +11 -1
- package/src/sap/ui/rta/messagebundle_vi.properties +10 -0
- package/src/sap/ui/rta/messagebundle_zh_CN.properties +10 -0
- package/src/sap/ui/rta/messagebundle_zh_TW.properties +10 -0
- package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +2 -2
- package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
- package/src/sap/ui/rta/plugin/Combine.js +2 -2
- package/src/sap/ui/rta/plugin/CompVariant.js +4 -2
- package/src/sap/ui/rta/plugin/ControlVariant.js +5 -23
- package/src/sap/ui/rta/plugin/CreateContainer.js +2 -2
- package/src/sap/ui/rta/plugin/CutPaste.js +2 -2
- package/src/sap/ui/rta/plugin/DragDrop.js +2 -2
- package/src/sap/ui/rta/plugin/LocalReset.js +2 -2
- package/src/sap/ui/rta/plugin/Plugin.js +15 -13
- package/src/sap/ui/rta/plugin/RTAElementMover.js +2 -2
- package/src/sap/ui/rta/plugin/Remove.js +2 -2
- package/src/sap/ui/rta/plugin/Rename.js +3 -3
- package/src/sap/ui/rta/plugin/RenameHandler.js +5 -9
- package/src/sap/ui/rta/plugin/Resize.js +3 -3
- package/src/sap/ui/rta/plugin/Selection.js +2 -2
- package/src/sap/ui/rta/plugin/Settings.js +2 -21
- package/src/sap/ui/rta/plugin/Split.js +2 -2
- package/src/sap/ui/rta/plugin/Stretch.js +7 -5
- package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +94 -126
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +28 -31
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +141 -172
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +108 -137
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +2 -2
- package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +96 -141
- package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.fragment.xml +112 -0
- package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +183 -0
- package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +109 -0
- package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +239 -0
- package/src/sap/ui/rta/plugin/annotations/AnnotationTypes.js +15 -0
- package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +2 -2
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +3 -3
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialogController.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/urlCleaner.js +1 -1
- package/src/sap/ui/rta/service/Action.js +2 -2
- package/src/sap/ui/rta/service/ControllerExtension.js +2 -2
- package/src/sap/ui/rta/service/Outline.js +2 -2
- package/src/sap/ui/rta/service/Property.js +2 -2
- package/src/sap/ui/rta/service/Receiver.js +1 -1
- package/src/sap/ui/rta/service/Selection.js +2 -2
- package/src/sap/ui/rta/service/SupportTools.js +2 -2
- package/src/sap/ui/rta/service/index.js +1 -1
- package/src/sap/ui/rta/themes/base/WhatsNew.less +5 -0
- package/src/sap/ui/rta/themes/base/library.source.less +1 -1
- package/src/sap/ui/rta/themes/sap_hcb/library.source.less +1 -1
- package/src/sap/ui/rta/toolbar/Adaptation.js +2 -2
- package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +1 -1
- package/src/sap/ui/rta/toolbar/Base.js +2 -2
- package/src/sap/ui/rta/toolbar/BaseRenderer.js +1 -1
- package/src/sap/ui/rta/toolbar/Fiori.js +3 -4
- package/src/sap/ui/rta/toolbar/FioriLike.js +2 -2
- package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +2 -2
- package/src/sap/ui/rta/toolbar/Standalone.js +2 -2
- package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptations.js +1 -1
- package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +2 -2
- package/src/sap/ui/rta/toolbar/translation/Translation.js +3 -3
- package/src/sap/ui/rta/toolbar/versioning/Versioning.js +2 -2
- package/src/sap/ui/rta/util/Animation.js +1 -1
- package/src/sap/ui/rta/util/BindingsExtractor.js +1 -1
- package/src/sap/ui/rta/util/PluginManager.js +16 -10
- package/src/sap/ui/rta/util/PopupManager.js +3 -3
- package/src/sap/ui/rta/util/ReloadManager.js +9 -9
- package/src/sap/ui/rta/util/ServiceEventBus.js +2 -2
- package/src/sap/ui/rta/util/ServiceManager.js +2 -2
- package/src/sap/ui/rta/util/adaptationStarter.js +17 -2
- package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +2 -2
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +2 -2
- package/src/sap/ui/rta/util/changeVisualization/ChangeStates.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +5 -3
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/CombineVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/CreateContainerVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/MoveVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/RenameVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/SplitVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +1 -1
- package/src/sap/ui/rta/util/hasStableId.js +1 -1
- package/src/sap/ui/rta/util/showMessageBox.js +1 -1
- package/src/sap/ui/rta/util/validateFlexEnabled.js +1 -1
- package/src/sap/ui/rta/util/validateStableIds.js +1 -1
- package/src/sap/ui/rta/util/validateText.js +1 -1
- package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +2 -2
- package/src/sap/ui/rta/util/whatsNew/WhatsNewDialog.fragment.xml +5 -4
- package/src/sap/ui/rta/util/whatsNew/WhatsNewOverview.js +1 -1
- package/src/sap/ui/rta/util/whatsNew/WhatsNewOverviewDialog.fragment.xml +8 -2
- package/src/sap/ui/rta/util/whatsNew/WhatsNewUtils.js +1 -1
- package/src/sap/ui/rta/util/whatsNew/whatsNewContent/WhatsNewFeatures.js +1 -1
- package/src/sap/ui/rta/command/Annotation.js +0 -45
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* OpenUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2025 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -25,14 +25,14 @@ sap.ui.define([
|
|
|
25
25
|
* Helper object to build the RTA commands resulting from the AdditionalElements Plugin
|
|
26
26
|
*
|
|
27
27
|
* @author SAP SE
|
|
28
|
-
* @version 1.
|
|
28
|
+
* @version 1.132.1
|
|
29
29
|
* @private
|
|
30
30
|
* @since 1.94
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
const CommandBuilder = {};
|
|
33
33
|
|
|
34
34
|
function getRevealDataFromActions(mActions, oRevealedElement) {
|
|
35
|
-
|
|
35
|
+
let mRevealData;
|
|
36
36
|
mActions.reveal.elements.some(function(mElement) {
|
|
37
37
|
if (mElement.element.getId() === oRevealedElement.getId()) {
|
|
38
38
|
mRevealData = mElement;
|
|
@@ -44,81 +44,62 @@ sap.ui.define([
|
|
|
44
44
|
return mRevealData;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
function createCommandsForInvisibleElement(mPropertyBag) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Log.warning(`No move action configured for ${
|
|
66
|
-
mParents.parent.getMetadata().getName()
|
|
67
|
-
}, aggregation: ${oSelectedElement.aggregation}`, "sap.ui.rta");
|
|
68
|
-
}
|
|
69
|
-
return oCompositeCommand;
|
|
70
|
-
});
|
|
47
|
+
async function createCommandsForInvisibleElement(mPropertyBag) {
|
|
48
|
+
const oRevealCommandForInvisible = await createRevealCommandForInvisible(
|
|
49
|
+
mPropertyBag.selectedElement, mPropertyBag.actions, mPropertyBag.parents, mPropertyBag.plugin
|
|
50
|
+
);
|
|
51
|
+
mPropertyBag.compositeCommand.addCommand(oRevealCommandForInvisible);
|
|
52
|
+
const oMoveCommandForInvisible = await createMoveCommandForInvisible(
|
|
53
|
+
mPropertyBag.selectedElement, mPropertyBag.parents, mPropertyBag.siblingElement,
|
|
54
|
+
mPropertyBag.index, mPropertyBag.targetAggregation, mPropertyBag.plugin
|
|
55
|
+
);
|
|
56
|
+
if (oMoveCommandForInvisible) {
|
|
57
|
+
mPropertyBag.compositeCommand.addCommand(oMoveCommandForInvisible);
|
|
58
|
+
} else {
|
|
59
|
+
Log.warning(
|
|
60
|
+
`No move action configured for ${mPropertyBag.parents.parent.getMetadata().getName()}, aggregation: ${mPropertyBag.selectedElement.aggregation}`,
|
|
61
|
+
"sap.ui.rta"
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return mPropertyBag.compositeCommand;
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
function createRevealCommandForInvisible(mSelectedElement, mActions, mParents, oPlugin) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
const oRevealedElement = ElementUtil.getElementInstance(mSelectedElement.elementId);
|
|
69
|
+
const oRevealedElementOverlay = OverlayRegistry.getOverlay(oRevealedElement);
|
|
70
|
+
const mRevealData = getRevealDataFromActions(mActions, oRevealedElement);
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
var oRevealAction = mRevealData.action;
|
|
72
|
+
const sVMReference = oRevealedElementOverlay ? oPlugin.getVariantManagementReference(oRevealedElementOverlay) : undefined;
|
|
80
73
|
|
|
81
|
-
|
|
82
|
-
if (oRevealedElementOverlay) {
|
|
83
|
-
sVariantManagementReference = oPlugin.getVariantManagementReference(oRevealedElementOverlay);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (oRevealAction.changeOnRelevantContainer) {
|
|
74
|
+
if (mRevealData.action.changeOnRelevantContainer) {
|
|
87
75
|
return oPlugin.getCommandFactory().getCommandFor(oRevealedElement, "reveal", {
|
|
88
76
|
revealedElementId: oRevealedElement.getId(),
|
|
89
77
|
directParent: mParents.parent
|
|
90
|
-
},
|
|
78
|
+
}, mRevealData.designTimeMetadata, sVMReference);
|
|
91
79
|
}
|
|
92
|
-
return oPlugin.getCommandFactory().getCommandFor(
|
|
93
|
-
oRevealedElement,
|
|
94
|
-
"reveal",
|
|
95
|
-
{ },
|
|
96
|
-
oDesignTimeMetadata,
|
|
97
|
-
sVariantManagementReference
|
|
98
|
-
);
|
|
80
|
+
return oPlugin.getCommandFactory().getCommandFor(oRevealedElement, "reveal", {}, mRevealData.designTimeMetadata, sVMReference);
|
|
99
81
|
}
|
|
100
82
|
|
|
101
83
|
function createMoveCommandForInvisible(oSelectedElement, mParents, oSiblingElement, iIndex, sTargetAggregationName, oPlugin) {
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
const oRevealedElement = ElementUtil.getElementInstance(oSelectedElement.elementId);
|
|
85
|
+
const oRevealedElementOverlay = OverlayRegistry.getOverlay(oRevealedElement);
|
|
104
86
|
// Elements can also be moved between aggregations inside the parent
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
var iRevealTargetIndex = Utils.getIndex(mParents.parent, oSiblingElement, sTargetAggregationName);
|
|
109
|
-
var iRevealedSourceIndex = Utils.getIndex(oSourceParent, oRevealedElement, sSourceAggregationName) - 1;
|
|
87
|
+
const oSourceParent = oRevealedElementOverlay.getParentElementOverlay().getElement() || mParents.parent;
|
|
88
|
+
const iTempRevealTargetIndex = Utils.getIndex(mParents.parent, oSiblingElement, sTargetAggregationName);
|
|
89
|
+
const iRevealedSourceIndex = Utils.getIndex(oSourceParent, oRevealedElement, oSelectedElement.sourceAggregation) - 1;
|
|
110
90
|
|
|
111
|
-
iRevealTargetIndex = iIndex !== undefined ?
|
|
112
|
-
iIndex : ElementUtil.adjustIndexForMove(oSourceParent,
|
|
91
|
+
const iRevealTargetIndex = iIndex !== undefined ?
|
|
92
|
+
iIndex : ElementUtil.adjustIndexForMove(oSourceParent, mParents.parent, iRevealedSourceIndex, iTempRevealTargetIndex);
|
|
113
93
|
|
|
114
|
-
if (
|
|
94
|
+
if (
|
|
95
|
+
iRevealTargetIndex !== iRevealedSourceIndex
|
|
115
96
|
|| mParents.parent !== oRevealedElement.getParent()
|
|
116
|
-
||
|
|
97
|
+
|| oSelectedElement.sourceAggregation !== sTargetAggregationName
|
|
117
98
|
) {
|
|
118
|
-
|
|
99
|
+
const oSourceParentOverlay = OverlayRegistry.getOverlay(oRevealedElement) ?
|
|
119
100
|
OverlayRegistry.getOverlay(oRevealedElement).getParentAggregationOverlay() : mParents.relevantContainerOverlay;
|
|
120
|
-
|
|
121
|
-
|
|
101
|
+
const oSourceParentDesignTimeMetadata = oSourceParentOverlay.getDesignTimeMetadata();
|
|
102
|
+
const sVariantManagementReference = oPlugin.getVariantManagementReference(oRevealedElementOverlay);
|
|
122
103
|
|
|
123
104
|
return oPlugin.getCommandFactory().getCommandFor(mParents.relevantContainer, "move", {
|
|
124
105
|
movedElements: [{
|
|
@@ -128,19 +109,19 @@ sap.ui.define([
|
|
|
128
109
|
}],
|
|
129
110
|
source: {
|
|
130
111
|
parent: oSourceParent,
|
|
131
|
-
aggregation:
|
|
112
|
+
aggregation: oSelectedElement.sourceAggregation
|
|
132
113
|
},
|
|
133
114
|
target: {
|
|
134
|
-
parent:
|
|
115
|
+
parent: mParents.parent,
|
|
135
116
|
aggregation: sTargetAggregationName
|
|
136
117
|
}
|
|
137
|
-
},
|
|
118
|
+
}, oSourceParentDesignTimeMetadata, sVariantManagementReference);
|
|
138
119
|
}
|
|
139
120
|
return Promise.resolve();
|
|
140
121
|
}
|
|
141
122
|
|
|
142
123
|
function areLibDependenciesMissing(oComponent, mRequiredLibraries) {
|
|
143
|
-
|
|
124
|
+
const mAppsLibDependencies = oComponent.getManifestEntry("/sap.ui5/dependencies/libs");
|
|
144
125
|
return Object.keys(mRequiredLibraries).some(function(sRequiredLib) {
|
|
145
126
|
return !mAppsLibDependencies[sRequiredLib] || mAppsLibDependencies[sRequiredLib].lazy;
|
|
146
127
|
});
|
|
@@ -148,11 +129,10 @@ sap.ui.define([
|
|
|
148
129
|
|
|
149
130
|
function createCommandForAddLibrary(mParents, mRequiredLibraries, oParentAggregationDTMetadata, oPlugin) {
|
|
150
131
|
if (mRequiredLibraries) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
var sReference = mManifest["sap.app"].id;
|
|
132
|
+
const oComponent = FlUtils.getAppComponentForControl(mParents.relevantContainer);
|
|
133
|
+
if (areLibDependenciesMissing(oComponent, mRequiredLibraries)) {
|
|
134
|
+
const mManifest = oComponent.getManifest();
|
|
135
|
+
const sReference = mManifest["sap.app"].id;
|
|
156
136
|
return oPlugin.getCommandFactory().getCommandFor(mParents.publicParent, "addLibrary", {
|
|
157
137
|
reference: sReference,
|
|
158
138
|
parameters: { libraries: mRequiredLibraries },
|
|
@@ -163,36 +143,28 @@ sap.ui.define([
|
|
|
163
143
|
return Promise.resolve();
|
|
164
144
|
}
|
|
165
145
|
|
|
166
|
-
function createCommandsForAddViaDelegate(mPropertyBag) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
oCompositeCommand.addCommand(oAddViaDelegateCommand);
|
|
182
|
-
}
|
|
183
|
-
return oCompositeCommand;
|
|
184
|
-
});
|
|
146
|
+
async function createCommandsForAddViaDelegate(mPropertyBag) {
|
|
147
|
+
const mAddViaDelegateAction = mPropertyBag.actions.addViaDelegate.action;
|
|
148
|
+
const oParentAggregationOverlay = mPropertyBag.parents.parentOverlay.getAggregationOverlay(mPropertyBag.actions.aggregation);
|
|
149
|
+
const oParentAggregationDTMetadata = oParentAggregationOverlay.getDesignTimeMetadata();
|
|
150
|
+
const oCommandForAddLibrary = await createCommandForAddLibrary(
|
|
151
|
+
mPropertyBag.parents, mAddViaDelegateAction.delegateInfo.requiredLibraries, oParentAggregationDTMetadata, mPropertyBag.plugin
|
|
152
|
+
);
|
|
153
|
+
if (oCommandForAddLibrary) {
|
|
154
|
+
mPropertyBag.compositeCommand.addCommand(oCommandForAddLibrary);
|
|
155
|
+
}
|
|
156
|
+
const oAddViaDelegateCommand = await createAddViaDelegateCommand(mPropertyBag, oParentAggregationDTMetadata);
|
|
157
|
+
if (oAddViaDelegateCommand) {
|
|
158
|
+
mPropertyBag.compositeCommand.addCommand(oAddViaDelegateCommand);
|
|
159
|
+
}
|
|
160
|
+
return mPropertyBag.compositeCommand;
|
|
185
161
|
}
|
|
186
162
|
|
|
187
163
|
function getODataServiceUriFromManifest(oManifest) {
|
|
188
|
-
|
|
164
|
+
let sUri = "";
|
|
189
165
|
if (oManifest) {
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
oSapApp && oSapApp.dataSources
|
|
193
|
-
&& oSapApp.dataSources.mainService
|
|
194
|
-
&& oSapApp.dataSources.mainService.uri
|
|
195
|
-
) {
|
|
166
|
+
const oSapApp = oManifest.getEntry ? oManifest.getEntry("sap.app") : oManifest["sap.app"];
|
|
167
|
+
if (oSapApp?.dataSources?.mainService?.uri) {
|
|
196
168
|
sUri = oSapApp.dataSources.mainService.uri;
|
|
197
169
|
}
|
|
198
170
|
}
|
|
@@ -204,33 +176,26 @@ sap.ui.define([
|
|
|
204
176
|
}
|
|
205
177
|
|
|
206
178
|
function createAddViaDelegateCommand(mPropertyBag, oParentAggregationDTMetadata) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
var oParent = mAddViaDelegateAction.changeOnRelevantContainer ? mParents.relevantContainer : mParents.parent;
|
|
215
|
-
var oParentOverlay = mAddViaDelegateAction.changeOnRelevantContainer ? mParents.relevantContainerOverlay : mParents.parentOverlay;
|
|
216
|
-
var sVariantManagementReference = oPlugin.getVariantManagementReference(oParentOverlay);
|
|
217
|
-
var iAddTargetIndex = Utils.getIndex(mParents.parent, oSiblingElement, mActions.aggregation, oParentAggregationDTMetadata.getData().getIndex);
|
|
218
|
-
var sCommandName = "addDelegateProperty";
|
|
219
|
-
var oManifest = FlUtils.getAppComponentForControl(mParents.parent).getManifest();
|
|
220
|
-
var sServiceUri = getODataServiceUriFromManifest(oManifest);
|
|
179
|
+
const mParents = mPropertyBag.parents;
|
|
180
|
+
const mAddViaDelegateAction = mPropertyBag.actions.addViaDelegate.action;
|
|
181
|
+
const oParent = mAddViaDelegateAction.changeOnRelevantContainer ? mParents.relevantContainer : mParents.parent;
|
|
182
|
+
const oParentOverlay = mAddViaDelegateAction.changeOnRelevantContainer ? mParents.relevantContainerOverlay : mParents.parentOverlay;
|
|
183
|
+
const iAddTargetIndex = Utils.getIndex(
|
|
184
|
+
mParents.parent, mPropertyBag.siblingElement, mPropertyBag.actions.aggregation, oParentAggregationDTMetadata.getData().getIndex
|
|
185
|
+
);
|
|
221
186
|
|
|
222
|
-
return
|
|
223
|
-
newControlId: createFieldLabelId(oParent,
|
|
224
|
-
index:
|
|
225
|
-
bindingString:
|
|
226
|
-
entityType:
|
|
187
|
+
return mPropertyBag.plugin.getCommandFactory().getCommandFor(mParents.parent, "addDelegateProperty", {
|
|
188
|
+
newControlId: createFieldLabelId(oParent, mPropertyBag.selectedElement.entityType, mPropertyBag.selectedElement.bindingPath),
|
|
189
|
+
index: mPropertyBag.index !== undefined ? mPropertyBag.index : iAddTargetIndex,
|
|
190
|
+
bindingString: mPropertyBag.selectedElement.bindingPath,
|
|
191
|
+
entityType: mPropertyBag.selectedElement.entityType, // needed for custom field support tool
|
|
227
192
|
parentId: mParents.parent.getId(),
|
|
228
|
-
propertyName:
|
|
229
|
-
oDataServiceVersion:
|
|
230
|
-
oDataServiceUri:
|
|
193
|
+
propertyName: mPropertyBag.selectedElement.name,
|
|
194
|
+
oDataServiceVersion: mPropertyBag.selectedElement.oDataServiceVersion,
|
|
195
|
+
oDataServiceUri: getODataServiceUriFromManifest(FlUtils.getAppComponentForControl(mParents.parent).getManifest()),
|
|
231
196
|
modelType: mAddViaDelegateAction.delegateInfo.modelType,
|
|
232
197
|
relevantContainerId: mParents.relevantContainer.getId()
|
|
233
|
-
}, oParentAggregationDTMetadata,
|
|
198
|
+
}, oParentAggregationDTMetadata, mPropertyBag.plugin.getVariantManagementReference(oParentOverlay));
|
|
234
199
|
}
|
|
235
200
|
|
|
236
201
|
/**
|
|
@@ -242,9 +207,9 @@ sap.ui.define([
|
|
|
242
207
|
* @param {Array<sap.ui.core.Element>} aSelectedElements - Selected elements when the action was triggered
|
|
243
208
|
* @param {string} sTargetAggregation - The aggregation where the element is being inserted
|
|
244
209
|
* @param {sap.ui.rta.plugin.additionalElements.AdditionalElementsPlugin} oPlugin - Instance of the AdditionalElementsPlugin
|
|
245
|
-
* @returns {Promise}
|
|
210
|
+
* @returns {Promise<undefined>} Resolves when the commands are created
|
|
246
211
|
*/
|
|
247
|
-
CommandBuilder.createCommands = function(mParents, oSiblingElement, mActions, iIndex, aSelectedElements, sTargetAggregation, oPlugin) {
|
|
212
|
+
CommandBuilder.createCommands = async function(mParents, oSiblingElement, mActions, iIndex, aSelectedElements, sTargetAggregation, oPlugin) {
|
|
248
213
|
// sort elements by label in descending order. When added the fields will be in ascending order on the UI
|
|
249
214
|
aSelectedElements.sort(function(oElement1, oElement2) {
|
|
250
215
|
if (oElement1.label > oElement2.label) {
|
|
@@ -257,12 +222,10 @@ sap.ui.define([
|
|
|
257
222
|
});
|
|
258
223
|
|
|
259
224
|
if (aSelectedElements.length > 0) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
aSelectedElements.forEach(function(oSelectedElement) {
|
|
265
|
-
var mPropertyBag = {
|
|
225
|
+
try {
|
|
226
|
+
const oCompositeCommand = await oPlugin.getCommandFactory().getCommandFor(mParents.parent, "composite");
|
|
227
|
+
for (const oSelectedElement of aSelectedElements) {
|
|
228
|
+
const mPropertyBag = {
|
|
266
229
|
compositeCommand: oCompositeCommand,
|
|
267
230
|
selectedElement: oSelectedElement,
|
|
268
231
|
parents: mParents,
|
|
@@ -274,36 +237,28 @@ sap.ui.define([
|
|
|
274
237
|
};
|
|
275
238
|
switch (oSelectedElement.type) {
|
|
276
239
|
case "invisible":
|
|
277
|
-
|
|
278
|
-
createCommandsForInvisibleElement.bind(this, mPropertyBag));
|
|
240
|
+
await createCommandsForInvisibleElement(mPropertyBag);
|
|
279
241
|
break;
|
|
280
242
|
case "delegate":
|
|
281
|
-
|
|
282
|
-
createCommandsForAddViaDelegate.bind(this, mPropertyBag));
|
|
243
|
+
await createCommandsForAddViaDelegate(mPropertyBag);
|
|
283
244
|
break;
|
|
284
245
|
default:
|
|
285
246
|
Log.error(`Can't create command for untreated element.type ${oSelectedElement.type}`);
|
|
286
247
|
}
|
|
287
|
-
}
|
|
288
|
-
return oPromise.then(function() { return oCompositeCommand; });
|
|
289
|
-
}.bind(this))
|
|
248
|
+
}
|
|
290
249
|
|
|
291
|
-
.then(function(oCompositeCommand) {
|
|
292
250
|
oPlugin.fireElementModified({
|
|
293
251
|
command: oCompositeCommand
|
|
294
252
|
});
|
|
295
|
-
})
|
|
296
|
-
|
|
297
|
-
.catch(function(vMessage) {
|
|
253
|
+
} catch (oError) {
|
|
298
254
|
throw DtUtils.propagateError(
|
|
299
|
-
|
|
255
|
+
oError,
|
|
300
256
|
"AdditionalElementsPlugin#_createCommands",
|
|
301
257
|
"Error occurred during _createCommands execution",
|
|
302
258
|
"sap.ui.rta.plugin"
|
|
303
259
|
);
|
|
304
|
-
}
|
|
260
|
+
}
|
|
305
261
|
}
|
|
306
|
-
return Promise.resolve();
|
|
307
262
|
};
|
|
308
263
|
|
|
309
264
|
return CommandBuilder;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<core:FragmentDefinition
|
|
2
|
+
xmlns:core="sap.ui.core"
|
|
3
|
+
xmlns:f="sap.ui.layout.form"
|
|
4
|
+
xmlns="sap.m"
|
|
5
|
+
>
|
|
6
|
+
<Dialog
|
|
7
|
+
id="sapUiRtaChangeAnnotationDialog"
|
|
8
|
+
verticalScrolling="true"
|
|
9
|
+
resizable="false"
|
|
10
|
+
draggable="true"
|
|
11
|
+
contentWidth="50rem"
|
|
12
|
+
contentHeight="25rem"
|
|
13
|
+
>
|
|
14
|
+
<customHeader>
|
|
15
|
+
<Bar>
|
|
16
|
+
<contentLeft>
|
|
17
|
+
<Label
|
|
18
|
+
id="sapUiRtaChangeAnnotationDialog_title"
|
|
19
|
+
class="sapUiSmallMargin"
|
|
20
|
+
text="{/title}"/>
|
|
21
|
+
</contentLeft>
|
|
22
|
+
<contentRight>
|
|
23
|
+
<Button
|
|
24
|
+
id="sapUiRtaChangeAnnotationDialog_toggleShowAllPropertiesButton"
|
|
25
|
+
class="sapUiSmallMargin"
|
|
26
|
+
text="{= ${/showChangedPropertiesOnly} ? ${i18n>ANNOTATION_CHANGE_DIALOG_BUTTON_ALL_PROPERTIES} : ${i18n>ANNOTATION_CHANGE_DIALOG_BUTTON_CHANGED_PROPERTIES}}"
|
|
27
|
+
press="switchDisplayMode"/>
|
|
28
|
+
</contentRight>
|
|
29
|
+
</Bar>
|
|
30
|
+
</customHeader>
|
|
31
|
+
<content>
|
|
32
|
+
<VBox>
|
|
33
|
+
<MessageStrip
|
|
34
|
+
text="{i18n>ANNOTATION_CHANGE_DIALOG_WARNING}"
|
|
35
|
+
type="Warning"
|
|
36
|
+
showIcon="true"
|
|
37
|
+
class="sapUiSmallMarginBottom">
|
|
38
|
+
<link>
|
|
39
|
+
<Link text="{i18n>ANNOTATION_CHANGE_DIALOG_WARNING_MORE_INFO}"
|
|
40
|
+
target="_blank"
|
|
41
|
+
href=""/> <!-- TODO: Change link once the docs are available -->
|
|
42
|
+
</link>
|
|
43
|
+
</MessageStrip>
|
|
44
|
+
<Label
|
|
45
|
+
id="sapUiRtaChangeAnnotationDialog_description"
|
|
46
|
+
visible="{= ${/description}.length > 0}"
|
|
47
|
+
text="{/description}"/>
|
|
48
|
+
<SearchField
|
|
49
|
+
id="sapUiRtaChangeAnnotationDialog_propertiesFilter"
|
|
50
|
+
placeholder="{i18n>ANNOTATION_CHANGE_DIALOG_PROPERTY_SEARCH}"
|
|
51
|
+
width="100%"
|
|
52
|
+
value="{/filterText}"
|
|
53
|
+
liveChange="onFilterProperties"/>
|
|
54
|
+
<f:Form editable="false">
|
|
55
|
+
<f:layout>
|
|
56
|
+
<f:ResponsiveGridLayout
|
|
57
|
+
labelSpanXL="3"
|
|
58
|
+
labelSpanL="3"
|
|
59
|
+
labelSpanM="3"
|
|
60
|
+
labelSpanS="12"
|
|
61
|
+
adjustLabelSpan="false"
|
|
62
|
+
emptySpanXL="4"
|
|
63
|
+
emptySpanL="4"
|
|
64
|
+
emptySpanM="4"
|
|
65
|
+
emptySpanS="0"
|
|
66
|
+
columnsXL="1"
|
|
67
|
+
columnsL="1"
|
|
68
|
+
columnsM="1"
|
|
69
|
+
singleContainerFullSize="false"/>
|
|
70
|
+
</f:layout>
|
|
71
|
+
<f:FormContainer
|
|
72
|
+
id="sapUiRtaChangeAnnotationDialog_propertyList"
|
|
73
|
+
formElements="{path: '/propertiesToDisplay', templateShareable: false}">
|
|
74
|
+
<f:FormElement label="{propertyName}">
|
|
75
|
+
<Select
|
|
76
|
+
visible="{path: '/valueType', formatter: '.formatters.isValueList'}"
|
|
77
|
+
selectedKey="{currentValue}"
|
|
78
|
+
change="onValueListChange"
|
|
79
|
+
items="{path: '/possibleValues', templateShareable: false}">
|
|
80
|
+
<core:Item key="{key}" text="{text}" />
|
|
81
|
+
</Select>
|
|
82
|
+
<Input
|
|
83
|
+
visible="{path: '/valueType', formatter: '.formatters.isString'}"
|
|
84
|
+
value="{currentValue}"
|
|
85
|
+
change="onStringChange"/>
|
|
86
|
+
<CheckBox
|
|
87
|
+
visible="{path: '/valueType', formatter: '.formatters.isBoolean'}"
|
|
88
|
+
selected="{=!!${currentValue}}"
|
|
89
|
+
select="onBooleanChange"/>
|
|
90
|
+
</f:FormElement>
|
|
91
|
+
</f:FormContainer>
|
|
92
|
+
</f:Form>
|
|
93
|
+
</VBox>
|
|
94
|
+
</content>
|
|
95
|
+
<beginButton>
|
|
96
|
+
<Button
|
|
97
|
+
id="sapUiRtaChangeAnnotationDialog_saveButton"
|
|
98
|
+
type="Emphasized"
|
|
99
|
+
text="{i18n>ANNOTATION_CHANGE_DIALOG_SAVE}"
|
|
100
|
+
press="onSavePress"
|
|
101
|
+
/>
|
|
102
|
+
</beginButton>
|
|
103
|
+
<endButton>
|
|
104
|
+
<Button
|
|
105
|
+
id="sapUiRtaChangeAnnotationDialog_cancelButton"
|
|
106
|
+
type="Transparent"
|
|
107
|
+
text="{i18n>ANNOTATION_CHANGE_DIALOG_CANCEL}"
|
|
108
|
+
press="onCancelPress"
|
|
109
|
+
/>
|
|
110
|
+
</endButton>
|
|
111
|
+
</Dialog>
|
|
112
|
+
</core:FragmentDefinition>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
|
|
2
|
+
/*!
|
|
3
|
+
* OpenUI5
|
|
4
|
+
* (c) Copyright 2009-2025 SAP SE or an SAP affiliate company.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
6
|
+
*/
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/ui/base/ManagedObject",
|
|
9
|
+
"sap/ui/core/Fragment",
|
|
10
|
+
"sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
|
|
11
|
+
"sap/ui/fl/write/api/PersistenceWriteAPI",
|
|
12
|
+
"sap/ui/model/json/JSONModel",
|
|
13
|
+
"sap/ui/model/resource/ResourceModel",
|
|
14
|
+
"sap/ui/rta/plugin/annotations/AnnotationChangeDialogController"
|
|
15
|
+
], function(
|
|
16
|
+
ManagedObject,
|
|
17
|
+
Fragment,
|
|
18
|
+
FlexRuntimeInfoAPI,
|
|
19
|
+
PersistenceWriteAPI,
|
|
20
|
+
JSONModel,
|
|
21
|
+
ResourceModel,
|
|
22
|
+
AnnotationChangeDialogController
|
|
23
|
+
) {
|
|
24
|
+
"use strict";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @class Constructor for a new sap.ui.rta.plugin.annotations.AnnotationChangeDialog.
|
|
28
|
+
* @extends sap.ui.base.ManagedObject
|
|
29
|
+
* @author SAP SE
|
|
30
|
+
* @version 1.132.1
|
|
31
|
+
* @constructor
|
|
32
|
+
* @since 1.132
|
|
33
|
+
* @private
|
|
34
|
+
* @ui5-restricted sap.ui.rta
|
|
35
|
+
*/
|
|
36
|
+
const AnnotationChangeDialog = ManagedObject.extend("sap.ui.rta.plugin.annotations.AnnotationChangeDialog");
|
|
37
|
+
|
|
38
|
+
AnnotationChangeDialog.prototype._createDialog = async function() {
|
|
39
|
+
this._oController = new AnnotationChangeDialogController();
|
|
40
|
+
const oPopover = await Fragment.load({
|
|
41
|
+
name: "sap.ui.rta.plugin.annotations.AnnotationChangeDialog",
|
|
42
|
+
controller: this._oController
|
|
43
|
+
});
|
|
44
|
+
this.oChangeAnnotationModel = new JSONModel();
|
|
45
|
+
oPopover.setModel(this.oChangeAnnotationModel);
|
|
46
|
+
const oI18nModel = new ResourceModel({ bundleName: "sap.ui.rta.messagebundle" });
|
|
47
|
+
oPopover.setModel(oI18nModel, "i18n");
|
|
48
|
+
return oPopover;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
AnnotationChangeDialog.prototype._openDialog = function() {
|
|
52
|
+
this._oPopover.open();
|
|
53
|
+
return this._oController.initialize();
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Annotation change info
|
|
58
|
+
*
|
|
59
|
+
* @typedef {object} sap.ui.rta.plugin.annotations.AnnotationChangeInfo
|
|
60
|
+
* @property {string} serviceUrl - Url of the OData service
|
|
61
|
+
* @property {object[]} properties - Array of properties
|
|
62
|
+
* @property {string} properties.annotationPath - Path of the property
|
|
63
|
+
* @property {string} properties.propertyName - Name of the property
|
|
64
|
+
* @property {string} properties.currentValue - Current value of the property
|
|
65
|
+
* @property {object[]} possibleValues - Array of possible values for value list type properties
|
|
66
|
+
* @property {string} possibleValues.key - Key of the option
|
|
67
|
+
* @property {string} possibleValues.text - Text of the option
|
|
68
|
+
* @property {string} [preSelectedProperty] - Name of the property that should be filtered for initially
|
|
69
|
+
* @private
|
|
70
|
+
* @ui5-restricted
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @callback sap.ui.rta.plugin.annotations.getAnnotationChangeInfo
|
|
75
|
+
* @property {sap.ui.core.Control} oControl - Control for which the annotation change is made
|
|
76
|
+
* @property {string} sAnnotation - Annotation name
|
|
77
|
+
* @returns {sap.ui.rta.plugin.annotations.AnnotationChangeInfo} - Annotation change info
|
|
78
|
+
* @private
|
|
79
|
+
* @ui5-restricted
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Annotation change definition
|
|
84
|
+
*
|
|
85
|
+
* @typedef {object} sap.ui.rta.plugin.annotations.AnnotationChangeDefinition
|
|
86
|
+
* @property {string} annotationChangeType - Change type
|
|
87
|
+
* @property {object} content - Change content
|
|
88
|
+
* @property {string} content.annotationPath - Path of the property
|
|
89
|
+
* @property {string} content.value - New value
|
|
90
|
+
* @property {string} serviceUrl - Url of the OData service
|
|
91
|
+
* @private
|
|
92
|
+
* @ui5-restricted
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Opens the annotation change dialog and returns the changes made by the user.
|
|
97
|
+
*
|
|
98
|
+
* @param {object} mPropertyBag - Property bag
|
|
99
|
+
* @param {string} mPropertyBag.title - Title of the dialog
|
|
100
|
+
* @param {string} mPropertyBag.type - Value type of the annotation, see {@link sap.ui.rta.plugin.annotations.AnnotationTypes}
|
|
101
|
+
* @param {object} mPropertyBag.delegate - Annotation change info provider delegate
|
|
102
|
+
* @param {sap.ui.rta.plugin.annotations.getAnnotationChangeInfo} mPropertyBag.delegate.getAnnotationsChangeInfo - Delegate function to get annotation change info
|
|
103
|
+
* @param {sap.ui.core.Control} mPropertyBag.control - Control for which the annotation change is made
|
|
104
|
+
* @param {string} mPropertyBag.annotation - Annotation name
|
|
105
|
+
* @param {string} [mPropertyBag.description] - Description of the dialog
|
|
106
|
+
* @returns {Promise<sap.ui.rta.plugin.annotations.AnnotationChangeDefinition[]>} - Array of changes made by the user
|
|
107
|
+
*/
|
|
108
|
+
AnnotationChangeDialog.prototype.openDialogAndHandleChanges = async function(mPropertyBag) {
|
|
109
|
+
const {
|
|
110
|
+
title: sAnnotationTitle,
|
|
111
|
+
type: sAnnotationValueType,
|
|
112
|
+
delegate: oDelegate,
|
|
113
|
+
control: oControl,
|
|
114
|
+
annotation: sAnnotation,
|
|
115
|
+
description: sAnnotationDescription = ""
|
|
116
|
+
} = mPropertyBag;
|
|
117
|
+
const {
|
|
118
|
+
serviceUrl: sServiceUrl,
|
|
119
|
+
properties: aProperties,
|
|
120
|
+
possibleValues: aPossibleValues,
|
|
121
|
+
preSelectedProperty: sPreSelectedPropertyKey
|
|
122
|
+
} = oDelegate.getAnnotationsChangeInfo(oControl, sAnnotation);
|
|
123
|
+
|
|
124
|
+
const aExistingChanges = PersistenceWriteAPI._getAnnotationChanges({
|
|
125
|
+
control: oControl
|
|
126
|
+
});
|
|
127
|
+
const aChangedAnnotations = aExistingChanges
|
|
128
|
+
.map((oChange) => {
|
|
129
|
+
return oChange.getContent().annotationPath;
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
this._oPopover ||= await this._createDialog();
|
|
133
|
+
|
|
134
|
+
const oOriginalProperties = {};
|
|
135
|
+
aProperties.forEach(({ annotationPath, currentValue }) => {
|
|
136
|
+
oOriginalProperties[annotationPath] = currentValue;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const sFilterText = sPreSelectedPropertyKey
|
|
140
|
+
? aProperties.find((oProperty) => oProperty.annotationPath === sPreSelectedPropertyKey).propertyName
|
|
141
|
+
: "";
|
|
142
|
+
this.oChangeAnnotationModel.setData({
|
|
143
|
+
title: sAnnotationTitle,
|
|
144
|
+
description: sAnnotationDescription,
|
|
145
|
+
properties: aProperties, // all properties
|
|
146
|
+
changedProperties: aProperties.filter(({ annotationPath }) => aChangedAnnotations.includes(annotationPath)),
|
|
147
|
+
propertiesToDisplay: aProperties, // switches dynamcially between all properties and changed properties
|
|
148
|
+
showChangedPropertiesOnly: false,
|
|
149
|
+
filterText: sFilterText,
|
|
150
|
+
possibleValues: aPossibleValues,
|
|
151
|
+
valueType: sAnnotationValueType
|
|
152
|
+
});
|
|
153
|
+
if (sFilterText) {
|
|
154
|
+
this._oController.filterProperties(sFilterText);
|
|
155
|
+
}
|
|
156
|
+
const oChangedProperties = await this._openDialog();
|
|
157
|
+
this._oPopover.close();
|
|
158
|
+
return Object.entries(oChangedProperties).map(([sPath, vNewValue]) => {
|
|
159
|
+
if (oOriginalProperties[sPath] === vNewValue) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
serviceUrl: sServiceUrl,
|
|
164
|
+
content: {
|
|
165
|
+
annotationPath: sPath,
|
|
166
|
+
value: vNewValue
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}).filter(Boolean);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
AnnotationChangeDialog.prototype.destroy = function(...aArgs) {
|
|
173
|
+
ManagedObject.prototype.destroy.apply(this, aArgs);
|
|
174
|
+
if (this._oPopover) {
|
|
175
|
+
this._oPopover.destroy();
|
|
176
|
+
}
|
|
177
|
+
if (this._oController) {
|
|
178
|
+
this._oController.destroy();
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return AnnotationChangeDialog;
|
|
183
|
+
});
|