@openui5/sap.ui.fl 1.139.0 → 1.141.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 (205) hide show
  1. package/.eslint-rules/import-check.js +71 -0
  2. package/THIRDPARTY.txt +2 -2
  3. package/package.json +3 -3
  4. package/src/sap/ui/fl/.library +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/LayerUtils.js +1 -1
  9. package/src/sap/ui/fl/Utils.js +1 -1
  10. package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +13 -3
  11. package/src/sap/ui/fl/apply/_internal/changes/Applier.js +3 -2
  12. package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
  13. package/src/sap/ui/fl/apply/_internal/changes/Reverter.js +4 -1
  14. package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
  15. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +2 -2
  16. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
  17. package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
  18. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
  19. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewDataSource.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/AddNewOutbound.js +1 -1
  22. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddTechnicalAttributes.js +1 -1
  23. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +1 -1
  26. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
  27. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetAch.js +1 -1
  28. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetDescription.js +1 -1
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
  30. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
  31. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetCloudDevAdaptationStatus.js +1 -1
  32. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
  33. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
  34. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
  35. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
  36. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
  37. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
  38. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
  39. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
  40. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/ChangeModel.js +1 -1
  41. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
  42. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
  43. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
  44. package/src/sap/ui/fl/apply/_internal/controlVariants/URLHandler.js +14 -12
  45. package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +2 -2
  46. package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
  47. package/src/sap/ui/fl/apply/_internal/flexObjects/AnnotationChange.js +1 -1
  48. package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
  49. package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +13 -10
  50. package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +1 -1
  51. package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +1 -1
  52. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +2 -2
  53. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +2 -8
  54. package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
  55. package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +2 -2
  56. package/src/sap/ui/fl/apply/_internal/flexObjects/VariantChange.js +1 -1
  57. package/src/sap/ui/fl/apply/_internal/flexObjects/VariantManagementChange.js +1 -1
  58. package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +6 -3
  59. package/src/sap/ui/fl/apply/_internal/flexState/DataSelector.js +5 -5
  60. package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +12 -26
  61. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +68 -229
  62. package/src/sap/ui/fl/apply/_internal/flexState/InitialPrepareFunctions.js +0 -8
  63. package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  64. package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
  65. package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +3 -3
  66. package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
  67. package/src/sap/ui/fl/apply/_internal/flexState/communication/FLPAboutInfo.js +2 -2
  68. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantManagementState.js +287 -10
  69. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/applyChangesOnVariant.js +61 -0
  70. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +22 -5
  71. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +72 -19
  72. package/src/sap/ui/fl/apply/_internal/init.js +47 -0
  73. package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +17 -7
  74. package/src/sap/ui/fl/apply/api/AnnotationChangeHandlerAPI.js +2 -1
  75. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +190 -53
  76. package/src/sap/ui/fl/apply/api/DelegateMediatorAPI.js +17 -1
  77. package/src/sap/ui/fl/apply/api/ExtensionPointRegistryAPI.js +2 -1
  78. package/src/sap/ui/fl/apply/api/FlexRuntimeInfoAPI.js +6 -5
  79. package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +45 -45
  80. package/src/sap/ui/fl/apply/api/UI2PersonalizationApplyAPI.js +2 -1
  81. package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
  82. package/src/sap/ui/fl/changeHandler/AddXML.js +2 -2
  83. package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +4 -4
  84. package/src/sap/ui/fl/changeHandler/Base.js +3 -2
  85. package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
  86. package/src/sap/ui/fl/changeHandler/BaseAddXml.js +21 -9
  87. package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
  88. package/src/sap/ui/fl/changeHandler/ChangeAnnotation.js +7 -2
  89. package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
  90. package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
  91. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  92. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
  93. package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
  94. package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
  95. package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
  96. package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
  97. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  98. package/src/sap/ui/fl/changeHandler/common/createIFrame.js +1 -4
  99. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChange.js +3 -3
  100. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +3 -3
  101. package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
  102. package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
  103. package/src/sap/ui/fl/designtime/variants/VariantManagement.designtime.js +14 -12
  104. package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
  105. package/src/sap/ui/fl/initial/_internal/Loader.js +372 -0
  106. package/src/sap/ui/fl/{apply/_internal/flexState → initial/_internal}/ManifestUtils.js +1 -1
  107. package/src/sap/ui/fl/initial/_internal/Settings.js +1 -1
  108. package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
  109. package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
  110. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +67 -9
  111. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +1 -1
  112. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +12 -5
  113. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
  114. package/src/sap/ui/fl/{apply → initial}/_internal/preprocessors/ControllerExtension.js +16 -5
  115. package/src/sap/ui/fl/{apply → initial}/_internal/preprocessors/RegistrationDelegator.js +9 -40
  116. package/src/sap/ui/fl/{apply → initial}/_internal/preprocessors/XmlPreprocessor.js +29 -21
  117. package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
  118. package/src/sap/ui/fl/initial/api/InitialFlexAPI.js +1 -1
  119. package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
  120. package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
  121. package/src/sap/ui/fl/library.js +44 -44
  122. package/src/sap/ui/fl/messagebundle_vi.properties +1 -1
  123. package/src/sap/ui/fl/support/_internal/extractChangeDependencies.js +1 -1
  124. package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +2 -2
  125. package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
  126. package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +2 -2
  127. package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
  128. package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
  129. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
  130. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
  131. package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
  132. package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
  133. package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
  134. package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
  135. package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
  136. package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
  137. package/src/sap/ui/fl/util/IFrame.js +5 -4
  138. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  139. package/src/sap/ui/fl/variants/VariantManagement.js +88 -36
  140. package/src/sap/ui/fl/variants/VariantManager.js +81 -21
  141. package/src/sap/ui/fl/variants/VariantModel.js +38 -189
  142. package/src/sap/ui/fl/write/_internal/SaveAs.js +1 -1
  143. package/src/sap/ui/fl/write/_internal/Storage.js +14 -1
  144. package/src/sap/ui/fl/write/_internal/Versions.js +9 -5
  145. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +10 -1
  146. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +6 -1
  147. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  148. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +1 -1
  149. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +1 -1
  150. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
  151. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  152. package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +27 -2
  153. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
  154. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +4 -1
  155. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  156. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
  157. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  158. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  159. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  160. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  161. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  162. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  163. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  164. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  165. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
  166. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  167. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
  168. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  169. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
  170. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  171. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
  172. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
  173. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectManager.js +40 -71
  174. package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +3 -3
  175. package/src/sap/ui/fl/write/_internal/flexState/changes/UIChangeManager.js +1 -1
  176. package/src/sap/ui/fl/write/_internal/flexState/compVariants/{CompVariantState.js → CompVariantManager.js} +176 -309
  177. package/src/sap/ui/fl/write/_internal/init.js +27 -0
  178. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +2 -2
  179. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  180. package/src/sap/ui/fl/write/api/Adaptations.js +1 -1
  181. package/src/sap/ui/fl/write/api/AppVariantWriteAPI.js +4 -2
  182. package/src/sap/ui/fl/write/api/BusinessNetworkAPI.js +60 -26
  183. package/src/sap/ui/fl/write/api/ChangesWriteAPI.js +4 -3
  184. package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +19 -23
  185. package/src/sap/ui/fl/write/api/ContextSharingAPI.js +3 -2
  186. package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +2 -1
  187. package/src/sap/ui/fl/write/api/FeaturesAPI.js +2 -1
  188. package/src/sap/ui/fl/write/api/FieldExtensibility.js +3 -2
  189. package/src/sap/ui/fl/write/api/LocalResetAPI.js +3 -2
  190. package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +23 -20
  191. package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +10 -7
  192. package/src/sap/ui/fl/write/api/SACIntegrationUpdateVariant.js +8 -7
  193. package/src/sap/ui/fl/write/api/SmartBusinessWriteAPI.js +3 -2
  194. package/src/sap/ui/fl/write/api/SmartVariantManagementWriteAPI.js +26 -22
  195. package/src/sap/ui/fl/write/api/TranslationAPI.js +3 -2
  196. package/src/sap/ui/fl/write/api/UI2PersonalizationWriteAPI.js +4 -3
  197. package/src/sap/ui/fl/write/api/VersionsAPI.js +4 -3
  198. package/src/sap/ui/fl/write/api/connectors/FileListBaseConnector.js +3 -2
  199. package/src/sap/ui/fl/write/api/connectors/ObjectStorageConnector.js +4 -2
  200. package/src/sap/ui/fl/write/connectors/BaseConnector.js +13 -0
  201. package/ui5.yaml +0 -1
  202. package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +0 -208
  203. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +0 -233
  204. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap.js +0 -118
  205. package/src/sap/ui/fl/util/resolveBinding.js +0 -79
