@openui5/sap.ui.rta 1.108.2 → 1.110.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 (253) hide show
  1. package/.reuse/dep5 +16 -16
  2. package/THIRDPARTY.txt +2 -2
  3. package/package.json +6 -6
  4. package/src/sap/ui/rta/.library +2 -2
  5. package/src/sap/ui/rta/Client.js +2 -2
  6. package/src/sap/ui/rta/RuntimeAuthoring.js +240 -191
  7. package/src/sap/ui/rta/Utils.js +40 -19
  8. package/src/sap/ui/rta/api/startAdaptation.js +1 -1
  9. package/src/sap/ui/rta/api/startKeyUserAdaptation.js +1 -1
  10. package/src/sap/ui/rta/appVariant/AppVariantDialog.js +1 -1
  11. package/src/sap/ui/rta/appVariant/AppVariantManager.js +2 -2
  12. package/src/sap/ui/rta/appVariant/AppVariantOverviewDialog.js +1 -1
  13. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +1 -1
  14. package/src/sap/ui/rta/appVariant/Feature.js +2 -8
  15. package/src/sap/ui/rta/appVariant/S4HanaCloudBackend.js +1 -1
  16. package/src/sap/ui/rta/appVariant/Utils.js +1 -1
  17. package/src/sap/ui/rta/appVariant/manageApps/webapp/Component.js +1 -1
  18. package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +1 -1
  19. package/src/sap/ui/rta/appVariant/manageApps/webapp/index.js +1 -1
  20. package/src/sap/ui/rta/appVariant/manageApps/webapp/model/models.js +1 -1
  21. package/src/sap/ui/rta/command/AddIFrame.js +2 -2
  22. package/src/sap/ui/rta/command/AddProperty.js +2 -2
  23. package/src/sap/ui/rta/command/AddXML.js +3 -3
  24. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +3 -3
  25. package/src/sap/ui/rta/command/AppDescriptorCommand.js +3 -3
  26. package/src/sap/ui/rta/command/BaseCommand.js +2 -2
  27. package/src/sap/ui/rta/command/BindProperty.js +2 -2
  28. package/src/sap/ui/rta/command/Combine.js +2 -2
  29. package/src/sap/ui/rta/command/CommandFactory.js +2 -2
  30. package/src/sap/ui/rta/command/CompositeCommand.js +2 -2
  31. package/src/sap/ui/rta/command/ControlVariantConfigure.js +5 -3
  32. package/src/sap/ui/rta/command/ControlVariantSave.js +2 -2
  33. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +15 -15
  34. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +11 -4
  35. package/src/sap/ui/rta/command/ControlVariantSwitch.js +42 -10
  36. package/src/sap/ui/rta/command/CreateContainer.js +2 -2
  37. package/src/sap/ui/rta/command/CustomAdd.js +2 -2
  38. package/src/sap/ui/rta/command/FlexCommand.js +18 -16
  39. package/src/sap/ui/rta/command/LREPSerializer.js +27 -17
  40. package/src/sap/ui/rta/command/LocalReset.js +2 -2
  41. package/src/sap/ui/rta/command/Move.js +2 -2
  42. package/src/sap/ui/rta/command/Property.js +2 -2
  43. package/src/sap/ui/rta/command/Remove.js +2 -2
  44. package/src/sap/ui/rta/command/Rename.js +2 -2
  45. package/src/sap/ui/rta/command/Resize.js +2 -2
  46. package/src/sap/ui/rta/command/Reveal.js +2 -2
  47. package/src/sap/ui/rta/command/Settings.js +2 -2
  48. package/src/sap/ui/rta/command/Split.js +2 -2
  49. package/src/sap/ui/rta/command/Stack.js +11 -3
  50. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +2 -2
  51. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +2 -3
  52. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +2 -2
  53. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +28 -6
  54. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +2 -2
  55. package/src/sap/ui/rta/enablement/TestDelegate.js +1 -1
  56. package/src/sap/ui/rta/enablement/elementActionTest.js +28 -19
  57. package/src/sap/ui/rta/library.js +3 -3
  58. package/src/sap/ui/rta/messagebundle.properties +65 -17
  59. package/src/sap/ui/rta/messagebundle_ar.properties +32 -8
  60. package/src/sap/ui/rta/messagebundle_bg.properties +32 -8
  61. package/src/sap/ui/rta/messagebundle_ca.properties +32 -8
  62. package/src/sap/ui/rta/messagebundle_cs.properties +32 -8
  63. package/src/sap/ui/rta/messagebundle_cy.properties +31 -7
  64. package/src/sap/ui/rta/messagebundle_da.properties +31 -7
  65. package/src/sap/ui/rta/messagebundle_de.properties +31 -7
  66. package/src/sap/ui/rta/messagebundle_el.properties +31 -7
  67. package/src/sap/ui/rta/messagebundle_en.properties +31 -7
  68. package/src/sap/ui/rta/messagebundle_en_GB.properties +32 -8
  69. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +31 -7
  70. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +31 -7
  71. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +31 -7
  72. package/src/sap/ui/rta/messagebundle_es.properties +31 -7
  73. package/src/sap/ui/rta/messagebundle_es_MX.properties +31 -7
  74. package/src/sap/ui/rta/messagebundle_et.properties +31 -7
  75. package/src/sap/ui/rta/messagebundle_fi.properties +31 -7
  76. package/src/sap/ui/rta/messagebundle_fr.properties +31 -7
  77. package/src/sap/ui/rta/messagebundle_fr_CA.properties +32 -8
  78. package/src/sap/ui/rta/messagebundle_hi.properties +32 -8
  79. package/src/sap/ui/rta/messagebundle_hr.properties +32 -8
  80. package/src/sap/ui/rta/messagebundle_hu.properties +31 -7
  81. package/src/sap/ui/rta/messagebundle_id.properties +32 -8
  82. package/src/sap/ui/rta/messagebundle_it.properties +32 -8
  83. package/src/sap/ui/rta/messagebundle_iw.properties +31 -7
  84. package/src/sap/ui/rta/messagebundle_ja.properties +32 -8
  85. package/src/sap/ui/rta/messagebundle_kk.properties +31 -7
  86. package/src/sap/ui/rta/messagebundle_ko.properties +31 -7
  87. package/src/sap/ui/rta/messagebundle_lt.properties +31 -7
  88. package/src/sap/ui/rta/messagebundle_lv.properties +32 -8
  89. package/src/sap/ui/rta/messagebundle_ms.properties +32 -8
  90. package/src/sap/ui/rta/messagebundle_nl.properties +31 -7
  91. package/src/sap/ui/rta/messagebundle_no.properties +32 -8
  92. package/src/sap/ui/rta/messagebundle_pl.properties +32 -8
  93. package/src/sap/ui/rta/messagebundle_pt.properties +32 -8
  94. package/src/sap/ui/rta/messagebundle_pt_PT.properties +31 -7
  95. package/src/sap/ui/rta/messagebundle_ro.properties +32 -8
  96. package/src/sap/ui/rta/messagebundle_ru.properties +32 -8
  97. package/src/sap/ui/rta/messagebundle_sh.properties +31 -7
  98. package/src/sap/ui/rta/messagebundle_sk.properties +31 -7
  99. package/src/sap/ui/rta/messagebundle_sl.properties +31 -7
  100. package/src/sap/ui/rta/messagebundle_sv.properties +32 -8
  101. package/src/sap/ui/rta/messagebundle_th.properties +33 -9
  102. package/src/sap/ui/rta/messagebundle_tr.properties +31 -7
  103. package/src/sap/ui/rta/messagebundle_uk.properties +31 -7
  104. package/src/sap/ui/rta/messagebundle_vi.properties +32 -8
  105. package/src/sap/ui/rta/messagebundle_zh_CN.properties +32 -8
  106. package/src/sap/ui/rta/messagebundle_zh_TW.properties +32 -8
  107. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +2 -2
  108. package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
  109. package/src/sap/ui/rta/plugin/Combine.js +2 -2
  110. package/src/sap/ui/rta/plugin/CompVariant.js +107 -29
  111. package/src/sap/ui/rta/plugin/ControlVariant.js +118 -50
  112. package/src/sap/ui/rta/plugin/CreateContainer.js +2 -2
  113. package/src/sap/ui/rta/plugin/CutPaste.js +2 -2
  114. package/src/sap/ui/rta/plugin/DragDrop.js +4 -4
  115. package/src/sap/ui/rta/plugin/EasyAdd.js +30 -21
  116. package/src/sap/ui/rta/plugin/EasyRemove.js +13 -11
  117. package/src/sap/ui/rta/plugin/LocalReset.js +6 -4
  118. package/src/sap/ui/rta/plugin/Plugin.js +50 -13
  119. package/src/sap/ui/rta/plugin/RTAElementMover.js +2 -2
  120. package/src/sap/ui/rta/plugin/Remove.js +2 -2
  121. package/src/sap/ui/rta/plugin/Rename.js +2 -2
  122. package/src/sap/ui/rta/plugin/RenameHandler.js +29 -19
  123. package/src/sap/ui/rta/plugin/Resize.js +2 -2
  124. package/src/sap/ui/rta/plugin/Selection.js +7 -14
  125. package/src/sap/ui/rta/plugin/Settings.js +2 -2
  126. package/src/sap/ui/rta/plugin/Split.js +2 -2
  127. package/src/sap/ui/rta/plugin/Stretch.js +17 -16
  128. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +28 -7
  129. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.fragment.xml +1 -0
  130. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +2 -2
  131. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +1 -1
  132. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +5 -5
  133. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +2 -2
  134. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +2 -2
  135. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +2 -2
  136. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.fragment.xml +7 -2
  137. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +2 -2
  138. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialogController.js +4 -4
  139. package/src/sap/ui/rta/plugin/iframe/urlCleaner.js +1 -1
  140. package/src/sap/ui/rta/service/Action.js +2 -2
  141. package/src/sap/ui/rta/service/ControllerExtension.js +3 -3
  142. package/src/sap/ui/rta/service/Outline.js +2 -2
  143. package/src/sap/ui/rta/service/Property.js +2 -2
  144. package/src/sap/ui/rta/service/Receiver.js +1 -1
  145. package/src/sap/ui/rta/service/Selection.js +2 -2
  146. package/src/sap/ui/rta/service/SupportTools.js +2 -2
  147. package/src/sap/ui/rta/service/index.js +1 -1
  148. package/src/sap/ui/rta/themes/base/Toolbar.adaptation.less +26 -9
  149. package/src/sap/ui/rta/themes/base/library.source.less +1 -1
  150. package/src/sap/ui/rta/themes/sap_hcb/library.source.less +1 -1
  151. package/src/sap/ui/rta/toolbar/ActionsMenu.fragment.xml +82 -0
  152. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +35 -90
  153. package/src/sap/ui/rta/toolbar/Adaptation.js +83 -27
  154. package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +1 -1
  155. package/src/sap/ui/rta/toolbar/Base.js +4 -4
  156. package/src/sap/ui/rta/toolbar/BaseRenderer.js +1 -1
  157. package/src/sap/ui/rta/toolbar/Fiori.js +11 -10
  158. package/src/sap/ui/rta/toolbar/FioriLike.js +2 -2
  159. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +2 -2
  160. package/src/sap/ui/rta/toolbar/Personalization.js +2 -2
  161. package/src/sap/ui/rta/toolbar/Standalone.js +2 -2
  162. package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptations.js +263 -0
  163. package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptationsDialog.fragment.xml +149 -0
  164. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +185 -0
  165. package/src/sap/ui/rta/toolbar/contextBased/{SaveAsContextBasedAdaptationDialog.fragment.xml → SaveAsAdaptationDialog.fragment.xml} +19 -15
  166. package/src/sap/ui/rta/toolbar/translation/Translation.js +2 -2
  167. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +4 -4
  168. package/src/sap/ui/rta/util/Animation.js +5 -9
  169. package/src/sap/ui/rta/util/BindingsExtractor.js +1 -1
  170. package/src/sap/ui/rta/util/PluginManager.js +2 -2
  171. package/src/sap/ui/rta/util/PopupManager.js +2 -2
  172. package/src/sap/ui/rta/util/ReloadManager.js +2 -2
  173. package/src/sap/ui/rta/util/ServiceEventBus.js +2 -2
  174. package/src/sap/ui/rta/util/StylesLoader.js +1 -1
  175. package/src/sap/ui/rta/util/UrlParser.js +1 -1
  176. package/src/sap/ui/rta/util/adaptationStarter.js +1 -1
  177. package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +1 -1
  178. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +4 -3
  179. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorCategorySelection.fragment.xml +11 -10
  180. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorPopover.fragment.xml +1 -0
  181. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +28 -4
  182. package/src/sap/ui/rta/util/changeVisualization/ChangeStates.js +2 -2
  183. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +110 -72
  184. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +1 -1
  185. package/src/sap/ui/rta/util/changeVisualization/commands/CombineVisualization.js +1 -1
  186. package/src/sap/ui/rta/util/changeVisualization/commands/CreateContainerVisualization.js +1 -1
  187. package/src/sap/ui/rta/util/changeVisualization/commands/MoveVisualization.js +1 -1
  188. package/src/sap/ui/rta/util/changeVisualization/commands/RenameVisualization.js +1 -1
  189. package/src/sap/ui/rta/util/changeVisualization/commands/SplitVisualization.js +1 -1
  190. package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +1 -1
  191. package/src/sap/ui/rta/util/hasStableId.js +1 -1
  192. package/src/sap/ui/rta/util/showMessageBox.js +1 -1
  193. package/src/sap/ui/rta/util/validateFlexEnabled.js +1 -1
  194. package/src/sap/ui/rta/util/validateStableIds.js +1 -1
  195. package/src/sap/ui/rta/appContexts/AppContextsOverviewDialog.js +0 -76
  196. package/src/sap/ui/rta/appContexts/Component.js +0 -31
  197. package/src/sap/ui/rta/appContexts/controller/ManageContexts.controller.js +0 -323
  198. package/src/sap/ui/rta/appContexts/controller/RestAPIConnector.js +0 -22
  199. package/src/sap/ui/rta/appContexts/i18n/i18n.properties +0 -47
  200. package/src/sap/ui/rta/appContexts/i18n/i18n_ar.properties +0 -23
  201. package/src/sap/ui/rta/appContexts/i18n/i18n_bg.properties +0 -23
  202. package/src/sap/ui/rta/appContexts/i18n/i18n_ca.properties +0 -23
  203. package/src/sap/ui/rta/appContexts/i18n/i18n_cs.properties +0 -23
  204. package/src/sap/ui/rta/appContexts/i18n/i18n_cy.properties +0 -23
  205. package/src/sap/ui/rta/appContexts/i18n/i18n_da.properties +0 -23
  206. package/src/sap/ui/rta/appContexts/i18n/i18n_de.properties +0 -23
  207. package/src/sap/ui/rta/appContexts/i18n/i18n_el.properties +0 -23
  208. package/src/sap/ui/rta/appContexts/i18n/i18n_en.properties +0 -23
  209. package/src/sap/ui/rta/appContexts/i18n/i18n_en_GB.properties +0 -23
  210. package/src/sap/ui/rta/appContexts/i18n/i18n_en_US_sappsd.properties +0 -23
  211. package/src/sap/ui/rta/appContexts/i18n/i18n_en_US_saprigi.properties +0 -23
  212. package/src/sap/ui/rta/appContexts/i18n/i18n_en_US_saptrc.properties +0 -23
  213. package/src/sap/ui/rta/appContexts/i18n/i18n_es.properties +0 -23
  214. package/src/sap/ui/rta/appContexts/i18n/i18n_es_MX.properties +0 -23
  215. package/src/sap/ui/rta/appContexts/i18n/i18n_et.properties +0 -23
  216. package/src/sap/ui/rta/appContexts/i18n/i18n_fi.properties +0 -23
  217. package/src/sap/ui/rta/appContexts/i18n/i18n_fr.properties +0 -23
  218. package/src/sap/ui/rta/appContexts/i18n/i18n_fr_CA.properties +0 -23
  219. package/src/sap/ui/rta/appContexts/i18n/i18n_hi.properties +0 -23
  220. package/src/sap/ui/rta/appContexts/i18n/i18n_hr.properties +0 -23
  221. package/src/sap/ui/rta/appContexts/i18n/i18n_hu.properties +0 -23
  222. package/src/sap/ui/rta/appContexts/i18n/i18n_id.properties +0 -23
  223. package/src/sap/ui/rta/appContexts/i18n/i18n_it.properties +0 -23
  224. package/src/sap/ui/rta/appContexts/i18n/i18n_iw.properties +0 -23
  225. package/src/sap/ui/rta/appContexts/i18n/i18n_ja.properties +0 -23
  226. package/src/sap/ui/rta/appContexts/i18n/i18n_kk.properties +0 -23
  227. package/src/sap/ui/rta/appContexts/i18n/i18n_ko.properties +0 -23
  228. package/src/sap/ui/rta/appContexts/i18n/i18n_lt.properties +0 -23
  229. package/src/sap/ui/rta/appContexts/i18n/i18n_lv.properties +0 -23
  230. package/src/sap/ui/rta/appContexts/i18n/i18n_ms.properties +0 -23
  231. package/src/sap/ui/rta/appContexts/i18n/i18n_nl.properties +0 -23
  232. package/src/sap/ui/rta/appContexts/i18n/i18n_no.properties +0 -23
  233. package/src/sap/ui/rta/appContexts/i18n/i18n_pl.properties +0 -23
  234. package/src/sap/ui/rta/appContexts/i18n/i18n_pt.properties +0 -23
  235. package/src/sap/ui/rta/appContexts/i18n/i18n_pt_PT.properties +0 -23
  236. package/src/sap/ui/rta/appContexts/i18n/i18n_ro.properties +0 -23
  237. package/src/sap/ui/rta/appContexts/i18n/i18n_ru.properties +0 -23
  238. package/src/sap/ui/rta/appContexts/i18n/i18n_sh.properties +0 -23
  239. package/src/sap/ui/rta/appContexts/i18n/i18n_sk.properties +0 -23
  240. package/src/sap/ui/rta/appContexts/i18n/i18n_sl.properties +0 -23
  241. package/src/sap/ui/rta/appContexts/i18n/i18n_sv.properties +0 -23
  242. package/src/sap/ui/rta/appContexts/i18n/i18n_th.properties +0 -23
  243. package/src/sap/ui/rta/appContexts/i18n/i18n_tr.properties +0 -23
  244. package/src/sap/ui/rta/appContexts/i18n/i18n_uk.properties +0 -23
  245. package/src/sap/ui/rta/appContexts/i18n/i18n_vi.properties +0 -23
  246. package/src/sap/ui/rta/appContexts/i18n/i18n_zh_CN.properties +0 -23
  247. package/src/sap/ui/rta/appContexts/i18n/i18n_zh_TW.properties +0 -23
  248. package/src/sap/ui/rta/appContexts/index.html +0 -25
  249. package/src/sap/ui/rta/appContexts/manifest.json +0 -52
  250. package/src/sap/ui/rta/appContexts/view/EditContextsDialog.fragment.xml +0 -76
  251. package/src/sap/ui/rta/appContexts/view/ManageContexts.view.xml +0 -103
  252. package/src/sap/ui/rta/appContexts/view/SaveAsContextsDialog.fragment.xml +0 -76
  253. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation.js +0 -124
