@openui5/sap.ui.fl 1.129.0 → 1.130.1

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 (172) hide show
  1. package/THIRDPARTY.txt +1 -1
  2. package/package.json +3 -3
  3. package/src/sap/ui/fl/.library +1 -1
  4. package/src/sap/ui/fl/ChangePersistence.js +26 -38
  5. package/src/sap/ui/fl/ChangePersistenceFactory.js +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/FlexController.js +1 -1
  10. package/src/sap/ui/fl/FlexControllerFactory.js +1 -1
  11. package/src/sap/ui/fl/LayerUtils.js +1 -1
  12. package/src/sap/ui/fl/Utils.js +8 -8
  13. package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
  14. package/src/sap/ui/fl/apply/_internal/appVariant/DescriptorChangeTypes.js +2 -1
  15. package/src/sap/ui/fl/apply/_internal/changes/Applier.js +152 -197
  16. package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +23 -17
  17. package/src/sap/ui/fl/apply/_internal/changes/Reverter.js +27 -37
  18. package/src/sap/ui/fl/apply/_internal/changes/Utils.js +26 -31
  19. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
  20. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +3 -2
  21. package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +2 -1
  22. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
  23. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewDataSource.js +1 -1
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +1 -1
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewOutbound.js +1 -1
  26. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddTechnicalAttributes.js +1 -1
  27. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
  28. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +1 -1
  30. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
  31. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetAch.js +1 -1
  32. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetDescription.js +1 -1
  33. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
  34. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
  35. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetCloudDevAdaptationStatus.js +1 -1
  36. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
  37. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
  38. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
  39. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
  40. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
  41. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
  42. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
  43. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
  44. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/ChangeModel.js +78 -0
  45. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
  46. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
  47. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
  48. package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
  49. package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
  50. package/src/sap/ui/fl/apply/_internal/flexObjects/AnnotationChange.js +1 -1
  51. package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
  52. package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +1 -1
  53. package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +1 -1
  54. package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +1 -1
  55. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +1 -1
  56. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +7 -3
  57. package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
  58. package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +1 -1
  59. package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +1 -1
  60. package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +1 -1
  61. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +34 -13
  62. package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
  63. package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
  64. package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  65. package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
  66. package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +1 -1
  67. package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
  68. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantManagementState.js +108 -0
  69. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
  70. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -1
  71. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +57 -9
  72. package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +2 -2
  73. package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
  74. package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +6 -6
  75. package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
  76. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +25 -10
  77. package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +18 -45
  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/HideControl.js +1 -1
  86. package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
  87. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  88. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
  89. package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
  90. package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
  91. package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
  92. package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
  93. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  94. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +4 -4
  95. package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
  96. package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
  97. package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
  98. package/src/sap/ui/fl/initial/_internal/Storage.js +37 -1
  99. package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
  100. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +1 -1
  101. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +3 -2
  102. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +1 -1
  103. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
  104. package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
  105. package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +15 -1
  106. package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
  107. package/src/sap/ui/fl/library.js +43 -43
  108. package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +1 -1
  109. package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
  110. package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +1 -1
  111. package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
  112. package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
  113. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
  114. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
  115. package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
  116. package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
  117. package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
  118. package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
  119. package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
  120. package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
  121. package/src/sap/ui/fl/util/DescriptorChangeCheck.js +35 -16
  122. package/src/sap/ui/fl/util/IFrame.js +1 -1
  123. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  124. package/src/sap/ui/fl/util/resolveBinding.js +1 -1
  125. package/src/sap/ui/fl/variants/VariantModel.js +33 -11
  126. package/src/sap/ui/fl/write/_internal/Storage.js +1 -1
  127. package/src/sap/ui/fl/write/_internal/Versions.js +7 -3
  128. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
  129. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
  130. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  131. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +34 -1
  132. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +163 -176
  133. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +62 -61
  134. package/src/sap/ui/fl/write/_internal/condenser/Utils.js +17 -19
  135. package/src/sap/ui/fl/write/_internal/condenser/classifications/Create.js +13 -13
  136. package/src/sap/ui/fl/write/_internal/condenser/classifications/Destroy.js +17 -19
  137. package/src/sap/ui/fl/write/_internal/condenser/classifications/Move.js +32 -35
  138. package/src/sap/ui/fl/write/_internal/condenser/classifications/Update.js +2 -10
  139. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  140. package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +1 -1
  141. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
  142. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +56 -4
  143. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  144. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
  145. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  146. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  147. package/src/sap/ui/fl/write/_internal/controlVariants/ControlVariantWriteUtils.js +59 -0
  148. package/src/sap/ui/fl/write/_internal/delegates/ODataV2ReadDelegate.js +1 -2
  149. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  150. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  151. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  152. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  153. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  154. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  155. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
  156. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  157. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
  158. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  159. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
  160. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  161. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
  162. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
  163. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectManager.js +33 -2
  164. package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  165. package/src/sap/ui/fl/write/_internal/flexState/changes/UIChangeManager.js +26 -3
  166. package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +20 -12
  167. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
  168. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  169. package/src/sap/ui/fl/write/api/ChangesWriteAPI.js +73 -3
  170. package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
  171. package/src/sap/ui/fl/write/api/LocalResetAPI.js +17 -27
  172. package/src/sap/ui/fl/write/api/VersionsAPI.js +26 -4
