@openui5/sap.ui.fl 1.98.0 → 1.101.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 (204) hide show
  1. package/THIRDPARTY.txt +6 -6
  2. package/package.json +3 -3
  3. package/src/sap/ui/fl/.library +1 -1
  4. package/src/sap/ui/fl/Cache.js +1 -1
  5. package/src/sap/ui/fl/Change.js +34 -12
  6. package/src/sap/ui/fl/ChangePersistence.js +130 -168
  7. package/src/sap/ui/fl/ChangePersistenceFactory.js +2 -2
  8. package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +3 -4
  9. package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +3 -4
  10. package/src/sap/ui/fl/FakeLrepLocalStorage.js +4 -4
  11. package/src/sap/ui/fl/FlexController.js +25 -57
  12. package/src/sap/ui/fl/FlexControllerFactory.js +5 -2
  13. package/src/sap/ui/fl/LayerUtils.js +1 -1
  14. package/src/sap/ui/fl/Utils.js +14 -14
  15. package/src/sap/ui/fl/Variant.js +5 -5
  16. package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
  17. package/src/sap/ui/fl/apply/_internal/changes/Applier.js +56 -9
  18. package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
  19. package/src/sap/ui/fl/apply/_internal/changes/Reverter.js +1 -1
  20. package/src/sap/ui/fl/apply/_internal/changes/Utils.js +46 -2
  21. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
  22. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
  23. package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
  26. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
  27. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
  28. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
  30. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
  31. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
  32. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
  33. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
  34. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
  35. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
  36. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
  37. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
  38. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
  39. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
  40. package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
  41. package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +8 -0
  42. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +452 -0
  43. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +68 -0
  44. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +34 -43
  45. package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -3
  46. package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
  47. package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
  48. package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
  49. package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +12 -10
  50. package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
  51. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -4
  52. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +34 -32
  53. package/src/sap/ui/fl/{PreprocessorImpl.js → apply/_internal/preprocessors/ControllerExtension.js} +38 -47
  54. package/src/sap/ui/fl/{EventHistory.js → apply/_internal/preprocessors/EventHistory.js} +7 -7
  55. package/src/sap/ui/fl/{RegistrationDelegator.js → apply/_internal/preprocessors/RegistrationDelegator.js} +40 -42
  56. package/src/sap/ui/fl/{XmlPreprocessorImpl.js → apply/_internal/preprocessors/XmlPreprocessor.js} +6 -6
  57. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
  58. package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +1 -1
  59. package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
  60. package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
  61. package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
  62. package/src/sap/ui/fl/changeHandler/Base.js +1 -1
  63. package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
  64. package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
  65. package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
  66. package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
  67. package/src/sap/ui/fl/changeHandler/MoveControls.js +7 -2
  68. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  69. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
  70. package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
  71. package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
  72. package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
  73. package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
  74. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  75. package/src/sap/ui/fl/codeExt/CodeExtManager.js +1 -1
  76. package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +4 -4
  77. package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
  78. package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
  79. package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
  80. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +1 -1
  81. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeRegistryItem.js +9 -9
  82. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
  83. package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
  84. package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
  85. package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
  86. package/src/sap/ui/fl/library.js +16 -16
  87. package/src/sap/ui/fl/messagebundle_fr.properties +14 -14
  88. package/src/sap/ui/fl/registry/Settings.js +44 -5
  89. package/src/sap/ui/fl/support/Flexibility.js +1 -1
  90. package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
  91. package/src/sap/ui/fl/support/_internal/getFlexSettings.js +34 -0
  92. package/src/sap/ui/fl/support/api/SupportAPI.js +5 -2
  93. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
  94. package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
  95. package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
  96. package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
  97. package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
  98. package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +4 -4
  99. package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +4 -4
  100. package/src/sap/ui/fl/support/diagnostics/Flexibility.controller.js +1 -1
  101. package/src/sap/ui/fl/themes/base/VariantManagement.less +0 -1
  102. package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
  103. package/src/sap/ui/fl/util/DescriptorChangeCheck.js +1 -1
  104. package/src/sap/ui/fl/util/IFrame.js +1 -1
  105. package/src/sap/ui/fl/util/IFrameRenderer.js +1 -1
  106. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  107. package/src/sap/ui/fl/util/changePropertyValueByPath.js +1 -1
  108. package/src/sap/ui/fl/util/resolveBinding.js +1 -1
  109. package/src/sap/ui/fl/variants/VariantManagement.js +5 -0
  110. package/src/sap/ui/fl/variants/VariantModel.js +34 -31
  111. package/src/sap/ui/fl/variants/context/Component.js +2 -6
  112. package/src/sap/ui/fl/variants/context/controller/ContextVisibility.controller.js +6 -41
  113. package/src/sap/ui/fl/variants/context/i18n/i18n.properties +3 -7
  114. package/src/sap/ui/fl/variants/context/i18n/i18n_ar.properties +2 -4
  115. package/src/sap/ui/fl/variants/context/i18n/i18n_bg.properties +2 -4
  116. package/src/sap/ui/fl/variants/context/i18n/i18n_ca.properties +2 -4
  117. package/src/sap/ui/fl/variants/context/i18n/i18n_cs.properties +2 -4
  118. package/src/sap/ui/fl/variants/context/i18n/i18n_cy.properties +2 -4
  119. package/src/sap/ui/fl/variants/context/i18n/i18n_da.properties +2 -4
  120. package/src/sap/ui/fl/variants/context/i18n/i18n_de.properties +2 -4
  121. package/src/sap/ui/fl/variants/context/i18n/i18n_el.properties +2 -4
  122. package/src/sap/ui/fl/variants/context/i18n/i18n_en.properties +2 -4
  123. package/src/sap/ui/fl/variants/context/i18n/i18n_en_GB.properties +2 -4
  124. package/src/sap/ui/fl/variants/context/i18n/i18n_en_US_sappsd.properties +2 -4
  125. package/src/sap/ui/fl/variants/context/i18n/i18n_en_US_saprigi.properties +2 -4
  126. package/src/sap/ui/fl/variants/context/i18n/i18n_en_US_saptrc.properties +2 -4
  127. package/src/sap/ui/fl/variants/context/i18n/i18n_es.properties +2 -4
  128. package/src/sap/ui/fl/variants/context/i18n/i18n_es_MX.properties +2 -4
  129. package/src/sap/ui/fl/variants/context/i18n/i18n_et.properties +2 -4
  130. package/src/sap/ui/fl/variants/context/i18n/i18n_fi.properties +2 -4
  131. package/src/sap/ui/fl/variants/context/i18n/i18n_fr.properties +2 -4
  132. package/src/sap/ui/fl/variants/context/i18n/i18n_fr_CA.properties +2 -4
  133. package/src/sap/ui/fl/variants/context/i18n/i18n_hi.properties +2 -4
  134. package/src/sap/ui/fl/variants/context/i18n/i18n_hr.properties +2 -4
  135. package/src/sap/ui/fl/variants/context/i18n/i18n_hu.properties +2 -4
  136. package/src/sap/ui/fl/variants/context/i18n/i18n_id.properties +2 -4
  137. package/src/sap/ui/fl/variants/context/i18n/i18n_it.properties +2 -4
  138. package/src/sap/ui/fl/variants/context/i18n/i18n_iw.properties +2 -4
  139. package/src/sap/ui/fl/variants/context/i18n/i18n_ja.properties +2 -4
  140. package/src/sap/ui/fl/variants/context/i18n/i18n_kk.properties +2 -4
  141. package/src/sap/ui/fl/variants/context/i18n/i18n_ko.properties +2 -4
  142. package/src/sap/ui/fl/variants/context/i18n/i18n_lt.properties +2 -4
  143. package/src/sap/ui/fl/variants/context/i18n/i18n_lv.properties +2 -4
  144. package/src/sap/ui/fl/variants/context/i18n/i18n_ms.properties +2 -4
  145. package/src/sap/ui/fl/variants/context/i18n/i18n_nl.properties +2 -4
  146. package/src/sap/ui/fl/variants/context/i18n/i18n_no.properties +2 -4
  147. package/src/sap/ui/fl/variants/context/i18n/i18n_pl.properties +2 -4
  148. package/src/sap/ui/fl/variants/context/i18n/i18n_pt.properties +2 -4
  149. package/src/sap/ui/fl/variants/context/i18n/i18n_pt_PT.properties +2 -4
  150. package/src/sap/ui/fl/variants/context/i18n/i18n_ro.properties +2 -4
  151. package/src/sap/ui/fl/variants/context/i18n/i18n_ru.properties +2 -4
  152. package/src/sap/ui/fl/variants/context/i18n/i18n_sh.properties +2 -4
  153. package/src/sap/ui/fl/variants/context/i18n/i18n_sk.properties +2 -4
  154. package/src/sap/ui/fl/variants/context/i18n/i18n_sl.properties +2 -4
  155. package/src/sap/ui/fl/variants/context/i18n/i18n_sv.properties +2 -4
  156. package/src/sap/ui/fl/variants/context/i18n/i18n_th.properties +2 -4
  157. package/src/sap/ui/fl/variants/context/i18n/i18n_tr.properties +2 -4
  158. package/src/sap/ui/fl/variants/context/i18n/i18n_uk.properties +2 -4
  159. package/src/sap/ui/fl/variants/context/i18n/i18n_vi.properties +2 -4
  160. package/src/sap/ui/fl/variants/context/i18n/i18n_zh_CN.properties +2 -4
  161. package/src/sap/ui/fl/variants/context/i18n/i18n_zh_TW.properties +2 -4
  162. package/src/sap/ui/fl/variants/context/view/ContextVisibility.view.xml +7 -6
  163. package/src/sap/ui/fl/write/_internal/Storage.js +15 -1
  164. package/src/sap/ui/fl/write/_internal/StorageFeaturesMerger.js +1 -1
  165. package/src/sap/ui/fl/write/_internal/Versions.js +2 -2
  166. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +5 -1
  167. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +4 -2
  168. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  169. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +1 -1
  170. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +2 -2
  171. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
  172. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  173. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +33 -3
  174. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +1 -4
  175. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  176. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
  177. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  178. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  179. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  180. package/src/sap/ui/fl/write/_internal/extensionPoint/Registry.js +1 -1
  181. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  182. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  183. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  184. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  185. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  186. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
  187. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  188. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +5 -5
  189. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  190. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
  191. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  192. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
  193. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
  194. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectState.js +2 -2
  195. package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +1 -1
  196. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
  197. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  198. package/src/sap/ui/fl/write/api/AppVariantWriteAPI.js +13 -4
  199. package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +125 -32
  200. package/src/sap/ui/fl/write/api/FeaturesAPI.js +4 -1
  201. package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
  202. package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +49 -4
  203. package/src/sap/ui/fl/write/api/TranslationAPI.js +23 -2
  204. package/src/sap/ui/fl/write/connectors/BaseConnector.js +13 -0
