@openui5/sap.ui.fl 1.122.0 → 1.123.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 +1 -1
- 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 +1 -1
- 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 +90 -46
- package/src/sap/ui/fl/apply/_internal/DelegateMediatorNew.js +193 -0
- 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 +1 -1
- package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageConnector.js +8 -4
- package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
- 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 +7 -11
- package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +6 -2
- package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +7 -6
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +39 -24
- package/src/sap/ui/fl/apply/_internal/flexState/InitialPrepareFunctions.js +1 -1
- 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 +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +0 -3
- package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +11 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
- package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
- package/src/sap/ui/fl/apply/api/DelegateMediatorAPI.js +75 -7
- 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 +1 -1
- 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 +1 -1
- 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/initial/_internal/FlexConfiguration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
- 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/LrepConnector.js +12 -8
- 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/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/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/util/IFrame.js +1 -1
- 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 +18 -1
- package/src/sap/ui/fl/write/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/write/_internal/Versions.js +12 -9
- 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 +1 -1
- 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 +276 -0
- 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 +1 -1
- 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 +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +1 -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 +37 -7
- package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +0 -1
- package/src/sap/ui/fl/write/api/VersionsAPI.js +33 -35
- package/src/sap/ui/fl/write/api/connectors/FileListBaseConnector.js +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openui5/sap.ui.fl",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.123.0",
|
|
4
4
|
"description": "OpenUI5 UI Library sap.ui.fl",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/SAP/openui5.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@openui5/sap.m": "1.
|
|
18
|
-
"@openui5/sap.ui.core": "1.
|
|
17
|
+
"@openui5/sap.m": "1.123.0",
|
|
18
|
+
"@openui5/sap.ui.core": "1.123.0"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/src/sap/ui/fl/.library
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<copyright>OpenUI5
|
|
7
7
|
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
8
8
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
|
|
9
|
-
<version>1.
|
|
9
|
+
<version>1.123.0</version>
|
|
10
10
|
|
|
11
11
|
<documentation>SAPUI5 library with sap.ui.fl controls.</documentation>
|
|
12
12
|
|
package/src/sap/ui/fl/Utils.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
sap.ui.define([
|
|
7
8
|
"sap/base/Log",
|
|
8
9
|
"sap/base/util/merge",
|
|
@@ -25,12 +26,13 @@ sap.ui.define([
|
|
|
25
26
|
*
|
|
26
27
|
* @private
|
|
27
28
|
* @author SAP SE
|
|
28
|
-
* @version 1.
|
|
29
|
+
* @version 1.123.0
|
|
29
30
|
*
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
+
const DelegateMediator = {};
|
|
32
33
|
|
|
33
34
|
DelegateMediator._mDefaultDelegateItems = {};
|
|
35
|
+
DelegateMediator._mControlSpecificDelegateItems = {};
|
|
34
36
|
DelegateMediator.types = {
|
|
35
37
|
READONLY: "readonly",
|
|
36
38
|
WRITEONLY: "writeonly",
|
|
@@ -43,7 +45,7 @@ sap.ui.define([
|
|
|
43
45
|
}
|
|
44
46
|
if (oControl.getModel) {
|
|
45
47
|
// get the default model
|
|
46
|
-
|
|
48
|
+
const oModel = oControl.getModel();
|
|
47
49
|
if (!oModel) {
|
|
48
50
|
return undefined;
|
|
49
51
|
}
|
|
@@ -54,33 +56,43 @@ sap.ui.define([
|
|
|
54
56
|
|
|
55
57
|
function getDefaultDelegateInfo(oControl, sModelType) {
|
|
56
58
|
sModelType = getModelTypeForControl(oControl, sModelType);
|
|
57
|
-
|
|
59
|
+
const aDelegateInfo = DelegateMediator._mDefaultDelegateItems[sModelType];
|
|
58
60
|
return (aDelegateInfo || []).map(function(mDelegateInfo) {
|
|
59
61
|
mDelegateInfo.payload = {};
|
|
60
62
|
return mDelegateInfo;
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
async function getControlSpecificDelegateInfo(oModifier, oControl) {
|
|
67
|
+
const oControlMetadata = await oModifier.getControlMetadata(oControl);
|
|
68
|
+
const mDelegateInfo = DelegateMediator._mControlSpecificDelegateItems[oControlMetadata.getName()];
|
|
69
|
+
if (mDelegateInfo) {
|
|
70
|
+
mDelegateInfo.payload ||= {};
|
|
71
|
+
}
|
|
72
|
+
return mDelegateInfo;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function requireDelegatesAsync(oModifier, oControl, mDelegateInfo, aLoadedDelegates) {
|
|
76
|
+
try {
|
|
77
|
+
const oDelegate = await requireAsync(mDelegateInfo.name);
|
|
78
|
+
mDelegateInfo.instance = oDelegate || {};
|
|
79
|
+
aLoadedDelegates.push(mDelegateInfo);
|
|
80
|
+
return aLoadedDelegates;
|
|
81
|
+
} catch (oError) {
|
|
82
|
+
Log.error(`Failed to load the delegate for the control ${oModifier.getId(oControl)}
|
|
83
|
+
${oError.message}`);
|
|
84
|
+
return aLoadedDelegates;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
64
88
|
function loadDelegates(oModifier, oControl, aDelegates) {
|
|
65
89
|
if (!aDelegates.length) {
|
|
66
|
-
// it is a valid case to ask for a delegate and there is none
|
|
67
|
-
// a broken delegate is logged below
|
|
68
90
|
return Promise.resolve([]);
|
|
69
91
|
}
|
|
70
|
-
|
|
92
|
+
const aPromises = [];
|
|
71
93
|
aDelegates.forEach(function(mDelegateInfo) {
|
|
72
94
|
aPromises.push(function(aLoadedDelegates) {
|
|
73
|
-
return
|
|
74
|
-
.then(function(oDelegate) {
|
|
75
|
-
mDelegateInfo.instance = oDelegate || {};
|
|
76
|
-
aLoadedDelegates.push(mDelegateInfo);
|
|
77
|
-
return aLoadedDelegates;
|
|
78
|
-
})
|
|
79
|
-
.catch(function(oError) {
|
|
80
|
-
Log.error(`Failed to load the delegate for the control ${oModifier.getId(oControl)}
|
|
81
|
-
${oError.message}`);
|
|
82
|
-
return aLoadedDelegates;
|
|
83
|
-
});
|
|
95
|
+
return requireDelegatesAsync(oModifier, oControl, mDelegateInfo, aLoadedDelegates);
|
|
84
96
|
});
|
|
85
97
|
});
|
|
86
98
|
return aPromises.reduce(function(oPreviousPromise, oCurrentPromise) {
|
|
@@ -150,15 +162,15 @@ sap.ui.define([
|
|
|
150
162
|
function mergeDelegates(aDelegates) {
|
|
151
163
|
// check from in reverted order whether the read and or the write part is available
|
|
152
164
|
// build a new object that consists of the read and the write part probably of more than one delegate
|
|
153
|
-
|
|
165
|
+
let mResultDelegateInfo = {
|
|
154
166
|
names: [],
|
|
155
167
|
instance: {},
|
|
156
168
|
modelType: aDelegates.length && aDelegates[0].modelType
|
|
157
169
|
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
for (
|
|
161
|
-
|
|
170
|
+
let bReadPartMissing = true;
|
|
171
|
+
let bWritePartMissing = true;
|
|
172
|
+
for (let i = (aDelegates.length - 1); i >= 0; i--) {
|
|
173
|
+
const mDelegateInfo = aDelegates[i];
|
|
162
174
|
if (isCompleteDelegate(mDelegateInfo)) {
|
|
163
175
|
if (bReadPartMissing && bWritePartMissing) {
|
|
164
176
|
mResultDelegateInfo = assignCompleteDelegate(mResultDelegateInfo, mDelegateInfo);
|
|
@@ -207,8 +219,8 @@ sap.ui.define([
|
|
|
207
219
|
}
|
|
208
220
|
|
|
209
221
|
function isCompetingDelegateAlreadyRegistered(mPropertyBag) {
|
|
210
|
-
|
|
211
|
-
|
|
222
|
+
const aDefaultDelegates = DelegateMediator._mDefaultDelegateItems[mPropertyBag.modelType] || [];
|
|
223
|
+
const aDefaultDelegateTypes = aDefaultDelegates.map(function(mDefaultDelegateInfo) {
|
|
212
224
|
return mDefaultDelegateInfo.delegateType;
|
|
213
225
|
});
|
|
214
226
|
return aDefaultDelegateTypes.indexOf(DelegateMediator.types.COMPLETE) > -1
|
|
@@ -231,21 +243,23 @@ sap.ui.define([
|
|
|
231
243
|
*/
|
|
232
244
|
DelegateMediator.getRequiredLibrariesForDefaultDelegate = function(aDelegateNames, oControl, sModelType) {
|
|
233
245
|
sModelType = getModelTypeForControl(oControl, sModelType);
|
|
234
|
-
|
|
246
|
+
const aDelegateInfo = DelegateMediator._mDefaultDelegateItems[sModelType] || [];
|
|
235
247
|
return aDelegateInfo.reduce(function(aRequiredLibNames, mDelegateInfo) {
|
|
236
|
-
|
|
248
|
+
const bIsDefaultDelegate = aDelegateNames.indexOf(mDelegateInfo.name) > -1;
|
|
237
249
|
return aRequiredLibNames.concat(Object.keys((bIsDefaultDelegate && mDelegateInfo.requiredLibraries) || {}));
|
|
238
250
|
}, []);
|
|
239
251
|
};
|
|
240
252
|
|
|
241
253
|
/**
|
|
242
|
-
* Checks if there is already a registered delegate available for the given model type
|
|
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.
|
|
243
256
|
*
|
|
244
|
-
* @param {string}
|
|
245
|
-
* @returns {boolean} <code>true</code> if a delegate is already registered for the model type
|
|
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
|
|
246
259
|
*/
|
|
247
|
-
DelegateMediator.isDelegateRegistered = function(
|
|
248
|
-
return !!DelegateMediator._mDefaultDelegateItems[
|
|
260
|
+
DelegateMediator.isDelegateRegistered = function(sKeyType) {
|
|
261
|
+
return !!DelegateMediator._mDefaultDelegateItems[sKeyType]
|
|
262
|
+
|| !!DelegateMediator._mControlSpecificDelegateItems[sKeyType];
|
|
249
263
|
};
|
|
250
264
|
|
|
251
265
|
/**
|
|
@@ -278,6 +292,34 @@ sap.ui.define([
|
|
|
278
292
|
});
|
|
279
293
|
};
|
|
280
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Registers a control specific delegate by control type.
|
|
297
|
+
*
|
|
298
|
+
* @param {object} mPropertyBag - Property bag for control specific delegate
|
|
299
|
+
* @param {object} mPropertyBag.controlType - control type
|
|
300
|
+
* @param {object} mPropertyBag.delegate - path to control specific delegate
|
|
301
|
+
* @param {object} mPropertyBag.delegateType - Defines the type of the control specific delegate.
|
|
302
|
+
* Please look at <code>DelegageMediator.types</code> for possible entries
|
|
303
|
+
* @param {object} [mPropertyBag.requiredLibraries] - map of required libraries
|
|
304
|
+
* @param {object} [mPropertyBag.payload] - payload for the delegate
|
|
305
|
+
*/
|
|
306
|
+
DelegateMediator.registerControlSpecificDelegate = function(mPropertyBag) {
|
|
307
|
+
if (!(mPropertyBag.controlType && mPropertyBag.delegate)) {
|
|
308
|
+
throw new Error("'controlType' and 'delegate' properties are required for registration!");
|
|
309
|
+
}
|
|
310
|
+
mPropertyBag.delegateType ||= DelegateMediator.types.WRITEONLY;
|
|
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] = {
|
|
315
|
+
name: mPropertyBag.delegate,
|
|
316
|
+
requiredLibraries: mPropertyBag.requiredLibraries,
|
|
317
|
+
delegateType: mPropertyBag.delegateType,
|
|
318
|
+
controlType: mPropertyBag.controlType,
|
|
319
|
+
payload: mPropertyBag.payload
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
|
|
281
323
|
/**
|
|
282
324
|
* Returns the delegate object for the requested control.
|
|
283
325
|
*
|
|
@@ -287,24 +329,26 @@ sap.ui.define([
|
|
|
287
329
|
* @param {boolean} [bSupportsDefault] - Include default delegate if no instance specific delegate is available
|
|
288
330
|
* @returns {Promise.<sap.ui.core.util.reflection.FlexDelegateInfo>} Delegate information including the lazy loaded instance of the delegate
|
|
289
331
|
*/
|
|
290
|
-
DelegateMediator.getDelegateForControl = function(oControl, oModifier, sModelType, bSupportsDefault) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
332
|
+
DelegateMediator.getDelegateForControl = async function(oControl, oModifier, sModelType, bSupportsDefault) {
|
|
333
|
+
await validateInputParameters(oControl, oModifier);
|
|
334
|
+
|
|
335
|
+
const aDelegateInfo = (bSupportsDefault && getDefaultDelegateInfo(oControl, sModelType)) || [];
|
|
336
|
+
const mControlSpecificDelegate = await getControlSpecificDelegateInfo(oModifier, oControl);
|
|
337
|
+
if (mControlSpecificDelegate) {
|
|
338
|
+
aDelegateInfo.push(mControlSpecificDelegate);
|
|
339
|
+
}
|
|
340
|
+
const mInstanceSpecificDelegate = await oModifier.getFlexDelegate(oControl);
|
|
341
|
+
if (mInstanceSpecificDelegate) {
|
|
342
|
+
// instance specific delegate always takes over
|
|
343
|
+
aDelegateInfo.push(mInstanceSpecificDelegate);
|
|
344
|
+
}
|
|
345
|
+
const aDelegates = await loadDelegates(oModifier, oControl, aDelegateInfo);
|
|
346
|
+
return mergeDelegates(aDelegates);
|
|
304
347
|
};
|
|
305
348
|
|
|
306
349
|
DelegateMediator.clear = function() {
|
|
307
350
|
DelegateMediator._mDefaultDelegateItems = {};
|
|
351
|
+
DelegateMediator._mControlSpecificDelegateItems = {};
|
|
308
352
|
};
|
|
309
353
|
|
|
310
354
|
return DelegateMediator;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2024 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/Log",
|
|
9
|
+
"sap/base/util/restricted/_pick",
|
|
10
|
+
"sap/ui/fl/requireAsync"
|
|
11
|
+
], function(
|
|
12
|
+
Log,
|
|
13
|
+
_pick,
|
|
14
|
+
requireAsync
|
|
15
|
+
) {
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Delegator mediator to manage default delegators.
|
|
20
|
+
*
|
|
21
|
+
* @alias sap.ui.fl.apply._internal.DelegateMediator
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
* @author SAP SE
|
|
25
|
+
* @version 1.123.0
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
const DelegateMediator = {};
|
|
29
|
+
|
|
30
|
+
let mModelSpecificDelegateItems = {};
|
|
31
|
+
let mControlSpecificDelegateItems = {};
|
|
32
|
+
|
|
33
|
+
function getModelTypeForControl(oControl) {
|
|
34
|
+
const oModel = oControl.getModel?.();
|
|
35
|
+
if (!oModel) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return oModel.getMetadata().getName();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getModelSpecificDelegateInfo(oControl, sModelType) {
|
|
42
|
+
sModelType ||= getModelTypeForControl(oControl);
|
|
43
|
+
const mDelegateInfo = mModelSpecificDelegateItems[sModelType];
|
|
44
|
+
return mDelegateInfo;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function getControlSpecificDelegateInfo(oControl, oModifier) {
|
|
48
|
+
const oControlMetadata = await oModifier.getControlMetadata(oControl);
|
|
49
|
+
const mDelegateInfo = mControlSpecificDelegateItems[oControlMetadata.getName()];
|
|
50
|
+
return mDelegateInfo;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function requireDelegatesAsync(oControl, oModifier, mDelegateInfo) {
|
|
54
|
+
return requireAsync(mDelegateInfo.name)
|
|
55
|
+
.catch((oError) => {
|
|
56
|
+
Log.error(`Failed to load the delegate for the control ${oModifier.getId(oControl)}
|
|
57
|
+
${oError.message}`);
|
|
58
|
+
return undefined;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function loadDelegates(oControl, oModifier, aDelegates) {
|
|
63
|
+
const aPromises = [];
|
|
64
|
+
aDelegates.forEach(function(mDelegateInfo) {
|
|
65
|
+
if (mDelegateInfo) {
|
|
66
|
+
aPromises.push(
|
|
67
|
+
async function() {
|
|
68
|
+
const oDelegate = await requireDelegatesAsync(oControl, oModifier, mDelegateInfo);
|
|
69
|
+
mDelegateInfo.instance = oDelegate || {};
|
|
70
|
+
return mDelegateInfo;
|
|
71
|
+
}()
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return Promise.all(aPromises);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Register model specific read delegate by the model type.
|
|
80
|
+
*
|
|
81
|
+
* @param {object} mPropertyBag - Property bag for read delegate
|
|
82
|
+
* @param {object} mPropertyBag.modelType - Read delegate model type
|
|
83
|
+
* @param {object} mPropertyBag.delegate - Path to read delegate
|
|
84
|
+
*/
|
|
85
|
+
DelegateMediator.registerReadDelegate = function(mPropertyBag) {
|
|
86
|
+
if (!(mPropertyBag.modelType && mPropertyBag.delegate)) {
|
|
87
|
+
throw new Error("'modelType' and 'delegate' properties are required for registration!");
|
|
88
|
+
}
|
|
89
|
+
// No overriding of read delegates possible
|
|
90
|
+
if (mModelSpecificDelegateItems[mPropertyBag.modelType]) {
|
|
91
|
+
throw new Error(`modelType ${mPropertyBag.modelType} is already defined!`);
|
|
92
|
+
}
|
|
93
|
+
mModelSpecificDelegateItems[mPropertyBag.modelType] = {
|
|
94
|
+
name: mPropertyBag.delegate,
|
|
95
|
+
modelType: mPropertyBag.modelType
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Registers a control specific write delegate by control type.
|
|
101
|
+
*
|
|
102
|
+
* @param {object} mPropertyBag - Property bag for control specific delegate
|
|
103
|
+
* @param {object} mPropertyBag.controlType - Control type
|
|
104
|
+
* @param {object} mPropertyBag.delegate - path to control specific delegate
|
|
105
|
+
* @param {object} [mPropertyBag.requiredLibraries] - Map of required libraries
|
|
106
|
+
* @param {object} [mPropertyBag.payload] - Payload for the delegate
|
|
107
|
+
*/
|
|
108
|
+
DelegateMediator.registerWriteDelegate = function(mPropertyBag) {
|
|
109
|
+
if (!(mPropertyBag.controlType && mPropertyBag.delegate)) {
|
|
110
|
+
throw new Error("'controlType' and 'delegate' properties are required for registration!");
|
|
111
|
+
}
|
|
112
|
+
mControlSpecificDelegateItems[mPropertyBag.controlType] = {
|
|
113
|
+
name: mPropertyBag.delegate,
|
|
114
|
+
requiredLibraries: mPropertyBag.requiredLibraries,
|
|
115
|
+
delegateType: mPropertyBag.delegateType,
|
|
116
|
+
controlType: mPropertyBag.controlType,
|
|
117
|
+
payload: mPropertyBag.payload
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
function finalizeReadDelegateInfo(mDelegateInfo) {
|
|
122
|
+
return mDelegateInfo
|
|
123
|
+
? {
|
|
124
|
+
...mDelegateInfo,
|
|
125
|
+
modelType: mDelegateInfo.modelType || mDelegateInfo.payload?.modelType,
|
|
126
|
+
instance: _pick(mDelegateInfo.instance, ["getPropertyInfo", "getRepresentedProperties"])
|
|
127
|
+
}
|
|
128
|
+
: undefined;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Returns the model specific read delegate for the requested control.
|
|
133
|
+
* The instancespcific read delegate is returned if available.
|
|
134
|
+
*
|
|
135
|
+
* @param {sap.ui.core.Element} oControl - Control for which the corresponding delegate should be returned
|
|
136
|
+
* @param {sap.ui.core.util.reflection.BaseTreeModifier} oModifier - Control tree modifier
|
|
137
|
+
* @param {string} [sModelType] - Model type; required in case you passed the <code>XmlTreeModifier</code>
|
|
138
|
+
* @returns {Promise.<sap.ui.core.util.reflection.FlexDelegateInfo>} Delegate information including the lazy loaded instance of the delegate
|
|
139
|
+
*/
|
|
140
|
+
DelegateMediator.getReadDelegateForControl = async function(oControl, oModifier, sModelType) {
|
|
141
|
+
let mModelSpecificDelegateInfo = getModelSpecificDelegateInfo(oControl, sModelType);
|
|
142
|
+
let mInstanceSpecificDelegateInfo = await oModifier.getFlexDelegate(oControl);
|
|
143
|
+
[mInstanceSpecificDelegateInfo, mModelSpecificDelegateInfo] = await loadDelegates(oControl, oModifier, [
|
|
144
|
+
mInstanceSpecificDelegateInfo,
|
|
145
|
+
mModelSpecificDelegateInfo
|
|
146
|
+
]);
|
|
147
|
+
return mInstanceSpecificDelegateInfo?.instance.getPropertyInfo
|
|
148
|
+
? finalizeReadDelegateInfo(mInstanceSpecificDelegateInfo)
|
|
149
|
+
: finalizeReadDelegateInfo(mModelSpecificDelegateInfo);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
function finalizeWriteDelegateInfo(mDelegateInfo, oControl) {
|
|
153
|
+
return mDelegateInfo
|
|
154
|
+
? {
|
|
155
|
+
...mDelegateInfo,
|
|
156
|
+
controlType: mDelegateInfo.controlType || oControl.getMetadata().getName(),
|
|
157
|
+
instance: _pick(mDelegateInfo.instance, ["createLabel", "createControlForProperty", "createLayout"])
|
|
158
|
+
}
|
|
159
|
+
: undefined;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Returns the write delegate for the requested control.
|
|
164
|
+
* The instancespecific write delegate is returned if available.
|
|
165
|
+
*
|
|
166
|
+
* @param {sap.ui.core.Element} oControl - Control for which the corresponding delegate should be returned
|
|
167
|
+
* @param {sap.ui.core.util.reflection.BaseTreeModifier} oModifier - Control tree modifier
|
|
168
|
+
* @returns {Promise.<sap.ui.core.util.reflection.FlexDelegateInfo>} Delegate information including the lazy loaded instance of the delegate
|
|
169
|
+
*/
|
|
170
|
+
DelegateMediator.getWriteDelegateForControl = async function(oControl, oModifier) {
|
|
171
|
+
let mControlSpecificDelegateInfo = await getControlSpecificDelegateInfo(oControl, oModifier);
|
|
172
|
+
let mInstanceSpecificDelegateInfo = await oModifier.getFlexDelegate(oControl);
|
|
173
|
+
[mInstanceSpecificDelegateInfo, mControlSpecificDelegateInfo] = await loadDelegates(oControl, oModifier, [
|
|
174
|
+
mInstanceSpecificDelegateInfo,
|
|
175
|
+
mControlSpecificDelegateInfo
|
|
176
|
+
]);
|
|
177
|
+
return (mInstanceSpecificDelegateInfo?.instance.createLabel
|
|
178
|
+
|| mInstanceSpecificDelegateInfo?.instance.createLayout)
|
|
179
|
+
? finalizeWriteDelegateInfo(mInstanceSpecificDelegateInfo, oControl)
|
|
180
|
+
: finalizeWriteDelegateInfo(mControlSpecificDelegateInfo, oControl);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Clears the model and control specific delegate items.
|
|
185
|
+
* This method is used for testing purposes.
|
|
186
|
+
*/
|
|
187
|
+
DelegateMediator.clear = function() {
|
|
188
|
+
mModelSpecificDelegateItems = {};
|
|
189
|
+
mControlSpecificDelegateItems = {};
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
return DelegateMediator;
|
|
193
|
+
});
|
|
@@ -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.123.0
|
|
23
23
|
* @private
|
|
24
24
|
* @ui5-restricted sap.ui.fl.apply._internal
|
|
25
25
|
*/
|