@@ -9,20 +9,22 @@ sap.ui.define([
9
9
  "sap/base/util/restricted/_pick",
10
10
  "sap/base/util/ObjectPath",
11
11
  "sap/ui/fl/apply/_internal/controlVariants/Utils",
12
+ "sap/ui/fl/apply/_internal/flexObjects/States",
12
13
  "sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler",
13
14
  "sap/ui/fl/apply/_internal/flexState/DataSelector",
14
- "sap/ui/fl/apply/_internal/flexObjects/States",
15
15
  "sap/ui/fl/apply/_internal/flexState/FlexState",
16
+ "sap/ui/fl/initial/_internal/Storage",
16
17
  "sap/ui/fl/LayerUtils"
17
18
  ], function(
18
19
  _omit,
19
20
  _pick,
20
21
  ObjectPath,
21
22
  VariantsApplyUtil,
23
+ States,
22
24
  DependencyHandler,
23
25
  DataSelector,
24
- States,
25
26
  FlexState,
27
+ Storage,
26
28
  LayerUtils
27
29
  ) {
28
30
  "use strict";
@@ -32,7 +34,7 @@ sap.ui.define([
32
34
  *
33
35
  * @namespace sap.ui.fl.apply._internal.flexState.controlVariants.VariantManagementState
34
36
  * @since 1.74
35
- * @version 1.129.0
37
+ * @version 1.130.1
36
38
  * @private
37
39
  * @ui5-restricted
38
40
  */
@@ -460,6 +462,24 @@ sap.ui.define([
460
462
  FlexState.getFlexObjectsDataSelector().clearCachedResult({ reference: sReference });
461
463
  };
462
464
 
465
+ /**
466
+ * Loads the flex objects for the given variant references and adds them to the FlexState.
467
+ *
468
+ * @param {object} mPropertyBag - Object with the necessary properties
469
+ * @param {string} mPropertyBag.reference - Flexibility reference
470
+ * @param {string[]} mPropertyBag.variantReferences - List of variant references to be loaded
471
+ */
472
+ VariantManagementState.loadVariants = async function(mPropertyBag) {
473
+ const oStorageResponse = await Storage.loadFlVariants({
474
+ variantReferences: mPropertyBag.variantReferences,
475
+ reference: mPropertyBag.reference
476
+ });
477
+ FlexState.updateWithDataProvided({
478
+ reference: mPropertyBag.reference,
479
+ newData: oStorageResponse
480
+ });
481
+ };
482
+
463
483
  /**
464
484
  * Returns control changes for a given variant reference.
465
485
  *
@@ -468,23 +488,26 @@ sap.ui.define([
468
488
  * @param {string} mPropertyBag.vReference - ID of the variant
469
489
  * @param {string} mPropertyBag.reference - Component reference
470
490
  * @param {boolean} [mPropertyBag.includeDirtyChanges] - Whether dirty changes of the current session should be included, <code>true</code> by default
491
+ * @param {boolean} [mPropertyBag.includeReferencedChanges] - Whether changes from referenced variants should be included, <code>true</code> by default
471
492
  *
472
493
  * @returns {object[]|sap.ui.fl.apply._internal.flexObjects.FlexObject[]} All changes of the variant
473
494
  * @private
474
495
  * @ui5-restricted
475
496
  */
476
497
  VariantManagementState.getControlChangesForVariant = function(mPropertyBag) {
477
- var aResult = [];
478
- var oVariant = VariantManagementState.getVariant(mPropertyBag);
498
+ const oVariant = VariantManagementState.getVariant(mPropertyBag);
479
499
  if (oVariant) {
480
- aResult = oVariant.controlChanges.filter(function(oChange) {
500
+ return oVariant.controlChanges.filter(function(oChange) {
501
+ const bIsDirty = oChange.getState() !== States.LifecycleState.PERSISTED;
502
+ const bIsFromReferencedVariant = oChange.getVariantReference() !== mPropertyBag.vReference;
503
+
481
504
  return (
482
- mPropertyBag.includeDirtyChanges !== false
483
- || oChange.getState() === States.LifecycleState.PERSISTED
505
+ (mPropertyBag.includeDirtyChanges !== false || !bIsDirty)
506
+ && (mPropertyBag.includeReferencedChanges !== false || !bIsFromReferencedVariant)
484
507
  );
485
508
  });
486
509
  }
487
- return aResult;
510
+ return [];
488
511
  };
489
512
 
490
513
  /**
@@ -592,6 +615,31 @@ sap.ui.define([
592
615
  }, []);
593
616
  };
594
617
 
618
+ /**
619
+ * Returns all variant management changes related to the current variant management map.
620
+ *
621
+ * @param {object} mPropertyBag - Object with the necessary properties
622
+ * @param {string} mPropertyBag.reference - Flex reference of the current app
623
+ * @param {string} [mPropertyBag.vReference] - Variant reference, provide this parameter to filter for changes related to a specific variant
624
+ * @returns {object[]} Array of variant management changes
625
+ */
626
+ VariantManagementState.getVariantManagementChanges = function(mPropertyBag) {
627
+ const oVariantsMap = oVariantManagementMapDataSelector.get({
628
+ reference: mPropertyBag.reference
629
+ });
630
+ const aVariantManagementChanges = Object.values(oVariantsMap)
631
+ .map((oVariantManagement) => oVariantManagement.variantManagementChanges)
632
+ .flat();
633
+
634
+ if (!mPropertyBag.vReference) {
635
+ return aVariantManagementChanges;
636
+ }
637
+ return aVariantManagementChanges.filter((oVariantManagementChange) => {
638
+ // Currently setDefault changes are the only type of variant management changes
639
+ return mPropertyBag.vReference === oVariantManagementChange.getContent().defaultVariant;
640
+ });
641
+ };
642
+
595
643
  /**
596
644
  * Loads the initial changes of all variant managements.
597
645
  * If the application is started with valid variant references, they are used.
@@ -192,7 +192,7 @@ sap.ui.define([
192
192
  });
193
193
 
194
194
  // manifest descriptor changes for ABAP mixed mode can only be applied in this hook,
195
- // because at this point all libs have been loaded (in contrast to the first Component._fnPreprocessManifest hook),
195
+ // because at this point all libs have been loaded (in contrast to the first Component(s) 'onPreprocessManifest' hook),
196
196
  // but the manifest is still adaptable
197
197
  return AppDescriptorApplier.applyChangesIncludedInManifest(oManifest, ApplyStrategyFactory.getRuntimeStrategy());
198
198
  }
@@ -231,4 +231,4 @@ sap.ui.define([
231
231
  };
232
232
 
233
233
  return ComponentLifecycleHooks;
234
- });
234
+ });
@@ -26,7 +26,7 @@ sap.ui.define([
26
26
  * @class
27
27
  * @constructor
28
28
  * @author SAP SE
29
- * @version 1.129.0
29
+ * @version 1.130.1
30
30
  * @since 1.27.0
31
31
  * @private
32
32
  * @ui5-restricted sap.ui.fl, sap.ui.core
@@ -8,7 +8,7 @@
8
8
  sap.ui.define([
9
9
  "sap/ui/core/mvc/Controller",
10
10
  "sap/ui/core/mvc/XMLView",
11
- "sap/ui/core/Component",
11
+ "sap/ui/core/ComponentHooks",
12
12
  "sap/ui/core/ExtensionPoint",
13
13
  "sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor",
14
14
  "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  ], function(
23
23
  MvcController,
24
24
  XMLView,
25
- Component,
25
+ ComponentHooks,
26
26
  ExtensionPoint,
27
27
  Preprocessor,
28
28
  ManifestUtils,
@@ -40,14 +40,14 @@ sap.ui.define([
40
40
  * @class
41
41
  * @constructor
42
42
  * @author SAP SE
43
- * @version 1.129.0
43
+ * @version 1.130.1
44
44
  * @since 1.43.0
45
45
  * @private
46
46
  */
47
47
  var RegistrationDelegator = {};
48
48
 
49
49
  function registerChangesInComponent() {
50
- Component._fnOnInstanceCreated = ComponentLifecycleHooks.instanceCreatedHook;
50
+ ComponentHooks.onInstanceCreated.register(ComponentLifecycleHooks.instanceCreatedHook);
51
51
  }
52
52
 
53
53
  function registerChangeHandlers() {
@@ -56,7 +56,7 @@ sap.ui.define([
56
56
  }
57
57
 
58
58
  function registerLoadComponentEventHandler() {
59
- Component._fnLoadComponentCallback = ComponentLifecycleHooks.componentLoadedHook;
59
+ ComponentHooks.onComponentLoaded.register(ComponentLifecycleHooks.componentLoadedHook);
60
60
  }
61
61
 
62
62
  function registerExtensionProvider() {
@@ -70,7 +70,7 @@ sap.ui.define([
70
70
  }
71
71
 
72
72
  function registerDescriptorChangeHandler() {
73
- Component._fnPreprocessManifest = Preprocessor.preprocessManifest;
73
+ ComponentHooks.onPreprocessManifest.register(Preprocessor.preprocessManifest);
74
74
  }
75
75
 
76
76
  function getExtensionPointProvider(oView) {
@@ -38,7 +38,7 @@ sap.ui.define([
38
38
  * @class
39
39
  * @constructor
40
40
  * @author SAP SE
41
- * @version 1.129.0
41
+ * @version 1.130.1
42
42
  * @since 1.27.0
43
43
  * @private
44
44
  */
@@ -9,12 +9,14 @@ sap.ui.define([
9
9
  "sap/ui/core/Component",
10
10
  "sap/ui/core/Element",
11
11
  "sap/ui/fl/apply/_internal/controlVariants/URLHandler",
12
+ "sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState",
12
13
  "sap/ui/fl/Utils"
13
14
  ], function(
14
15
  Log,
15
16
  Component,
16
17
  Element,
17
18
  URLHandler,
19
+ VariantManagementState,
18
20
  Utils
19
21
  ) {
20
22
  "use strict";
@@ -116,6 +118,7 @@ sap.ui.define([
116
118
  /**
117
119
  *
118
120
  * Activates the passed variant applicable to the passed control/component.
121
+ * If the Variant is not available and the backend supports lazy loading, a backend request is made to fetch the variant.
119
122
  *
120
123
  * @param {object} mPropertyBag - Object with parameters as properties
121
124
  * @param {sap.ui.base.ManagedObject|string} mPropertyBag.element - Component or control (instance or ID) on which the <code>variantModel</code> is set
@@ -125,13 +128,13 @@ sap.ui.define([
125
128
  *
126
129
  * @public
127
130
  */
128
- activateVariant(mPropertyBag) {
131
+ async activateVariant(mPropertyBag) {
129
132
  function logAndReject(oError) {
130
133
  Log.error(oError);
131
134
  return Promise.reject(oError);
132
135
  }
133
136
 
134
- var oElement;
137
+ let oElement;
135
138
  if (typeof mPropertyBag.element === "string") {
136
139
  oElement = Component.getComponentById(mPropertyBag.element);
137
140
  if (!(oElement instanceof Component)) {
@@ -145,34 +148,46 @@ sap.ui.define([
145
148
  oElement = mPropertyBag.element;
146
149
  }
147
150
 
148
- var oAppComponent = Utils.getAppComponentForControl(oElement);
151
+ const oAppComponent = Utils.getAppComponentForControl(oElement);
149
152
  if (!oAppComponent) {
150
153
  return logAndReject(Error("A valid variant management control or component (instance or ID) should be passed as parameter"));
151
154
  }
152
155
 
153
- var oVariantModel = oAppComponent.getModel(VARIANT_MODEL_NAME);
156
+ const oVariantModel = oAppComponent.getModel(VARIANT_MODEL_NAME);
154
157
  if (!oVariantModel) {
155
158
  return logAndReject(Error("No variant management model found for the passed control or application component"));
156
159
  }
157
- var sVariantManagementReference = oVariantModel.getVariantManagementReference(mPropertyBag.variantReference).variantManagementReference;
160
+
161
+ // if the variant management reference is not available, the variant is not yet loaded
162
+ if (!oVariantModel.getVariantManagementReference(mPropertyBag.variantReference).variantManagementReference) {
163
+ try {
164
+ await VariantManagementState.loadVariants({
165
+ reference: oVariantModel.sFlexReference,
166
+ variantReferences: [mPropertyBag.variantReference]
167
+ });
168
+ } catch (oError) {
169
+ return logAndReject(Error(`Variant with reference '${mPropertyBag.variantReference}' could not be found`));
170
+ }
171
+ }
172
+
173
+ const sVariantManagementReference = oVariantModel.getVariantManagementReference(mPropertyBag.variantReference).variantManagementReference;
158
174
  if (!sVariantManagementReference) {
159
175
  return logAndReject(Error("A valid control or component, and a valid variant/ID combination are required"));
160
176
  }
161
177
 
162
178
  // sap/fe is using this API very early during app start, sometimes before FlexState is initialized
163
- return oVariantModel.waitForVMControlInit(sVariantManagementReference)
179
+ await oVariantModel.waitForVMControlInit(sVariantManagementReference);
164
180
 
165
- .then(function() {
181
+ try {
166
182
  return oVariantModel.updateCurrentVariant({
167
183
  variantManagementReference: sVariantManagementReference,
168
184
  newVariantReference: mPropertyBag.variantReference,
169
185
  appComponent: oAppComponent
170
186
  });
171
- })
172
- .catch(function(oError) {
187
+ } catch (oError) {
173
188
  Log.error(oError);
174
189
  throw oError;
175
- });
190
+ }
176
191
  },
177
192
 
178
193
  /**
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
+ "sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantManagementState",
8
9
  "sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger",
9
10
  "sap/ui/fl/apply/_internal/flexState/compVariants/Utils",
10
11
  "sap/ui/fl/apply/_internal/flexState/FlexState",
@@ -12,6 +13,7 @@ sap.ui.define([
12
13
  "sap/ui/fl/LayerUtils",
13
14
  "sap/ui/fl/Utils"
14
15
  ], function(
16
+ CompVariantManagementState,
15
17
  CompVariantMerger,
16
18
  CompVariantUtils,
17
19
  FlexState,
@@ -21,45 +23,27 @@ sap.ui.define([
21
23
  ) {
22
24
  "use strict";
23
25
 
24
- /**
25
- * Returns the SmartVariant <code>ChangeMap</code> from the Change Persistence.
26
- *
27
- * @param {sap.ui.comp.smartvariants.SmartVariantManagement|
28
- * sap.ui.comp.smartfilterbar.SmartFilterBar|
29
- * sap.ui.comp.smarttable.SmartTable|
30
- * sap.ui.comp.smartchart.SmartChart} oControl - Variant management control
31
- * @returns {object} <code>persistencyKey</code> map and corresponding changes, or an empty object
32
- */
33
- function getVariantsMapForKey(oControl) {
34
- const sReference = ManifestUtils.getFlexReferenceForControl(oControl);
35
- const sPersistencyKey = CompVariantUtils.getPersistencyKey(oControl);
36
- const mCompVariantsMap = FlexState.getCompVariantsMap(sReference);
37
- return mCompVariantsMap._getOrCreate(sPersistencyKey);
38
- }
39
-
40
26
  function getCompEntities(mPropertyBag) {
41
27
  var oControl = mPropertyBag.control;
42
28
  var oVMControl = oControl.getVariantManagement?.() || oControl;
43
29
  var sSVMControlId = oVMControl.getId();
44
- var sReference = ManifestUtils.getFlexReferenceForControl(oControl);
45
30
 
46
31
  return FlexState.initialize({
47
- reference: sReference,
32
+ reference: mPropertyBag.reference,
48
33
  componentData: {},
49
34
  manifest: Utils.getAppDescriptor(oControl),
50
35
  componentId: Utils.getAppComponentForControl(oControl).getId()
51
36
  }).then(function() {
52
- var sPersistencyKey = CompVariantUtils.getPersistencyKey(oControl);
53
- var mCompVariantsMap = FlexState.getCompVariantsMap(sReference);
37
+ var mCompVariantsMap = FlexState.getCompVariantsMap(mPropertyBag.reference);
54
38
  // Store external input data to FlexState so they can be restored after invalidating cache
55
39
  FlexState.setInitialNonFlCompVariantData(
56
- sReference,
57
- sPersistencyKey,
40
+ mPropertyBag.reference,
41
+ mPropertyBag.persistencyKey,
58
42
  mPropertyBag.standardVariant,
59
43
  mPropertyBag.variants,
60
44
  sSVMControlId
61
45
  );
62
- return mCompVariantsMap._initialize(sPersistencyKey, mPropertyBag.variants, sSVMControlId);
46
+ return mCompVariantsMap._initialize(mPropertyBag.persistencyKey, mPropertyBag.variants, sSVMControlId);
63
47
  });
64
48
  }
65
49
 
@@ -126,35 +110,24 @@ sap.ui.define([
126
110
  * @ui5-restricted sap.ui.comp
127
111
  */
128
112
  async loadVariants(mPropertyBag) {
113
+ mPropertyBag.reference = ManifestUtils.getFlexReferenceForControl(mPropertyBag.control);
114
+ mPropertyBag.persistencyKey = CompVariantUtils.getPersistencyKey(mPropertyBag.control);
115
+
129
116
  const mCompMaps = await getCompEntities(mPropertyBag);
130
- const sPersistencyKey = CompVariantUtils.getPersistencyKey(mPropertyBag.control);
131
- const sDefaultVariantId = CompVariantUtils.getDefaultVariantId(getVariantsMapForKey(mPropertyBag.control));
117
+
132
118
  const mMergedCompVariants = CompVariantMerger.merge(
133
- sPersistencyKey,
119
+ mPropertyBag.persistencyKey,
134
120
  mCompMaps,
135
121
  mPropertyBag.standardVariant,
136
122
  mPropertyBag.control
137
123
  );
138
- mMergedCompVariants.defaultVariantId = sDefaultVariantId;
139
- return mMergedCompVariants;
140
- },
141
124
 
142
- /**
143
- * Retrieves the default variant for the current control synchronously. WARNING: The consumer has to make sure that the
144
- * changes have already been retrieved with <code>getChanges</code>.
145
- * It's recommended to use the async API <code>getDefaultVariantId</code>, which works regardless of any preconditions.
146
- *
147
- * @param {object} mPropertyBag - Object with parameters as properties
148
- * @param {sap.ui.comp.smartvariants.SmartVariantManagement} mPropertyBag.control - SAPUI5 Smart Variant Management control
149
- * @returns {string} ID of the default variant
150
- * @private
151
- * @ui5-restricted sap.ui.comp
152
- * @deprecated
153
- */
154
- getDefaultVariantId(mPropertyBag) {
155
- var aDefaultVariantChanges = getVariantsMapForKey(mPropertyBag.control).defaultVariants;
156
- var oChange = aDefaultVariantChanges[aDefaultVariantChanges.length - 1];
157
- return oChange ? oChange.getContent().defaultVariantName : "";
125
+ mMergedCompVariants.defaultVariantId = CompVariantManagementState.getDefaultVariantId({
126
+ persistencyKey: mPropertyBag.persistencyKey,
127
+ reference: mPropertyBag.reference,
128
+ variants: mMergedCompVariants.variants
129
+ });
130
+ return mMergedCompVariants;
158
131
  }
159
132
  };
160
133
 
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  *
23
23
  * @alias sap.ui.fl.changeHandler.AddIFrame
24
24
  * @author SAP SE
25
- * @version 1.129.0
25
+ * @version 1.130.1
26
26
  * @since 1.72
27
27
  * @private
28
28
  */
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  *
17
17
  * @alias sap.ui.fl.changeHandler.AddXML
18
18
  * @author SAP SE
19
- * @version 1.129.0
19
+ * @version 1.130.1
20
20
  * @since 1.54
21
21
  * @private
22
22
  */
@@ -18,7 +18,7 @@ sap.ui.define([
18
18
  *
19
19
  * @alias sap.ui.fl.changeHandler.AddXMLAtExtensionPoint
20
20
  * @author SAP SE
21
- * @version 1.129.0
21
+ * @version 1.130.1
22
22
  * @since 1.75
23
23
  * @private
24
24
  */
@@ -14,7 +14,7 @@ sap.ui.define([
14
14
  /**
15
15
  * Base functionality for all change handlers, which provides some reuse methods
16
16
  * @namespace sap.ui.fl.changeHandler.Base
17
- * @version 1.129.0
17
+ * @version 1.130.1
18
18
  * @private
19
19
  * @ui5-restricted change handlers
20
20
  */
@@ -29,7 +29,7 @@ sap.ui.define([
29
29
  * @constructor
30
30
  * @alias sap.ui.fl.changeHandler.BaseAddViaDelegate
31
31
  * @author SAP SE
32
- * @version 1.129.0
32
+ * @version 1.130.1
33
33
  * @private
34
34
  * @ui5-restricted change handlers
35
35
  */
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  *
23
23
  * @alias sap.ui.fl.changeHandler.BaseAddXml
24
24
  * @author SAP SE
25
- * @version 1.129.0
25
+ * @version 1.130.1
26
26
  * @since 1.75
27
27
  * @private
28
28
  * @ui5-restricted change handlers
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  * @constructor
18
18
  * @alias sap.ui.fl.changeHandler.BaseRename
19
19
  * @author SAP SE
20
- * @version 1.129.0
20
+ * @version 1.130.1
21
21
  * @since 1.46
22
22
  *
23
23
  * @private
@@ -21,7 +21,7 @@ sap.ui.define([
21
21
  * Change handler for hiding of a control.
22
22
  * @alias sap.ui.fl.changeHandler.HideControl
23
23
  * @author SAP SE
24
- * @version 1.129.0
24
+ * @version 1.130.1
25
25
  * @since 1.27.0
26
26
  */
27
27
  var HideControl = {};
@@ -19,7 +19,7 @@ function(
19
19
  *
20
20
  * @alias sap.ui.fl.changeHandler.MoveControls
21
21
  * @author SAP SE
22
- * @version 1.129.0
22
+ * @version 1.130.1
23
23
  * @since 1.46
24
24
  */
25
25
  var MoveControls = { };
@@ -12,7 +12,7 @@ sap.ui.define([], function() {
12
12
  *
13
13
  * @alias sap.ui.fl.changeHandler.MoveElements
14
14
  * @author SAP SE
15
- * @version 1.129.0
15
+ * @version 1.130.1
16
16
  * @since 1.34.0
17
17
  */
18
18
  var MoveElements = { };
@@ -18,7 +18,7 @@ sap.ui.define([
18
18
  *
19
19
  * @alias sap.ui.fl.changeHandler.PropertyBindingChange
20
20
  * @author SAP SE
21
- * @version 1.129.0
21
+ * @version 1.130.1
22
22
  * @since 1.38
23
23
  * @private
24
24
  */
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  *
23
23
  * @alias sap.ui.fl.changeHandler.PropertyChange
24
24
  * @author SAP SE
25
- * @version 1.129.0
25
+ * @version 1.130.1
26
26
  * @since 1.36
27
27
  * @private
28
28
  */
@@ -19,7 +19,7 @@ sap.ui.define([
19
19
  * Change handler for stashing of a control.
20
20
  * @alias sap.ui.fl.changeHandler.StashControl
21
21
  * @author SAP SE
22
- * @version 1.129.0
22
+ * @version 1.130.1
23
23
  * @since 1.27.0
24
24
  */
25
25
  var StashControl = {};
@@ -21,7 +21,7 @@ sap.ui.define([
21
21
  * Change handler for unhiding of a control.
22
22
  * @alias sap.ui.fl.changeHandler.UnhideControl
23
23
  * @author SAP SE
24
- * @version 1.129.0
24
+ * @version 1.130.1
25
25
  * @since 1.27.0
26
26
  */
27
27
  var UnhideControl = {};
@@ -15,7 +15,7 @@ sap.ui.define([
15
15
  * Change handler for unstashing of a control.
16
16
  * @alias sap.ui.fl.changeHandler.UnstashControl
17
17
  * @author SAP SE
18
- * @version 1.129.0
18
+ * @version 1.130.1
19
19
  * @since 1.27.0
20
20
  */
21
21
  var UnstashControl = {};
@@ -18,7 +18,7 @@ sap.ui.define([
18
18
  *
19
19
  * @alias sap.ui.fl.changeHandler.UpdateIFrame
20
20
  * @author SAP SE
21
- * @version 1.129.0
21
+ * @version 1.130.1
22
22
  * @since 1.72
23
23
  * @private
24
24
  */
@@ -23,7 +23,7 @@ sap.ui.define([
23
23
  * @namespace
24
24
  * @name sap.ui.fl.descriptorRelated
25
25
  * @author SAP SE
26
- * @version 1.129.0
26
+ * @version 1.130.1
27
27
  * @private
28
28
  * @ui5-restricted sap.ui.rta, smart business
29
29
  */
@@ -33,7 +33,7 @@ sap.ui.define([
33
33
  * @namespace
34
34
  * @name sap.ui.fl.descriptorRelated.api
35
35
  * @author SAP SE
36
- * @version 1.129.0
36
+ * @version 1.130.1
37
37
  * @private
38
38
  * @ui5-restricted sap.ui.rta, smart business
39
39
  */
@@ -47,7 +47,7 @@ sap.ui.define([
47
47
  * @constructor
48
48
  * @alias sap.ui.fl.descriptorRelated.api.DescriptorChange
49
49
  * @author SAP SE
50
- * @version 1.129.0
50
+ * @version 1.130.1
51
51
  * @private
52
52
  * @ui5-restricted sap.ui.rta, smart business
53
53
  */
@@ -125,7 +125,7 @@ sap.ui.define([
125
125
  * @constructor
126
126
  * @alias sap.ui.fl.descriptorRelated.api.DescriptorChangeFactory
127
127
  * @author SAP SE
128
- * @version 1.129.0
128
+ * @version 1.130.1
129
129
  * @private
130
130
  * @ui5-restricted sap.ui.rta, smart business
131
131
  */
@@ -38,7 +38,7 @@ sap.ui.define([
38
38
  * @namespace
39
39
  * @alias sap.ui.fl.descriptorRelated.api.DescriptorInlineChangeFactory
40
40
  * @author SAP SE
41
- * @version 1.129.0
41
+ * @version 1.130.1
42
42
  * @private
43
43
  * @deprecated Since version 1.76
44
44
  * @ui5-restricted sap.ui.rta, smart business
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @namespace
17
17
  * @alias sap.ui.fl.descriptorRelated.api.DescriptorVariantFactory
18
18
  * @author SAP SE
19
- * @version 1.129.0
19
+ * @version 1.130.1
20
20
  * @private
21
21
  * @deprecated Since version 1.73
22
22
  * @ui5-restricted sap.ui.rta, smart business
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * The flexibility Configuration.
17
17
  *
18
18
  * @author SAP SE
19
- * @version 1.129.0
19
+ * @version 1.130.1
20
20
  * @private
21
21
  * @alias module:sap/ui/fl/initial/_internal/FlexConfiguration
22
22
  * @namespace