@@ -10,6 +10,7 @@ sap.ui.define([
10
10
  "sap/ui/core/Core",
11
11
  "sap/ui/core/Element",
12
12
  "sap/ui/fl/apply/_internal/controlVariants/Utils",
13
+ "sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
13
14
  "sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage",
14
15
  "sap/ui/fl/registry/Settings",
15
16
  "sap/ui/fl/FlexControllerFactory",
@@ -21,6 +22,7 @@ sap.ui.define([
21
22
  Core,
22
23
  Element,
23
24
  VariantUtils,
25
+ FlexRuntimeInfoAPI,
24
26
  ChangeHandlerStorage,
25
27
  Settings,
26
28
  FlexControllerFactory,
@@ -39,7 +41,9 @@ sap.ui.define([
39
41
  * @ui5-restricted UI5 controls that allow personalization
40
42
  */
41
43
 
42
- function checkChangeSpecificData(oChange, sLayer) {
44
+ var mChangeCreationListeners = {};
45
+
46
+ function checkChangeSpecificData(oChange, sLayer) {
43
47
  if (!oChange.changeSpecificData) {
44
48
  return Promise.reject(new Error("No changeSpecificData available"));
45
49
  }
@@ -113,43 +117,85 @@ sap.ui.define([
113
117
  if (!mPropertyBag.changes.length) {
114
118
  return Promise.resolve([]);
115
119
  }
116
- var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.changes[0].selectorElement || mPropertyBag.changes[0].selectorControl);
120
+ var oReferenceControl = (
121
+ mPropertyBag.changes[0].selectorElement
122
+ || mPropertyBag.changes[0].selectorControl
123
+ );
124
+ var oAppComponent = Utils.getAppComponentForControl(oReferenceControl);
125
+ var sFlexReference = FlexRuntimeInfoAPI.getFlexReference({element: oReferenceControl});
117
126
  var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
118
127
  var oVariantModel = oAppComponent.getModel(Utils.VARIANT_MODEL_NAME);
119
128
  var sLayer = Layer.USER;
120
129
  var aSuccessfulChanges = [];
121
130
 
122
- return mPropertyBag.changes.reduce(function(oPromise, oPersonalizationChange) {
123
- return oPromise.then(function() {
124
- oPersonalizationChange.selectorControl = oPersonalizationChange.selectorElement;
125
- return checkChangeSpecificData(oPersonalizationChange, sLayer);
126
- }).then(function() {
127
- if (!mPropertyBag.ignoreVariantManagement) {
128
- // check for preset variantReference
129
- if (!oPersonalizationChange.changeSpecificData.variantReference) {
130
- var sVariantManagementReference = getRelevantVariantManagementReference(oAppComponent, oPersonalizationChange.selectorControl, mPropertyBag.useStaticArea);
131
- if (sVariantManagementReference) {
132
- var sCurrentVariantReference = oVariantModel.oData[sVariantManagementReference].currentVariant;
133
- oPersonalizationChange.changeSpecificData.variantReference = sCurrentVariantReference;
131
+ function createChanges() {
132
+ var aAddedChanges = [];
133
+ return mPropertyBag.changes.reduce(function(pPromise, oPersonalizationChange) {
134
+ return pPromise
135
+ .then(function() {
136
+ oPersonalizationChange.selectorControl = oPersonalizationChange.selectorElement;
137
+ return checkChangeSpecificData(oPersonalizationChange, sLayer);
138
+ })
139
+ .then(function() {
140
+ if (!mPropertyBag.ignoreVariantManagement) {
141
+ // check for preset variantReference
142
+ if (!oPersonalizationChange.changeSpecificData.variantReference) {
143
+ var sVariantManagementReference = getRelevantVariantManagementReference(oAppComponent, oPersonalizationChange.selectorControl, mPropertyBag.useStaticArea);
144
+ if (sVariantManagementReference) {
145
+ var sCurrentVariantReference = oVariantModel.oData[sVariantManagementReference].currentVariant;
146
+ oPersonalizationChange.changeSpecificData.variantReference = sCurrentVariantReference;
147
+ }
148
+ }
149
+ } else {
150
+ // delete preset variantReference
151
+ delete oPersonalizationChange.changeSpecificData.variantReference;
134
152
  }
135
- }
136
- } else {
137
- // delete preset variantReference
138
- delete oPersonalizationChange.changeSpecificData.variantReference;
139
- }
140
153
 
141
- oPersonalizationChange.changeSpecificData = Object.assign(oPersonalizationChange.changeSpecificData, {developerMode: false, layer: sLayer});
142
- return oFlexController.addChange(oPersonalizationChange.changeSpecificData, oPersonalizationChange.selectorControl);
143
- }).then(function(oAddedChange) {
144
- return oFlexController.applyChange(oAddedChange, oPersonalizationChange.selectorControl);
145
- }).then(function(oAppliedChange) {
146
- aSuccessfulChanges.push(oAppliedChange);
147
- }).catch(function(oError) {
148
- Log.error("A Change was not added successfully. Reason:", oError.message);
154
+ oPersonalizationChange.changeSpecificData = Object.assign(oPersonalizationChange.changeSpecificData, {developerMode: false, layer: sLayer});
155
+ return oFlexController.addChange(oPersonalizationChange.changeSpecificData, oPersonalizationChange.selectorControl);
156
+ })
157
+ .then(function(oAddedChange) {
158
+ aAddedChanges.push({
159
+ changeInstance: oAddedChange,
160
+ selectorControl: oPersonalizationChange.selectorControl
161
+ });
162
+ })
163
+ .catch(function(oError) {
164
+ Log.error("A Change was not added successfully. Reason:", oError.message);
165
+ });
166
+ }, Promise.resolve())
167
+ .then(function() {
168
+ return aAddedChanges;
169
+ });
170
+ }
171
+
172
+ function applyChanges(aAddedChanges) {
173
+ return aAddedChanges.reduce(function(pPromise, oAddedChange) {
174
+ return pPromise
175
+ .then(function() {
176
+ return oFlexController.applyChange(oAddedChange.changeInstance, oAddedChange.selectorControl);
177
+ })
178
+ .then(function(oAppliedChange) {
179
+ aSuccessfulChanges.push(oAppliedChange);
180
+ })
181
+ .catch(function(oError) {
182
+ Log.error("A Change was not applied successfully. Reason:", oError.message);
183
+ });
184
+ }, Promise.resolve());
185
+ }
186
+
187
+ // Make sure to first create and add all changes so that change handlers
188
+ // that rely on change batching in the applier can wait for them, e.g.
189
+ // when adding multiple columns at once to a MDC table
190
+ return createChanges()
191
+ .then(applyChanges)
192
+ .then(function() {
193
+ (mChangeCreationListeners[sFlexReference] || [])
194
+ .forEach(function(fnCallback) {
195
+ fnCallback(aSuccessfulChanges);
196
+ });
197
+ return aSuccessfulChanges;
149
198
  });
150
- }, Promise.resolve()).then(function() {
151
- return aSuccessfulChanges;
152
- });
153
199
  },
154
200
 
155
201
  /**
@@ -157,7 +203,7 @@ sap.ui.define([
157
203
  *
158
204
  * @param {object} mPropertyBag - Object with parameters as properties
159
205
  * @param {sap.ui.fl.Selector[]} mPropertyBag.selectors - Array of selectors, at least one selector is necessary
160
- * @param {String[]} [mPropertyBag.changeTypes] - Types of changes to be deleted
206
+ * @param {string[]} [mPropertyBag.changeTypes] - Types of changes to be deleted
161
207
  *
162
208
  * @returns {Promise} Promise that resolves after the deletion took place and changes are reverted
163
209
  *
@@ -218,7 +264,7 @@ sap.ui.define([
218
264
  *
219
265
  * @param {object} mPropertyBag - Object with parameters as properties
220
266
  * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector
221
- * @param {String[]} [mPropertyBag.changes] - Array of changes to be saved; if not provided, all unsaved changes will be saved
267
+ * @param {string[]} [mPropertyBag.changes] - Array of changes to be saved; if not provided, all unsaved changes will be saved
222
268
  *
223
269
  * @returns {Promise} Promise that is resolved when the changes have been saved
224
270
  *
@@ -278,6 +324,53 @@ sap.ui.define([
278
324
  .then(function (oSettings) {
279
325
  return oSettings.isCondensingEnabled(Layer.USER);
280
326
  });
327
+ },
328
+
329
+ /**
330
+ * Registers the provided callback function to be called when personalization changes are
331
+ * added for the flex reference that the given control belongs to.
332
+ *
333
+ * @param {sap.ui.core.Control} oControl - Reference control to get the flex reference
334
+ * @param {function} fnCallback - Function to be called on change creation
335
+ * @private
336
+ * @sapui5-restricted sap.ui.rta
337
+ */
338
+ attachChangeCreation: function(oControl, fnCallback) {
339
+ var sFlexReference = FlexRuntimeInfoAPI.getFlexReference({element: oControl});
340
+ mChangeCreationListeners[sFlexReference] = (mChangeCreationListeners[sFlexReference] || []).concat(fnCallback);
341
+ },
342
+
343
+ /**
344
+ * Removes a previously registered callback function by reference.
345
+ *
346
+ * @param {sap.ui.core.Control} oControl - Reference control to get the flex reference
347
+ * @param {function} fnCallback - Function reference to be removed
348
+ * @private
349
+ * @sapui5-restricted sap.ui.rta
350
+ */
351
+ detachChangeCreation: function(oControl, fnCallback) {
352
+ var sFlexReference = FlexRuntimeInfoAPI.getFlexReference({element: oControl});
353
+ if (Array.isArray(mChangeCreationListeners[sFlexReference])) {
354
+ mChangeCreationListeners[sFlexReference] = mChangeCreationListeners[sFlexReference].filter(function(fnRegisteredCallback) {
355
+ return fnRegisteredCallback !== fnCallback;
356
+ });
357
+ }
358
+ },
359
+
360
+ /**
361
+ * Removes all registered change creation listeners.
362
+ *
363
+ * @param {sap.ui.core.Control} [oControl] - When provided, listeners are only removed for the flex reference of the given control
364
+ * @private
365
+ * @sapui5-restricted sap.ui.rta
366
+ */
367
+ detachAllChangeCreationListeners: function(oControl) {
368
+ if (oControl) {
369
+ var sFlexReference = FlexRuntimeInfoAPI.getFlexReference({element: oControl});
370
+ delete mChangeCreationListeners[sFlexReference];
371
+ } else {
372
+ mChangeCreationListeners = {};
373
+ }
281
374
  }
282
375
  };
283
376
 
@@ -37,7 +37,10 @@ sap.ui.define([
37
37
  */
38
38
  isPublishAvailable: function () {
39
39
  return Settings.getInstance().then(function (oSettings) {
40
- return !oSettings.isProductiveSystem();
40
+ return (
41
+ !oSettings.isProductiveSystem()
42
+ && oSettings.isSystemWithTransports()
43
+ );
41
44
  });
42
45
  },
43
46
 
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  *
25
25
  * @namespace sap.ui.fl.write.api.FieldExtensibility
26
26
  * @since 1.87
27
- * @version 1.98.0
27
+ * @version 1.101.0
28
28
  * @private
29
29
  * @ui5-restricted sap.ui.fl, sap.ui.rta
30
30
  */
@@ -14,11 +14,14 @@ sap.ui.define([
14
14
  "sap/ui/fl/apply/_internal/appVariant/DescriptorChangeTypes",
15
15
  "sap/ui/fl/write/_internal/condenser/Condenser",
16
16
  "sap/ui/fl/write/_internal/flexState/FlexObjectState",
17
+ "sap/ui/fl/write/_internal/Storage",
17
18
  "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
19
+ "sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState",
18
20
  "sap/ui/fl/write/api/FeaturesAPI",
19
21
  "sap/ui/fl/Layer",
20
22
  "sap/ui/fl/LayerUtils",
21
- "sap/ui/fl/registry/Settings"
23
+ "sap/ui/fl/registry/Settings",
24
+ "sap/ui/fl/Utils"
22
25
  ], function(
23
26
  includes,
24
27
  _omit,
@@ -29,11 +32,14 @@ sap.ui.define([
29
32
  DescriptorChangeTypes,
30
33
  Condenser,
31
34
  FlexObjectState,
35
+ Storage,
32
36
  ManifestUtils,
37
+ VariantManagementState,
33
38
  FeaturesAPI,
34
39
  Layer,
35
40
  LayerUtils,
36
- Settings
41
+ Settings,
42
+ FlUtils
37
43
  ) {
38
44
  "use strict";
39
45
 
@@ -78,6 +84,37 @@ sap.ui.define([
78
84
  });
79
85
  }
80
86
 
87
+ /**
88
+ * Removes variant-dependent changes belonging to variants which are currently not selected
89
+ *
90
+ * @param {array} aChanges - List of changes to check
91
+ * @param {sap.ui.fl.Control} oControl - Control for which the changes are being checked
92
+ * @returns {sap.ui.fl.Change[]} List of variant-dependent changes belonging to the currently selected variants
93
+ */
94
+ function filterChangesByCurrentVariants(aChanges, oControl) {
95
+ // 1. Get current variant references
96
+ var oComponent = FlUtils.getAppComponentForControl(oControl);
97
+ var oModel = oComponent.getModel(FlUtils.VARIANT_MODEL_NAME);
98
+ var sFlexReference = oModel && oModel.sFlexReference;
99
+ var aVariantManagementReferences = VariantManagementState.getVariantManagementReferences(sFlexReference);
100
+
101
+ if (aVariantManagementReferences.length === 0) {
102
+ return aChanges;
103
+ }
104
+
105
+ var aCurrentVariantReferences = aVariantManagementReferences.map(function(sVMReference) {
106
+ return oModel.getCurrentVariantReference(sVMReference);
107
+ });
108
+
109
+ // 2. Remove variant-dependent changes not assigned to a current variant reference
110
+ return aChanges.filter(function(oChange) {
111
+ return aCurrentVariantReferences.some(function(sCurrentVariantReference) {
112
+ return oChange.getVariantReference() === sCurrentVariantReference
113
+ || !oChange.getVariantReference();
114
+ });
115
+ });
116
+ }
117
+
81
118
  /**
82
119
  * Determines if user-specific changes or variants are present in the flex persistence.
83
120
  *
@@ -154,7 +191,7 @@ sap.ui.define([
154
191
  // If there is change and the layer is transportable , the request to back end is always necessary
155
192
  // because of control variant reset logic through setVisible change and app descriptor changes
156
193
  if (bIsLayerTransportable) {
157
- return ChangesController.getFlexControllerInstance(mPropertyBag.selector).getResetAndPublishInfo(mPropertyBag)
194
+ return Storage.getFlexInfo(mPropertyBag)
158
195
  .then(function(oResponse) {
159
196
  oFlexInfo.allContextsProvided = oResponse.allContextsProvided === undefined || oResponse.allContextsProvided;
160
197
  oFlexInfo.isResetEnabled = oResponse.isResetEnabled;
@@ -365,6 +402,7 @@ sap.ui.define([
365
402
  * @param {boolean} [mPropertyBag.includeDirtyChanges] - Flag if dirty UI changes should be included
366
403
  * @param {string} [mPropertyBag.cacheKey] - Key to validate the cache entry stored on client side
367
404
  * @param {boolean} [mPropertyBag.invalidateCache] - Indicates whether the cache is to be invalidated
405
+ * @param {boolean} [mPropertyBag.onlyCurrentVariants] - Whether only changes for the currently active variants should be considered
368
406
  *
369
407
  * @returns {Promise} Promise resolves with an array of all change instances {@see sap.ui.fl.Change}
370
408
  * @private
@@ -375,7 +413,14 @@ sap.ui.define([
375
413
  mPropertyBag.currentLayer = mPropertyBag.layer;
376
414
  }
377
415
 
378
- return FlexObjectState.getFlexObjects(mPropertyBag);
416
+ //TODO: Check the mPropertyBag.selector parameter name - the methods called on FlexObjectState expect a control
417
+ return FlexObjectState.getFlexObjects(mPropertyBag)
418
+ .then(function(aChanges) {
419
+ if (mPropertyBag.onlyCurrentVariants) {
420
+ return filterChangesByCurrentVariants(aChanges, mPropertyBag.selector);
421
+ }
422
+ return aChanges;
423
+ });
379
424
  };
380
425
 
381
426
  return PersistenceWriteAPI;
@@ -32,7 +32,7 @@ sap.ui.define([
32
32
  * Downloads the XLIFF file for the given parameters.
33
33
  *
34
34
  * @param {object} mPropertyBag - Property bag
35
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - The root control of key user adaptation
35
+ * @param {sap.ui.fl.Selector} mPropertyBag.selector - Root control of key user adaptation
36
36
  to determine the app component and the reference
37
37
  * @param {string} mPropertyBag.sourceLanguage - Source language for for which the request should be made
38
38
  * @param {string} mPropertyBag.targetLanguage - Target language for for which the request should be made
@@ -67,7 +67,7 @@ sap.ui.define([
67
67
  *
68
68
  * @param {object} mPropertyBag - Property bag
69
69
  * @param {sap.ui.fl.Layer} mPropertyBag.layer - Layer
70
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - The root control of key user adaptation
70
+ * @param {sap.ui.fl.Selector} mPropertyBag.selector - Root control of key user adaptation
71
71
  to determine the app component and the reference
72
72
  * @returns {Promise} Resolves after the languages are retrieved;
73
73
  * rejects if an error occurs or parameters are missing
@@ -88,6 +88,27 @@ sap.ui.define([
88
88
  .then(Storage.translation.getSourceLanguages.bind(undefined, mPropertyBag));
89
89
  };
90
90
 
91
+ /**
92
+ * Uploads an XLIFF file.
93
+ *
94
+ * @param {object} mPropertyBag - Property bag
95
+ * @param {sap.ui.fl.Layer} mPropertyBag.layer - Layer
96
+ * @param {object} mPropertyBag.payload - The file to be uploaded
97
+ * @returns {Promise} Resolves after the file was uploaded;
98
+ * rejects if an error occurs or a parameter is missing
99
+ */
100
+ TranslationAPI.postTranslationTexts = function (mPropertyBag) {
101
+ if (!mPropertyBag.layer) {
102
+ return Promise.reject("No layer was provided");
103
+ }
104
+ if (!mPropertyBag.payload) {
105
+ return Promise.reject("No payload was provided");
106
+ }
107
+
108
+ return Promise.resolve()
109
+ .then(Storage.translation.postTranslationTexts.bind(undefined, mPropertyBag));
110
+ };
111
+
91
112
  /* TODO follow up commit
92
113
  TranslationAPI.upload = function (mPropertyBag) {
93
114
  };
@@ -245,6 +245,19 @@ sap.ui.define([
245
245
  */
246
246
  getTexts: function () {
247
247
  return Promise.reject("translation.getTexts is not implemented");
248
+ },
249
+
250
+ /**
251
+ * Interface called to upload an XLIFF file.
252
+ *
253
+ * @param {object} mPropertyBag - Property bag
254
+ * @param {sap.ui.fl.Layer} mPropertyBag.layer - Layer
255
+ * @param {object} mPropertyBag.payload - The file to be uploaded
256
+ * @returns {Promise} Resolves after the file was uploaded;
257
+ * rejects if an error occurs or a parameter is missing
258
+ */
259
+ postTranslationTexts: function () {
260
+ return Promise.reject("translation.postTranslationTexts is not implemented");
248
261
  }
249
262
  }
250
263
  };