@openui5/sap.ui.fl 1.128.0 → 1.130.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 (187) hide show
  1. package/THIRDPARTY.txt +2 -2
  2. package/package.json +3 -3
  3. package/src/sap/ui/fl/.library +1 -1
  4. package/src/sap/ui/fl/ChangePersistence.js +38 -458
  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 +27 -51
  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 +5 -5
  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 +6 -4
  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 +152 -0
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +12 -18
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewOutbound.js +67 -0
  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 +11 -9
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +5 -3
  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/controlVariants/URLHandler.js +18 -5
  49. package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
  50. package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
  51. package/src/sap/ui/fl/apply/_internal/flexObjects/AnnotationChange.js +2 -2
  52. package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +2 -4
  53. package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +19 -10
  54. package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +4 -3
  55. package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +4 -3
  56. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +16 -12
  57. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +23 -22
  58. package/src/sap/ui/fl/apply/_internal/flexObjects/States.js +4 -3
  59. package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +6 -5
  60. package/src/sap/ui/fl/apply/_internal/flexObjects/UpdatableChange.js +1 -1
  61. package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +4 -3
  62. package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +1 -1
  63. package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +4 -4
  64. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +50 -73
  65. package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
  66. package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
  67. package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  68. package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
  69. package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +10 -6
  70. package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
  71. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantManagementState.js +105 -0
  72. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
  73. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap.js +16 -15
  74. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +10 -12
  75. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +69 -14
  76. package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +2 -2
  77. package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
  78. package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +6 -6
  79. package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
  80. package/src/sap/ui/fl/apply/api/AnnotationChangeHandlerAPI.js +63 -0
  81. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +25 -10
  82. package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +18 -45
  83. package/src/sap/ui/fl/changeHandler/AddIFrame.js +4 -4
  84. package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
  85. package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +2 -1
  86. package/src/sap/ui/fl/changeHandler/Base.js +1 -1
  87. package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
  88. package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
  89. package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
  90. package/src/sap/ui/fl/changeHandler/HideControl.js +26 -5
  91. package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
  92. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  93. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
  94. package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
  95. package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
  96. package/src/sap/ui/fl/changeHandler/UnhideControl.js +33 -1
  97. package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
  98. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  99. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +14 -13
  100. package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
  101. package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
  102. package/src/sap/ui/fl/designtime/util/editIFrame.js +2 -1
  103. package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
  104. package/src/sap/ui/fl/initial/_internal/Storage.js +46 -8
  105. package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
  106. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +3 -3
  107. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +25 -2
  108. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +54 -22
  109. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
  110. package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
  111. package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +15 -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/registry/Settings.js +1 -1
  115. package/src/sap/ui/fl/support/_internal/extractChangeDependencies.js +29 -58
  116. package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +1 -1
  117. package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +12 -66
  118. package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +7 -4
  119. package/src/sap/ui/fl/support/_internal/getFlexSettings.js +30 -19
  120. package/src/sap/ui/fl/support/api/SupportAPI.js +8 -4
  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/DescriptorChangeCheck.js +133 -20
  130. package/src/sap/ui/fl/util/IFrame.js +3 -3
  131. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  132. package/src/sap/ui/fl/util/changePropertyValueByPath.js +15 -4
  133. package/src/sap/ui/fl/util/resolveBinding.js +9 -9
  134. package/src/sap/ui/fl/variants/VariantModel.js +81 -42
  135. package/src/sap/ui/fl/variants/context/controller/ContextVisibility.controller.js +2 -2
  136. package/src/sap/ui/fl/write/_internal/SaveAs.js +12 -3
  137. package/src/sap/ui/fl/write/_internal/Storage.js +6 -6
  138. package/src/sap/ui/fl/write/_internal/Versions.js +7 -3
  139. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
  140. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
  141. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  142. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +34 -1
  143. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +165 -178
  144. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +62 -61
  145. package/src/sap/ui/fl/write/_internal/condenser/Utils.js +17 -19
  146. package/src/sap/ui/fl/write/_internal/condenser/classifications/Create.js +13 -13
  147. package/src/sap/ui/fl/write/_internal/condenser/classifications/Destroy.js +17 -19
  148. package/src/sap/ui/fl/write/_internal/condenser/classifications/Move.js +32 -35
  149. package/src/sap/ui/fl/write/_internal/condenser/classifications/Update.js +2 -10
  150. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  151. package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +1 -1
  152. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
  153. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +98 -5
  154. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  155. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +3 -3
  156. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  157. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  158. package/src/sap/ui/fl/write/_internal/controlVariants/ControlVariantWriteUtils.js +59 -0
  159. package/src/sap/ui/fl/write/_internal/delegates/ODataV2ReadDelegate.js +1 -2
  160. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  161. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  162. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  163. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  164. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  165. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  166. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +122 -77
  167. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  168. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
  169. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  170. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +18 -18
  171. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  172. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +12 -11
  173. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +6 -8
  174. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectManager.js +212 -5
  175. package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  176. package/src/sap/ui/fl/write/_internal/flexState/changes/UIChangeManager.js +109 -0
  177. package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +62 -54
  178. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
  179. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  180. package/src/sap/ui/fl/write/api/ChangesWriteAPI.js +73 -3
  181. package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +22 -19
  182. package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +56 -30
  183. package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
  184. package/src/sap/ui/fl/write/api/LocalResetAPI.js +17 -27
  185. package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +28 -51
  186. package/src/sap/ui/fl/write/api/SmartBusinessWriteAPI.js +11 -7
  187. package/src/sap/ui/fl/write/api/VersionsAPI.js +32 -8
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  * @extends sap.ui.fl.apply._internal.flexObjects.Variant
23
23
  * @alias sap.ui.fl.apply._internal.flexObjects.FlVariant