@@ -1,16 +1,18 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/rta/command/BaseCommand",
8
7
  "sap/ui/core/util/reflection/JsControlTreeModifier",
9
- "sap/ui/fl/Utils"
8
+ "sap/ui/fl/apply/api/ControlVariantApplyAPI",
9
+ "sap/ui/fl/Utils",
10
+ "sap/ui/rta/command/BaseCommand"
10
11
  ], function(
11
- BaseCommand,
12
12
  JsControlTreeModifier,
13
- flUtils
13
+ ControlVariantApplyAPI,
14
+ flUtils,
15
+ BaseCommand
14
16
  ) {
15
17
  "use strict";
16
18
 
@@ -20,7 +22,7 @@ sap.ui.define([
20
22
  * @class
21
23
  * @extends sap.ui.rta.command.BaseCommand
22
24
  * @author SAP SE
23
- * @version 1.108.2
25
+ * @version 1.110.0
24
26
  * @constructor
25
27
  * @private
26
28
  * @since 1.50
@@ -35,6 +37,9 @@ sap.ui.define([
35
37
  },
36
38
  sourceVariantReference: {
37
39
  type: "string"
40
+ },
41
+ discardVariantContent: {
42
+ type: "boolean"
38
43
  }
39
44
  },
40
45
  associations: {},
@@ -42,7 +47,15 @@ sap.ui.define([
42
47
  }
43
48
  });
44
49
 
45
- ControlVariantSwitch.prototype._getAppComponent = function () {
50
+ function discardVariantContent(sVReference) {
51
+ return this.oModel.eraseDirtyChangesOnVariant(this.sVariantManagementReference, sVReference)
52
+ .then(function(aDirtyChanges) {
53
+ this._aSourceVariantDirtyChanges = aDirtyChanges;
54
+ this.oModel.checkUpdate(true);
55
+ }.bind(this));
56
+ }
57
+
58
+ ControlVariantSwitch.prototype._getAppComponent = function() {
46
59
  var oElement = this.getElement();
47
60
  return oElement ? flUtils.getAppComponentForControl(oElement) : this.getSelector().appComponent;
48
61
  };
@@ -50,6 +63,7 @@ sap.ui.define([
50
63
 
51
64
  /**
52
65
  * Template Method to implement execute logic, with ensure precondition Element is available.
66
+ *
53
67
  * @public
54
68
  * @returns {Promise} Returns resolve after execution
55
69
  */
@@ -58,9 +72,17 @@ sap.ui.define([
58
72
  var oAppComponent = this._getAppComponent();
59
73
  var sNewVariantReference = this.getTargetVariantReference();
60
74
 
61
- this.oModel = oAppComponent.getModel(flUtils.VARIANT_MODEL_NAME);
75
+ this.oModel = oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
62
76
  this.sVariantManagementReference = JsControlTreeModifier.getSelector(oElement, oAppComponent).id;
63
- return this._updateModelVariant(sNewVariantReference, oAppComponent);
77
+
78
+ return Promise.resolve()
79
+ .then(function() {
80
+ if (this.getDiscardVariantContent()) {
81
+ return discardVariantContent.call(this, this.getSourceVariantReference());
82
+ }
83
+ return undefined;
84
+ }.bind(this))
85
+ .then(this._updateModelVariant.bind(this, sNewVariantReference, oAppComponent));
64
86
  };
65
87
 
66
88
  /**
@@ -71,10 +93,20 @@ sap.ui.define([
71
93
  ControlVariantSwitch.prototype.undo = function() {
72
94
  var sOldVariantReference = this.getSourceVariantReference();
73
95
  var oAppComponent = this._getAppComponent();
96
+
97
+ if (this.getDiscardVariantContent()) {
98
+ return this.oModel.addAndApplyChangesOnVariant(this._aSourceVariantDirtyChanges)
99
+ .then(function() {
100
+ this._aSourceVariantDirtyChanges = null;
101
+ this.oModel.checkUpdate(true);
102
+ return this._updateModelVariant(sOldVariantReference, oAppComponent);
103
+ }.bind(this));
104
+ }
105
+
74
106
  return this._updateModelVariant(sOldVariantReference, oAppComponent);
75
107
  };
76
108
 
77
- ControlVariantSwitch.prototype._updateModelVariant = function (sVariantReference, oAppComponent) {
109
+ ControlVariantSwitch.prototype._updateModelVariant = function(sVariantReference, oAppComponent) {
78
110
  if (this.getTargetVariantReference() !== this.getSourceVariantReference()) {
79
111
  return this.oModel.updateCurrentVariant({
80
112
  variantManagementReference: this.sVariantManagementReference,
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
@@ -12,7 +12,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
12
12
  * @class
13
13
  * @extends sap.ui.rta.command.FlexCommand
14
14
  * @author SAP SE
15
- * @version 1.108.2
15
+ * @version 1.110.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.34
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
@@ -12,7 +12,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
12
12
  * @class
13
13
  * @extends sap.ui.rta.command.FlexCommand
14
14
  * @author SAP SE
15
- * @version 1.108.2
15
+ * @version 1.110.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.62
@@ -1,26 +1,28 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/rta/command/BaseCommand",
8
- "sap/ui/rta/library",
9
- "sap/ui/core/util/reflection/JsControlTreeModifier",
10
- "sap/ui/fl/Utils",
11
- "sap/base/Log",
12
7
  "sap/base/util/merge",
8
+ "sap/base/util/values",
9
+ "sap/base/Log",
10
+ "sap/ui/core/util/reflection/JsControlTreeModifier",
11
+ "sap/ui/fl/apply/api/ControlVariantApplyAPI",
13
12
  "sap/ui/fl/write/api/ChangesWriteAPI",
14
- "sap/base/util/values"
13
+ "sap/ui/fl/Utils",
14
+ "sap/ui/rta/command/BaseCommand",
15
+ "sap/ui/rta/library"
15
16
  ], function(
16
- BaseCommand,
17
- rtaLibrary,
18
- JsControlTreeModifier,
19
- FlUtils,
20
- Log,
21
17
  merge,
18
+ objectValues,
19
+ Log,
20
+ JsControlTreeModifier,
21
+ ControlVariantApplyAPI,
22
22
  ChangesWriteAPI,
23
- objectValues
23
+ FlUtils,
24
+ BaseCommand,
25
+ rtaLibrary
24
26
  ) {
25
27
  "use strict";
26
28
 
@@ -31,7 +33,7 @@ sap.ui.define([
31
33
  * @extends sap.ui.rta.command.BaseCommand
32
34
  *
33
35
  * @author SAP SE
34
- * @version 1.108.2
36
+ * @version 1.110.0
35
37
  *
36
38
  * @constructor
37
39
  * @private
@@ -195,7 +197,7 @@ sap.ui.define([
195
197
  mChangeSpecificData = merge({}, mChangeSpecificData, mFlexSettings);
196
198
  }
197
199
  mChangeSpecificData.jsOnly = this.getJsOnly();
198
- var oModel = this.getAppComponent().getModel(FlUtils.VARIANT_MODEL_NAME);
200
+ var oModel = this.getAppComponent().getModel(ControlVariantApplyAPI.getVariantModelName());
199
201
  var sVariantReference;
200
202
  if (oModel && sVariantManagementReference) {
201
203
  sVariantReference = oModel.getCurrentVariantReference(sVariantManagementReference);
@@ -237,7 +239,7 @@ sap.ui.define([
237
239
 
238
240
  /**
239
241
  * @private
240
- * @param {sap.ui.fl.Change|Object} vChange Change object or map containing the change object
242
+ * @param {sap.ui.fl.apply._internal.flexObjects.UIChange|Object} vChange Change object or map containing the change object
241
243
  * @returns {Promise} Returns an empty promise
242
244
  */
243
245
  FlexCommand.prototype._applyChange = function(vChange) {
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -8,7 +8,6 @@ sap.ui.define([
8
8
  "sap/ui/rta/command/FlexCommand",
9
9
  "sap/ui/rta/command/AppDescriptorCommand",
10
10
  "sap/ui/fl/Utils",
11
- "sap/ui/fl/Change",
12
11
  "sap/ui/dt/ElementUtil",
13
12
  "sap/base/Log",
14
13
  "sap/ui/fl/write/api/PersistenceWriteAPI"
@@ -17,7 +16,6 @@ sap.ui.define([
17
16
  FlexCommand,
18
17
  AppDescriptorCommand,
19
18
  FlUtils,
20
- Change,
21
19
  ElementUtil,
22
20
  Log,
23
21
  PersistenceWriteAPI
@@ -29,7 +27,7 @@ sap.ui.define([
29
27
  * @class
30
28
  * @extends sap.ui.base.ManagedObject
31
29
  * @author SAP SE
32
- * @version 1.108.2
30
+ * @version 1.110.0
33
31
  * @constructor
34
32
  * @private
35
33
  * @since 1.42
@@ -114,9 +112,6 @@ sap.ui.define([
114
112
  var oAppComponent = oCommand.getAppComponent();
115
113
  if (oAppComponent) {
116
114
  var oPreparedChange = oCommand.getPreparedChange();
117
- if (oPreparedChange.getState() === Change.states.DELETED) {
118
- oPreparedChange.setState(Change.states.NEW);
119
- }
120
115
  if (!this._isPersistedChange(oPreparedChange)) {
121
116
  PersistenceWriteAPI.add({change: oCommand.getPreparedChange(), selector: oAppComponent});
122
117
  }
@@ -182,23 +177,33 @@ sap.ui.define([
182
177
  }.bind(this))
183
178
  .then(function() {
184
179
  Log.info("UI adaptation successfully transfered changes to layered repository");
180
+ this.getCommandStack().setSaved(true);
185
181
  this.getCommandStack().removeAllCommands();
186
182
  }.bind(this));
187
183
 
188
184
  return this._lastPromise;
189
185
  };
190
186
 
191
- LREPSerializer.prototype._triggerUndoChanges = function() {
187
+ LREPSerializer.prototype._triggerUndoChanges = function(bRemoveChanges) {
192
188
  var oCommandStack = this.getCommandStack();
193
189
  var aPromises = [];
194
190
 
195
191
  var aCommands = oCommandStack.getAllExecutedCommands();
196
- aCommands.forEach(function(oCommand) {
197
- aPromises.push(oCommand.undo.bind(oCommand));
198
- });
199
192
 
200
- // The last command has to be undone first, therefore reversing is required
201
- aPromises = aPromises.reverse();
193
+ if (bRemoveChanges) {
194
+ // Calling "undo" from the stack, the serializer is also informed of the
195
+ // command execution and clears the dirty changes from the persistence
196
+ aCommands.forEach(function() {
197
+ // Undo on the stack already starts from the last command
198
+ aPromises.push(oCommandStack.undo.bind(oCommandStack));
199
+ });
200
+ } else {
201
+ aCommands.forEach(function(oCommand) {
202
+ aPromises.push(oCommand.undo.bind(oCommand));
203
+ });
204
+ // The last command has to be undone first, therefore reversing is required
205
+ aPromises = aPromises.reverse();
206
+ }
202
207
 
203
208
  return FlUtils.execPromiseQueueSequentially(aPromises, false, true);
204
209
  };
@@ -208,18 +213,23 @@ sap.ui.define([
208
213
  * At this point command stack is not aware if the changes have been already booked for the new app variant.
209
214
  * Therefore if there shall be some UI changes present in command stack, we undo all the changes till the beginning.
210
215
  * In the last when user presses 'Save and Exit', there will be no change registered for the current app.
216
+ * @param {boolean} bRemoveChanges if LREPSerializer should clear the dirty changes in the persistence
211
217
  * @returns {Promise} returns a promise with true or false
212
218
  */
213
- LREPSerializer.prototype.clearCommandStack = function() {
219
+ LREPSerializer.prototype.clearCommandStack = function(bRemoveChanges) {
214
220
  var oCommandStack = this.getCommandStack();
215
221
 
216
222
  // Detach the event 'commandExecuted' here to stop the communication of LREPSerializer with Flex
217
- oCommandStack.detachCommandExecuted(this.handleCommandExecuted.bind(this));
218
- return this._triggerUndoChanges()
223
+ if (!bRemoveChanges) {
224
+ oCommandStack.detachCommandExecuted(this.handleCommandExecuted.bind(this));
225
+ }
226
+ return this._triggerUndoChanges(bRemoveChanges)
219
227
  .then(function() {
220
228
  oCommandStack.removeAllCommands();
221
229
  // Attach the event 'commandExecuted' here to start the communication of LREPSerializer with Flex
222
- oCommandStack.attachCommandExecuted(this.handleCommandExecuted.bind(this));
230
+ if (!bRemoveChanges) {
231
+ oCommandStack.attachCommandExecuted(this.handleCommandExecuted.bind(this));
232
+ }
223
233
  return true;
224
234
  }.bind(this));
225
235
  };
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  * @class
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  * @author SAP SE
23
- * @version 1.108.2
23
+ * @version 1.110.0
24
24
  * @constructor
25
25
  * @private
26
26
  * @since 1.90
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -17,7 +17,7 @@ function(
17
17
  * @class
18
18
  * @extends sap.ui.rta.command.FlexCommand
19
19
  * @author SAP SE
20
- * @version 1.108.2
20
+ * @version 1.110.0
21
21
  * @constructor
22
22
  * @private
23
23
  * @since 1.34
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.108.2
19
+ * @version 1.110.0
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.34
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
@@ -12,7 +12,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
12
12
  * @class
13
13
  * @extends sap.ui.rta.command.FlexCommand
14
14
  * @author SAP SE
15
- * @version 1.108.2
15
+ * @version 1.110.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.42
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
@@ -12,7 +12,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
12
12
  * @class
13
13
  * @extends sap.ui.rta.command.FlexCommand
14
14
  * @author SAP SE
15
- * @version 1.108.2
15
+ * @version 1.110.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.34
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.108.2
19
+ * @version 1.110.0
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.101
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
@@ -12,7 +12,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
12
12
  * @class
13
13
  * @extends sap.ui.rta.command.FlexCommand
14
14
  * @author SAP SE
15
- * @version 1.108.2
15
+ * @version 1.110.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.44
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
@@ -12,7 +12,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
12
12
  * @class
13
13
  * @extends sap.ui.rta.command.FlexCommand
14
14
  * @author SAP SE
15
- * @version 1.108.2
15
+ * @version 1.110.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.44
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -14,7 +14,7 @@ sap.ui.define([
14
14
  * @class
15
15
  * @extends sap.ui.rta.command.FlexCommand
16
16
  * @author SAP SE
17
- * @version 1.108.2
17
+ * @version 1.110.0
18
18
  * @constructor
19
19
  * @private
20
20
  * @since 1.46
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -59,7 +59,7 @@ sap.ui.define([
59
59
  * @class
60
60
  * @extends sap.ui.base.ManagedObject
61
61
  * @author SAP SE
62
- * @version 1.108.2
62
+ * @version 1.110.0
63
63
  * @constructor
64
64
  * @private
65
65
  * @since 1.34
@@ -70,7 +70,15 @@ sap.ui.define([
70
70
  var Stack = ManagedObject.extend("sap.ui.rta.command.Stack", {
71
71
  metadata: {
72
72
  library: "sap.ui.rta",
73
- properties: {},
73
+ properties: {
74
+ /**
75
+ * If the stack was saved at least once
76
+ */
77
+ saved: {
78
+ type: "boolean",
79
+ defaultValue: false
80
+ }
81
+ },
74
82
  aggregations: {
75
83
  commands: {
76
84
  type: "sap.ui.rta.command.BaseCommand",
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  * @extends sap.ui.rta.command.AppDescriptorCommand
18
18
  *
19
19
  * @author SAP SE
20
- * @version 1.108.2
20
+ * @version 1.110.0
21
21
  *
22
22
  * @constructor
23
23
  * @private
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  * @class
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  * @author SAP SE
23
- * @version 1.108.2
23
+ * @version 1.110.0
24
24
  * @constructor
25
25
  * @private
26
26
  * @since 1.102
@@ -81,7 +81,6 @@ sap.ui.define([
81
81
  };
82
82
 
83
83
  CompVariantContent.prototype.execute = function() {
84
- this.setIsModifiedBefore(this.getElement().getModified());
85
84
  this.getElement().setModified(true);
86
85
  var oNewVariantContent = setVariantContent.call(this, this.getNewContent());
87
86
  callFlAPIFunction.call(this, "updateVariantContent", this.getVariantId(), {content: oNewVariantContent});
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  * @class
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  * @author SAP SE
23
- * @version 1.108.2
23
+ * @version 1.110.0
24
24
  * @constructor
25
25
  * @private
26
26
  * @since 1.87
@@ -1,12 +1,14 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/rta/command/BaseCommand"
7
+ "sap/ui/rta/command/BaseCommand",
8
+ "sap/ui/fl/write/api/SmartVariantManagementWriteAPI"
8
9
  ], function(
9
- BaseCommand
10
+ BaseCommand,
11
+ SmartVariantManagementWriteAPI
10
12
  ) {
11
13
  "use strict";
12
14
 
@@ -16,7 +18,7 @@ sap.ui.define([
16
18
  * @class
17
19
  * @extends sap.ui.rta.command.BaseCommand
18
20
  * @author SAP SE
19
- * @version 1.108.2
21
+ * @version 1.110.0
20
22
  * @constructor
21
23
  * @private
22
24
  * @since 1.87
@@ -31,18 +33,29 @@ sap.ui.define([
31
33
  },
32
34
  targetVariantId: {
33
35
  type: "string"
36
+ },
37
+ discardVariantContent: {
38
+ type: "boolean"
34
39
  }
35
40
  }
36
41
  }
37
42
  });
38
43
 
39
44
  /**
40
- * Triggers the configuration of a variant.
45
+ * Triggers the switch of a variant. If the switch was done from
46
+ * a variant with changes, the user can decide to discard them on switch.
41
47
  * @public
42
- * @returns {Promise} Returns resolve after execution
48
+ * @returns {Promise} Resolves after execution
43
49
  */
44
50
  CompVariantSwitch.prototype.execute = function() {
45
51
  this.getElement().activateVariant(this.getTargetVariantId());
52
+ if (this.getDiscardVariantContent()) {
53
+ this.getElement().setModified(false);
54
+ SmartVariantManagementWriteAPI.discardVariantContent({
55
+ control: this.getElement(),
56
+ id: this.getSourceVariantId()
57
+ });
58
+ }
46
59
  return Promise.resolve();
47
60
  };
48
61
 
@@ -52,7 +65,16 @@ sap.ui.define([
52
65
  * @returns {Promise} Resolves after undo
53
66
  */
54
67
  CompVariantSwitch.prototype.undo = function() {
68
+ if (this.getDiscardVariantContent()) {
69
+ SmartVariantManagementWriteAPI.revert({
70
+ control: this.getElement(),
71
+ id: this.getSourceVariantId()
72
+ });
73
+ }
55
74
  this.getElement().activateVariant(this.getSourceVariantId());
75
+ if (this.getDiscardVariantContent()) {
76
+ this.getElement().setModified(true);
77
+ }
56
78
  return Promise.resolve();
57
79
  };
58
80
 
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  * @class
23
23
  * @extends sap.ui.rta.command.BaseCommand
24
24
  * @author SAP SE
25
- * @version 1.108.2
25
+ * @version 1.110.0
26
26
  * @constructor
27
27
  * @private
28
28
  * @since 1.87
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([