@openui5/sap.ui.fl 1.100.0 → 1.102.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 (149) hide show
  1. package/THIRDPARTY.txt +5 -5
  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/ChangePersistence.js +36 -23
  6. package/src/sap/ui/fl/ChangePersistenceFactory.js +1 -1
  7. package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
  8. package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
  9. package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
  10. package/src/sap/ui/fl/FlexController.js +4 -6
  11. package/src/sap/ui/fl/FlexControllerFactory.js +4 -1
  12. package/src/sap/ui/fl/LayerUtils.js +1 -1
  13. package/src/sap/ui/fl/Scenario.js +27 -0
  14. package/src/sap/ui/fl/Utils.js +9 -7
  15. package/src/sap/ui/fl/Variant.js +1 -1
  16. package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
  17. package/src/sap/ui/fl/apply/_internal/changes/Applier.js +46 -1
  18. package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
  19. package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
  20. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
  21. package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
  22. package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
  23. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
  24. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
  25. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
  26. package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
  27. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
  28. package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
  29. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
  30. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
  31. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
  32. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
  33. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
  34. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
  35. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
  36. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
  37. package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
  38. package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
  39. package/src/sap/ui/fl/apply/_internal/controlVariants/Utils.js +9 -5
  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 +1 -1
  43. package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +1 -1
  44. package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +8 -11
  45. package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
  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 +1 -1
  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 -1
  52. package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +27 -1
  53. package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
  54. package/src/sap/ui/fl/apply/_internal/preprocessors/EventHistory.js +1 -1
  55. package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +1 -1
  56. package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
  57. package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
  58. package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
  59. package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
  60. package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
  61. package/src/sap/ui/fl/changeHandler/Base.js +1 -1
  62. package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +4 -2
  63. package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
  64. package/src/sap/ui/fl/changeHandler/BaseRename.js +6 -4
  65. package/src/sap/ui/fl/changeHandler/HideControl.js +4 -2
  66. package/src/sap/ui/fl/changeHandler/MoveControls.js +10 -3
  67. package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
  68. package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +6 -4
  69. package/src/sap/ui/fl/changeHandler/PropertyChange.js +4 -2
  70. package/src/sap/ui/fl/changeHandler/StashControl.js +17 -4
  71. package/src/sap/ui/fl/changeHandler/UnhideControl.js +6 -4
  72. package/src/sap/ui/fl/changeHandler/UnstashControl.js +7 -3
  73. package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
  74. package/src/sap/ui/fl/changeHandler/condenser/Classification.js +43 -0
  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 +8 -6
  80. package/src/sap/ui/fl/initial/_internal/StorageUtils.js +1 -1
  81. package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeRegistryItem.js +1 -1
  82. package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +7 -2
  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 +22 -66
  87. package/src/sap/ui/fl/library.support.js +1 -1
  88. package/src/sap/ui/fl/messagebundle_fr.properties +14 -14
  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 +1 -1
  92. package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
  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 +1 -1
  99. package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
  100. package/src/sap/ui/fl/support/diagnostics/Flexibility.controller.js +1 -1
  101. package/src/sap/ui/fl/themes/base/VariantManagement.less +23 -21
  102. package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
  103. package/src/sap/ui/fl/util/IFrame.js +1 -1
  104. package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
  105. package/src/sap/ui/fl/util/resolveBinding.js +1 -1
  106. package/src/sap/ui/fl/variants/VariantManagement.js +2 -1
  107. package/src/sap/ui/fl/variants/VariantModel.js +7 -1
  108. package/src/sap/ui/fl/write/_internal/Storage.js +7 -1
  109. package/src/sap/ui/fl/write/_internal/StorageFeaturesMerger.js +1 -1
  110. package/src/sap/ui/fl/write/_internal/Versions.js +85 -36
  111. package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
  112. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
  113. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
  114. package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +1 -1
  115. package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +13 -11
  116. package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +5 -3
  117. package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
  118. package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +2 -2
  119. package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +78 -12
  120. package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
  121. package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
  122. package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
  123. package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
  124. package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
  125. package/src/sap/ui/fl/write/_internal/extensionPoint/Registry.js +1 -1
  126. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
  127. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
  128. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
  129. package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
  130. package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
  131. package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
  132. package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
  133. package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
  134. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
  135. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
  136. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
  137. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
  138. package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
  139. package/src/sap/ui/fl/write/_internal/flexState/FlexObjectState.js +27 -6
  140. package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +98 -41
  141. package/src/sap/ui/fl/write/_internal/transport/TransportDialog.js +13 -2
  142. package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +7 -4
  143. package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
  144. package/src/sap/ui/fl/write/api/FeaturesAPI.js +2 -2
  145. package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
  146. package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +18 -11
  147. package/src/sap/ui/fl/write/api/TranslationAPI.js +54 -17
  148. package/src/sap/ui/fl/write/api/Version.js +22 -0
  149. package/src/sap/ui/fl/write/api/VersionsAPI.js +90 -74
