@openui5/sap.ui.fl 1.138.0 → 1.140.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 (193) hide show
  1. package/README.md +1 -1
  2. package/REUSE.toml +8 -1
  3. package/THIRDPARTY.txt +72 -66
  4. package/package.json +4 -4
  5. package/src/sap/ui/fl/.library +1 -1
  6. package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
  7. package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
  8. package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
  9. package/src/sap/ui/fl/LayerUtils.js +1 -1
  10. package/src/sap/ui/fl/Utils.js +1 -1
  11. package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
  12. package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
  13. package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
  14. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +6 -6
  15. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
  16. package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
  17. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
  18. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewDataSource.js +1 -1
  19. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +1 -1
  20. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewOutbound.js +1 -1
  21. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddTechnicalAttributes.js +1 -1
  22. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
  23. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +1 -1
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
  26. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetAch.js +1 -1
  27. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetDescription.js +1 -1
  28. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
  30. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetCloudDevAdaptationStatus.js +1 -1
  31. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
  32. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
  33. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
  34. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
  35. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
  36. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
  37. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
  38. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
  39. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/ChangeModel.js +1 -1
  40. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
  41. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
  42. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
  43. package/src/sap/ui/fl/apply/_internal/controlVariants/URLHandler.js +25 -24
  44. package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +2 -2
  45. package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
  46. package/src/sap/ui/fl/apply/_internal/flexObjects/AnnotationChange.js +1 -1
  47. package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
  48. package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +13 -10
  49. package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +1 -1
  50. package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +1 -1
  51. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +2 -2
  52. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +1 -1
  53. package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
  54. package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +1 -1
  55. package/src/sap/ui/fl/apply/_internal/flexObjects/VariantChange.js +1 -1
  56. package/src/sap/ui/fl/apply/_internal/flexObjects/VariantManagementChange.js +1 -1
  57. package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +1 -1
  58. package/src/sap/ui/fl/apply/_internal/flexState/DataSelector.js +3 -3
  59. package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +12 -26
  60. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +58 -114
  61. package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  62. package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
  63. package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +3 -3
  64. package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
  65. package/src/sap/ui/fl/apply/_internal/flexState/communication/FLPAboutInfo.js +2 -2
  66. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantManagementState.js +290 -10
  67. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/applyChangesOnVariant.js +61 -0
  68. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -1
  69. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +22 -9
  70. package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +5 -4
  71. package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +2 -2
  72. package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +3 -3
  73. package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +2 -2
  74. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
  75. package/src/sap/ui/fl/apply/api/FlexRuntimeInfoAPI.js +4 -4
  76. package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +43 -44
  77. package/src/sap/ui/fl/apply/api/UI2PersonalizationApplyAPI.js +1 -1
  78. package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
  79. package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
  80. package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
  81. package/src/sap/ui/fl/changeHandler/Base.js +1 -1
  82. package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
  83. package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
  84. package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
  85. package/src/sap/ui/fl/changeHandler/ChangeAnnotation.js +1 -1
  86. package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
  87. package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
  88. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  89. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
  90. package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
  91. package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
  92. package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
  93. package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
  94. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  95. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChange.js +3 -3
  96. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +3 -3
  97. package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
  98. package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
  99. package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
  100. package/src/sap/ui/fl/{apply/_internal/flexState → initial/_internal}/Loader.js +12 -10
  101. package/src/sap/ui/fl/{apply/_internal/flexState → initial/_internal}/ManifestUtils.js +1 -1
  102. package/src/sap/ui/fl/initial/_internal/Settings.js +13 -1
  103. package/src/sap/ui/fl/initial/_internal/Storage.js +3 -2
  104. package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
  105. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +9 -7
  106. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +1 -1
  107. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +1 -1
  108. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
  109. package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
  110. package/src/sap/ui/fl/initial/api/InitialFlexAPI.js +1 -1
  111. package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
  112. package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
  113. package/src/sap/ui/fl/library.js +43 -43
  114. package/src/sap/ui/fl/messagebundle_vi.properties +1 -1
  115. package/src/sap/ui/fl/support/_internal/extractChangeDependencies.js +6 -2
  116. package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +2 -2
  117. package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +2 -2
  118. package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +2 -2
  119. package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
  120. package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
  121. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
  122. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
  123. package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
  124. package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
  125. package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
  126. package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
  127. package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
  128. package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
  129. package/src/sap/ui/fl/util/IFrame.js +15 -5
  130. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  131. package/src/sap/ui/fl/variants/VariantManagement.js +39 -2
  132. package/src/sap/ui/fl/variants/VariantManager.js +9 -9
  133. package/src/sap/ui/fl/variants/VariantModel.js +59 -44
  134. package/src/sap/ui/fl/write/_internal/SaveAs.js +1 -1
  135. package/src/sap/ui/fl/write/_internal/Storage.js +14 -1
  136. package/src/sap/ui/fl/write/_internal/Versions.js +1 -1
  137. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +10 -1
  138. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +6 -1
  139. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  140. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +1 -1
  141. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +1 -1
  142. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +4 -2
  143. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  144. package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +27 -2
  145. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
  146. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +4 -1
  147. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  148. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
  149. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  150. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  151. package/src/sap/ui/fl/write/_internal/controlVariants/ControlVariantWriteUtils.js +2 -2
  152. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  153. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  154. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  155. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  156. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  157. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  158. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
  159. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  160. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
  161. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  162. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
  163. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  164. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
  165. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
  166. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectManager.js +15 -54
  167. package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  168. package/src/sap/ui/fl/write/_internal/flexState/changes/UIChangeManager.js +1 -1
  169. package/src/sap/ui/fl/write/_internal/flexState/compVariants/{CompVariantState.js → CompVariantManager.js} +186 -302
  170. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +2 -2
  171. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  172. package/src/sap/ui/fl/write/api/AppVariantWriteAPI.js +2 -1
  173. package/src/sap/ui/fl/write/api/BusinessNetworkAPI.js +92 -6
  174. package/src/sap/ui/fl/write/api/ChangesWriteAPI.js +39 -17
  175. package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +17 -20
  176. package/src/sap/ui/fl/write/api/ContextSharingAPI.js +1 -1
  177. package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
  178. package/src/sap/ui/fl/write/api/LocalResetAPI.js +1 -1
  179. package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +25 -23
  180. package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +5 -5
  181. package/src/sap/ui/fl/write/api/SACIntegrationUpdateVariant.js +6 -6
  182. package/src/sap/ui/fl/write/api/SmartBusinessWriteAPI.js +1 -1
  183. package/src/sap/ui/fl/write/api/SmartVariantManagementWriteAPI.js +25 -22
  184. package/src/sap/ui/fl/write/api/TranslationAPI.js +1 -1
  185. package/src/sap/ui/fl/write/api/UI2PersonalizationWriteAPI.js +2 -2
  186. package/src/sap/ui/fl/write/api/VersionsAPI.js +2 -2
  187. package/src/sap/ui/fl/write/api/connectors/FileListBaseConnector.js +1 -1
  188. package/src/sap/ui/fl/write/api/connectors/ObjectStorageConnector.js +2 -1
  189. package/src/sap/ui/fl/write/connectors/BaseConnector.js +13 -0
  190. package/ui5.yaml +0 -1
  191. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +0 -233
  192. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap.js +0 -118
  193. package/src/sap/ui/fl/util/resolveBinding.js +0 -79
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  "sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState",
17
17
  "sap/ui/fl/apply/_internal/flexState/DataSelector",