24
24
  * @since 1.104
25
- * @version 1.128.0
25
+ * @version 1.130.0
26
26
  * @private
27
27
  * @ui5-restricted sap.ui.fl
28
28
  */
@@ -79,10 +79,11 @@ sap.ui.define([
79
79
  * @static
80
80
  */
81
81
  FlVariant.getMappingInfo = function() {
82
- return Object.assign(Variant.getMappingInfo(), {
82
+ return {
83
+ ...Variant.getMappingInfo(),
83
84
  variantReference: "variantReference",
84
85
  variantManagementReference: "variantManagementReference"
85
- });
86
+ };
86
87
  };
87
88
 
88
89
  /**
@@ -69,7 +69,7 @@ sap.ui.define([
69
69
  * @extends sap.ui.base.ManagedObject
70
70
  * @alias sap.ui.fl.apply._internal.flexObjects.FlexObject
71
71
  * @since 1.100
72
- * @version 1.128.0
72
+ * @version 1.130.0
73
73
  * @private
74
74
  * @ui5-restricted sap.ui.fl
75
75
  */
@@ -166,7 +166,7 @@ sap.ui.define([
166
166
  * @static
167
167
  */
168
168
  FlexObject.getMappingInfo = function() {
169
- return Object.assign({}, {
169
+ return {
170
170
  "flexObjectMetadata.changeType": "changeType",
171
171
  "flexObjectMetadata.reference": "reference",
172
172
  "flexObjectMetadata.namespace": "namespace",
@@ -192,7 +192,7 @@ sap.ui.define([
192
192
  id: "fileName",
193
193
  content: "content",
194
194
  texts: "texts"
195
- });
195
+ };
196
196
  };
197
197
 
198
198
  /**
@@ -213,7 +213,7 @@ sap.ui.define([
213
213
  FlexObject.prototype.setContent = function(oContent, bSkipStateChange) {
214
214
  this.setProperty("content", oContent);
215
215
  if (!bSkipStateChange) {
216
- this.setState(States.LifecycleState.DIRTY);
216
+ this.setState(States.LifecycleState.UPDATED);
217
217
  }
218
218
  return this;
219
219
  };
@@ -223,7 +223,7 @@ sap.ui.define([
223
223
  * @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject.FlexObjectMetadata} Additional metadata
224
224
  */
225
225
  FlexObject.prototype.getFlexObjectMetadata = function() {
226
- return Object.assign({}, this.getProperty("flexObjectMetadata"));
226
+ return { ...this.getProperty("flexObjectMetadata") };
227
227
  };
228
228
 
229
229
  /**
@@ -231,7 +231,7 @@ sap.ui.define([
231
231
  * @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject.SupportInformation} Support information
232
232
  */
233
233
  FlexObject.prototype.getSupportInformation = function() {
234
- return Object.assign({}, this.getProperty("supportInformation"));
234
+ return { ...this.getProperty("supportInformation") };
235
235
  };
236
236
 
237
237
  function isValidStateChange(sNewState, sCurrentState) {
@@ -241,7 +241,7 @@ sap.ui.define([
241
241
  // flex object state cannot move from NEW to DIRTY directly
242
242
  if (
243
243
  sCurrentState === States.LifecycleState.NEW
244
- && sNewState === States.LifecycleState.DIRTY
244
+ && sNewState === States.LifecycleState.UPDATED
245
245
  ) {
246
246
  return false;
247
247
  }
@@ -306,6 +306,10 @@ sap.ui.define([
306
306
  return (sSourceSystem !== sSystem || sSourceClient !== sClient);
307
307
  };
308
308
 
309
+ FlexObject.prototype.isValidForDependencyMap = function() {
310
+ return false;
311
+ };
312
+
309
313
  /**
310
314
  * Getter for the namespace from the FlexObjectMetadata.
311
315
  * @returns {string} Namespace
@@ -349,17 +353,17 @@ sap.ui.define([
349
353
  * @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} <code>this</code> context for chaining
350
354
  */
351
355
  FlexObject.prototype.setText = function(sTextId, sNewText, sType, bSkipStateChange) {
352
- var oTexts = Object.assign({}, this.getTexts());
353
- var oNewText = {
356
+ const oTexts = { ...this.getTexts() };
357
+ const oNewText = {
354
358
  value: sNewText
355
359
  };
356
360
  if (sType) {
357
361
  oNewText.type = sType;
358
362
  }
359
- oTexts[sTextId] = Object.assign({}, oTexts[sTextId], oNewText);
363
+ oTexts[sTextId] = { ...oTexts[sTextId], ...oNewText };
360
364
  this.setTexts(oTexts);
361
365
  if (!bSkipStateChange) {
362
- this.setState(States.LifecycleState.DIRTY);
366
+ this.setState(States.LifecycleState.UPDATED);
363
367
  }
364
368
  return this;
365
369
  };
@@ -539,4 +543,4 @@ sap.ui.define([
539
543
  return mFileContent;
540
544
  };
541
545
  return FlexObject;
542
- });
546
+ });
@@ -15,6 +15,7 @@ sap.ui.define([
15
15
  "sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor",
16
16
  "sap/ui/fl/apply/_internal/flexObjects/States",
17
17
  "sap/ui/fl/apply/_internal/flexObjects/UIChange",
18
+ "sap/ui/fl/apply/_internal/flexObjects/UpdatableChange",
18
19
  "sap/ui/fl/registry/Settings",
19
20
  "sap/ui/fl/Layer",
20
21
  "sap/ui/fl/LayerUtils",
@@ -31,6 +32,7 @@ sap.ui.define([
31
32
  getVariantAuthor,
32
33
  States,
33
34
  UIChange,
35
+ UpdatableChange,
34
36
  Settings,
35
37
  Layer,
36
38
  LayerUtils,
@@ -38,14 +40,14 @@ sap.ui.define([
38
40
  ) {
39
41
  "use strict";
40
42
 
41
- var FLEX_OBJECT_TYPES = {
42
- BASE_FLEX_OBJECT: FlexObject,
43
+ const FLEX_OBJECT_TYPES = {
43
44
  COMP_VARIANT_OBJECT: CompVariant,
44
45
  FL_VARIANT_OBJECT: FlVariant,
45
46
  CONTROLLER_EXTENSION: ControllerExtensionChange,
46
47
  APP_DESCRIPTOR_CHANGE: AppDescriptorChange,
47
48
  ANNOTATION_CHANGE: AnnotationChange,
48
- UI_CHANGE: UIChange
49
+ UI_CHANGE: UIChange,
50
+ UPDATABLE_CHANGE: UpdatableChange
49
51
  };
50
52
 
51
53
  function getFlexObjectClass(oNewFileContent) {
@@ -59,6 +61,8 @@ sap.ui.define([
59
61
  return FLEX_OBJECT_TYPES.APP_DESCRIPTOR_CHANGE;
60
62
  } else if (oNewFileContent.fileType === "annotation_change") {
61
63
  return FLEX_OBJECT_TYPES.ANNOTATION_CHANGE;
64
+ } else if (oNewFileContent.fileType === "change" && oNewFileContent.changeType === "defaultVariant") {
65
+ return FLEX_OBJECT_TYPES.UPDATABLE_CHANGE;
62
66
  }
63
67
  return FLEX_OBJECT_TYPES.UI_CHANGE;
64
68
  }
@@ -102,11 +106,11 @@ sap.ui.define([
102
106
  *
103
107
  * @namespace sap.ui.fl.apply._internal.flexObjects.FlexObjectFactory
104
108
  * @since 1.100
105
- * @version 1.128.0
109
+ * @version 1.130.0
106
110
  * @private
107
111
  * @ui5-restricted sap.ui.fl
108
112
  */
109
- var FlexObjectFactory = {};
113
+ const FlexObjectFactory = {};
110
114
 
111
115
  /**
112
116
  * Creates a new flex object.
@@ -115,26 +119,23 @@ sap.ui.define([
115
119
  * @param {class} [ObjectClass] - Object class to be instantiated
116
120
  * @param {boolean} [bPersisted] - Whether to set the state to PERSISTED after creation
117
121
  * @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} Created flex object
122
+ * @private
123
+ * @ui5-restricted sap.ui.fl, ux tools
118
124
  */
119
125
  FlexObjectFactory.createFromFileContent = function(oFileContent, ObjectClass, bPersisted) {
120
- var oNewFileContent = Object.assign({}, oFileContent);
126
+ const oNewFileContent = { ...oFileContent };
121
127
  var FlexObjectClass = ObjectClass || getFlexObjectClass(oNewFileContent);
122
128
  if (!FlexObjectClass) {
123
129
  throw new Error("Unknown file type");
124
130
  }
125
- oNewFileContent.support = Object.assign(
126
- {
127
- generator: "FlexObjectFactory.createFromFileContent"
128
- },
129
- oNewFileContent.support || {}
130
- );
131
- var oMappingInfo = FlexObjectClass.getMappingInfo();
132
- var mCreationInfo = FlexObject.mapFileContent(oNewFileContent, oMappingInfo);
133
- var mProperties = Object.entries(mCreationInfo).reduce(function(mPropertyMap, aProperty) {
131
+ oNewFileContent.support = { generator: "FlexObjectFactory.createFromFileContent", ...(oNewFileContent.support || {}) };
132
+ const oMappingInfo = FlexObjectClass.getMappingInfo();
133
+ const mCreationInfo = FlexObject.mapFileContent(oNewFileContent, oMappingInfo);
134
+ const mProperties = Object.entries(mCreationInfo).reduce(function(mPropertyMap, aProperty) {
134
135
  ObjectPath.set(aProperty[0].split("."), aProperty[1], mPropertyMap);
135
136
  return mPropertyMap;
136
137
  }, {});
137
- var oFlexObject = new FlexObjectClass(mProperties);
138
+ const oFlexObject = new FlexObjectClass(mProperties);
138
139
  if (bPersisted) {
139
140
  // Set the property directly for the initial state to avoid state change validation
140
141
  oFlexObject.setProperty("state", States.LifecycleState.PERSISTED);
@@ -144,7 +145,7 @@ sap.ui.define([
144
145
 
145
146
  FlexObjectFactory.createUIChange = function(mPropertyBag) {
146
147
  mPropertyBag.packageName ||= "$TMP";
147
- var mProperties = createBasePropertyBag(mPropertyBag);
148
+ const mProperties = createBasePropertyBag(mPropertyBag);
148
149
  mProperties.layer ||= mPropertyBag.isUserDependent ? Layer.USER : LayerUtils.getCurrentLayer();
149
150
  mProperties.selector = mPropertyBag.selector;
150
151
  mProperties.jsOnly = mPropertyBag.jsOnly;
@@ -156,13 +157,13 @@ sap.ui.define([
156
157
 
157
158
  FlexObjectFactory.createAppDescriptorChange = function(mPropertyBag) {
158
159
  mPropertyBag.compositeCommand ||= mPropertyBag.support && mPropertyBag.support.compositeCommand;
159
- var mProperties = createBasePropertyBag(mPropertyBag);
160
+ const mProperties = createBasePropertyBag(mPropertyBag);
160
161
  return new AppDescriptorChange(mProperties);
161
162
  };
162
163
 
163
164
  FlexObjectFactory.createAnnotationChange = function(mPropertyBag) {
164
165
  mPropertyBag.compositeCommand ||= mPropertyBag.support && mPropertyBag.support.compositeCommand;
165
- var mProperties = createBasePropertyBag(mPropertyBag);
166
+ const mProperties = createBasePropertyBag(mPropertyBag);
166
167
  return new AnnotationChange(mProperties);
167
168
  };
168
169
 
@@ -185,7 +186,7 @@ sap.ui.define([
185
186
  codeRef: mPropertyBag.codeRef
186
187
  };
187
188
 
188
- var mProperties = createBasePropertyBag(mPropertyBag);
189
+ const mProperties = createBasePropertyBag(mPropertyBag);
189
190
  mProperties.flexObjectMetadata.moduleName = mPropertyBag.moduleName;
190
191
  mProperties.controllerName = mPropertyBag.controllerName;
191
192
  return new ControllerExtensionChange(mProperties);
@@ -209,7 +210,7 @@ sap.ui.define([
209
210
  */
210
211
  FlexObjectFactory.createFlVariant = function(mPropertyBag) {
211
212
  mPropertyBag.generator ||= "FlexObjectFactory.createFlVariant";
212
- var mProperties = createBasePropertyBag(mPropertyBag);
213
+ const mProperties = createBasePropertyBag(mPropertyBag);
213
214
  mProperties.variantManagementReference = mPropertyBag.variantManagementReference;
214
215
  mProperties.variantReference = mPropertyBag.variantReference;
215
216
  mProperties.contexts = mPropertyBag.contexts;
@@ -257,7 +258,7 @@ sap.ui.define([
257
258
  FlexObjectFactory.createCompVariant = function(oFileContent, mAuthors) {
258
259
  oFileContent.generator ||= "FlexObjectFactory.createCompVariant";
259
260
  oFileContent.user = ObjectPath.get("support.user", oFileContent);
260
- var mCompVariantContent = createBasePropertyBag(oFileContent);
261
+ const mCompVariantContent = createBasePropertyBag(oFileContent);
261
262
 
262
263
  mCompVariantContent.variantId = oFileContent.variantId || mCompVariantContent.id;
263
264
  mCompVariantContent.contexts = oFileContent.contexts;
@@ -9,9 +9,10 @@ sap.ui.define([], function() {
9
9
  return {
10
10
  LifecycleState: {
11
11
  NEW: "NEW",
12
- PERSISTED: "NONE",
13
- DELETED: "DELETE",
14
- DIRTY: "UPDATE"
12
+ PERSISTED: "PERSISTED",
13
+ DELETED: "DELETED",
14
+ DIRTY: "UPDATED", // deprecated, use UPDATED
15
+ UPDATED: "UPDATED"
15
16
  },
16
17
  ApplyState: {
17
18
  INITIAL: "initial",
@@ -26,7 +26,7 @@ sap.ui.define([
26
26
  * @extends sap.ui.fl.apply._internal.flexObjects.FlexObject
27
27
  * @alias sap.ui.fl.apply._internal.flexObjects.UIChange
28
28
  * @since 1.109
29
- * @version 1.128.0
29
+ * @version 1.130.0
30
30
  * @private
31
31
  * @ui5-restricted
32
32
  */
@@ -113,13 +113,14 @@ sap.ui.define([
113
113
  * @static
114
114
  */
115
115
  UIChange.getMappingInfo = function() {
116
- return Object.assign(FlexObject.getMappingInfo(), {
116
+ return {
117
+ ...FlexObject.getMappingInfo(),
117
118
  selector: "selector",
118
119
  dependentSelectors: "dependentSelector",
119
120
  jsOnly: "jsOnly",
120
121
  variantReference: "variantReference",
121
122
  isChangeOnStandardVariant: "isChangeOnStandardVariant"
122
- });
123
+ };
123
124
  };
124
125
 
125
126
  /**
@@ -335,7 +336,7 @@ sap.ui.define([
335
336
  throw new Error("Parameter mPropertyBag is mandatory");
336
337
  }
337
338
 
338
- var oCurrentDependentSelectors = Object.assign({}, this.getDependentSelectors());
339
+ var oCurrentDependentSelectors = { ...this.getDependentSelectors() };
339
340
 
340
341
  if (oCurrentDependentSelectors[sAlias]) {
341
342
  throw new Error(`Alias '${sAlias}' already exists in the change.`);
@@ -469,7 +470,7 @@ sap.ui.define([
469
470
  */
470
471
  UIChange.prototype.getExtensionPointInfo = function() {
471
472
  if (isPlainObject(this._oExtensionPointInfo)) {
472
- return Object.assign({}, this._oExtensionPointInfo);
473
+ return { ...this._oExtensionPointInfo };
473
474
  }
474
475
  return this._oExtensionPointInfo;
475
476
  };
@@ -40,7 +40,7 @@ sap.ui.define([
40
40
  * @static
41
41
  */
42
42
  UpdatableChange.getMappingInfo = function() {
43
- return Object.assign(UIChange.getMappingInfo(), {});
43
+ return { ...UIChange.getMappingInfo() };
44
44
  };
45
45
 
46
46
  UpdatableChange.prototype.popLatestRevertInfo = function() {
@@ -19,7 +19,7 @@ sap.ui.define([
19
19
  * @extends sap.ui.fl.apply._internal.flexObjects.FlexObject
20
20
  * @alias sap.ui.fl.apply._internal.flexObjects.Variant
21
21
  * @since 1.103
22
- * @version 1.128.0
22
+ * @version 1.130.0
23
23
  * @private
24
24
  * @ui5-restricted sap.ui.fl
25
25
  */
@@ -94,11 +94,12 @@ sap.ui.define([
94
94
  * @static
95
95
  */
96
96
  Variant.getMappingInfo = function() {
97
- return Object.assign(FlexObject.getMappingInfo(), {
97
+ return {
98
+ ...FlexObject.getMappingInfo(),
98
99
  favorite: "favorite",
99
100
  executeOnSelection: "executeOnSelection",
100
101
  contexts: "contexts"
101
- });
102
+ };
102
103
  };
103
104
 
104
105
  /**
@@ -21,7 +21,7 @@ sap.ui.define([
21
21
  *
22
22
  * @function
23
23
  * @since 1.121
24
- * @version 1.128.0
24
+ * @version 1.130.0
25
25
  * @private
26
26
  * @ui5-restricted sap.ui.fl
27
27
  * @alias module:sap/ui/fl/apply/_internal/flexState/compVariants/getVariantAuthor
@@ -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.128.0
42
+ * @version 1.130.0
43
43
  * @private
44
44
  * @ui5-restricted sap.ui.fl
45
45
  */
@@ -58,13 +58,13 @@ sap.ui.define([
58
58
 
59
59
  function getCompleteDependency(oChange, sReference) {
60
60
  const mInitialDependencies = FlexObjectState.getCompleteDependencyMap(sReference).mDependencies;
61
- return mInitialDependencies[oChange.getId()] && Object.assign({}, mInitialDependencies[oChange.getId()]);
61
+ return mInitialDependencies[oChange.getId()] && { ...mInitialDependencies[oChange.getId()] };
62
62
  }
63
63
 
64
64
  function copyDependencies(oInitialDependency, aNewValidDependencies, oAppComponent, oChange, sReference) {
65
65
  const aNewValidControlDependencies = [];
66
66
  const oDependencyMap = FlexObjectState.getLiveDependencyMap(sReference);
67
- const oModifiedDependency = Object.assign({}, oInitialDependency);
67
+ const oModifiedDependency = { ...oInitialDependency };
68
68
  oInitialDependency.controlsDependencies.forEach((oDependentControlSelector) => {
69
69
  // if the control is already available we don't need to add a dependency to it
70
70
  if (!JsControlTreeModifier.bySelector(oDependentControlSelector, oAppComponent)) {
@@ -231,7 +231,7 @@ sap.ui.define([
231
231
  oSelector.changeTypes ||= [];
232
232
  const mChangesMap = FlexObjectState.getLiveDependencyMap(sFlexReference);
233
233
  let aPromises = [];
234
- const mDependencies = Object.assign({}, mChangesMap.mDependencies);
234
+ const mDependencies = { ...mChangesMap.mDependencies };
235
235
  const {mChanges} = mChangesMap;
236
236
  const aChangesForControl = mChanges[oControl.getId()] || [];
237
237
 
@@ -89,7 +89,7 @@ sap.ui.define([
89
89
  *
90
90
  * @namespace sap.ui.fl.apply._internal.flexState.FlexState
91
91
  * @since 1.73
92
- * @version 1.128.0
92
+ * @version 1.130.0
93
93
  * @private
94
94
  * @ui5-restricted sap.ui.fl.apply._internal
95
95
  */
@@ -145,11 +145,7 @@ sap.ui.define([
145
145
  );
146
146
  // If the parent variant no longer exists, change the reference to the standard variant
147
147
  if (!bParentVariantExists) {
148
- return Object.assign(
149
- {},
150
- oVariant,
151
- { variantReference: oVariant.variantManagementReference }
152
- );
148
+ return { ...oVariant, variantReference: oVariant.variantManagementReference };
153
149
  }
154
150
  return oVariant;
155
151
  });
@@ -268,10 +264,6 @@ sap.ui.define([
268
264
  oFlexObjectsDataSelector.checkUpdate({ reference: sReference });
269
265
  }
270
266
 
271
- function getCompVariantsMap(sReference) {
272
- return getInstanceEntryOrThrowError(sReference, "compVariants");
273
- }
274
-
275
267
  function buildRuntimePersistence(oFlexStateInstance, aExternalFlexObjects) {
276
268
  const oStorageResponse = oFlexStateInstance.storageResponse;
277
269
  var oRuntimePersistence = {
@@ -306,7 +298,8 @@ sap.ui.define([
306
298
  });
307
299
  });
308
300
 
309
- _mInstances[sReference].runtimePersistence = Object.assign(oRuntimePersistence, {
301
+ _mInstances[sReference].runtimePersistence = {
302
+ ...oRuntimePersistence,
310
303
  flexObjects: aChangeDefinitions.map(function(oChangeDef) {
311
304
  var iObjectIndex;
312
305
  // Only keep FlexObjects found in the storage change definitions
@@ -328,7 +321,7 @@ sap.ui.define([
328
321
  Log.error(sErrorText);
329
322
  throw new Error(sErrorText);
330
323
  })
331
- });
324
+ };
332
325
 
333
326
  // If the final length is different, an object is no longer there (e.g. new version requested)
334
327
  if (iInitialFlexObjectsLength !== _mInstances[sReference].runtimePersistence.flexObjects.length) {
@@ -348,7 +341,6 @@ sap.ui.define([
348
341
  }
349
342
  if (!_mInstances[sReference].storageResponse) {
350
343
  _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mInstances[sReference].unfilteredStorageResponse);
351
- _mInstances[sReference].maxLayer = FlexInfoSession.getByReference(sReference).maxLayer;
352
344
  // Flex objects need to be recreated
353
345
  delete _mInstances[sReference].runtimePersistence;
354
346
  bDataUpdated = true;
@@ -373,9 +365,10 @@ sap.ui.define([
373
365
 
374
366
  function filterByMaxLayer(sReference, mResponse) {
375
367
  const mFilteredReturn = merge({}, mResponse);
368
+ mFilteredReturn.changes = { ...StorageUtils.getEmptyFlexDataResponse(), ...mFilteredReturn.changes };
376
369
  const mFlexObjects = mFilteredReturn.changes;
370
+ const oFlexInfoSession = FlexInfoSession.getByReference(sReference);
377
371
  if (LayerUtils.isLayerFilteringRequired(sReference)) {
378
- const oFlexInfoSession = FlexInfoSession.getByReference(sReference);
379
372
  each(_mFlexObjectInfo, function(iIndex, mFlexObjectInfo) {
380
373
  mFlexObjectInfo.pathInResponse.forEach(function(sPath) {
381
374
  const aFilterByMaxLayer = ObjectPath.get(sPath, mFlexObjects).filter(function(oChangeDefinition) {
@@ -385,6 +378,7 @@ sap.ui.define([
385
378
  });
386
379
  });
387
380
  }
381
+ _mInstances[sReference].maxLayer = oFlexInfoSession.maxLayer;
388
382
  return mFilteredReturn;
389
383
  }
390
384
 
@@ -416,7 +410,7 @@ sap.ui.define([
416
410
  var oResponse = mResponse && mResponse.changes || {};
417
411
  var oFlexInfoSession = FlexInfoSession.getByReference(sReference);
418
412
  if (oResponse.info !== undefined) {
419
- oFlexInfoSession = Object.assign(oFlexInfoSession, oResponse.info);
413
+ oFlexInfoSession = { ...oFlexInfoSession, ...oResponse.info };
420
414
  }
421
415
  FlexInfoSession.setByReference(oFlexInfoSession, sReference);
422
416
  }
@@ -552,6 +546,32 @@ sap.ui.define([
552
546
  return !!_mInstances[sReference];
553
547
  };
554
548
 
549
+ /**
550
+ * Updates the saved backend response and the runtime persistence with new data.
551
+ * The new data must not be already available in the storageResponse or runtimePersistence.
552
+ * As of now this does not work with nested structures (comp related objects) or ui2personalization.
553
+ *
554
+ * @param {object} mPropertyBag - Contains additional data needed for reading and storing changes
555
+ * @param {string} mPropertyBag.reference - Flex reference of the app
556
+ * @param {object} mPropertyBag.newData - New Data to be added. Needs to have the structure of the storageResponse.changes object
557
+ */
558
+ FlexState.updateWithDataProvided = function(mPropertyBag) {
559
+ if (!_mInstances[mPropertyBag.reference]) {
560
+ initializeEmptyState(mPropertyBag.reference);
561
+ }
562
+ const oInstance = _mInstances[mPropertyBag.reference];
563
+ Object.entries(mPropertyBag.newData).forEach(([sKey, vValue]) => {
564
+ oInstance.unfilteredStorageResponse.changes[sKey].push(...vValue);
565
+ });
566
+ oInstance.storageResponse = filterByMaxLayer(mPropertyBag.reference, oInstance.unfilteredStorageResponse);
567
+ oInstance.runtimePersistence.flexObjects =
568
+ [
569
+ ...oInstance.runtimePersistence.flexObjects,
570
+ ...createFlexObjects(filterByMaxLayer(mPropertyBag.reference, { changes: mPropertyBag.newData }))
571
+ ];
572
+ oFlexObjectsDataSelector.checkUpdate({ reference: mPropertyBag.reference });
573
+ };
574
+
555
575
  /**
556
576
  * Triggers a call to the backend to fetch new data and update the runtime persistence
557
577
  *
@@ -566,8 +586,8 @@ sap.ui.define([
566
586
  */
567
587
  FlexState.update = async function(mPropertyBag) {
568
588
  enhancePropertyBag(mPropertyBag);
569
- var sReference = mPropertyBag.reference;
570
- var oCurrentRuntimePersistence = _mInstances[sReference].runtimePersistence;
589
+ const sReference = mPropertyBag.reference;
590
+ const oCurrentRuntimePersistence = _mInstances[sReference].runtimePersistence;
571
591
 
572
592
  const oOldInitPromise = _mInitPromises[sReference].promise;
573
593
  const oNewInitPromise = new Deferred();
@@ -575,8 +595,7 @@ sap.ui.define([
575
595
  await oOldInitPromise;
576
596
  await loadFlexData(mPropertyBag);
577
597
  _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mInstances[sReference].unfilteredStorageResponse);
578
- _mInstances[sReference].maxLayer = FlexInfoSession.getByReference(sReference).maxLayer;
579
- var bUpdated = updateRuntimePersistence(
598
+ const bUpdated = updateRuntimePersistence(
580
599
  sReference,
581
600
  _mInstances[sReference].storageResponse,
582
601
  oCurrentRuntimePersistence
@@ -746,7 +765,6 @@ sap.ui.define([
746
765
  if (_mInstances[sReference]) {
747
766
  _mInstances[sReference].preparedMaps = {};
748
767
  _mInstances[sReference].storageResponse = filterByMaxLayer(sReference, _mInstances[sReference].unfilteredStorageResponse);
749
- _mInstances[sReference].maxLayer = FlexInfoSession.getByReference(sReference).maxLayer;
750
768
  // Storage response has changed, recreate the flex objects
751
769
  _mInstances[sReference].runtimePersistence = buildRuntimePersistence(
752
770
  _mInstances[sReference],
@@ -756,97 +774,55 @@ sap.ui.define([
756
774
  }
757
775
  };
758
776
 
759
- /**
760
- * Adds a dirty flex object to the flex state.
761
- *
762
- * @param {string} sReference - Flexibility reference of the app
763
- * @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oFlexObject - Flexibility object
764
- */
765
- FlexState.addDirtyFlexObject = function(sReference, oFlexObject) {
766
- if (!_mInstances[sReference]) {
767
- initializeEmptyState(sReference);
768
- }
769
- const sAdaptationLayer = FlexInfoSession.getByReference(sReference).adaptationLayer;
770
- const bFlexObjectsOverAdaptationLayer = !!sAdaptationLayer
771
- && LayerUtils.isOverLayer(oFlexObject.getLayer(), sAdaptationLayer);
772
- const bAlreadyInRuntimePersistence = _mInstances[sReference].runtimePersistence.flexObjects.includes(oFlexObject);
773
- // FIXME: Currently called from the ChangePersistence which might be
774
- // independent of FlexState in some test cases
775
- // Once the ChangePersistence is no longer used
776
- // make sure to remove the safeguard
777
- if (!bFlexObjectsOverAdaptationLayer && _mInstances[sReference] && !bAlreadyInRuntimePersistence) {
778
- _mInstances[sReference].runtimePersistence.flexObjects.push(oFlexObject);
779
- oFlexObjectsDataSelector.checkUpdate(
780
- { reference: sReference },
781
- [{ type: "addFlexObject", updatedObject: oFlexObject }]
782
- );
783
- }
784
- };
785
-
786
777
  /**
787
778
  * Adds a list of dirty flex objects to the flex state.
788
779
  *
789
780
  * @param {string} sReference - Flexibility reference of the app
790
- * @param {array.<sap.ui.fl.apply._internal.flexObjects.FlexObject>} aFlexObjects - Flexibility objects
781
+ * @param {array.<sap.ui.fl.apply._internal.flexObjects.FlexObject>} aFlexObjects - Flex objects
782
+ * @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} The flex objects that were added
791
783
  */
792
784
  FlexState.addDirtyFlexObjects = function(sReference, aFlexObjects) {
793
785
  if (!_mInstances[sReference]) {
794
786
  initializeEmptyState(sReference);
795
787
  }
796
788
  const sAdaptationLayer = FlexInfoSession.getByReference(sReference).adaptationLayer;
797
- aFlexObjects = aFlexObjects
789
+ const aFilteredFlexObjects = aFlexObjects
798
790
  .filter((oFlexObject) => !sAdaptationLayer || !LayerUtils.isOverLayer(oFlexObject.getLayer(), sAdaptationLayer))
799
791
  .filter((oFlexObject) => (
800
792
  !_mInstances[sReference].runtimePersistence.flexObjects
801
793
  .some((oExistingFlexObject) => (oExistingFlexObject.getId() === oFlexObject.getId()))
802
794
  ));
803
795
 
804
- if (aFlexObjects.length > 0 && _mInstances[sReference]) {
796
+ if (aFilteredFlexObjects.length > 0) {
805
797
  _mInstances[sReference].runtimePersistence.flexObjects =
806
- _mInstances[sReference].runtimePersistence.flexObjects.concat(aFlexObjects);
798
+ _mInstances[sReference].runtimePersistence.flexObjects.concat(aFilteredFlexObjects);
807
799
  oFlexObjectsDataSelector.checkUpdate(
808
800
  { reference: sReference },
809
- aFlexObjects.map(function(oFlexObject) {
801
+ aFilteredFlexObjects.map(function(oFlexObject) {
810
802
  return { type: "addFlexObject", updatedObject: oFlexObject };
811
803
  })
812
804
  );
813
805
  }
814
- };
815
806
 
816
- FlexState.removeDirtyFlexObject = function(sReference, oFlexObject) {
817
- // FIXME: Currently called from the ChangePersistence which might be
818
- // independent of FlexState in some test cases
819
- // Once the ChangePersistence is no longer used
820
- // make sure to remove the safeguard
821
- if (_mInstances[sReference]) {
822
- const aFlexObjects = _mInstances[sReference].runtimePersistence.flexObjects;
823
- const iIndex = aFlexObjects.indexOf(oFlexObject);
824
- if (iIndex >= 0) {
825
- aFlexObjects.splice(iIndex, 1);
826
- oFlexObjectsDataSelector.checkUpdate(
827
- { reference: sReference },
828
- [{ type: "removeFlexObject", updatedObject: oFlexObject }]
829
- );
830
- }
831
- }
807
+ return aFilteredFlexObjects;
832
808
  };
833
809
 
834
810
  FlexState.removeDirtyFlexObjects = function(sReference, aFlexObjects) {
811
+ const aRemovedFlexObjects = [];
835
812
  // FIXME: Currently called from the ChangePersistence which might be
836
813
  // independent of FlexState in some test cases
837
814
  // Once the ChangePersistence is no longer used
838
815
  // make sure to remove the safeguard
839
816
  if (_mInstances[sReference] && aFlexObjects.length > 0) {
840
- let bFlexObjectRemoved = false;
841
817
  const aCurrentFlexObjects = _mInstances[sReference].runtimePersistence.flexObjects;
842
818
  aFlexObjects.forEach(function(oFlexObject) {
843
819
  const iIndex = aCurrentFlexObjects.indexOf(oFlexObject);
844
820
  if (iIndex >= 0) {
845
- bFlexObjectRemoved = true;
821
+ aRemovedFlexObjects.push(oFlexObject);
846
822
  aCurrentFlexObjects.splice(iIndex, 1);
847
823
  }
848
824
  });
849
- if (bFlexObjectRemoved) {
825
+ if (aRemovedFlexObjects.length > 0) {
850
826
  oFlexObjectsDataSelector.checkUpdate(
851
827
  { reference: sReference },
852
828
  aFlexObjects.map(function(oFlexObject) {
@@ -855,6 +831,7 @@ sap.ui.define([
855
831
  );
856
832
  }
857
833
  }
834
+ return aRemovedFlexObjects;
858
835
  };
859
836
 
860
837
  FlexState.getComponentIdForReference = function(sReference) {
@@ -878,7 +855,7 @@ sap.ui.define([
878
855
  };
879
856
 
880
857
  FlexState.getCompVariantsMap = function(sReference) {
881
- return getCompVariantsMap(sReference);
858
+ return getInstanceEntryOrThrowError(sReference, "compVariants");
882
859
  };
883
860
 
884
861
  FlexState.callPrepareFunction = function(sMapName, mPropertyBag) {