@@ -8,24 +8,19 @@ sap.ui.define([
8
8
  "sap/ui/fl/apply/_internal/flexState/FlexState",
9
9
  "sap/ui/fl/write/_internal/Versions",
10
10
  "sap/ui/fl/Utils",
11
+ "sap/ui/fl/write/api/Version",
11
12
  "sap/ui/fl/apply/_internal/flexState/ManifestUtils"
12
13
  ], function(
13
14
  FlexState,
14
15
  Versions,
15
16
  Utils,
17
+ Version,
16
18
  ManifestUtils
17
19
  ) {
18
20
  "use strict";
19
21
 
20
- function getReference(oAppComponent) {
21
- var sReference;
22
- if (oAppComponent) {
23
- var oManifest = oAppComponent.getManifest();
24
- sReference = ManifestUtils.getFlexReference({
25
- manifest: oManifest,
26
- componentData: oAppComponent.getComponentData()
27
- });
28
- }
22
+ function getFlexReferenceForControl(control) {
23
+ var sReference = ManifestUtils.getFlexReferenceForControl(control);
29
24
 
30
25
  if (!sReference) {
31
26
  throw Error("The application ID could not be determined");
@@ -35,16 +30,18 @@ sap.ui.define([
35
30
  }
36
31
 
37
32
  function getVersionsModel(mPropertyBag) {
38
- if (!mPropertyBag.selector) {
39
- throw Error("No selector was provided");
33
+ if (!mPropertyBag.control) {
34
+ throw Error("No control was provided");
40
35
  }
41
36
  if (!mPropertyBag.layer) {
42
37
  throw Error("No layer was provided");
43
38
  }
44
39
 
45
- var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.selector);
40
+ var sReference = getFlexReferenceForControl(mPropertyBag.control);
41
+
46
42
  return Versions.getVersionsModel({
47
- reference: Utils.normalizeReference(getReference(oAppComponent)),
43
+ nonNormalizedReference: sReference,
44
+ reference: Utils.normalizeReference(sReference),
48
45
  layer: mPropertyBag.layer
49
46
  });
50
47
  }
@@ -61,27 +58,27 @@ sap.ui.define([
61
58
  var VersionsAPI = /** @lends sap.ui.fl.write.api.VersionsAPI */ {};
62
59
 
63
60
  /**
64
- * Initializes the versions for a given selector and layer.
61
+ * Initializes the versions for a given control and layer.
65
62
  *
66
63
  * @param {object} mPropertyBag - Property bag
67
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector for which the request is done
64
+ * @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
68
65
  * @param {string} mPropertyBag.layer - Layer for which the versions should be retrieved
69
66
  *
70
67
  * @returns {Promise<sap.ui.model.json.JSONModel>} Model with list of versions if available and further version properties;
71
68
  * Rejects if not all parameters were passed or the application could not be determined
72
69
  */
73
70
  VersionsAPI.initialize = function (mPropertyBag) {
74
- if (!mPropertyBag.selector) {
75
- return Promise.reject("No selector was provided");
71
+ if (!mPropertyBag.control) {
72
+ return Promise.reject("No control was provided");
76
73
  }
77
74
  if (!mPropertyBag.layer) {
78
75
  return Promise.reject("No layer was provided");
79
76
  }
80
77
 
81
- var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.selector);
78
+ var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.control);
82
79
 
83
80
  return Versions.initialize({
84
- reference: Utils.normalizeReference(getReference(oAppComponent)),
81
+ reference: Utils.normalizeReference(getFlexReferenceForControl(oAppComponent)),
85
82
  layer: mPropertyBag.layer
86
83
  });
87
84
  };
@@ -90,7 +87,7 @@ sap.ui.define([
90
87
  * Returns a flag if a draft exists for the current application and layer.
91
88
  *
92
89
  * @param {object} mPropertyBag - Property bag
93
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector for which the request is done
90
+ * @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
94
91
  * @param {string} mPropertyBag.layer - Layer for which the versions should be retrieved
95
92
  *
96
93
  * @return {boolean} Flag if a draft is available;
@@ -101,7 +98,7 @@ sap.ui.define([
101
98
 
102
99
  var aVersions = oModel.getProperty("/versions");
103
100
  var oDraft = aVersions.find(function (oVersion) {
104
- return oVersion.version === sap.ui.fl.Versions.Draft;
101
+ return oVersion.version === Version.Number.Draft;
105
102
  });
106
103
 
107
104
  return !!oDraft;
@@ -111,7 +108,7 @@ sap.ui.define([
111
108
  * Returns a flag if the displayed version is not the active version for the current application and layer.
112
109
  *
113
110
  * @param {object} mPropertyBag - Property bag
114
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector for which the request is done
111
+ * @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
115
112
  * @param {string} mPropertyBag.layer - Layer for which the versions should be retrieved
116
113
  *
117
114
  * @return {boolean} Flag if the displayed version is not the active version
@@ -123,7 +120,7 @@ sap.ui.define([
123
120
  var displayedVersion = oModel.getProperty("/displayedVersion");
124
121
  var activeVersion = oModel.getProperty("/activeVersion");
125
122
 
126
- return displayedVersion !== sap.ui.fl.Versions.Draft && displayedVersion !== activeVersion;
123
+ return displayedVersion !== Version.Number.Draft && displayedVersion !== activeVersion;
127
124
  };
128
125
 
129
126
  /**
@@ -131,13 +128,13 @@ sap.ui.define([
131
128
  * an actual reload of the application has to be triggered by the caller.
132
129
  *
133
130
  * @param {object} mPropertyBag - Property bag
134
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector for which the request is done
131
+ * @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
135
132
  * @param {string} mPropertyBag.layer - Layer for which the versions should be retrieved
136
133
  *
137
134
  * @returns {Promise} Resolves as soon as the clearance and the requesting is triggered.
138
135
  */
139
136
  VersionsAPI.loadDraftForApplication = function (mPropertyBag) {
140
- mPropertyBag.version = sap.ui.fl.Versions.Draft;
137
+ mPropertyBag.version = Version.Number.Draft;
141
138
  return VersionsAPI.loadVersionForApplication(mPropertyBag);
142
139
  };
143
140
 
@@ -146,7 +143,7 @@ sap.ui.define([
146
143
  * an actual reload of the application has to be triggered by the caller.
147
144
  *
148
145
  * @param {object} mPropertyBag - Property bag
149
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector for which the request is done
146
+ * @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
150
147
  * @param {string} mPropertyBag.layer - Layer for which the versions should be retrieved
151
148
  * @param {string} [mPropertyBag.version] - Version to be loaded
152
149
  * @param {boolean} [mPropertyBag.allContexts] - Includes also restricted contexts
@@ -154,8 +151,8 @@ sap.ui.define([
154
151
  * @returns {Promise} Resolves as soon as the clearance and the requesting is triggered.
155
152
  */
156
153
  VersionsAPI.loadVersionForApplication = function (mPropertyBag) {
157
- if (!mPropertyBag.selector) {
158
- return Promise.reject("No selector was provided");
154
+ if (!mPropertyBag.control) {
155
+ return Promise.reject("No control was provided");
159
156
  }
160
157
  if (!mPropertyBag.layer) {
161
158
  return Promise.reject("No layer was provided");
@@ -167,16 +164,13 @@ sap.ui.define([
167
164
  }
168
165
  }
169
166
 
170
- var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.selector);
171
- return Promise.resolve()
172
- .then(getReference.bind(undefined, oAppComponent))
173
- .then(function (sReference) {
174
- return FlexState.clearAndInitialize({
175
- componentId: oAppComponent.getId(),
176
- reference: sReference,
177
- version: mPropertyBag.version,
178
- allContexts: mPropertyBag.allContexts
179
- });
167
+ var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.control);
168
+ var sReference = getFlexReferenceForControl(oAppComponent);
169
+ return FlexState.clearAndInitialize({
170
+ componentId: oAppComponent.getId(),
171
+ reference: sReference,
172
+ version: mPropertyBag.version,
173
+ allContexts: mPropertyBag.allContexts
180
174
  });
181
175
  };
182
176
 
@@ -184,7 +178,7 @@ sap.ui.define([
184
178
  * (Re-)activates a version.
185
179
  *
186
180
  * @param {object} mPropertyBag - Property bag
187
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector for which the request is done
181
+ * @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
188
182
  * @param {string} mPropertyBag.layer - Layer for which the versions should be retrieved
189
183
  * @param {string} mPropertyBag.title - Title of the to be activated version
190
184
  *
@@ -192,12 +186,12 @@ sap.ui.define([
192
186
  *
193
187
  * @returns {Promise<sap.ui.fl.Version>} Promise resolving with the updated list of versions for the application
194
188
  * when the version was activated;
195
- * rejects if an error occurs, the layer does not support draft handling, there is no draft to activate or
189
+ * rejects if an error occurs, the layer does not support draft handling, there is unsaved content, there is no draft to activate or
196
190
  * when the displayed version is already active
197
191
  */
198
192
  VersionsAPI.activate = function (mPropertyBag) {
199
- if (!mPropertyBag.selector) {
200
- return Promise.reject("No selector was provided");
193
+ if (!mPropertyBag.control) {
194
+ return Promise.reject("No control was provided");
201
195
  }
202
196
  if (!mPropertyBag.layer) {
203
197
  return Promise.reject("No layer was provided");
@@ -206,18 +200,14 @@ sap.ui.define([
206
200
  return Promise.reject("No version title was provided");
207
201
  }
208
202
 
209
- var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.selector);
203
+ var sReference = getFlexReferenceForControl(mPropertyBag.control);
210
204
 
211
- return Promise.resolve()
212
- .then(getReference.bind(undefined, oAppComponent))
213
- .then(function (sReference) {
214
- return Versions.activate({
215
- nonNormalizedReference: sReference,
216
- reference: Utils.normalizeReference(sReference),
217
- layer: mPropertyBag.layer,
218
- title: mPropertyBag.title,
219
- appComponent: oAppComponent
220
- });
205
+ return Versions.activate({
206
+ nonNormalizedReference: sReference,
207
+ reference: Utils.normalizeReference(sReference),
208
+ layer: mPropertyBag.layer,
209
+ title: mPropertyBag.title,
210
+ appComponent: Utils.getAppComponentForControl(mPropertyBag.control)
221
211
  });
222
212
  };
223
213
 
@@ -227,40 +217,66 @@ sap.ui.define([
227
217
  * and the consumer must take care of making a reload of the application itself.
228
218
  *
229
219
  * @param {object} mPropertyBag - Property bag
230
- * @param {sap.ui.fl.Selector} mPropertyBag.selector - Selector for which the request is done
220
+ * @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
231
221
  * @param {string} mPropertyBag.layer - Layer for which the versions should be retrieved
232
222
  * @returns {Promise<boolean>} Promise resolving with a flag if a discarding took place;
233
223
  * rejects if an error occurs or the layer does not support draft handling
234
224
  */
235
225
  VersionsAPI.discardDraft = function (mPropertyBag) {
236
- if (!mPropertyBag.selector) {
237
- return Promise.reject("No selector was provided");
226
+ if (!mPropertyBag.control) {
227
+ return Promise.reject("No control was provided");
238
228
  }
239
229
  if (!mPropertyBag.layer) {
240
230
  return Promise.reject("No layer was provided");
241
231
  }
242
232
 
243
- var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.selector);
233
+ var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.control);
234
+ var sReference = getFlexReferenceForControl(oAppComponent);
244
235
 
245
- return Promise.resolve()
246
- .then(getReference.bind(undefined, oAppComponent))
247
- .then(function (sReference) {
248
- return Versions.discardDraft({
249
- nonNormalizedReference: sReference,
250
- reference: Utils.normalizeReference(sReference),
251
- layer: mPropertyBag.layer
252
- }).then(function(oDiscardInfo) {
253
- if (oDiscardInfo.backendChangesDiscarded) {
254
- //invalidate flexState to trigger getFlexData for the current active version after discard
255
- FlexState.clearAndInitialize({
256
- componentId: oAppComponent.getId(),
257
- reference: sReference
258
- });
259
- }
260
- return oDiscardInfo;
261
- });
236
+ return Versions.discardDraft({
237
+ nonNormalizedReference: sReference,
238
+ reference: Utils.normalizeReference(sReference),
239
+ layer: mPropertyBag.layer
240
+ }).then(function(oDiscardInfo) {
241
+ if (oDiscardInfo.backendChangesDiscarded) {
242
+ //invalidate flexState to trigger getFlexData for the current active version after discard
243
+ FlexState.clearAndInitialize({
244
+ componentId: oAppComponent.getId(),
245
+ reference: sReference
246
+ });
247
+ }
248
+ return oDiscardInfo;
262
249
  });
263
250
  };
264
251
 
252
+ /**
253
+ * Publish a version.
254
+ *
255
+ * @param {object} mPropertyBag - Property bag
256
+ * @param {sap.ui.fl.Selector} mPropertyBag.selector - To retrieve the associated flex persistence
257
+ * @param {string} [mPropertyBag.styleClass] - Style class name that will be added to the transport dialog
258
+ * @param {string} mPropertyBag.layer - Working layer
259
+ * @param {string} mPropertyBag.version - ID of version which need to be published
260
+ * @returns {Promise<string>} Promise that can resolve to the following strings:
261
+ * - "Cancel" if publish process was canceled
262
+ * - <sMessage> when all the version is successfully transported fl will return the message to show
263
+ * - "Error" in case of a problem
264
+ */
265
+ VersionsAPI.publish = function (mPropertyBag) {
266
+ if (!mPropertyBag.selector) {
267
+ return Promise.reject("No selector was provided");
268
+ }
269
+ if (!mPropertyBag.layer) {
270
+ return Promise.reject("No layer was provided");
271
+ }
272
+ if (!mPropertyBag.version) {
273
+ return Promise.reject("No version was provided");
274
+ }
275
+ mPropertyBag.styleClass = mPropertyBag.styleClass || "";
276
+ mPropertyBag.reference = getFlexReferenceForControl(mPropertyBag.selector);
277
+
278
+ return Versions.publish(mPropertyBag);
279
+ };
280
+
265
281
  return VersionsAPI;
266
282
  });