@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.
Files changed (152) hide show
  1. package/package.json +3 -3
  2. package/src/sap/ui/fl/.library +1 -1
  3. package/src/sap/ui/fl/ChangePersistence.js +1 -1
  4. package/src/sap/ui/fl/ChangePersistenceFactory.js +1 -1
  5. package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
  6. package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
  7. package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
  8. package/src/sap/ui/fl/FlexController.js +1 -1
  9. package/src/sap/ui/fl/FlexControllerFactory.js +1 -1
  10. package/src/sap/ui/fl/LayerUtils.js +1 -1
  11. package/src/sap/ui/fl/Utils.js +1 -1
  12. package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +90 -46
  13. package/src/sap/ui/fl/apply/_internal/DelegateMediatorNew.js +193 -0
  14. package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
  15. package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
  16. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
  17. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
  18. package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
  19. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
  20. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +1 -1
  21. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
  22. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
  23. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
  26. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
  27. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
  28. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
  30. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
  31. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
  32. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
  33. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
  34. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
  35. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
  36. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageConnector.js +8 -4
  37. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
  38. package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
  39. package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
  40. package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
  41. package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +1 -1
  42. package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +1 -1
  43. package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +1 -1
  44. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +1 -1
  45. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +7 -11
  46. package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
  47. package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +6 -2
  48. package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +7 -6
  49. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +39 -24
  50. package/src/sap/ui/fl/apply/_internal/flexState/InitialPrepareFunctions.js +1 -1
  51. package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
  52. package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
  53. package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  54. package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
  55. package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +1 -1
  56. package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
  57. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
  58. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -1
  59. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +1 -1
  60. package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +0 -3
  61. package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
  62. package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +11 -1
  63. package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
  64. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
  65. package/src/sap/ui/fl/apply/api/DelegateMediatorAPI.js +75 -7
  66. package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
  67. package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
  68. package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
  69. package/src/sap/ui/fl/changeHandler/Base.js +1 -1
  70. package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
  71. package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
  72. package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
  73. package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
  74. package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
  75. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  76. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
  77. package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
  78. package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
  79. package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
  80. package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
  81. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  82. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +4 -4
  83. package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
  84. package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
  85. package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
  86. package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
  87. package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
  88. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +1 -1
  89. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +1 -1
  90. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +1 -1
  91. package/src/sap/ui/fl/initial/_internal/connectors/LrepConnector.js +12 -8
  92. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
  93. package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
  94. package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
  95. package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
  96. package/src/sap/ui/fl/library.js +43 -43
  97. package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +1 -1
  98. package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
  99. package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
  100. package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
  101. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
  102. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
  103. package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
  104. package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
  105. package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
  106. package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
  107. package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
  108. package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
  109. package/src/sap/ui/fl/util/IFrame.js +1 -1
  110. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  111. package/src/sap/ui/fl/util/resolveBinding.js +1 -1
  112. package/src/sap/ui/fl/variants/VariantModel.js +18 -1
  113. package/src/sap/ui/fl/write/_internal/Storage.js +1 -1
  114. package/src/sap/ui/fl/write/_internal/Versions.js +12 -9
  115. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
  116. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
  117. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  118. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +1 -1
  119. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +1 -1
  120. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
  121. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  122. package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +1 -1
  123. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
  124. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +1 -1
  125. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  126. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
  127. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  128. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  129. package/src/sap/ui/fl/write/_internal/delegates/ODataV2ReadDelegate.js +276 -0
  130. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  131. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  132. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  133. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  134. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  135. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  136. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
  137. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  138. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
  139. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  140. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
  141. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  142. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
  143. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
  144. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectState.js +1 -1
  145. package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  146. package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +1 -1
  147. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
  148. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  149. package/src/sap/ui/fl/write/api/FieldExtensibility.js +37 -7
  150. package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +0 -1
  151. package/src/sap/ui/fl/write/api/VersionsAPI.js +33 -35
  152. 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.122.0",
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.122.0",
18
- "@openui5/sap.ui.core": "1.122.0"
17
+ "@openui5/sap.m": "1.123.0",
18
+ "@openui5/sap.ui.core": "1.123.0"
19
19
  }
20
20
  }
@@ -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.122.0</version>
9
+ <version>1.123.0</version>
10
10
 
11
11
  <documentation>SAPUI5 library with sap.ui.fl controls.</documentation>
12
12
 