18
18
  "sap/ui/fl/apply/_internal/flexState/FlexState",
19
- "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
19
+ "sap/ui/fl/initial/_internal/ManifestUtils",
20
20
  "sap/ui/fl/Utils"
21
21
  ], function(
22
22
  merge,
@@ -39,7 +39,7 @@ sap.ui.define([
39
39
  * @namespace
40
40
  * @alias sap.ui.fl.apply._internal.flexState.FlexObjectState
41
41
  * @since 1.83
42
- * @version 1.138.0
42
+ * @version 1.140.0
43
43
  * @private
44
44
  * @ui5-restricted sap.ui.fl
45
45
  */
@@ -210,12 +210,12 @@ sap.ui.define([
210
210
  };
211
211
 
212
212
  /**
213
- * Waits for all the changes for all controls that are passed to be processed and a variant switch to be done.
213
+ * Waits for all the changes for all controls that are passed to be processed.
214
214
  *
215
215
  * @param {object[]} aSelectorInformation - An array containing an object with {@link sap.ui.fl.Selector} and further configuration
216
216
  * @param {sap.ui.fl.Selector} aSelectorInformation.selector - A {@link sap.ui.fl.Selector}
217
217
  * @param {string[]} [aSelectorInformation.changeTypes] - An array containing the change types that will be considered. If empty no filtering will be done
218
- * @returns {Promise} Resolves when a variant switch is done and all changes on controls have been processed
218
+ * @returns {Promise} Resolves when all changes on controls have been processed
219
219
  */
220
220
  FlexObjectState.waitForFlexObjectsToBeApplied = async function(aSelectorInformation) {
221
221
  const oAppComponent = Utils.getAppComponentForSelector(aSelectorInformation[0].selector);
@@ -224,7 +224,6 @@ sap.ui.define([
224
224
  }
225
225
  const sFlexReference = ManifestUtils.getFlexReferenceForControl(oAppComponent);
226
226
 
227
- await VariantManagementState.getVariantSwitchPromise(sFlexReference);
228
227
  await Promise.all(aSelectorInformation.map((oSelector) => {
229
228
  const oControl = oSelector.selector.id && Element.getElementById(oSelector.selector.id) || oSelector.selector;
230
229
 
@@ -260,34 +259,21 @@ sap.ui.define([
260
259
  }));
261
260
  };
262
261
 
263
- function getCompVariantEntities(sReference) {
264
- const aEntities = [];
265
- const mCompEntities = FlexState.getCompVariantsMap(sReference);
266
- for (const sPersistencyKey in mCompEntities) {
267
- const mCompVariantsOfPersistencyKey = mCompEntities[sPersistencyKey];
268
- for (const sId in mCompVariantsOfPersistencyKey.byId) {
269
- aEntities.push(mCompVariantsOfPersistencyKey.byId[sId]);
270
- }
271
- }
272
- return aEntities;
273
- }
274
-
275
- function isNewChangeDeleted(oFlexObject) {
276
- return !(oFlexObject.getState() === States.LifecycleState.DELETED && oFlexObject._sPreviousState === States.LifecycleState.NEW);
277
- }
278
-
279
262
  /**
280
263
  * Collects modified changes from the different states within the <code>sap.ui.fl</code> library.
281
- * TODO: remove special CompVariant handling todos#5
282
264
  *
283
265
  * @param {object} sReference - Flex Reference
284
266
  * @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} All dirty Flex objects
285
267
  */
286
268
  FlexObjectState.getDirtyFlexObjects = function(sReference) {
287
- const aCompVariantEntities = getCompVariantEntities(sReference);
288
- return oAllDirtyFlexObjectsDataSelector.get({reference: sReference})
289
- .concat(aCompVariantEntities.filter((oFlexObject) => oFlexObject.getState() !== States.LifecycleState.PERSISTED))
290
- // change is not dirty when it is created and deleted in the same session
269
+ function isNewChangeDeleted(oFlexObject) {
270
+ // Also consider the fileType in case it is a compVariant("variant") because there the state is already set to DELETED
271
+ return !(oFlexObject.getState() === States.LifecycleState.DELETED && oFlexObject._sPreviousState === States.LifecycleState.NEW)
272
+ || (oFlexObject.getState() === States.LifecycleState.DELETED && oFlexObject.getFileType() === "variant");
273
+ }
274
+
275
+ return oAllDirtyFlexObjectsDataSelector
276
+ .get({reference: sReference})
291
277
  .filter((oFlexObject) => isNewChangeDeleted(oFlexObject));
292
278
  };
293
279
 
@@ -14,11 +14,10 @@ sap.ui.define([
14
14
  "sap/ui/core/Component",
15
15
  "sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory",
16
16
  "sap/ui/fl/apply/_internal/flexObjects/States",
17
- "sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap",
18
17
  "sap/ui/fl/apply/_internal/flexState/DataSelector",
19
18
  "sap/ui/fl/apply/_internal/flexState/InitialPrepareFunctions",
20
- "sap/ui/fl/apply/_internal/flexState/Loader",
21
- "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
19
+ "sap/ui/fl/initial/_internal/Loader",
20
+ "sap/ui/fl/initial/_internal/ManifestUtils",
22
21
  "sap/ui/fl/initial/_internal/FlexInfoSession",
23
22
  "sap/ui/fl/initial/_internal/StorageUtils",
24
23
  "sap/ui/fl/LayerUtils"
@@ -32,7 +31,6 @@ sap.ui.define([
32
31
  Component,
33
32
  FlexObjectFactory,
34
33
  States,
35
- prepareCompVariantsMap,
36
34
  DataSelector,
37
35
  InitialPrepareFunctions,
38
36
  Loader,
@@ -51,9 +49,6 @@ sap.ui.define([
51
49
  * The persistence happens inside an object mapped to the component reference, with the following properties:
52
50
  *
53
51
  * {
54
- * preparedMaps: {
55
- * compVariantsMap: {},
56
- * },
57
52
  * storageResponse: {
58
53
  * changes: {
59
54
  * annotationChanges: [...],
@@ -73,7 +68,6 @@ sap.ui.define([
73
68
  * },
74
69
  * loadModules: <boolean>
75
70
  * },
76
- * unfilteredStorageResponse: {...}, // same as above but without layer filtering
77
71
  * runtimePersistence: {
78
72
  * flexObjects: [...],
79
73
  * runtimeOnlyData: {
@@ -82,22 +76,23 @@ sap.ui.define([
82
76
  * },
83
77
  * maxLayer: <string>,
84
78
  * emptyState: <boolean>,
85
- * partialFlexState: <boolean>,
79
+ * skipLoadBundle: <boolean>,
86
80
  * componentId: "<componentId>",
87
81
  * componentData: {...}
88
82
  * }
89
83
  *
90
84
  * @namespace sap.ui.fl.apply._internal.flexState.FlexState
91
85
  * @since 1.73
92
- * @version 1.138.0
86
+ * @version 1.140.0
93
87
  * @private
94
88
  * @ui5-restricted sap.ui.fl.apply._internal
95
89
  */
96
- var FlexState = {};
90
+ const FlexState = {};
97
91
 
98
- var _mInstances = {};
99
- var _mInitPromises = {};
100
- var _mFlexObjectInfo = {
92
+ const _mInstances = {};
93
+ const _mCachedFlexData = {};
94
+ const _mInitPromises = {};
95
+ const _mFlexObjectInfo = {
101
96
  appDescriptorChanges: {
102
97
  pathInResponse: []
103
98
  },
@@ -112,17 +107,17 @@ sap.ui.define([
112
107
  initialPreparationFunctionName: "variants",
113
108
  pathInResponse: ["variants", "variantChanges", "variantDependentControlChanges", "variantManagementChanges"]
114
109
  },
115
- compVariants: {
116
- prepareFunction: prepareCompVariantsMap,
117
- pathInResponse: ["comp.variants", "comp.standardVariants", "comp.defaultVariants", "comp.changes"]
110
+ comp: {
111
+ pathInResponse: ["comp.changes", "comp.defaultVariants", "comp.standardVariants", "comp.variants"]
118
112
  }
119
113
  };
114
+
120
115
  // some runtime data is only fetched once (e.g. during control init) and has to survive an invalidation of the FlexState
121
116
  // TODO: Move to runtime persistence as soon as flex objects are no longer deleted during cache invalidation
122
117
  // but instead updated with the new data from the flex response
123
- var _mExternalData = {
124
- compVariants: {},
125
- flexObjects: {}
118
+ const _mExternalData = {
119
+ flexObjects: {},
120
+ smartVariantManagementControls: {}
126
121
  };
127
122
 
128
123
  function prepareChangeDefinitions(sStorageResponseKey, vStorageResponsePart) {
@@ -187,14 +182,6 @@ sap.ui.define([
187
182
  return undefined;
188
183
  }
189
184
 
190
- function initializeState(sMapName, mPropertyBag, sReference) {
191
- mPropertyBag.reference = sReference;
192
- var oUpdate = runInitialPreparation(sMapName, mPropertyBag);
193
- if (oUpdate) {
194
- updateInstance(sReference, oUpdate);
195
- }
196
- }
197
-
198
185
  var oFlexObjectsDataSelector = new DataSelector({
199
186
  id: "flexObjects",
200
187
  parameterKey: "reference",
@@ -238,32 +225,6 @@ sap.ui.define([
238
225
  }
239
226
  });
240
227
 
241
- function getInstanceEntryOrThrowError(sReference, sMapName) {
242
- if (!_mInstances[sReference]) {
243
- initializeEmptyState(sReference);
244
- }
245
-
246
- if (!_mInstances[sReference].preparedMaps[sMapName]) {
247
- var mPropertyBag = {
248
- unfilteredStorageResponse: _mInstances[sReference].unfilteredStorageResponse,
249
- storageResponse: _mInstances[sReference].storageResponse,
250
- componentId: _mInstances[sReference].componentId,
251
- componentData: _mInstances[sReference].componentData,
252
- reference: sReference,
253
- runtimePersistence: _mInstances[sReference].runtimePersistence
254
- };
255
- _mInstances[sReference].preparedMaps[sMapName] = FlexState.callPrepareFunction(sMapName, mPropertyBag);
256
- initializeState(sMapName, mPropertyBag, sReference);
257
- }
258
-
259
- return _mInstances[sReference].preparedMaps[sMapName];
260
- }
261
-
262
- function updateInstance(sReference, oUpdate) {
263
- _mInstances[sReference] = merge(_mInstances[sReference], oUpdate);
264
- oFlexObjectsDataSelector.checkUpdate({ reference: sReference });
265
- }
266
-
267
228
  function buildRuntimePersistence(oFlexStateInstance, aExternalFlexObjects) {
268
229
  const oStorageResponse = oFlexStateInstance.storageResponse;
269
230
  var oRuntimePersistence = {
@@ -357,7 +318,7 @@ sap.ui.define([
357
318
  bDataUpdated = true;
358
319
  }
359
320
  if (!_mInstances[sReference].storageResponse) {
360
- _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mInstances[sReference].unfilteredStorageResponse);
321
+ _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mCachedFlexData[sReference]);
361
322
  // Flex objects need to be recreated
362
323
  delete _mInstances[sReference].runtimePersistence;
363
324
  bDataUpdated = true;
@@ -376,7 +337,7 @@ sap.ui.define([
376
337
  }
377
338
 
378
339
  if (bDataUpdated) {
379
- oFlexObjectsDataSelector.checkUpdate({ reference: sReference });
340
+ oFlexObjectsDataSelector.checkUpdate({ reference: sReference});
380
341
  }
381
342
  }
382
343
 
@@ -399,31 +360,27 @@ sap.ui.define([
399
360
  return mFilteredReturn;
400
361
  }
401
362
 
402
- async function loadFlexData(mPropertyBag) {
363
+ async function loadAndCacheFlexData(mPropertyBag) {
403
364
  const mResponse = await Loader.loadFlexData(mPropertyBag);
404
- if (!mPropertyBag.partialFlexState) {
365
+ if (!mPropertyBag.skipLoadBundle) {
405
366
  mResponse.authors = await Loader.loadVariantsAuthors(mPropertyBag.reference);
406
367
  }
368
+ _mCachedFlexData[mPropertyBag.reference] = merge({}, mResponse);
407
369
  storeInfoInSession(mPropertyBag.reference, mResponse);
408
-
409
- return mResponse;
410
370
  }
411
371
 
412
- function prepareNewInstance(mResponse, mPropertyBag) {
372
+ function prepareNewInstance(mPropertyBag) {
413
373
  // The following line is used by the Flex Support Tool to set breakpoints - please adjust the tool if you change it!
414
374
  _mInstances[mPropertyBag.reference] = merge({}, {
415
- unfilteredStorageResponse: mResponse,
416
- preparedMaps: {},
417
375
  componentId: mPropertyBag.componentId,
418
376
  componentData: mPropertyBag.componentData,
419
- partialFlexState: mPropertyBag.partialFlexState,
377
+ skipLoadBundle: mPropertyBag.skipLoadBundle,
420
378
  version: mPropertyBag.version,
421
379
  allContextsProvided: mPropertyBag.allContextsProvided
422
380
  });
423
381
 
424
382
  // no further changes to storageResponse properties allowed
425
383
  Object.freeze(_mInstances[mPropertyBag.reference].storageResponse);
426
- Object.freeze(_mInstances[mPropertyBag.reference].unfilteredStorageResponse);
427
384
  }
428
385
 
429
386
  function storeInfoInSession(sReference, mResponse) {
@@ -437,19 +394,17 @@ sap.ui.define([
437
394
 
438
395
  function checkPartialFlexState(mInitProperties) {
439
396
  var oFlexInstance = _mInstances[mInitProperties.reference];
440
- if (oFlexInstance.partialFlexState === true && mInitProperties.partialFlexState !== true) {
441
- oFlexInstance.partialFlexState = false;
442
- mInitProperties.partialFlexData = merge({}, oFlexInstance.unfilteredStorageResponse.changes);
397
+ if (oFlexInstance.skipLoadBundle === true && mInitProperties.skipLoadBundle !== true) {
398
+ oFlexInstance.skipLoadBundle = false;
399
+ mInitProperties.partialFlexData = merge({}, _mCachedFlexData[mInitProperties.reference].changes);
443
400
  mInitProperties.reInitialize = true;
444
401
  }
445
402
  }
446
403
 
447
- function checkComponentId(mInitProperties) {
404
+ function checkComponentIdChanged(mInitProperties) {
448
405
  var sFlexInstanceComponentId = _mInstances[mInitProperties.reference].componentId;
449
406
  // if the component with the same reference was rendered with a new ID - clear existing state
450
- if (!mInitProperties.reInitialize && sFlexInstanceComponentId !== mInitProperties.componentId) {
451
- mInitProperties.reInitialize = true;
452
- }
407
+ return sFlexInstanceComponentId !== mInitProperties.componentId;
453
408
  }
454
409
 
455
410
  function checkVersionAndAllContexts(mInitProperties) {
@@ -471,18 +426,17 @@ sap.ui.define([
471
426
 
472
427
  function initializeEmptyState(sReference) {
473
428
  _mInstances[sReference] = {
474
- unfilteredStorageResponse: { changes: StorageUtils.getEmptyFlexDataResponse() },
475
429
  storageResponse: { changes: StorageUtils.getEmptyFlexDataResponse() },
476
- preparedMaps: {},
477
430
  emptyState: true,
478
431
  // this makes sure that a proper initialize will still work as expected
479
432
  reInitialize: true,
480
433
  componentId: ""
481
434
  };
435
+ _mCachedFlexData[sReference] = { changes: StorageUtils.getEmptyFlexDataResponse() };
482
436
  const oNewInitPromise = new Deferred();
483
437
  _mInitPromises[sReference] = oNewInitPromise;
484
438
  oNewInitPromise.resolve();
485
- initializeNewInstance({ reference: sReference });
439
+ initializeNewInstance({ reference: sReference});
486
440
  }
487
441
 
488
442
  FlexState.getRuntimeOnlyData = function(sReference) {
@@ -505,7 +459,7 @@ sap.ui.define([
505
459
  * @param {object} [mPropertyBag.asyncHints] - Async hints passed from the app index to the component processing
506
460
  * @param {string} [mPropertyBag.version] - Number of the version in which the state should be initialized
507
461
  * @param {string} [mPropertyBag.adaptationId] - Context-based adaptation for which the state should be initialized
508
- * @param {boolean} [mPropertyBag.partialFlexState=false] - if true state is initialized partially and does not include flex bundles
462
+ * @param {boolean} [mPropertyBag.skipLoadBundle=false] - if true state is initialized partially and does not include flex bundles
509
463
  * @returns {Promise<undefined>} Resolves a promise as soon as FlexState is initialized
510
464
  */
511
465
  FlexState.initialize = async function(mPropertyBag) {
@@ -520,17 +474,19 @@ sap.ui.define([
520
474
  if (oOldInitPromise) {
521
475
  await oOldInitPromise.promise;
522
476
  checkPartialFlexState(mProperties);
523
- checkComponentId(mProperties);
524
477
  checkVersionAndAllContexts(mProperties);
525
478
  if (mProperties.reInitialize) {
526
- const oResponse = await loadFlexData(mProperties);
527
- prepareNewInstance(oResponse, mProperties);
479
+ await loadAndCacheFlexData(mProperties);
480
+ prepareNewInstance(mProperties);
481
+ } else if (checkComponentIdChanged(mProperties)) {
482
+ // a changed component ID does not invalidate the cached flex data, only the instance
483
+ prepareNewInstance(mProperties);
528
484
  } else {
529
485
  rebuildResponseIfMaxLayerChanged(mPropertyBag.reference);
530
486
  }
531
487
  } else {
532
- const oResponse = await loadFlexData(mProperties);
533
- prepareNewInstance(oResponse, mProperties);
488
+ await loadAndCacheFlexData(mProperties);
489
+ prepareNewInstance(mProperties);
534
490
  }
535
491
 
536
492
  initializeNewInstance(mProperties);
@@ -582,9 +538,9 @@ sap.ui.define([
582
538
  }
583
539
  const oInstance = _mInstances[mPropertyBag.reference];
584
540
  Object.entries(mPropertyBag.newData).forEach(([sKey, vValue]) => {
585
- oInstance.unfilteredStorageResponse.changes[sKey].push(...vValue);
541
+ _mCachedFlexData[mPropertyBag.reference].changes[sKey].push(...vValue);
586
542
  });
587
- oInstance.storageResponse = filterByMaxLayer(mPropertyBag.reference, oInstance.unfilteredStorageResponse);
543
+ oInstance.storageResponse = filterByMaxLayer(mPropertyBag.reference, _mCachedFlexData[mPropertyBag.reference]);
588
544
  oInstance.runtimePersistence.flexObjects =
589
545
  [
590
546
  ...oInstance.runtimePersistence.flexObjects,
@@ -614,9 +570,9 @@ sap.ui.define([
614
570
  const oNewInitPromise = new Deferred();
615
571
  _mInitPromises[sReference] = oNewInitPromise;
616
572
  await oOldInitPromise;
617
- const oResponse = await loadFlexData(mPropertyBag);
618
- prepareNewInstance(oResponse, mPropertyBag);
619
- _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mInstances[sReference].unfilteredStorageResponse);
573
+ await loadAndCacheFlexData(mPropertyBag);
574
+ prepareNewInstance(mPropertyBag);
575
+ _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mCachedFlexData[sReference]);
620
576
  const bUpdated = updateRuntimePersistence(
621
577
  sReference,
622
578
  _mInstances[sReference].storageResponse,
@@ -664,11 +620,11 @@ sap.ui.define([
664
620
  const aFlexObjectUpdates = [];
665
621
  aUpdates.forEach((oUpdate) => {
666
622
  if (oUpdate.type === "ui2") {
667
- _mInstances[sReference].unfilteredStorageResponse.changes.ui2personalization = oUpdate.newData;
623
+ _mCachedFlexData[sReference].changes.ui2personalization = oUpdate.newData;
668
624
  } else {
669
625
  const vPath = getChangeCategory(oUpdate.flexObject);
670
626
  const sFileName = oUpdate.flexObject.fileName;
671
- const aUnfiltered = ObjectPath.get(vPath, _mInstances[sReference].unfilteredStorageResponse.changes);
627
+ const aUnfiltered = ObjectPath.get(vPath, _mCachedFlexData[sReference].changes);
672
628
  const aFiltered = ObjectPath.get(vPath, _mInstances[sReference].storageResponse.changes);
673
629
  const iExistingFlexObjectIdx = _mInstances[sReference].runtimePersistence.flexObjects.findIndex(
674
630
  (oFlexObject) => oFlexObject.getId() === sFileName
@@ -717,28 +673,12 @@ sap.ui.define([
717
673
  delete _mInitPromises[sReference];
718
674
  oFlexObjectsDataSelector.clearCachedResult({ reference: sReference });
719
675
  } else {
720
- _mInstances = {};
721
- _mInitPromises = {};
676
+ Object.keys(_mInstances).forEach((sReference) => delete _mInstances[sReference]);
677
+ Object.keys(_mInitPromises).forEach((sReference) => delete _mInitPromises[sReference]);
722
678
  oFlexObjectsDataSelector.clearCachedResult();
723
679
  }
724
680
  };
725
681
 
726
- FlexState.setInitialNonFlCompVariantData = function(sReference, sPersistencyKey, oStandardVariant, aVariants, sSVMControlId) {
727
- _mExternalData.compVariants[sReference] ||= {};
728
- _mExternalData.compVariants[sReference][sPersistencyKey] = {};
729
- _mExternalData.compVariants[sReference][sPersistencyKey].standardVariant = oStandardVariant;
730
- _mExternalData.compVariants[sReference][sPersistencyKey].variants = aVariants;
731
- _mExternalData.compVariants[sReference][sPersistencyKey].controlId = sSVMControlId;
732
- };
733
-
734
- FlexState.getInitialNonFlCompVariantData = function(sReference) {
735
- return _mExternalData.compVariants[sReference];
736
- };
737
-
738
- FlexState.resetInitialNonFlCompVariantData = function(sReference) {
739
- delete _mExternalData.compVariants[sReference];
740
- };
741
-
742
682
  /**
743
683
  * Adds a runtime-steady object to the external data map which survives when the FlexState is cleared.
744
684
  * For example: a fake standard variant.
@@ -785,8 +725,7 @@ sap.ui.define([
785
725
  */
786
726
  FlexState.rebuildFilteredResponse = function(sReference) {
787
727
  if (_mInstances[sReference]) {
788
- _mInstances[sReference].preparedMaps = {};
789
- _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mInstances[sReference].unfilteredStorageResponse);
728
+ _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mCachedFlexData[sReference]);
790
729
  // Storage response has changed, recreate the flex objects
791
730
  _mInstances[sReference].runtimePersistence = buildRuntimePersistence(
792
731
  _mInstances[sReference],
@@ -869,11 +808,7 @@ sap.ui.define([
869
808
  };
870
809
 
871
810
  FlexState.getUI2Personalization = function(sReference) {
872
- return merge({}, _mInstances[sReference].unfilteredStorageResponse.changes.ui2personalization);
873
- };
874
-
875
- FlexState.getCompVariantsMap = function(sReference) {
876
- return getInstanceEntryOrThrowError(sReference, "compVariants");
811
+ return merge({}, _mCachedFlexData[sReference].changes.ui2personalization);
877
812
  };
878
813
 
879
814
  FlexState.callPrepareFunction = function(sMapName, mPropertyBag) {
@@ -884,7 +819,7 @@ sap.ui.define([
884
819
  FlexState.getStorageResponse = function(sReference) {
885
820
  if (_mInitPromises[sReference]) {
886
821
  return _mInitPromises[sReference].promise.then(function() {
887
- return _mInstances[sReference].unfilteredStorageResponse;
822
+ return _mCachedFlexData[sReference];
888
823
  });
889
824
  }
890
825
  return Promise.resolve();
@@ -894,6 +829,15 @@ sap.ui.define([
894
829
  return _mInstances[sReference] && _mInstances[sReference].componentData;
895
830
  };
896
831
 
832
+ FlexState.addSVMControl = function(sReference, oControl) {
833
+ _mExternalData.smartVariantManagementControls[sReference] ||= [];
834
+ _mExternalData.smartVariantManagementControls[sReference].push(oControl);
835
+ };
836
+
837
+ FlexState.getSVMControls = function(sReference) {
838
+ return _mExternalData.smartVariantManagementControls[sReference] || [];
839
+ };
840
+
897
841
  /**
898
842
  * This function is temporary and will be removed once the allContextsProvided property is part of the flex/data requests in ABAP
899
843
  * The allContextsProvided property is not part of the initial flex/data request and needs to be set later to prevent
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  *
17
17
  * @namespace sap.ui.fl.apply._internal.flexState.UI2Personalization.UI2PersonalizationState
18
18
  * @since 1.75
19
- * @version 1.138.0
19
+ * @version 1.140.0
20
20
  * @private
21
21
  * @ui5-restricted
22
22
  */
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  *
21
21
  * @namespace sap.ui.fl.apply._internal.flexState.changes.DependencyHandler
22
22
  * @since 1.74
23
- * @version 1.138.0
23
+ * @version 1.140.0
24
24
  * @private
25
25
  * @ui5-restricted sap.ui.fl
26
26
  */
@@ -15,8 +15,8 @@ sap.ui.define([
15
15
  "sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler",
16
16
  "sap/ui/fl/apply/_internal/flexState/FlexObjectState",
17
17
  "sap/ui/fl/apply/_internal/flexState/FlexState",
18
- "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
19
18
  "sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage",
19
+ "sap/ui/fl/initial/_internal/ManifestUtils",
20
20
  "sap/ui/fl/Utils"
21
21
  ], (
22
22
  _omit,
@@ -29,8 +29,8 @@ sap.ui.define([
29
29
  DependencyHandler,
30
30
  FlexObjectState,
31
31
  FlexState,
32
- ManifestUtils,
33
32
  ChangeHandlerStorage,
33
+ ManifestUtils,
34
34
  Utils
35
35
  ) => {
36
36
  "use strict";
@@ -41,7 +41,7 @@ sap.ui.define([
41
41
  *
42
42
  * @namespace sap.ui.fl.apply._internal.flexState.changes.ExtensionPointState
43
43
  * @since 1.79
44
- * @version 1.138.0
44
+ * @version 1.140.0
45
45
  * @private
46
46
  * @ui5-restricted
47
47
  */
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @namespace
25
25
  * @alias sap.ui.fl.apply._internal.flexState.changes.UIChangesState
26
26
  * @since 1.121
27
- * @version 1.138.0
27
+ * @version 1.140.0
28
28
  * @private
29
29
  * @ui5-restricted
30
30
  */
@@ -7,14 +7,14 @@
7
7
  sap.ui.define([
8
8
  "sap/ui/core/Lib",
9
9
  "sap/ui/fl/apply/_internal/flexState/FlexState",
10
- "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
11
10
  "sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
11
+ "sap/ui/fl/initial/_internal/ManifestUtils",
12
12
  "sap/ui/fl/Utils"
13
13
  ], function(
14
14
  Lib,
15
15
  FlexState,
16
- ManifestUtils,
17
16
  FlexRuntimeInfoAPI,
17
+ ManifestUtils,
18
18
  FlexUtils
19
19
  ) {
20
20
  "use strict";