@@ -0,0 +1,372 @@
1
+ /*!
2
+ * OpenUI5
3
+ * (c) Copyright 2025 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+
7
+ sap.ui.define([
8
+ "sap/base/util/Deferred",
9
+ "sap/base/util/merge",
10
+ "sap/base/util/ObjectPath",
11
+ "sap/base/Log",
12
+ "sap/ui/base/ManagedObject",
13
+ "sap/ui/fl/initial/_internal/FlexInfoSession",
14
+ "sap/ui/fl/initial/_internal/ManifestUtils",
15
+ "sap/ui/fl/initial/_internal/Settings",
16
+ "sap/ui/fl/initial/_internal/Storage",
17
+ "sap/ui/fl/initial/_internal/StorageUtils"
18
+ ], function(
19
+ Deferred,
20
+ merge,
21
+ ObjectPath,
22
+ Log,
23
+ ManagedObject,
24
+ FlexInfoSession,
25
+ ManifestUtils,
26
+ Settings,
27
+ Storage,
28
+ StorageUtils
29
+ ) {
30
+ "use strict";
31
+
32
+ const _mCachedFlexData = {};
33
+ const _mInitPromises = {};
34
+
35
+ /**
36
+ * Class for loading Flex Data from the backend via the Connectors.
37
+ *
38
+ * @namespace sap.ui.fl.apply._internal.flexState.Loader
39
+ * @since 1.74
40
+ * @version 1.141.0
41
+ * @private
42
+ * @ui5-restricted sap.ui.fl.apply._internal.flexState
43
+ */
44
+ const Loader = {};
45
+
46
+ function getIdIsLocalTrueObject(vSelector) {
47
+ if (typeof vSelector === "string") {
48
+ vSelector = {id: vSelector};
49
+ }
50
+ vSelector.idIsLocal = true;
51
+
52
+ return vSelector;
53
+ }
54
+
55
+ function migrateOVPSelectorFlags(oManifest, mFlexData) {
56
+ if (ManifestUtils.getOvpEntry(oManifest)) {
57
+ [
58
+ mFlexData.changes,
59
+ mFlexData.variantChanges,
60
+ mFlexData.variantDependentControlChanges,
61
+ mFlexData.variantManagementChanges
62
+ ]
63
+ .flat()
64
+ .filter((oFlexObject) => (
65
+ oFlexObject.selector
66
+ && !oFlexObject.selector.idIsLocal
67
+ ))
68
+ .forEach(function(oFlexObject) {
69
+ oFlexObject.selector = getIdIsLocalTrueObject(oFlexObject.selector);
70
+
71
+ if (oFlexObject.dependentSelector) {
72
+ Object.keys(oFlexObject.dependentSelector).forEach((sCategory) => {
73
+ const vDependentSelector = oFlexObject.dependentSelector[sCategory];
74
+ if (Array.isArray(vDependentSelector)) {
75
+ oFlexObject.dependentSelector[sCategory] = vDependentSelector.map(getIdIsLocalTrueObject);
76
+ } else {
77
+ oFlexObject.dependentSelector[sCategory] = getIdIsLocalTrueObject(vDependentSelector);
78
+ }
79
+ });
80
+ }
81
+ });
82
+ }
83
+
84
+ return mFlexData;
85
+ }
86
+
87
+ function filterInvalidFileNames(mFlexData) {
88
+ StorageUtils.getAllFlexObjectNamespaces().forEach(function(vKey) {
89
+ const aFlexItems = ObjectPath.get(vKey, mFlexData);
90
+ if (aFlexItems) {
91
+ ObjectPath.set(vKey, aFlexItems.filter((oFlexItem) => {
92
+ let oTemporaryInstance;
93
+ try {
94
+ oTemporaryInstance = new ManagedObject(oFlexItem.fileName);
95
+ } catch (error) {
96
+ return false;
97
+ }
98
+ oTemporaryInstance.destroy();
99
+ return true;
100
+ }), mFlexData);
101
+ }
102
+ });
103
+ return mFlexData;
104
+ }
105
+
106
+ function getSideId(oComponentData) {
107
+ if (oComponentData?.startupParameters && Array.isArray(oComponentData.startupParameters.hcpApplicationId)) {
108
+ return oComponentData.startupParameters.hcpApplicationId[0];
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Removes the changes that should be deactivated and the deactivate changes from the Flex Data.
114
+ * This is the equivalent of deleting changes from the backend.
115
+ * Example Scenario: When creating an annotation rename change, any control based rename changes should be removed.
116
+ * But Developer changes can't be deleted from the backend, so they are deactivated.
117
+ *
118
+ * @param {object} mFlexData - Flex Data as returned from the Storage
119
+ * @returns {object} Flex Data without the deactivate and deactivated changes
120
+ */
121
+ function applyDeactivateChanges(mFlexData) {
122
+ const sDeactivateChangeType = "deactivateChanges";
123
+ const aToBeDeactivatedIds = mFlexData.changes.map((oChange) => {
124
+ if (oChange.changeType === sDeactivateChangeType) {
125
+ return [oChange.fileName, ...oChange.content.changeIds];
126
+ }
127
+ })
128
+ .flat()
129
+ .filter(Boolean);
130
+
131
+ // Filter all changes that should be deactivated (also already includes the id of the deactivate changes)
132
+ if (aToBeDeactivatedIds.length) {
133
+ StorageUtils.getAllFlexObjectNamespaces().forEach(function(vKey) {
134
+ const aFlexItems = ObjectPath.get(vKey, mFlexData);
135
+ if (aFlexItems.length) {
136
+ ObjectPath.set(vKey, aFlexItems.filter((oFlexItem) => !aToBeDeactivatedIds.includes(oFlexItem.fileName)), mFlexData);
137
+ }
138
+ });
139
+ }
140
+ return mFlexData;
141
+ }
142
+
143
+ /**
144
+ * Provides the flex data for a given application based on the configured connectors.
145
+ * This function needs a manifest object, async hints and either an ID to an instantiated component or component data as parameter.
146
+ * The fetched data is cached statically in the Loader class. Together with the data, all parameters that have been used
147
+ * for the request are cached as well. If the function is called again with the same parameters,
148
+ * the cached data is returned instead of a new request to the backend.
149
+ *
150
+ * @param {object} mPropertyBag - Contains additional data needed for loading changes
151
+ * @param {object} mPropertyBag.manifest - ManifestObject that belongs to current component
152
+ * @param {string} mPropertyBag.reference - Flex Reference
153
+ * @param {object} mPropertyBag.componentData - Component data of the current component
154
+ * @param {boolean} [mPropertyBag.reInitialize] - Flag if the application is reinitialized even if it was loaded before
155
+ * @param {object} [mPropertyBag.asyncHints] - Async hints passed from the app index to the component processing
156
+ * @param {boolean} [mPropertyBag.skipLoadBundle=false] - If true only the partial flex data is loaded, without the bundle
157
+ * @returns {Promise<object>} Resolves with the change file for the given component from the Storage
158
+ */
159
+ Loader.getFlexData = async function(mPropertyBag) {
160
+ // the FlexInfoSession is used to adjust the parameters of the request
161
+ let oFlexInfoSession = FlexInfoSession.getByReference(mPropertyBag.reference);
162
+ const mPropertyBagCopy = merge({}, mPropertyBag, {
163
+ version: oFlexInfoSession.version,
164
+ adaptationId: oFlexInfoSession.displayedAdaptationId,
165
+ allContextsProvided: oFlexInfoSession.allContextsProvided
166
+ });
167
+ const sReference = mPropertyBagCopy.reference;
168
+
169
+ const oOldInitPromise = _mInitPromises[sReference];
170
+ const oNewInitPromise = new Deferred();
171
+ _mInitPromises[sReference] = oNewInitPromise;
172
+
173
+ if (oOldInitPromise) {
174
+ await oOldInitPromise.promise;
175
+ }
176
+
177
+ const bRequiresNewLoadRequest =
178
+ mPropertyBag.reInitialize
179
+ || !_mCachedFlexData[mPropertyBag.reference]
180
+ || _mCachedFlexData[sReference].parameters.emptyState
181
+ || _mCachedFlexData[sReference].parameters.version !== mPropertyBagCopy.version
182
+ || _mCachedFlexData[sReference].parameters.allContextsProvided !== mPropertyBagCopy.allContextsProvided
183
+ || _mCachedFlexData[sReference].parameters.adaptationId !== mPropertyBagCopy.adaptationId;
184
+
185
+ const bRequiresOnlyCompletion =
186
+ _mCachedFlexData[sReference]
187
+ && !_mCachedFlexData[sReference].parameters.emptyState
188
+ && _mCachedFlexData[sReference].parameters.bundleNotLoaded
189
+ && !mPropertyBagCopy.skipLoadBundle;
190
+
191
+ if (!bRequiresNewLoadRequest && !bRequiresOnlyCompletion) {
192
+ oNewInitPromise.resolve();
193
+ return {
194
+ data: _mCachedFlexData[sReference].data,
195
+ cacheInvalidated: false
196
+ };
197
+ }
198
+
199
+ let oFlexData;
200
+ let oAuthors;
201
+ const sComponentName = ManifestUtils.getBaseComponentNameFromManifest(mPropertyBagCopy.manifest);
202
+ if (bRequiresNewLoadRequest) {
203
+ // the cache key cannot be used in case of a reinitialization
204
+ const sCacheKey = mPropertyBagCopy.reInitialize
205
+ ? undefined
206
+ : ManifestUtils.getCacheKeyFromAsyncHints(sReference, mPropertyBagCopy.asyncHints);
207
+
208
+ oFlexData = await Storage.loadFlexData({
209
+ preview: ManifestUtils.getPreviewSectionFromAsyncHints(mPropertyBagCopy.asyncHints),
210
+ reference: sReference,
211
+ componentName: sComponentName,
212
+ cacheKey: sCacheKey,
213
+ siteId: getSideId(mPropertyBagCopy.componentData),
214
+ appDescriptor: mPropertyBagCopy.manifest.getRawJson ? mPropertyBagCopy.manifest.getRawJson() : mPropertyBagCopy.manifest,
215
+ version: mPropertyBagCopy.version,
216
+ adaptationId: mPropertyBagCopy.adaptationId,
217
+ skipLoadBundle: mPropertyBagCopy.skipLoadBundle
218
+ });
219
+ const oSettings = await Settings.getInstance();
220
+ oAuthors = oSettings.getIsVariantAuthorNameAvailable() ? await Storage.loadVariantsAuthors(sReference) : {};
221
+ } else {
222
+ oFlexData = await Storage.completeFlexData({
223
+ reference: sReference,
224
+ componentName: sComponentName,
225
+ partialFlexData: _mCachedFlexData[sReference].data.changes
226
+ });
227
+ oAuthors = _mCachedFlexData[sReference].data.authors;
228
+ }
229
+
230
+ const oFlexDataCopy = Object.assign({}, oFlexData);
231
+ applyDeactivateChanges(oFlexDataCopy);
232
+ filterInvalidFileNames(oFlexDataCopy);
233
+ migrateOVPSelectorFlags(mPropertyBagCopy.manifest, oFlexDataCopy);
234
+
235
+ const oFormattedFlexData = {
236
+ changes: oFlexDataCopy,
237
+ cacheKey: oFlexDataCopy.cacheKey,
238
+ authors: oAuthors
239
+ };
240
+
241
+ _mCachedFlexData[sReference] = {
242
+ data: oFormattedFlexData,
243
+ parameters: {
244
+ bundleNotLoaded: !!mPropertyBagCopy.skipLoadBundle,
245
+ version: mPropertyBagCopy.version,
246
+ allContextsProvided: mPropertyBagCopy.allContextsProvided,
247
+ adaptationId: mPropertyBagCopy.adaptationId
248
+ }
249
+ };
250
+
251
+ if (oFormattedFlexData.changes.info !== undefined) {
252
+ oFlexInfoSession = { ...oFlexInfoSession, ...oFormattedFlexData.changes.info };
253
+ }
254
+ FlexInfoSession.setByReference(oFlexInfoSession, sReference);
255
+ oNewInitPromise.resolve();
256
+ return {
257
+ data: oFormattedFlexData,
258
+ cacheInvalidated: true
259
+ };
260
+ };
261
+
262
+ /**
263
+ * Initializes an empty cache for a specific reference.
264
+ *
265
+ * @param {string} sReference - The flex reference for which to initialize the cache.
266
+ * @returns {object} The empty Flex Data object
267
+ */
268
+ Loader.initializeEmptyCache = function(sReference) {
269
+ const oInitialFlexData = { changes: StorageUtils.getEmptyFlexDataResponse() };
270
+ _mCachedFlexData[sReference] = {
271
+ data: oInitialFlexData,
272
+ parameters: {
273
+ bundleNotLoaded: true,
274
+ emptyState: true
275
+ }
276
+ };
277
+ return oInitialFlexData;
278
+ };
279
+
280
+ /**
281
+ * Clears the cache for a specific reference or for all references if no reference is provided.
282
+ * Should only be used in tests.
283
+ *
284
+ * @param {string} [sReference] - The flex reference for which to clear the cache.
285
+ */
286
+ Loader.clearCache = function(sReference) {
287
+ if (sReference) {
288
+ delete _mCachedFlexData[sReference];
289
+ delete _mInitPromises[sReference];
290
+ } else {
291
+ Object.keys(_mCachedFlexData).forEach((sReference) => {
292
+ delete _mCachedFlexData[sReference];
293
+ delete _mInitPromises[sReference];
294
+ });
295
+ }
296
+ };
297
+
298
+ /**
299
+ * Loads a FlVariant and updates the cached flex data.
300
+ *
301
+ * @param {object} mPropertyBag - The property bag containing the variant reference and other parameters.
302
+ * @param {string} mPropertyBag.variantReference - The reference of the variant to load.
303
+ * @param {string} mPropertyBag.reference - The flex reference of the application.
304
+ * @returns {Promise<object>} Resolves with the loaded variant data.
305
+ */
306
+ Loader.loadFlVariant = async function(mPropertyBag) {
307
+ const oNewData = await Storage.loadFlVariant({
308
+ variantReference: mPropertyBag.variantReference,
309
+ reference: mPropertyBag.reference
310
+ });
311
+ Object.entries(oNewData).forEach(([sKey, vValue]) => {
312
+ _mCachedFlexData[mPropertyBag.reference].data.changes[sKey].push(...vValue);
313
+ });
314
+ return {
315
+ newData: oNewData,
316
+ completeData: _mCachedFlexData[mPropertyBag.reference].data
317
+ };
318
+ };
319
+
320
+ /**
321
+ * Updates the storage response for a specific reference.
322
+ *
323
+ * @param {string} sReference - The flex reference for which to update the storage response.
324
+ * @param {object[]} aUpdates - The updates to apply to the storage response.
325
+ */
326
+ Loader.updateCachedResponse = function(sReference, aUpdates) {
327
+ StorageUtils.updateStorageResponse(_mCachedFlexData[sReference].data, aUpdates);
328
+ };
329
+
330
+ /**
331
+ * Retrieves the cached flexibility data for a specific reference.
332
+ *
333
+ * @param {string} sReference - The flex reference for which to retrieve the cached data.
334
+ * @returns {Promise<object>} A promise that resolves with the cached flexibility data or an empty object if not found.
335
+ */
336
+ Loader.getCachedFlexData = function(sReference) {
337
+ // TODO return copy of the data once the CompVariantManager does not mutate it anymore
338
+ return _mCachedFlexData[sReference]?.data || {};
339
+ };
340
+
341
+ /**
342
+ * Waits for the Loader to initialize the cached backend response.
343
+ * If the getFlexData was not called before an error is logged and the promise resolves immediately.
344
+ *
345
+ * @param {string} sReference - The flex reference for which to wait for initialization.
346
+ * @return {Promise<undefined>} Resolves with undefined when the initialization is complete
347
+ */
348
+ Loader.waitForInitialization = function(sReference) {
349
+ const oInitPromise = _mInitPromises[sReference]?.promise;
350
+ if (!oInitPromise) {
351
+ Log.error("Loader.waitForInitialization was called before FlexState.initialize");
352
+ return Promise.resolve();
353
+ }
354
+ return oInitPromise;
355
+ };
356
+
357
+ /**
358
+ * This function is temporary and will be removed once the allContextsProvided property is part of the flex/data requests in ABAP
359
+ * The allContextsProvided property is not part of the initial flex/data request and needs to be set later to prevent
360
+ * FlexState from being reinitialized
361
+ *
362
+ * @param {string} sReference - Flexibility reference of the app
363
+ * @param {boolean} bAllContextsProvided - Flag to indicate if all contexts are provided
364
+ */
365
+ Loader.setAllContextsProvided = function(sReference, bAllContextsProvided) {
366
+ if (_mCachedFlexData[sReference] && _mCachedFlexData[sReference].parameters.allContextsProvided === undefined) {
367
+ _mCachedFlexData[sReference].parameters.allContextsProvided = bAllContextsProvided;
368
+ }
369
+ };
370
+
371
+ return Loader;
372
+ });
@@ -78,7 +78,7 @@ function(
78
78
  *
79
79
  * @namespace sap.ui.fl.apply._internal.flexState.ManifestUtils
80
80
  * @since 1.74
81
- * @version 1.139.0
81
+ * @version 1.141.0
82
82
  * @private
83
83
  */
84
84
  var ManifestUtils = {
@@ -40,7 +40,7 @@ sap.ui.define([
40
40
  * @extends sap.ui.base.ManagedObject
41
41
  * @alias sap.ui.fl.initial._internal.Settings
42
42
  * @since 1.137
43
- * @version 1.139.0
43
+ * @version 1.141.0
44
44
  * @private
45
45
  * @ui5-restricted sap.ui.fl
46
46
  */
@@ -28,7 +28,7 @@ sap.ui.define([
28
28
  *
29
29
  * @namespace sap.ui.fl.initial._internal.Storage
30
30
  * @since 1.67
31
- * @version 1.139.0
31
+ * @version 1.141.0
32
32
  * @private
33
33
  * @ui5-restricted sap.ui.fl
34
34
  */
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  *
21
21
  * @namespace sap.ui.fl.intial._internal.StorageFeaturesMerger
22
22
  * @since 1.70
23
- * @version 1.139.0
23
+ * @version 1.141.0
24
24
  * @private
25
25
  * @ui5-restricted sap.ui.fl.initial._internal.Storage
26
26
  */
@@ -5,17 +5,19 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
+ "sap/base/util/isEmptyObject",
9
+ "sap/base/util/ObjectPath",
8
10
  "sap/base/Log",
9
11
  "sap/ui/fl/initial/_internal/FlexConfiguration",
10
12
  "sap/ui/fl/Layer",
11
- "sap/ui/fl/LayerUtils",
12
- "sap/base/util/isEmptyObject"
13
+ "sap/ui/fl/LayerUtils"
13
14
  ], function(
15
+ isEmptyObject,
16
+ ObjectPath,
14
17
  Log,
15
18
  FlexConfiguration,
16
19
  Layer,
17
- LayerUtils,
18
- isEmptyObject
20
+ LayerUtils
19
21
  ) {
20
22
  "use strict";
21
23
 
@@ -25,7 +27,7 @@ sap.ui.define([
25
27
  *
26
28
  * @namespace sap.ui.fl.initial._internal.StorageUtils
27
29
  * @since 1.74
28
- * @version 1.139.0
30
+ * @version 1.141.0
29
31
  * @private
30
32
  * @ui5-restricted sap.ui.fl.initial._internal.Storage, sap.ui.fl.write._internal.Storage,
31
33
  * sap.ui.fl.initial._internal.connectors.ObjectStorageConnector, sap.ui.fl.initial._internal.connectors.ObjectPathConnector
@@ -104,6 +106,34 @@ sap.ui.define([
104
106
  });
105
107
  }
106
108
 
109
+ function getChangeCategoryPath(oChangeDefinition) {
110
+ switch (oChangeDefinition.fileType) {
111
+ case "change":
112
+ if (oChangeDefinition.selector && oChangeDefinition.selector.persistencyKey) {
113
+ return ["comp", "changes"];
114
+ }
115
+ if (oChangeDefinition.variantReference) {
116
+ return "variantDependentControlChanges";
117
+ }
118
+ if (oChangeDefinition.appDescriptorChange) {
119
+ return "appDescriptorChanges";
120
+ }
121
+ return "changes";
122
+ case "ctrl_variant":
123
+ return "variants";
124
+ case "ctrl_variant_change":
125
+ return "variantChanges";
126
+ case "ctrl_variant_management_change":
127
+ return "variantManagementChanges";
128
+ case "variant":
129
+ return ["comp", "variants"];
130
+ case "annotation_change":
131
+ return "annotationChanges";
132
+ default:
133
+ return "";
134
+ }
135
+ }
136
+
107
137
  /**
108
138
  * Loads the connectors from the given namespaces.
109
139
  * This function is replaced in the Vanilla Flex bundle with a custom implementation.
@@ -343,11 +373,39 @@ sap.ui.define([
343
373
  * @ui5-restricted sap.ui.fl
344
374
  */
345
375
  StorageUtils.isStorageResponseFilled = function(oResponse) {
346
- return Object.keys(oResponse || {}).some(function(sKey) {
347
- if (Array.isArray(oResponse[sKey])) {
348
- return oResponse[sKey].length !== 0;
376
+ const oUI2Available = !isEmptyObject(oResponse.ui2personalization);
377
+ return oUI2Available || StorageUtils.getAllFlexObjectNamespaces().some(function(sKey) {
378
+ return ObjectPath.get(sKey, oResponse)?.length > 0;
379
+ });
380
+ };
381
+
382
+ /**
383
+ * Updates the storage response with the provided updates by directly mutating the given response.
384
+ *
385
+ * @param {object} oResponse - Storage response to apply the updates to.
386
+ * @param {sap.ui.fl.apply._internal.flexState.dataSelector.UpdateInfo[]} aUpdates - The updates to apply to the storage response.
387
+ */
388
+ StorageUtils.updateStorageResponse = function(oResponse, aUpdates) {
389
+ aUpdates.forEach((oUpdate) => {
390
+ if (oUpdate.type === "ui2") {
391
+ oResponse.changes.ui2personalization = oUpdate.newData;
392
+ } else {
393
+ const vPath = getChangeCategoryPath(oUpdate.flexObject);
394
+ const sFileName = oUpdate.flexObject.fileName;
395
+ const aCache = ObjectPath.get(vPath, oResponse.changes);
396
+ switch (oUpdate.type) {
397
+ case "add":
398
+ aCache.push(oUpdate.flexObject);
399
+ break;
400
+ case "delete":
401
+ aCache.splice(aCache.findIndex((oFlexObject) => oFlexObject.fileName === sFileName), 1);
402
+ break;
403
+ case "update":
404
+ aCache.splice(aCache.findIndex((oFlexObject) => oFlexObject.fileName === sFileName), 1, oUpdate.flexObject);
405
+ break;
406
+ default:
407
+ }
349
408
  }
350
- return !isEmptyObject(oResponse[sKey]);
351
409
  });
352
410
  };
353
411
 
@@ -84,7 +84,7 @@ sap.ui.define([
84
84
  * @alias sap.ui.fl.registry.ChangeHandlerRegistration
85
85
  *
86
86
  * @author SAP SE
87
- * @version 1.139.0
87
+ * @version 1.141.0
88
88
  * @private
89
89
  * @ui5-restricted sap.ui.fl
90
90
  *
@@ -23,7 +23,7 @@ sap.ui.define([
23
23
  * @alias sap.ui.fl.registry.ChangeHandlerStorage
24
24
  *
25
25
  * @author SAP SE
26
- * @version 1.139.0
26
+ * @version 1.141.0
27
27
  * @private
28
28
  * @ui5-restricted sap.ui.fl
29
29
  *
@@ -135,10 +135,17 @@ sap.ui.define([
135
135
  const sSkipNext = "ChangeHandlerStorage.registerChangeHandlersForControl.skip_next_then";
136
136
 
137
137
  if (typeof mChangeHandlers === "string") {
138
- oPromise = requireAsync(`${mChangeHandlers}.flexibility`)
139
- .catch(function(oError) {
140
- Log.error(`Flexibility change handler registration failed.\nControlType: ${sControlType}\n${oError.message}`);
141
- return Promise.resolve(sSkipNext); // continue without a registration
138
+ oPromise = new Promise((resolve) => {
139
+ // TODO: The setTimeout is added to circumvent dependency issues caused by synchronous module loading.
140
+ // This shall be removed once sync loading is not used anymore in UI5. #todos10
141
+ setTimeout(() => {
142
+ requireAsync(`${mChangeHandlers}.flexibility`)
143
+ .then(resolve)
144
+ .catch(function(oError) {
145
+ Log.error(`Flexibility change handler registration failed.\nControlType: ${sControlType}\n${oError.message}`);
146
+ resolve(sSkipNext); // continue without a registration
147
+ });
148
+ }, 0);
142
149
  });
143
150
  }
144
151
 
@@ -62,7 +62,7 @@ sap.ui.define([
62
62
  *
63
63
  * @namespace sap.ui.fl.initial._internal.connectors.Utils
64
64
  * @since 1.70
65
- * @version 1.139.0
65
+ * @version 1.141.0
66
66
  * @private
67
67
  * @ui5-restricted sap.ui.fl.initial._internal.connectors, sap.ui.fl.write._internal.connectors, sap.ui.fl.write._internal.transport
68
68
  */
@@ -7,14 +7,18 @@
7
7
  sap.ui.define([
8
8
  "sap/base/Log",
9
9
  "sap/ui/core/Component",
10
- "sap/ui/fl/apply/_internal/flexState/FlexState",
11
- "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
10
+ "sap/ui/fl/initial/_internal/Loader",
11
+ "sap/ui/fl/initial/_internal/ManifestUtils",
12
+ "sap/ui/fl/initial/_internal/StorageUtils",
13
+ "sap/ui/fl/requireAsync",
12
14
  "sap/ui/fl/Utils"
13
15
  ], function(
14
16
  Log,
15
17
  Component,
16
- FlexState,
18
+ Loader,
17
19
  ManifestUtils,
20
+ StorageUtils,
21
+ requireAsync,
18
22
  Utils
19
23
  ) {
20
24
  "use strict";
@@ -26,7 +30,7 @@ sap.ui.define([
26
30
  * @class
27
31
  * @constructor
28
32
  * @author SAP SE
29
- * @version 1.139.0
33
+ * @version 1.141.0
30
34
  * @since 1.27.0
31
35
  * @private
32
36
  * @ui5-restricted sap.ui.fl, sap.ui.core
@@ -102,7 +106,14 @@ sap.ui.define([
102
106
  }
103
107
  var sFlexReference = ManifestUtils.getFlexReferenceForControl(oAppComponent);
104
108
 
105
- return FlexState.waitForInitialization(sFlexReference).then(() => {
109
+ return Loader.waitForInitialization(sFlexReference).then(async function() {
110
+ const oFlexData = Loader.getCachedFlexData(sFlexReference);
111
+ if (!StorageUtils.isStorageResponseFilled(oFlexData?.changes)) {
112
+ return [];
113
+ }
114
+
115
+ const FlexState = await requireAsync("sap/ui/fl/apply/_internal/flexState/FlexState");
116
+ await FlexState.waitForInitialization(sFlexReference);
106
117
  const aFlexObjects = FlexState.getFlexObjectsDataSelector().get({reference: sFlexReference});
107
118
  var aExtensionModules = aFlexObjects.filter(function(oChange) {
108
119
  return isCodeExt(oChange) && isForController(sControllerName, oChange);