@@ -68,7 +68,7 @@ sap.ui.define([
68
68
  *
69
69
  * @constructor
70
70
  * @author SAP SE
71
- * @version 1.122.0
71
+ * @version 1.123.0
72
72
  * @since 1.25.0
73
73
  * @private
74
74
  * @param {object} mComponent - Component data to initiate <code>ChangePersistence</code> instance
@@ -19,7 +19,7 @@ sap.ui.define([
19
19
  * @alias sap.ui.fl.ChangePersistenceFactory
20
20
  * @since 1.27.0
21
21
  * @author SAP SE
22
- * @version 1.122.0
22
+ * @version 1.123.0
23
23
  * @private
24
24
  * @ui5-restricted sap.ui.fl
25
25
  */
@@ -20,7 +20,7 @@ function(
20
20
  * @namespace
21
21
  *
22
22
  * @author SAP SE
23
- * @version 1.122.0
23
+ * @version 1.123.0
24
24
  *
25
25
  * @private
26
26
  * @since 1.48
@@ -20,7 +20,7 @@ function(
20
20
  * @namespace
21
21
  *
22
22
  * @author SAP SE
23
- * @version 1.122.0
23
+ * @version 1.123.0
24
24
  *
25
25
  * @private
26
26
  * @since 1.58
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  * @namespace
18
18
  *
19
19
  * @author SAP SE
20
- * @version 1.122.0
20
+ * @version 1.123.0
21
21
  *
22
22
  * @private
23
23
  * @since 1.48
@@ -81,7 +81,7 @@ sap.ui.define([
81
81
  * @since 1.27.0
82
82
  * @private
83
83
  * @author SAP SE
84
- * @version 1.122.0
84
+ * @version 1.123.0
85
85
  */
86
86
  var FlexController = function(sComponentName) {
87
87
  this._oChangePersistence = undefined;
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  * @alias sap.ui.fl.FlexControllerFactory
23
23
  * @since 1.27.0
24
24
  * @author SAP SE
25
- * @version 1.122.0
25
+ * @version 1.123.0
26
26
  *
27
27
  * @private
28
28
  * @ui5-restricted sap.ui.fl
@@ -41,7 +41,7 @@ sap.ui.define([
41
41
  *
42
42
  * @namespace sap.ui.fl.LayerUtils
43
43
  * @author SAP SE
44
- * @version 1.122.0
44
+ * @version 1.123.0
45
45
  */
46
46
  var LayerUtils = {
47
47
  _mLayersIndex: mLayersIndex,
@@ -65,7 +65,7 @@ sap.ui.define([
65
65
  * @namespace
66
66
  * @alias sap.ui.fl.Utils
67
67
  * @author SAP SE
68
- * @version 1.122.0
68
+ * @version 1.123.0
69
69
  *
70
70
  * @private
71
71
  * @ui5-restricted sap.ui.fl, sap.ui.rta
@@ -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.122.0
29
+ * @version 1.123.0
29
30
  *
30
31
  */
31
- var DelegateMediator = {};
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
- var oModel = oControl.getModel();
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
- var aDelegateInfo = DelegateMediator._mDefaultDelegateItems[sModelType];
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
- var aPromises = [];
92
+ const aPromises = [];
71
93
  aDelegates.forEach(function(mDelegateInfo) {
72
94
  aPromises.push(function(aLoadedDelegates) {
73
- return requireAsync(mDelegateInfo.name)
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
- var mResultDelegateInfo = {
165
+ let mResultDelegateInfo = {
154
166
  names: [],
155
167
  instance: {},
156
168
  modelType: aDelegates.length && aDelegates[0].modelType
157
169
  };
158
- var bReadPartMissing = true;
159
- var bWritePartMissing = true;
160
- for (var i = (aDelegates.length - 1); i >= 0; i--) {
161
- var mDelegateInfo = aDelegates[i];
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
- var aDefaultDelegates = DelegateMediator._mDefaultDelegateItems[mPropertyBag.modelType] || [];
211
- var aDefaultDelegateTypes = aDefaultDelegates.map(function(mDefaultDelegateInfo) {
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
- var aDelegateInfo = DelegateMediator._mDefaultDelegateItems[sModelType] || [];
246
+ const aDelegateInfo = DelegateMediator._mDefaultDelegateItems[sModelType] || [];
235
247
  return aDelegateInfo.reduce(function(aRequiredLibNames, mDelegateInfo) {
236
- var bIsDefaultDelegate = aDelegateNames.indexOf(mDelegateInfo.name) > -1;
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} sModelType - Delegate model type
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(sModelType) {
248
- return !!DelegateMediator._mDefaultDelegateItems[sModelType];
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
- return validateInputParameters(oControl, oModifier)
292
- .then(function() {
293
- return oModifier.getFlexDelegate(oControl);
294
- })
295
- .then(function(mInstanceSpecificDelegate) {
296
- var aDelegateInfo = (bSupportsDefault && getDefaultDelegateInfo(oControl, sModelType)) || [];
297
- if (mInstanceSpecificDelegate) {
298
- // instance specific delegate always takes over
299
- aDelegateInfo.push(mInstanceSpecificDelegate);
300
- }
301
- return loadDelegates(oModifier, oControl, aDelegateInfo);
302
- })
303
- .then(mergeDelegates.bind(this));
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
+ });
@@ -31,7 +31,7 @@ sap.ui.define([
31
31
  * @since 1.61.0
32
32
  * @private
33
33
  * @author SAP SE
34
- * @version 1.122.0
34
+ * @version 1.123.0
35
35
  */
36
36
  var FlexCustomData = {};
37
37
 
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  *
23
23
  * @namespace sap.ui.fl.apply._internal.changes.Utils
24
24
  * @since 1.70
25
- * @version 1.122.0
25
+ * @version 1.123.0
26
26
  * @private
27
27
  * @ui5-restricted sap.ui.fl.apply._internal, sap.ui.fl.write._internal
28
28
  */
@@ -27,7 +27,7 @@ sap.ui.define([
27
27
  *
28
28
  * @namespace sap.ui.fl.apply._internal.changes.descriptor.Preprocessor
29
29
  * @since 1.74
30
- * @version 1.122.0
30
+ * @version 1.123.0
31
31
  * @private
32
32
  * @ui5-restricted sap.ui.fl.apply._internal
33
33
  */
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  *
18
18
  * @namespace sap.ui.fl.apply._internal.changes.descriptor.Registration
19
19
  * @since 1.74
20
- * @version 1.122.0
20
+ * @version 1.123.0
21
21
  * @private
22
22
  * @ui5-restricted sap.ui.fl.apply._internal
23
23
  */
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  *
21
21
  * @namespace sap.ui.fl.apply._internal.changes.descriptor.RegistrationBuild
22
22
  * @since 1.77
23
- * @version 1.122.0
23
+ * @version 1.123.0
24
24
  * @private
25
25
  * @ui5-restricted sap.ui.fl.apply._internal
26
26
  */
@@ -135,7 +135,7 @@ sap.ui.define([
135
135
  * @namespace
136
136
  * @alias sap.ui.fl.apply._internal.changes.descriptor.app.AddAnnotationsToOData
137
137
  * @since 1.87
138
- * @version 1.122.0
138
+ * @version 1.123.0
139
139
  * @private
140
140
  * @ui5-restricted sap.ui.fl.apply._internal
141
141
  */
@@ -34,7 +34,7 @@ sap.ui.define([
34
34
  *
35
35
  * @namespace
36
36
  * @alias sap.ui.fl.apply._internal.changes.descriptor.app.AddNewInbound
37
- * @version 1.122.0
37
+ * @version 1.123.0
38
38
  * @private
39
39
  * @ui5-restricted sap.ui.fl.apply._internal
40
40
  */
@@ -30,7 +30,7 @@ sap.ui.define([
30
30
  *
31
31
  * @namespace
32
32
  * @alias sap.ui.fl.apply._internal.changes.descriptor.app.ChangeDataSource
33
- * @version 1.122.0
33
+ * @version 1.123.0
34
34
  * @private
35
35
  * @ui5-restricted sap.ui.fl.apply._internal
36
36
  */
@@ -31,7 +31,7 @@ sap.ui.define([
31
31
  *
32
32
  * @namespace
33
33
  * @alias sap.ui.fl.apply._internal.changes.descriptor.app.ChangeInbound
34
- * @version 1.122.0
34
+ * @version 1.123.0
35
35
  * @private
36
36
  * @ui5-restricted sap.ui.fl.apply._internal
37
37
  */
@@ -44,7 +44,7 @@ sap.ui.define([
44
44
  *
45
45
  * @namespace
46
46
  * @alias sap.ui.fl.apply._internal.changes.descriptor.app.RemoveAllInboundsExceptOne
47
- * @version 1.122.0
47
+ * @version 1.123.0
48
48
  * @private
49
49
  * @ui5-restricted sap.ui.fl.apply._internal
50
50
  */
@@ -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.122.0
22
+ * @version 1.123.0
23
23
  * @private
24
24
  * @ui5-restricted sap.ui.fl.apply._internal
25
25
  */
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  *
21
21
  * @namespace
22
22
  * @alias sap.ui.fl.apply._internal.changes.descriptor.fiori.SetAbstract
23
- * @version 1.122.0
23
+ * @version 1.123.0
24
24
  * @private
25
25
  * @ui5-restricted sap.ui.fl.apply._internal
26
26
  */
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  *
21
21
  * @namespace
22
22
  * @alias sap.ui.fl.apply._internal.changes.descriptor.fiori.SetRegistrationIds
23
- * @version 1.122.0
23
+ * @version 1.123.0
24
24
  * @private
25
25
  * @ui5-restricted sap.ui.fl.apply._internal
26
26
  */