@openui5/sap.ui.fl 1.123.1 → 1.124.0
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/package.json +3 -3
- package/src/sap/ui/fl/.library +1 -1
- package/src/sap/ui/fl/ChangePersistence.js +39 -48
- package/src/sap/ui/fl/ChangePersistenceFactory.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
- package/src/sap/ui/fl/FlexController.js +3 -34
- package/src/sap/ui/fl/FlexControllerFactory.js +1 -1
- package/src/sap/ui/fl/LayerUtils.js +1 -1
- package/src/sap/ui/fl/Utils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +113 -270
- package/src/sap/ui/fl/apply/_internal/appVariant/DescriptorChangeTypes.js +2 -1
- package/src/sap/ui/fl/apply/_internal/changes/Applier.js +36 -3
- package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +49 -5
- package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/controlVariants/URLHandler.js +28 -27
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +81 -44
- package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +30 -11
- package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +67 -70
- package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +14 -6
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +8 -7
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +108 -41
- package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +8 -15
- package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +7 -12
- package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +15 -19
- package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
- package/src/sap/ui/fl/apply/api/DelegateMediatorAPI.js +13 -86
- package/src/sap/ui/fl/apply/api/FlexRuntimeInfoAPI.js +14 -11
- package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/fl/changeHandler/Base.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +14 -29
- package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
- package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +2 -2
- package/src/sap/ui/fl/changeHandler/common/createIFrame.js +3 -2
- package/src/sap/ui/fl/descriptorRelated/Utils.js +16 -7
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +4 -4
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
- package/src/sap/ui/fl/designtime/util/IFrame.designtime.js +26 -0
- package/src/sap/ui/fl/designtime/util/editIFrame.js +8 -4
- package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/Storage.js +2 -2
- package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/connectors/KeyUserConnector.js +1 -1
- package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
- package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
- package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
- package/src/sap/ui/fl/library.js +43 -43
- package/src/sap/ui/fl/messagebundle_sh.properties +9 -9
- package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +1 -1
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
- package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/view/ContentDetails.view.xml +0 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/view/ContentDetailsEdit.view.xml +0 -1
- package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/util/IFrame.js +51 -64
- package/src/sap/ui/fl/util/IFrameRenderer.js +15 -9
- package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
- package/src/sap/ui/fl/util/resolveBinding.js +1 -1
- package/src/sap/ui/fl/variants/VariantModel.js +5 -5
- package/src/sap/ui/fl/write/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/write/_internal/Versions.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +2 -2
- package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +1 -1
- package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/delegates/ODataV2ReadDelegate.js +3 -3
- package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +12 -23
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/FlexObjectState.js +68 -95
- package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +2 -1
- package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
- package/src/sap/ui/fl/write/api/LocalResetAPI.js +9 -8
- package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +3 -7
- package/src/sap/ui/fl/write/api/SACIntegrationUpdateVariant.js +78 -0
- package/src/sap/ui/fl/write/api/VersionsAPI.js +4 -1
- package/src/sap/ui/fl/write/api/connectors/ObjectStorageConnector.js +9 -1
- package/src/sap/ui/fl/apply/_internal/DelegateMediatorNew.js +0 -193
- package/src/sap/ui/fl/apply/_internal/flexState/appDescriptorChanges/prepareAppDescriptorMap.js +0 -39
|
@@ -6,16 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/base/Log",
|
|
9
|
-
"sap/base/util/merge",
|
|
10
9
|
"sap/base/util/restricted/_pick",
|
|
11
|
-
"sap/ui/fl/requireAsync"
|
|
12
|
-
"sap/ui/core/util/reflection/JsControlTreeModifier"
|
|
10
|
+
"sap/ui/fl/requireAsync"
|
|
13
11
|
], function(
|
|
14
12
|
Log,
|
|
15
|
-
merge,
|
|
16
13
|
_pick,
|
|
17
|
-
requireAsync
|
|
18
|
-
JsControlTreeModifier
|
|
14
|
+
requireAsync
|
|
19
15
|
) {
|
|
20
16
|
"use strict";
|
|
21
17
|
|
|
@@ -26,292 +22,99 @@ sap.ui.define([
|
|
|
26
22
|
*
|
|
27
23
|
* @private
|
|
28
24
|
* @author SAP SE
|
|
29
|
-
* @version 1.
|
|
25
|
+
* @version 1.124.0
|
|
30
26
|
*
|
|
31
27
|
*/
|
|
32
28
|
const DelegateMediator = {};
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
DelegateMediator.types = {
|
|
37
|
-
READONLY: "readonly",
|
|
38
|
-
WRITEONLY: "writeonly",
|
|
39
|
-
COMPLETE: "complete"
|
|
40
|
-
};
|
|
30
|
+
let mModelSpecificDelegateItems = {};
|
|
31
|
+
let mControlSpecificDelegateItems = {};
|
|
41
32
|
|
|
42
|
-
function getModelTypeForControl(oControl
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (oControl.getModel) {
|
|
47
|
-
// get the default model
|
|
48
|
-
const oModel = oControl.getModel();
|
|
49
|
-
if (!oModel) {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
return oModel.getMetadata().getName();
|
|
33
|
+
function getModelTypeForControl(oControl) {
|
|
34
|
+
const oModel = oControl.getModel?.();
|
|
35
|
+
if (!oModel) {
|
|
36
|
+
return undefined;
|
|
53
37
|
}
|
|
54
|
-
return
|
|
38
|
+
return oModel.getMetadata().getName();
|
|
55
39
|
}
|
|
56
40
|
|
|
57
|
-
function
|
|
58
|
-
sModelType
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
mDelegateInfo.payload = {};
|
|
62
|
-
return mDelegateInfo;
|
|
63
|
-
});
|
|
41
|
+
function getModelSpecificDelegateInfo(oControl, sModelType) {
|
|
42
|
+
sModelType ||= getModelTypeForControl(oControl);
|
|
43
|
+
const mDelegateInfo = mModelSpecificDelegateItems[sModelType];
|
|
44
|
+
return mDelegateInfo;
|
|
64
45
|
}
|
|
65
46
|
|
|
66
|
-
async function getControlSpecificDelegateInfo(
|
|
47
|
+
async function getControlSpecificDelegateInfo(oControl, oModifier) {
|
|
67
48
|
const oControlMetadata = await oModifier.getControlMetadata(oControl);
|
|
68
|
-
const mDelegateInfo =
|
|
69
|
-
if (mDelegateInfo) {
|
|
70
|
-
mDelegateInfo.payload ||= {};
|
|
71
|
-
}
|
|
49
|
+
const mDelegateInfo = mControlSpecificDelegateItems[oControlMetadata.getName()];
|
|
72
50
|
return mDelegateInfo;
|
|
73
51
|
}
|
|
74
52
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
mDelegateInfo.instance = oDelegate || {};
|
|
79
|
-
aLoadedDelegates.push(mDelegateInfo);
|
|
80
|
-
return aLoadedDelegates;
|
|
81
|
-
} catch (oError) {
|
|
53
|
+
function requireDelegatesAsync(oControl, oModifier, mDelegateInfo) {
|
|
54
|
+
return requireAsync(mDelegateInfo.name)
|
|
55
|
+
.catch((oError) => {
|
|
82
56
|
Log.error(`Failed to load the delegate for the control ${oModifier.getId(oControl)}
|
|
83
57
|
${oError.message}`);
|
|
84
|
-
return
|
|
85
|
-
}
|
|
58
|
+
return undefined;
|
|
59
|
+
});
|
|
86
60
|
}
|
|
87
61
|
|
|
88
|
-
function loadDelegates(
|
|
89
|
-
if (!aDelegates.length) {
|
|
90
|
-
return Promise.resolve([]);
|
|
91
|
-
}
|
|
62
|
+
function loadDelegates(oControl, oModifier, aDelegates) {
|
|
92
63
|
const aPromises = [];
|
|
93
64
|
aDelegates.forEach(function(mDelegateInfo) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
function isCompleteDelegate(mDelegateInfo) {
|
|
108
|
-
return mDelegateInfo.delegateType === DelegateMediator.types.COMPLETE
|
|
109
|
-
|| (
|
|
110
|
-
isFunction(mDelegateInfo.instance.getPropertyInfo)
|
|
111
|
-
&& (isFunction(mDelegateInfo.instance.createLabel) || isFunction(mDelegateInfo.instance.createLayout))
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function isReadOnlyDelegate(mDelegateInfo) {
|
|
116
|
-
return mDelegateInfo.delegateType === DelegateMediator.types.READONLY
|
|
117
|
-
|| isFunction(mDelegateInfo.instance.getPropertyInfo);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function isWriteOnlyDelegate(mDelegateInfo) {
|
|
121
|
-
return mDelegateInfo.delegateType === DelegateMediator.types.WRITEONLY
|
|
122
|
-
|| isFunction(mDelegateInfo.instance.createLabel)
|
|
123
|
-
|| isFunction(mDelegateInfo.instance.createLayout);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function assignCommonPart(mTargetDelegateInfo, mDelegateInfo) {
|
|
127
|
-
mTargetDelegateInfo.names.push(mDelegateInfo.name);
|
|
128
|
-
if (mDelegateInfo.requiredLibraries) {
|
|
129
|
-
mTargetDelegateInfo.requiredLibraries = Object.assign(
|
|
130
|
-
mTargetDelegateInfo.requiredLibraries || {}, mDelegateInfo.requiredLibraries
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
if (mDelegateInfo.payload && !mTargetDelegateInfo.payload) {
|
|
134
|
-
// is available maximum once for instancespecific delegate
|
|
135
|
-
mTargetDelegateInfo.payload = mDelegateInfo.payload;
|
|
136
|
-
}
|
|
137
|
-
if (mDelegateInfo.delegateType) {
|
|
138
|
-
mTargetDelegateInfo.delegateType = mDelegateInfo.delegateType;
|
|
139
|
-
}
|
|
140
|
-
return mTargetDelegateInfo;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function assignReadPart(mTargetDelegateInfo, mDelegateInfo) {
|
|
144
|
-
mTargetDelegateInfo = assignCommonPart(mTargetDelegateInfo, mDelegateInfo);
|
|
145
|
-
return merge(mTargetDelegateInfo, { instance: _pick(
|
|
146
|
-
mDelegateInfo.instance, ["getPropertyInfo", "getRepresentedProperties"]
|
|
147
|
-
) });
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function assignWritePart(mTargetDelegateInfo, mDelegateInfo) {
|
|
151
|
-
mTargetDelegateInfo = assignCommonPart(mTargetDelegateInfo, mDelegateInfo);
|
|
152
|
-
return merge(mTargetDelegateInfo, { instance: _pick(
|
|
153
|
-
mDelegateInfo.instance, ["createLabel", "createControlForProperty", "createLayout"]
|
|
154
|
-
) });
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function assignCompleteDelegate(mTargetDelegateInfo, mDelegateInfo) {
|
|
158
|
-
mTargetDelegateInfo = assignCommonPart(mTargetDelegateInfo, mDelegateInfo);
|
|
159
|
-
return merge(mTargetDelegateInfo, _pick(mDelegateInfo, "instance"));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function mergeDelegates(aDelegates) {
|
|
163
|
-
// check from in reverted order whether the read and or the write part is available
|
|
164
|
-
// build a new object that consists of the read and the write part probably of more than one delegate
|
|
165
|
-
let mResultDelegateInfo = {
|
|
166
|
-
names: [],
|
|
167
|
-
instance: {},
|
|
168
|
-
modelType: aDelegates.length && aDelegates[0].modelType
|
|
169
|
-
};
|
|
170
|
-
let bReadPartMissing = true;
|
|
171
|
-
let bWritePartMissing = true;
|
|
172
|
-
for (let i = (aDelegates.length - 1); i >= 0; i--) {
|
|
173
|
-
const mDelegateInfo = aDelegates[i];
|
|
174
|
-
if (isCompleteDelegate(mDelegateInfo)) {
|
|
175
|
-
if (bReadPartMissing && bWritePartMissing) {
|
|
176
|
-
mResultDelegateInfo = assignCompleteDelegate(mResultDelegateInfo, mDelegateInfo);
|
|
177
|
-
} else if (bReadPartMissing) {
|
|
178
|
-
mResultDelegateInfo = assignReadPart(mResultDelegateInfo, mDelegateInfo);
|
|
179
|
-
} else if (bWritePartMissing) {
|
|
180
|
-
mResultDelegateInfo = assignWritePart(mResultDelegateInfo, mDelegateInfo);
|
|
181
|
-
}
|
|
182
|
-
break;
|
|
183
|
-
} else if (isReadOnlyDelegate(mDelegateInfo) && bReadPartMissing) {
|
|
184
|
-
mResultDelegateInfo = assignReadPart(mResultDelegateInfo, mDelegateInfo);
|
|
185
|
-
bReadPartMissing = false;
|
|
186
|
-
} else if (isWriteOnlyDelegate(mDelegateInfo) && bWritePartMissing) {
|
|
187
|
-
mResultDelegateInfo = assignWritePart(mResultDelegateInfo, mDelegateInfo);
|
|
188
|
-
bWritePartMissing = false;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return aDelegates.length ? mResultDelegateInfo : undefined;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function validateInputParameters(oControl, oModifier) {
|
|
195
|
-
return new Promise(function(resolve, reject) {
|
|
196
|
-
if (!oControl) {
|
|
197
|
-
reject(new Error("The control parameter is missing"));
|
|
198
|
-
}
|
|
199
|
-
if (!oModifier) {
|
|
200
|
-
reject(new Error("The modifier parameter is missing"));
|
|
201
|
-
}
|
|
202
|
-
if (!oControl) {
|
|
203
|
-
reject(new Error("The input control should be available"));
|
|
65
|
+
if (mDelegateInfo) {
|
|
66
|
+
aPromises.push(
|
|
67
|
+
async function() {
|
|
68
|
+
const oDelegate = await requireDelegatesAsync(oControl, oModifier, mDelegateInfo);
|
|
69
|
+
if (oDelegate) {
|
|
70
|
+
mDelegateInfo.instance = oDelegate || {};
|
|
71
|
+
return mDelegateInfo;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}()
|
|
75
|
+
);
|
|
76
|
+
} else {
|
|
77
|
+
aPromises.push(Promise.resolve());
|
|
204
78
|
}
|
|
205
|
-
if (
|
|
206
|
-
oModifier === JsControlTreeModifier
|
|
207
|
-
&& (!oControl.isA || !oControl.isA("sap.ui.base.ManagedObject"))
|
|
208
|
-
) {
|
|
209
|
-
reject(new Error("The input control should be a managed object"));
|
|
210
|
-
}
|
|
211
|
-
resolve();
|
|
212
79
|
});
|
|
80
|
+
return Promise.all(aPromises);
|
|
213
81
|
}
|
|
214
82
|
|
|
215
|
-
function isValidType(mPropertyBag) {
|
|
216
|
-
return Object.values(DelegateMediator.types).some(function(sDelegateMediatorType) {
|
|
217
|
-
return sDelegateMediatorType === mPropertyBag.delegateType;
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function isCompetingDelegateAlreadyRegistered(mPropertyBag) {
|
|
222
|
-
const aDefaultDelegates = DelegateMediator._mDefaultDelegateItems[mPropertyBag.modelType] || [];
|
|
223
|
-
const aDefaultDelegateTypes = aDefaultDelegates.map(function(mDefaultDelegateInfo) {
|
|
224
|
-
return mDefaultDelegateInfo.delegateType;
|
|
225
|
-
});
|
|
226
|
-
return aDefaultDelegateTypes.indexOf(DelegateMediator.types.COMPLETE) > -1
|
|
227
|
-
|| aDefaultDelegateTypes.indexOf(mPropertyBag.delegateType) > -1
|
|
228
|
-
|| (mPropertyBag.delegateType === DelegateMediator.types.COMPLETE && aDefaultDelegateTypes.length);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
DelegateMediator.getKnownDefaultDelegateLibraries = function() {
|
|
232
|
-
return ["sap.ui.comp"]; // OdataV2Delegate is defined in sap.ui.comp
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Returns a list of required libraries for the given default delegate.
|
|
237
|
-
* If it is not a default delegate, an empty list is returned.
|
|
238
|
-
*
|
|
239
|
-
* @param {string} aDelegateNames - List of delegate names
|
|
240
|
-
* @param {sap.ui.core.Element} oControl - Control for which the corresponding delegate was returned
|
|
241
|
-
* @param {string} [sModelType] - Model type, if none is provided the default model of oControl is taken instead
|
|
242
|
-
* @returns {string[]} Required libraries
|
|
243
|
-
*/
|
|
244
|
-
DelegateMediator.getRequiredLibrariesForDefaultDelegate = function(aDelegateNames, oControl, sModelType) {
|
|
245
|
-
sModelType = getModelTypeForControl(oControl, sModelType);
|
|
246
|
-
const aDelegateInfo = DelegateMediator._mDefaultDelegateItems[sModelType] || [];
|
|
247
|
-
return aDelegateInfo.reduce(function(aRequiredLibNames, mDelegateInfo) {
|
|
248
|
-
const bIsDefaultDelegate = aDelegateNames.indexOf(mDelegateInfo.name) > -1;
|
|
249
|
-
return aRequiredLibNames.concat(Object.keys((bIsDefaultDelegate && mDelegateInfo.requiredLibraries) || {}));
|
|
250
|
-
}, []);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Checks if there is already a registered delegate available for the given model type
|
|
255
|
-
* or control type in case of control specific delegates.
|
|
256
|
-
*
|
|
257
|
-
* @param {string} sKeyType - Delegate model or control type
|
|
258
|
-
* @returns {boolean} <code>true</code> if a delegate is already registered for the model or control type
|
|
259
|
-
*/
|
|
260
|
-
DelegateMediator.isDelegateRegistered = function(sKeyType) {
|
|
261
|
-
return !!DelegateMediator._mDefaultDelegateItems[sKeyType]
|
|
262
|
-
|| !!DelegateMediator._mControlSpecificDelegateItems[sKeyType];
|
|
263
|
-
};
|
|
264
|
-
|
|
265
83
|
/**
|
|
266
|
-
* Register
|
|
84
|
+
* Register model-specific read delegate by the model type.
|
|
267
85
|
*
|
|
268
|
-
* @param {object} mPropertyBag - Property bag for
|
|
269
|
-
* @param {object} mPropertyBag.modelType -
|
|
270
|
-
* @param {object} mPropertyBag.delegate - Path to
|
|
271
|
-
* @param {object} mPropertyBag.delegateType - Defines the type of the default delegate. Please look at <code>DelegageMediator.types</code> for possible entries
|
|
272
|
-
* @param {object} [mPropertyBag.requiredLibraries] - map of required libraries
|
|
86
|
+
* @param {object} mPropertyBag - Property bag for read delegate
|
|
87
|
+
* @param {object} mPropertyBag.modelType - Read delegate model type
|
|
88
|
+
* @param {object} mPropertyBag.delegate - Path to read delegate
|
|
273
89
|
*/
|
|
274
|
-
DelegateMediator.
|
|
90
|
+
DelegateMediator.registerReadDelegate = function(mPropertyBag) {
|
|
275
91
|
if (!(mPropertyBag.modelType && mPropertyBag.delegate)) {
|
|
276
92
|
throw new Error("'modelType' and 'delegate' properties are required for registration!");
|
|
277
93
|
}
|
|
278
|
-
|
|
279
|
-
if (mPropertyBag.
|
|
280
|
-
throw new Error(`
|
|
281
|
-
}
|
|
282
|
-
// No overriding of compete delegates possible
|
|
283
|
-
if (isCompetingDelegateAlreadyRegistered(mPropertyBag)) {
|
|
284
|
-
throw new Error(`modelType ${mPropertyBag.modelType}is already defined!`);
|
|
94
|
+
// No overriding of read delegates possible
|
|
95
|
+
if (mModelSpecificDelegateItems[mPropertyBag.modelType]) {
|
|
96
|
+
throw new Error(`modelType ${mPropertyBag.modelType} is already defined!`);
|
|
285
97
|
}
|
|
286
|
-
|
|
287
|
-
DelegateMediator._mDefaultDelegateItems[mPropertyBag.modelType].push({
|
|
98
|
+
mModelSpecificDelegateItems[mPropertyBag.modelType] = {
|
|
288
99
|
name: mPropertyBag.delegate,
|
|
289
|
-
requiredLibraries: mPropertyBag.requiredLibraries,
|
|
290
|
-
delegateType: mPropertyBag.delegateType,
|
|
291
100
|
modelType: mPropertyBag.modelType
|
|
292
|
-
}
|
|
101
|
+
};
|
|
293
102
|
};
|
|
294
103
|
|
|
295
104
|
/**
|
|
296
|
-
* Registers a control
|
|
105
|
+
* Registers a control-specific write delegate by control type.
|
|
297
106
|
*
|
|
298
|
-
* @param {object} mPropertyBag - Property bag for control
|
|
299
|
-
* @param {object} mPropertyBag.controlType -
|
|
300
|
-
* @param {object} mPropertyBag.delegate - path to control
|
|
301
|
-
* @param {object} mPropertyBag.
|
|
302
|
-
*
|
|
303
|
-
* @param {object} [mPropertyBag.requiredLibraries] - map of required libraries
|
|
304
|
-
* @param {object} [mPropertyBag.payload] - payload for the delegate
|
|
107
|
+
* @param {object} mPropertyBag - Property bag for control-specific delegate
|
|
108
|
+
* @param {object} mPropertyBag.controlType - Control type
|
|
109
|
+
* @param {object} mPropertyBag.delegate - path to control-specific delegate
|
|
110
|
+
* @param {object} [mPropertyBag.requiredLibraries] - Map of required libraries
|
|
111
|
+
* @param {object} [mPropertyBag.payload] - Payload for the delegate
|
|
305
112
|
*/
|
|
306
|
-
DelegateMediator.
|
|
113
|
+
DelegateMediator.registerWriteDelegate = function(mPropertyBag) {
|
|
307
114
|
if (!(mPropertyBag.controlType && mPropertyBag.delegate)) {
|
|
308
115
|
throw new Error("'controlType' and 'delegate' properties are required for registration!");
|
|
309
116
|
}
|
|
310
|
-
mPropertyBag.
|
|
311
|
-
if (mPropertyBag.delegateType && !isValidType(mPropertyBag)) {
|
|
312
|
-
throw new Error(`Control '${mPropertyBag.controlType}' specific delegateType: ${mPropertyBag.delegateType} is invalid!`);
|
|
313
|
-
}
|
|
314
|
-
DelegateMediator._mControlSpecificDelegateItems[mPropertyBag.controlType] = {
|
|
117
|
+
mControlSpecificDelegateItems[mPropertyBag.controlType] = {
|
|
315
118
|
name: mPropertyBag.delegate,
|
|
316
119
|
requiredLibraries: mPropertyBag.requiredLibraries,
|
|
317
120
|
delegateType: mPropertyBag.delegateType,
|
|
@@ -320,35 +123,75 @@ sap.ui.define([
|
|
|
320
123
|
};
|
|
321
124
|
};
|
|
322
125
|
|
|
126
|
+
function finalizeReadDelegateInfo(mDelegateInfo) {
|
|
127
|
+
return mDelegateInfo
|
|
128
|
+
? {
|
|
129
|
+
...mDelegateInfo,
|
|
130
|
+
modelType: mDelegateInfo.modelType || mDelegateInfo.payload?.modelType,
|
|
131
|
+
instance: _pick(mDelegateInfo.instance, ["getPropertyInfo", "getRepresentedProperties"])
|
|
132
|
+
}
|
|
133
|
+
: undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
323
136
|
/**
|
|
324
|
-
* Returns the delegate
|
|
137
|
+
* Returns the model-specific read delegate for the requested control.
|
|
138
|
+
* The instance-spcific read delegate is returned if available.
|
|
325
139
|
*
|
|
326
140
|
* @param {sap.ui.core.Element} oControl - Control for which the corresponding delegate should be returned
|
|
327
141
|
* @param {sap.ui.core.util.reflection.BaseTreeModifier} oModifier - Control tree modifier
|
|
328
|
-
* @param {string} sModelType - Model type; required in case you passed the <code>XmlTreeModifier</code>
|
|
329
|
-
* @param {boolean} [bSupportsDefault] - Include default delegate if no instance specific delegate is available
|
|
142
|
+
* @param {string} [sModelType] - Model type; required in case you passed the <code>XmlTreeModifier</code>
|
|
330
143
|
* @returns {Promise.<sap.ui.core.util.reflection.FlexDelegateInfo>} Delegate information including the lazy loaded instance of the delegate
|
|
331
144
|
*/
|
|
332
|
-
DelegateMediator.
|
|
333
|
-
|
|
145
|
+
DelegateMediator.getReadDelegateForControl = async function(oControl, oModifier, sModelType) {
|
|
146
|
+
let mModelSpecificDelegateInfo = getModelSpecificDelegateInfo(oControl, sModelType);
|
|
147
|
+
let mInstanceSpecificDelegateInfo = oModifier.getFlexDelegate(oControl);
|
|
148
|
+
[mInstanceSpecificDelegateInfo, mModelSpecificDelegateInfo] = await loadDelegates(oControl, oModifier, [
|
|
149
|
+
mInstanceSpecificDelegateInfo,
|
|
150
|
+
mModelSpecificDelegateInfo
|
|
151
|
+
]);
|
|
152
|
+
return mInstanceSpecificDelegateInfo?.instance.getPropertyInfo
|
|
153
|
+
? finalizeReadDelegateInfo(mInstanceSpecificDelegateInfo)
|
|
154
|
+
: finalizeReadDelegateInfo(mModelSpecificDelegateInfo);
|
|
155
|
+
};
|
|
334
156
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
157
|
+
function finalizeWriteDelegateInfo(mDelegateInfo, oControl) {
|
|
158
|
+
return mDelegateInfo
|
|
159
|
+
? {
|
|
160
|
+
...mDelegateInfo,
|
|
161
|
+
controlType: mDelegateInfo.controlType || oControl.getMetadata?.().getName(),
|
|
162
|
+
instance: _pick(mDelegateInfo.instance, ["createLabel", "createControlForProperty", "createLayout"])
|
|
163
|
+
}
|
|
164
|
+
: undefined;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Returns the write delegate for the requested control.
|
|
169
|
+
* The instance-specific write delegate is returned if available.
|
|
170
|
+
*
|
|
171
|
+
* @param {sap.ui.core.Element} oControl - Control for which the corresponding delegate should be returned
|
|
172
|
+
* @param {sap.ui.core.util.reflection.BaseTreeModifier} oModifier - Control tree modifier
|
|
173
|
+
* @returns {Promise.<sap.ui.core.util.reflection.FlexDelegateInfo>} Delegate information including the lazy loaded instance of the delegate. Undefined if delegate couldn't be loaded.
|
|
174
|
+
*/
|
|
175
|
+
DelegateMediator.getWriteDelegateForControl = async function(oControl, oModifier) {
|
|
176
|
+
let mControlSpecificDelegateInfo = await getControlSpecificDelegateInfo(oControl, oModifier);
|
|
177
|
+
let mInstanceSpecificDelegateInfo = oModifier.getFlexDelegate(oControl);
|
|
178
|
+
[mInstanceSpecificDelegateInfo, mControlSpecificDelegateInfo] = await loadDelegates(oControl, oModifier, [
|
|
179
|
+
mInstanceSpecificDelegateInfo,
|
|
180
|
+
mControlSpecificDelegateInfo
|
|
181
|
+
]);
|
|
182
|
+
return (mInstanceSpecificDelegateInfo?.instance.createLabel
|
|
183
|
+
|| mInstanceSpecificDelegateInfo?.instance.createLayout)
|
|
184
|
+
? finalizeWriteDelegateInfo(mInstanceSpecificDelegateInfo, oControl)
|
|
185
|
+
: finalizeWriteDelegateInfo(mControlSpecificDelegateInfo, oControl);
|
|
347
186
|
};
|
|
348
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Clears the model and control-specific delegate items.
|
|
190
|
+
* This method is used for testing purposes.
|
|
191
|
+
*/
|
|
349
192
|
DelegateMediator.clear = function() {
|
|
350
|
-
|
|
351
|
-
|
|
193
|
+
mModelSpecificDelegateItems = {};
|
|
194
|
+
mControlSpecificDelegateItems = {};
|
|
352
195
|
};
|
|
353
196
|
|
|
354
197
|
return DelegateMediator;
|
|
@@ -85,7 +85,7 @@ sap.ui.define([
|
|
|
85
85
|
return mPropertyBag.modifier.targets === "xmlTree";
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
function checkAndAdjustChangeStatus(oControl, oChange, mPropertyBag) {
|
|
88
|
+
function checkAndAdjustChangeStatus(oControl, oChange, mPropertyBag, bSkipDependencies) {
|
|
89
89
|
// in case of changes in templates, the original control is not always available at this point
|
|
90
90
|
// example: rename on a control created by a change inside a template
|
|
91
91
|
var oOriginalControl = Utils.getControlIfTemplateAffected(oChange, oControl, mPropertyBag).control;
|
|
@@ -98,7 +98,7 @@ sap.ui.define([
|
|
|
98
98
|
if (bChangeStatusAppliedFinished && !bIsCurrentlyAppliedOnControl) {
|
|
99
99
|
// if a change was already processed and is not applied anymore, then the control was destroyed and recreated.
|
|
100
100
|
// In this case we need to recreate/copy the dependencies if we are applying in JS
|
|
101
|
-
if (!
|
|
101
|
+
if (!bSkipDependencies) {
|
|
102
102
|
UIChangesState.copyDependenciesFromCompleteDependencyMap(oChange, mPropertyBag.appComponent);
|
|
103
103
|
}
|
|
104
104
|
oChange.setInitialApplyState();
|
|
@@ -381,6 +381,39 @@ sap.ui.define([
|
|
|
381
381
|
});
|
|
382
382
|
};
|
|
383
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Applies a given array of changes sequentially. If the change was successfully applied it is added to the LiveDependencyMap.
|
|
386
|
+
*
|
|
387
|
+
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} aChanges - FlexObjects to be applied
|
|
388
|
+
* @param {object} mPropertyBag - Object with parameters as properties
|
|
389
|
+
* @param {object} mPropertyBag.reference - Flex reference
|
|
390
|
+
* @param {object} mPropertyBag.appComponent - App Component instance
|
|
391
|
+
* @returns {Promise} Resolves after all changes were applied
|
|
392
|
+
*/
|
|
393
|
+
Applier.applyMultipleChanges = function(aChanges, mPropertyBag) {
|
|
394
|
+
mPropertyBag.modifier = JsControlTreeModifier;
|
|
395
|
+
const aPromises = aChanges.map(function(oChange) {
|
|
396
|
+
const oControl = JsControlTreeModifier.bySelector(oChange.getSelector(), mPropertyBag.appComponent);
|
|
397
|
+
if (oControl) {
|
|
398
|
+
checkAndAdjustChangeStatus(oControl, oChange, mPropertyBag, true);
|
|
399
|
+
if (!oChange.isApplyProcessFinished()) {
|
|
400
|
+
oChange.setQueuedForApply();
|
|
401
|
+
}
|
|
402
|
+
return function() {
|
|
403
|
+
return Applier.applyChangeOnControl(oChange, oControl, mPropertyBag)
|
|
404
|
+
.then(function(oResult) {
|
|
405
|
+
if (oResult.success) {
|
|
406
|
+
const oLiveDependencyMap = UIChangesState.getLiveDependencyMap(mPropertyBag.reference);
|
|
407
|
+
DependencyHandler.addRuntimeChangeToMap(oChange, mPropertyBag.appComponent, oLiveDependencyMap);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
return () => Promise.resolve();
|
|
413
|
+
});
|
|
414
|
+
return FlUtils.execPromiseQueueSequentially(aPromises);
|
|
415
|
+
};
|
|
416
|
+
|
|
384
417
|
/**
|
|
385
418
|
* Gets the dependency map and gets all changes for that control from the map, then, depending on
|
|
386
419
|
* dependencies, directly applies the change or saves the callback to apply in the dependency.
|
|
@@ -460,7 +493,7 @@ sap.ui.define([
|
|
|
460
493
|
.then(function(oChangeHandler) {
|
|
461
494
|
mPropertyBag.changeHandler = oChangeHandler;
|
|
462
495
|
oChange.setQueuedForApply();
|
|
463
|
-
checkAndAdjustChangeStatus(oControl, oChange, mPropertyBag);
|
|
496
|
+
checkAndAdjustChangeStatus(oControl, oChange, mPropertyBag, true);
|
|
464
497
|
|
|
465
498
|
if (!oChange.isApplyProcessFinished()) {
|
|
466
499
|
if (typeof mPropertyBag.changeHandler.onAfterXMLChangeProcessing === "function") {
|
|
@@ -19,7 +19,7 @@ sap.ui.define([
|
|
|
19
19
|
* Available for both runtime and build {@link sap.ui.fl.apply._internal.changes.descriptor.Registration}.
|
|
20
20
|
*
|
|
21
21
|
* @namespace sap.ui.fl.apply._internal.changes.descriptor.app.SetTitle
|
|
22
|
-
* @version 1.
|
|
22
|
+
* @version 1.124.0
|
|
23
23
|
* @private
|
|
24
24
|
* @ui5-restricted sap.ui.fl.apply._internal
|
|
25
25
|
*/
|