@openui5/sap.ui.rta 1.139.0 → 1.141.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 (154) hide show
  1. package/THIRDPARTY.txt +2 -2
  2. package/package.json +6 -6
  3. package/src/sap/ui/rta/.library +1 -1
  4. package/src/sap/ui/rta/Client.js +1 -1
  5. package/src/sap/ui/rta/RuntimeAuthoring.js +1 -1
  6. package/src/sap/ui/rta/Utils.js +1 -1
  7. package/src/sap/ui/rta/appVariant/AppVariantManager.js +7 -30
  8. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +6 -41
  9. package/src/sap/ui/rta/appVariant/Feature.js +5 -4
  10. package/src/sap/ui/rta/command/AddIFrame.js +6 -8
  11. package/src/sap/ui/rta/command/AddProperty.js +2 -2
  12. package/src/sap/ui/rta/command/AddXML.js +3 -3
  13. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +17 -19
  14. package/src/sap/ui/rta/command/AnnotationCommand.js +1 -1
  15. package/src/sap/ui/rta/command/BaseCommand.js +3 -4
  16. package/src/sap/ui/rta/command/BindProperty.js +4 -4
  17. package/src/sap/ui/rta/command/Combine.js +4 -4
  18. package/src/sap/ui/rta/command/CommandFactory.js +55 -77
  19. package/src/sap/ui/rta/command/CompositeCommand.js +19 -39
  20. package/src/sap/ui/rta/command/ControlVariantConfigure.js +16 -20
  21. package/src/sap/ui/rta/command/ControlVariantSave.js +19 -28
  22. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +38 -43
  23. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +15 -26
  24. package/src/sap/ui/rta/command/ControlVariantSwitch.js +29 -50
  25. package/src/sap/ui/rta/command/CreateContainer.js +3 -3
  26. package/src/sap/ui/rta/command/CustomAdd.js +2 -2
  27. package/src/sap/ui/rta/command/ExtendControllerCommand.js +2 -4
  28. package/src/sap/ui/rta/command/FlexCommand.js +34 -44
  29. package/src/sap/ui/rta/command/LREPSerializer.js +20 -23
  30. package/src/sap/ui/rta/command/LocalReset.js +3 -3
  31. package/src/sap/ui/rta/command/ManifestCommand.js +1 -1
  32. package/src/sap/ui/rta/command/Move.js +5 -5
  33. package/src/sap/ui/rta/command/Property.js +3 -3
  34. package/src/sap/ui/rta/command/Remove.js +4 -4
  35. package/src/sap/ui/rta/command/Rename.js +3 -3
  36. package/src/sap/ui/rta/command/Resize.js +2 -2
  37. package/src/sap/ui/rta/command/Reveal.js +3 -3
  38. package/src/sap/ui/rta/command/Settings.js +2 -2
  39. package/src/sap/ui/rta/command/Split.js +3 -3
  40. package/src/sap/ui/rta/command/Stack.js +51 -55
  41. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +10 -10
  42. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +4 -4
  43. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +2 -2
  44. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +11 -11
  45. package/src/sap/ui/rta/command/manifest/AddLibrary.js +4 -8
  46. package/src/sap/ui/rta/enablement/elementActionTest.js +21 -9
  47. package/src/sap/ui/rta/library.js +2 -2
  48. package/src/sap/ui/rta/messagebundle_ar.properties +32 -17
  49. package/src/sap/ui/rta/messagebundle_bg.properties +32 -17
  50. package/src/sap/ui/rta/messagebundle_ca.properties +32 -17
  51. package/src/sap/ui/rta/messagebundle_cnr.properties +31 -16
  52. package/src/sap/ui/rta/messagebundle_cs.properties +31 -16
  53. package/src/sap/ui/rta/messagebundle_cy.properties +30 -15
  54. package/src/sap/ui/rta/messagebundle_da.properties +32 -17
  55. package/src/sap/ui/rta/messagebundle_de.properties +33 -18
  56. package/src/sap/ui/rta/messagebundle_el.properties +32 -17
  57. package/src/sap/ui/rta/messagebundle_en.properties +32 -17
  58. package/src/sap/ui/rta/messagebundle_en_GB.properties +32 -17
  59. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +11 -1
  60. package/src/sap/ui/rta/messagebundle_es.properties +32 -17
  61. package/src/sap/ui/rta/messagebundle_es_MX.properties +39 -24
  62. package/src/sap/ui/rta/messagebundle_et.properties +31 -16
  63. package/src/sap/ui/rta/messagebundle_fi.properties +30 -15
  64. package/src/sap/ui/rta/messagebundle_fr.properties +32 -17
  65. package/src/sap/ui/rta/messagebundle_fr_CA.properties +30 -15
  66. package/src/sap/ui/rta/messagebundle_hi.properties +32 -17
  67. package/src/sap/ui/rta/messagebundle_hr.properties +31 -16
  68. package/src/sap/ui/rta/messagebundle_hu.properties +31 -16
  69. package/src/sap/ui/rta/messagebundle_id.properties +32 -17
  70. package/src/sap/ui/rta/messagebundle_it.properties +31 -16
  71. package/src/sap/ui/rta/messagebundle_iw.properties +30 -15
  72. package/src/sap/ui/rta/messagebundle_ja.properties +32 -17
  73. package/src/sap/ui/rta/messagebundle_kk.properties +32 -17
  74. package/src/sap/ui/rta/messagebundle_ko.properties +30 -15
  75. package/src/sap/ui/rta/messagebundle_lt.properties +31 -16
  76. package/src/sap/ui/rta/messagebundle_lv.properties +31 -16
  77. package/src/sap/ui/rta/messagebundle_mk.properties +31 -16
  78. package/src/sap/ui/rta/messagebundle_ms.properties +32 -17
  79. package/src/sap/ui/rta/messagebundle_nl.properties +32 -17
  80. package/src/sap/ui/rta/messagebundle_no.properties +31 -16
  81. package/src/sap/ui/rta/messagebundle_pl.properties +31 -16
  82. package/src/sap/ui/rta/messagebundle_pt.properties +32 -17
  83. package/src/sap/ui/rta/messagebundle_pt_PT.properties +32 -17
  84. package/src/sap/ui/rta/messagebundle_ro.properties +31 -16
  85. package/src/sap/ui/rta/messagebundle_ru.properties +31 -16
  86. package/src/sap/ui/rta/messagebundle_sh.properties +31 -16
  87. package/src/sap/ui/rta/messagebundle_sk.properties +31 -16
  88. package/src/sap/ui/rta/messagebundle_sl.properties +31 -16
  89. package/src/sap/ui/rta/messagebundle_sr.properties +31 -16
  90. package/src/sap/ui/rta/messagebundle_sv.properties +31 -16
  91. package/src/sap/ui/rta/messagebundle_th.properties +30 -15
  92. package/src/sap/ui/rta/messagebundle_tr.properties +31 -16
  93. package/src/sap/ui/rta/messagebundle_uk.properties +31 -16
  94. package/src/sap/ui/rta/messagebundle_vi.properties +33 -18
  95. package/src/sap/ui/rta/messagebundle_zh_CN.properties +31 -16
  96. package/src/sap/ui/rta/messagebundle_zh_TW.properties +32 -17
  97. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +10 -10
  98. package/src/sap/ui/rta/plugin/AddXMLPlugin.js +1 -1
  99. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  100. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  101. package/src/sap/ui/rta/plugin/ControlVariant.js +65 -87
  102. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  103. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  104. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  105. package/src/sap/ui/rta/plugin/ExtendControllerPlugin.js +1 -1
  106. package/src/sap/ui/rta/plugin/LocalReset.js +26 -35
  107. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  108. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  109. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  110. package/src/sap/ui/rta/plugin/Resize.js +1 -1
  111. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  112. package/src/sap/ui/rta/plugin/Settings.js +1 -1
  113. package/src/sap/ui/rta/plugin/Split.js +1 -1
  114. package/src/sap/ui/rta/plugin/Stretch.js +7 -6
  115. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  116. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  117. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +17 -5
  118. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
  119. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  120. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
  121. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +1 -1
  122. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +1 -1
  123. package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +1 -1
  124. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
  125. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  126. package/src/sap/ui/rta/plugin/rename/Rename.js +1 -1
  127. package/src/sap/ui/rta/plugin/rename/RenameDialog.js +2 -7
  128. package/src/sap/ui/rta/service/Action.js +1 -1
  129. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  130. package/src/sap/ui/rta/service/Outline.js +1 -1
  131. package/src/sap/ui/rta/service/Property.js +1 -1
  132. package/src/sap/ui/rta/service/Selection.js +1 -1
  133. package/src/sap/ui/rta/service/SupportTools.js +1 -1
  134. package/src/sap/ui/rta/toolbar/Adaptation.js +1 -1
  135. package/src/sap/ui/rta/toolbar/Base.js +7 -7
  136. package/src/sap/ui/rta/toolbar/Fiori.js +8 -8
  137. package/src/sap/ui/rta/toolbar/FioriLike.js +2 -2
  138. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  139. package/src/sap/ui/rta/toolbar/Standalone.js +3 -3
  140. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +1 -1
  141. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  142. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  143. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  144. package/src/sap/ui/rta/util/PopupManager.js +3 -3
  145. package/src/sap/ui/rta/util/ReloadManager.js +1 -1
  146. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  147. package/src/sap/ui/rta/util/ServiceManager.js +1 -1
  148. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +6 -6
  149. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +1 -1
  150. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +1 -1
  151. package/src/sap/ui/rta/util/changeVisualization/resolveBinding.js +79 -0
  152. package/src/sap/ui/rta/util/guidedTour/GuidedTour.js +1 -1
  153. package/src/sap/ui/rta/util/guidedTour/content/GeneralTour.js +1 -1
  154. package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +1 -1
@@ -4,7 +4,7 @@
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/core/util/reflection/JsControlTreeModifier",
7
+ "sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
8
8
  "sap/ui/fl/variants/VariantManager",
9
9
  "sap/ui/fl/write/api/ContextSharingAPI",
10
10
  "sap/ui/fl/write/api/PersistenceWriteAPI",
@@ -13,11 +13,11 @@ sap.ui.define([
13
13
  "sap/ui/rta/library",
14
14
  "sap/ui/rta/Utils"
15
15
  ], function(
16
- JsControlTreeModifier,
16
+ FlexRuntimeInfoAPI,
17
17
  VariantManager,
18
18
  ContextSharingAPI,
19
19
  PersistenceWriteAPI,
20
- flUtils,
20
+ FlUtils,
21
21
  BaseCommand,
22
22
  rtaLibrary,
23
23
  rtaUtils
@@ -30,13 +30,13 @@ sap.ui.define([
30
30
  * @class
31
31
  * @extends sap.ui.rta.command.BaseCommand
32
32
  * @author SAP SE
33
- * @version 1.139.0
33
+ * @version 1.141.0
34
34
  * @constructor
35
35
  * @private
36
36
  * @since 1.86
37
37
  * @alias sap.ui.rta.command.ControlVariantSaveAs
38
38
  */
39
- var ControlVariantSaveAs = BaseCommand.extend("sap.ui.rta.command.ControlVariantSaveAs", {
39
+ const ControlVariantSaveAs = BaseCommand.extend("sap.ui.rta.command.ControlVariantSaveAs", {
40
40
  metadata: {
41
41
  library: "sap.ui.rta",
42
42
  properties: {
@@ -46,9 +46,6 @@ sap.ui.define([
46
46
  sourceDefaultVariant: {
47
47
  type: "string"
48
48
  },
49
- model: {
50
- type: "object"
51
- },
52
49
  newVariantParameters: {
53
50
  type: "object"
54
51
  }
@@ -61,18 +58,17 @@ sap.ui.define([
61
58
  /**
62
59
  * @override
63
60
  */
64
- ControlVariantSaveAs.prototype.prepare = function(mFlexSettings) {
61
+ ControlVariantSaveAs.prototype.prepare = async function(mFlexSettings) {
65
62
  this.oVariantManagementControl = this.getElement();
66
- this.oAppComponent = flUtils.getAppComponentForControl(this.oVariantManagementControl);
67
- this.sVariantManagementReference = JsControlTreeModifier.getSelector(this.oVariantManagementControl, this.oAppComponent).id;
68
- this.oModel = this.getModel();
69
- this.setSourceDefaultVariant(this.oModel.getData()[this.sVariantManagementReference].defaultVariant);
63
+ this.oAppComponent = FlUtils.getAppComponentForControl(this.oVariantManagementControl);
64
+ this.sVariantManagementReference = this.oVariantManagementControl.getVariantManagementReference();
65
+ this.setSourceDefaultVariant(this.oVariantManagementControl.getDefaultVariantKey());
70
66
  this.sLayer = mFlexSettings.layer;
71
- var mComponentPropertyBag = mFlexSettings;
67
+ const mComponentPropertyBag = mFlexSettings;
72
68
  mComponentPropertyBag.variantManagementControl = this.oVariantManagementControl;
73
69
 
74
70
  function storeEventParameters(oEvent, oArgs) {
75
- var mParameters = oEvent.getParameters();
71
+ const mParameters = oEvent.getParameters();
76
72
  this.setNewVariantParameters(mParameters);
77
73
  this.oVariantManagementControl.detachSave(storeEventParameters, this);
78
74
  this.oVariantManagementControl.detachCancel(handleCancel, this);
@@ -84,15 +80,15 @@ sap.ui.define([
84
80
  oArgs.resolve(false);
85
81
  }
86
82
 
87
- return new Promise(function(resolve) {
83
+ const bState = await new Promise((resolve) => {
88
84
  this.oVariantManagementControl.attachSave({resolve}, storeEventParameters, this);
89
85
  this.oVariantManagementControl.attachCancel({resolve}, handleCancel, this);
90
- this.oVariantManagementControl.openSaveAsDialogForKeyUser(rtaUtils.getRtaStyleClassName(),
91
- ContextSharingAPI.createComponent(mComponentPropertyBag));
92
- }.bind(this))
93
- .then(function(bState) {
94
- return bState;
86
+ this.oVariantManagementControl.openSaveAsDialogForKeyUser(
87
+ rtaUtils.getRtaStyleClassName(),
88
+ ContextSharingAPI.createComponent(mComponentPropertyBag)
89
+ );
95
90
  });
91
+ return bState;
96
92
  };
97
93
 
98
94
  ControlVariantSaveAs.prototype.getPreparedChange = function() {
@@ -107,28 +103,27 @@ sap.ui.define([
107
103
  * @public
108
104
  * @returns {Promise} Promise that resolves after execution
109
105
  */
110
- ControlVariantSaveAs.prototype.execute = function() {
111
- var sSourceVariantReference = this.getSourceVariantReference();
112
- // once a change is saved to a variant it will automatically be restored by the VariantModel
113
- this._aControlChangesWithoutVariant = this.oModel.getVariant(sSourceVariantReference, this.sVariantManagementReference)
114
- .controlChanges
115
- .filter((oFlexObject) => !oFlexObject.getSavedToVariant());
116
- var mParams = this.getNewVariantParameters();
106
+ ControlVariantSaveAs.prototype.execute = async function() {
107
+ const sFlexReference = FlexRuntimeInfoAPI.getFlexReference({ element: this.oVariantManagementControl });
108
+ this._aControlChangesWithoutVariant = VariantManager.getControlChangesForVariant(
109
+ sFlexReference,
110
+ this.sVariantManagementReference,
111
+ this.getSourceVariantReference()
112
+ ).filter((oFlexObject) => !oFlexObject.getSavedToVariant());
113
+ const mParams = this.getNewVariantParameters();
117
114
  mParams.layer = this.sLayer;
118
115
  mParams.newVariantReference = this.sNewVariantReference;
119
116
  mParams.generator = rtaLibrary.GENERATOR_NAME;
120
- return VariantManager.handleSaveEvent(this.oVariantManagementControl, mParams, this.oModel)
121
- .then(function(aDirtyChanges) {
122
- this._aPreparedChanges = aDirtyChanges;
123
- [this._oVariantChange] = aDirtyChanges;
124
- this.sNewVariantReference = this._oVariantChange.getId();
125
- this._aPreparedChanges.forEach(function(oChange) {
126
- if (oChange.getFileType() === "change") {
127
- oChange.setSavedToVariant(true);
128
- }
129
- });
130
- this.getModel().invalidateMap();
131
- }.bind(this));
117
+ const aDirtyChanges = await VariantManager.handleSaveEvent(this.oVariantManagementControl, mParams);
118
+ this._aPreparedChanges = aDirtyChanges;
119
+ [this._oVariantChange] = aDirtyChanges;
120
+ this.sNewVariantReference = this._oVariantChange.getId();
121
+ this._aPreparedChanges.forEach(function(oChange) {
122
+ if (oChange.getFileType() === "change") {
123
+ oChange.setSavedToVariant(true);
124
+ }
125
+ });
126
+ VariantManager.updateVariantManagementMap(sFlexReference);
132
127
  };
133
128
 
134
129
  /**
@@ -138,8 +133,8 @@ sap.ui.define([
138
133
  */
139
134
  ControlVariantSaveAs.prototype.undo = async function() {
140
135
  if (this._oVariantChange) {
141
- var aChangesToBeDeleted = [];
142
- this._aPreparedChanges.forEach(function(oChange) {
136
+ const aChangesToBeDeleted = [];
137
+ this._aPreparedChanges.forEach((oChange) => {
143
138
  if (oChange.getFileType() === "ctrl_variant_management_change") {
144
139
  aChangesToBeDeleted.push(oChange);
145
140
  }
@@ -149,7 +144,7 @@ sap.ui.define([
149
144
  selector: this.oAppComponent
150
145
  });
151
146
 
152
- var mPropertyBag = {
147
+ const mPropertyBag = {
153
148
  variant: this._oVariantChange,
154
149
  sourceVariantReference: this.getSourceVariantReference(),
155
150
  variantManagementReference: this.sVariantManagementReference,
@@ -4,15 +4,11 @@
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/core/util/reflection/JsControlTreeModifier",
8
- "sap/ui/fl/apply/api/ControlVariantApplyAPI",
9
7
  "sap/ui/fl/variants/VariantManager",
10
8
  "sap/ui/fl/Utils",
11
9
  "sap/ui/rta/command/BaseCommand",
12
10
  "sap/ui/rta/library"
13
11
  ], function(
14
- JsControlTreeModifier,
15
- ControlVariantApplyAPI,
16
12
  VariantManager,
17
13
  flUtils,
18
14
  BaseCommand,
@@ -26,13 +22,13 @@ sap.ui.define([
26
22
  * @class
27
23
  * @extends sap.ui.rta.command.BaseCommand
28
24
  * @author SAP SE
29
- * @version 1.139.0
25
+ * @version 1.141.0
30
26
  * @constructor
31
27
  * @private
32
28
  * @since 1.50
33
29
  * @alias sap.ui.rta.command.ControlVariantSetTitle
34
30
  */
35
- var ControlVariantSetTitle = BaseCommand.extend("sap.ui.rta.command.ControlVariantSetTitle", {
31
+ const ControlVariantSetTitle = BaseCommand.extend("sap.ui.rta.command.ControlVariantSetTitle", {
36
32
  metadata: {
37
33
  library: "sap.ui.rta",
38
34
  properties: {
@@ -69,30 +65,26 @@ sap.ui.define([
69
65
  * @public
70
66
  * @returns {Promise} Returns resolve after execution
71
67
  */
72
- ControlVariantSetTitle.prototype.execute = function() {
73
- var oVariantManagementControl = this.getElement();
68
+ ControlVariantSetTitle.prototype.execute = async function() {
69
+ const oVariantManagementControl = this.getElement();
74
70
 
75
71
  this.oAppComponent = flUtils.getAppComponentForControl(oVariantManagementControl);
76
- this.oModel = this.oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
77
- this.sVariantManagementReference = JsControlTreeModifier.getSelector(oVariantManagementControl, this.oAppComponent).id;
78
- this.sCurrentVariant = this.oModel.getCurrentVariantReference(this.sVariantManagementReference);
72
+ this.sVariantManagementReference = oVariantManagementControl.getVariantManagementReference();
73
+ this.sCurrentVariantKey = oVariantManagementControl.getCurrentVariantKey();
79
74
 
80
- var sCurrentTitle = this.oModel.getVariantTitle(this.sCurrentVariant, this.sVariantManagementReference);
75
+ const sCurrentTitle = oVariantManagementControl.getVariantByKey(this.sCurrentVariantKey).getTitle();
81
76
  this.setOldText(sCurrentTitle);
82
77
 
83
- var mPropertyBag = {
78
+ const mPropertyBag = {
84
79
  appComponent: this.oAppComponent,
85
- variantReference: this.sCurrentVariant,
80
+ variantReference: this.sCurrentVariantKey,
86
81
  changeType: "setTitle",
87
82
  title: this.getNewText(),
88
83
  layer: this.sLayer,
89
84
  generator: rtaLibrary.GENERATOR_NAME
90
85
  };
91
86
 
92
- return Promise.resolve(VariantManager.addVariantChange(this.sVariantManagementReference, mPropertyBag))
93
- .then(function(oChange) {
94
- this._oVariantChange = oChange;
95
- }.bind(this));
87
+ this._oVariantChange = await VariantManager.addVariantChange(this.sVariantManagementReference, mPropertyBag);
96
88
  };
97
89
 
98
90
  /**
@@ -100,19 +92,16 @@ sap.ui.define([
100
92
  * @public
101
93
  * @returns {Promise} Returns resolve after undo
102
94
  */
103
- ControlVariantSetTitle.prototype.undo = function() {
104
- var mPropertyBag = {
105
- variantReference: this.sCurrentVariant,
95
+ ControlVariantSetTitle.prototype.undo = async function() {
96
+ const mPropertyBag = {
97
+ variantReference: this.sCurrentVariantKey,
106
98
  changeType: "setTitle",
107
99
  title: this.getOldText(),
108
100
  appComponent: this.oAppComponent
109
101
  };
110
- var oChange = this._oVariantChange;
111
102
 
112
- return Promise.resolve(VariantManager.deleteVariantChange(this.sVariantManagementReference, mPropertyBag, oChange))
113
- .then(function() {
114
- this._oVariantChange = null;
115
- }.bind(this));
103
+ await VariantManager.deleteVariantChange(this.sVariantManagementReference, mPropertyBag, this._oVariantChange);
104
+ this._oVariantChange = null;
116
105
  };
117
106
 
118
107
  return ControlVariantSetTitle;
@@ -4,13 +4,11 @@
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/core/util/reflection/JsControlTreeModifier",
8
7
  "sap/ui/fl/apply/api/ControlVariantApplyAPI",
9
8
  "sap/ui/fl/variants/VariantManager",
10
9
  "sap/ui/fl/Utils",
11
10
  "sap/ui/rta/command/BaseCommand"
12
11
  ], function(
13
- JsControlTreeModifier,
14
12
  ControlVariantApplyAPI,
15
13
  VariantManager,
16
14
  flUtils,
@@ -24,13 +22,13 @@ sap.ui.define([
24
22
  * @class
25
23
  * @extends sap.ui.rta.command.BaseCommand
26
24
  * @author SAP SE
27
- * @version 1.139.0
25
+ * @version 1.141.0
28
26
  * @constructor
29
27
  * @private
30
28
  * @since 1.50
31
29
  * @alias sap.ui.rta.command.ControlVariantSwitch
32
30
  */
33
- var ControlVariantSwitch = BaseCommand.extend("sap.ui.rta.command.ControlVariantSwitch", {
31
+ const ControlVariantSwitch = BaseCommand.extend("sap.ui.rta.command.ControlVariantSwitch", {
34
32
  metadata: {
35
33
  library: "sap.ui.rta",
36
34
  properties: {
@@ -60,40 +58,30 @@ sap.ui.define([
60
58
  }
61
59
  });
62
60
 
63
- function discardVariantContent(sVReference) {
64
- return VariantManager.eraseDirtyChangesOnVariant(this.sVariantManagementReference, sVReference, this._getAppComponent())
65
- .then(function(aDirtyChanges) {
66
- this.setDiscardedChanges(aDirtyChanges);
67
- }.bind(this));
61
+ async function discardVariantContent(sVReference) {
62
+ const aDirtyChanges = await VariantManager.eraseDirtyChangesOnVariant(
63
+ this.sVariantManagementReference,
64
+ sVReference,
65
+ this.getElement()
66
+ );
67
+ this.setDiscardedChanges(aDirtyChanges);
68
68
  }
69
69
 
70
- ControlVariantSwitch.prototype._getAppComponent = function() {
71
- var oElement = this.getElement();
72
- return oElement ? flUtils.getAppComponentForControl(oElement) : this.getSelector().appComponent;
73
- };
74
-
75
70
  /**
76
71
  * Template Method to implement execute logic, with ensure precondition Element is available.
77
72
  *
78
73
  * @public
79
74
  * @returns {Promise} Returns resolve after execution
80
75
  */
81
- ControlVariantSwitch.prototype.execute = function() {
82
- var oElement = this.getElement();
83
- var oAppComponent = this._getAppComponent();
84
- var sNewVariantReference = this.getTargetVariantReference();
85
-
86
- this.oModel = oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
87
- this.sVariantManagementReference = JsControlTreeModifier.getSelector(oElement, oAppComponent).id;
76
+ ControlVariantSwitch.prototype.execute = async function() {
77
+ const oElement = this.getElement();
78
+ const sNewVariantReference = this.getTargetVariantReference();
79
+ this.sVariantManagementReference = oElement.getVariantManagementReference();
88
80
 
89
- return Promise.resolve()
90
- .then(function() {
91
- if (this.getDiscardVariantContent()) {
92
- return discardVariantContent.call(this, this.getSourceVariantReference());
93
- }
94
- return undefined;
95
- }.bind(this))
96
- .then(this._updateModelVariant.bind(this, sNewVariantReference, oAppComponent));
81
+ if (this.getDiscardVariantContent()) {
82
+ await discardVariantContent.call(this, this.getSourceVariantReference());
83
+ }
84
+ this._updateVariant(sNewVariantReference);
97
85
  };
98
86
 
99
87
  /**
@@ -101,33 +89,24 @@ sap.ui.define([
101
89
  * @public
102
90
  * @returns {Promise} Returns resolve after undo
103
91
  */
104
- ControlVariantSwitch.prototype.undo = function() {
105
- var sSourceVariantReference = this.getSourceVariantReference();
106
- var oAppComponent = this._getAppComponent();
92
+ ControlVariantSwitch.prototype.undo = async function() {
93
+ const sSourceVariantReference = this.getSourceVariantReference();
107
94
 
108
- return this._updateModelVariant(sSourceVariantReference, oAppComponent)
109
- .then(function() {
110
- // When discarding, dirty changes on source variant need to be applied AFTER the switch
111
- if (this.getDiscardVariantContent()) {
112
- return VariantManager.addAndApplyChangesOnVariant(this.getDiscardedChanges(), this._getAppComponent())
113
- .then(function() {
114
- this.setDiscardedChanges([]);
115
- this.oModel.checkUpdate(true);
116
- }.bind(this));
117
- }
118
- return undefined;
119
- }.bind(this));
95
+ await this._updateVariant(sSourceVariantReference);
96
+ // When discarding, dirty changes on source variant need to be applied AFTER the switch
97
+ if (this.getDiscardVariantContent()) {
98
+ await VariantManager.addAndApplyChangesOnVariant(this.getDiscardedChanges(), this.getElement());
99
+ this.setDiscardedChanges([]);
100
+ }
120
101
  };
121
102
 
122
- ControlVariantSwitch.prototype._updateModelVariant = function(sVariantReference, oAppComponent) {
103
+ ControlVariantSwitch.prototype._updateVariant = async function(sVariantReference) {
123
104
  if (this.getTargetVariantReference() !== this.getSourceVariantReference()) {
124
- return this.oModel.updateCurrentVariant({
125
- variantManagementReference: this.sVariantManagementReference,
126
- newVariantReference: sVariantReference,
127
- appComponent: oAppComponent
105
+ await ControlVariantApplyAPI.activateVariant({
106
+ element: this.getElement(),
107
+ variantReference: sVariantReference
128
108
  });
129
109
  }
130
- return Promise.resolve();
131
110
  };
132
111
 
133
112
  return ControlVariantSwitch;
@@ -12,13 +12,13 @@ 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.139.0
15
+ * @version 1.141.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.34
19
19
  * @alias sap.ui.rta.command.CreateContainer
20
20
  */
21
- var CreateContainer = FlexCommand.extend("sap.ui.rta.command.CreateContainer", {
21
+ const CreateContainer = FlexCommand.extend("sap.ui.rta.command.CreateContainer", {
22
22
  metadata: {
23
23
  library: "sap.ui.rta",
24
24
  properties: {
@@ -44,7 +44,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
44
44
  });
45
45
 
46
46
  CreateContainer.prototype._getChangeSpecificData = function() {
47
- var mSpecificInfo = FlexCommand.prototype._getChangeSpecificData.apply(this);
47
+ const mSpecificInfo = FlexCommand.prototype._getChangeSpecificData.apply(this);
48
48
 
49
49
  mSpecificInfo.content.newLabel = this.getLabel();
50
50
 
@@ -12,13 +12,13 @@ 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.139.0
15
+ * @version 1.141.0
16
16
  * @constructor
17
17
  * @private
18
18
  * @since 1.62
19
19
  * @alias sap.ui.rta.command.CustomAdd
20
20
  */
21
- var CustomAdd = FlexCommand.extend("sap.ui.rta.command.CustomAdd", {
21
+ const CustomAdd = FlexCommand.extend("sap.ui.rta.command.CustomAdd", {
22
22
  metadata: {
23
23
  library: "sap.ui.rta",
24
24
  properties: {
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  * @class
23
23
  * @extends sap.ui.rta.command.FlexCommand
24
24
  * @author SAP SE
25
- * @version 1.139.0
25
+ * @version 1.141.0
26
26
  * @constructor
27
27
  * @private
28
28
  * @since 1.135
@@ -56,9 +56,7 @@ sap.ui.define([
56
56
  const sControllerName = oView.getControllerModuleName() ? `module:${oView.getControllerModuleName()}` : oView.getController()?.getMetadata().getName();
57
57
  // Calculate moduleName for code extension
58
58
  const sReference = FlexRuntimeInfoAPI.getFlexReference({element: oAppComponent});
59
- let sModuleName = sReference.replace(/\.Component/g, "").replace(/\./g, "/");
60
- sModuleName += "/changes/";
61
- sModuleName += sCodeRef.replace(/\.js/g, "");
59
+ const sModuleName = `${sReference.replace(/\.Component/g, "").replace(/\./g, "/")}/changes/${sCodeRef.replace(/\.js/g, "")}`;
62
60
 
63
61
  const oChangeSpecificData = {
64
62
  changeType: this.getChangeType(),
@@ -35,14 +35,14 @@ sap.ui.define([
35
35
  * @extends sap.ui.rta.command.BaseCommand
36
36
  *
37
37
  * @author SAP SE
38
- * @version 1.139.0
38
+ * @version 1.141.0
39
39
  *
40
40
  * @constructor
41
41
  * @private
42
42
  * @since 1.34
43
43
  * @alias sap.ui.rta.command.FlexCommand
44
44
  */
45
- var FlexCommand = BaseCommand.extend("sap.ui.rta.command.FlexCommand", {
45
+ const FlexCommand = BaseCommand.extend("sap.ui.rta.command.FlexCommand", {
46
46
  metadata: {
47
47
  library: "sap.ui.rta",
48
48
  properties: {
@@ -69,31 +69,29 @@ sap.ui.define([
69
69
  type: "boolean",
70
70
  defaultValue: false
71
71
  }
72
- },
73
- associations: {},
74
- events: {}
72
+ }
75
73
  }
76
74
  });
77
75
 
78
76
  /**
79
- * Retrieves id of element or selector
77
+ * Retrieves the id of element or selector
80
78
  *
81
- * @returns {string} id value
79
+ * @returns {string} Id value
82
80
  * @public
83
81
  */
84
82
  FlexCommand.prototype.getElementId = function() {
85
- var oElement = this.getElement();
83
+ const oElement = this.getElement();
86
84
  return oElement ? oElement.getId() : this.getSelector().id;
87
85
  };
88
86
 
89
87
  /**
90
88
  * Retrieves app component of element or selector
91
89
  *
92
- * @returns {sap.ui.core.UIComponent} component
90
+ * @returns {sap.ui.core.UIComponent} App component Instance
93
91
  * @private
94
92
  */
95
93
  FlexCommand.prototype.getAppComponent = function() {
96
- var oElement = this.getElement();
94
+ const oElement = this.getElement();
97
95
  return oElement ? FlUtils.getAppComponentForControl(oElement) : this.getSelector().appComponent;
98
96
  };
99
97
 
@@ -131,7 +129,7 @@ sap.ui.define([
131
129
 
132
130
  /**
133
131
  * Returns a prepared change if exists in the command
134
- * @returns {object} Prepared change object
132
+ * @returns {object} Prepared change instance
135
133
  * @public
136
134
  */
137
135
  FlexCommand.prototype.getPreparedChange = function() {
@@ -140,10 +138,10 @@ sap.ui.define([
140
138
 
141
139
  /**
142
140
  * @override
143
- * @returns {Promise} empty promise after finishing execution
141
+ * @returns {Promise<undefined>} Resolves with undefined after finishing execution
144
142
  */
145
143
  FlexCommand.prototype.execute = function() {
146
- var vChange = this.getPreparedChange();
144
+ const vChange = this.getPreparedChange();
147
145
  return this._applyChange(vChange);
148
146
  };
149
147
 
@@ -153,28 +151,26 @@ sap.ui.define([
153
151
  * @protected
154
152
  */
155
153
  FlexCommand.prototype._getChangeSpecificData = function() {
156
- var mProperties = this.getMetadata().getProperties();
157
- var mChangeSpecificData = {
154
+ const mProperties = this.getMetadata().getProperties();
155
+ const mChangeSpecificData = {
158
156
  changeType: this.getChangeType(),
159
157
  content: mProperties.content?.get(this)
160
158
  };
161
159
  objectValues(mProperties)
162
- .filter(function(oProperty) {
163
- return oProperty.group === "content";
164
- })
165
- .forEach(function(oProperty) {
160
+ .filter((oProperty) => oProperty.group === "content")
161
+ .forEach((oProperty) => {
166
162
  mChangeSpecificData.content ||= {};
167
163
  mChangeSpecificData.content[oProperty.name] = oProperty.get(this);
168
- }, this);
164
+ });
169
165
  return mChangeSpecificData;
170
166
  };
171
167
 
172
168
  /**
173
169
  * Creates a change.
174
- * @param {object} mFlexSettings Map containing the flexibility settings
175
- * @param {string} sVariantManagementReference Reference to the variant management
176
- * @param {string} sCommand Command name
177
- * @returns {object} Returns the change object
170
+ * @param {object} mFlexSettings - Map containing the flexibility settings
171
+ * @param {string} sVariantManagementReference - Reference to the variant management
172
+ * @param {string} sCommand - Command name
173
+ * @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} Returns the change instance
178
174
  * @private
179
175
  */
180
176
  FlexCommand.prototype._createChange = function(mFlexSettings, sVariantManagementReference, sCommand) {
@@ -188,8 +184,8 @@ sap.ui.define([
188
184
  * @param {object} mChangeSpecificData - Map containing change specific data
189
185
  * @param {object} mFlexSettings - Map containing flex settings
190
186
  * @param {string} sVariantManagementReference - Reference to the variant management
191
- * @param {string} sCommand Command name
192
- * @returns {Promise.<object>} Change object wrapped in a promise.
187
+ * @param {string} sCommand - Command name
188
+ * @returns {Promise<object>} Resolves with the Change instance
193
189
  * @private
194
190
  */
195
191
  FlexCommand.prototype._createChangeFromData = async function(
@@ -246,39 +242,33 @@ sap.ui.define([
246
242
  * @override
247
243
  */
248
244
  FlexCommand.prototype.undo = function() {
249
- var vControl = this.getElement() || JsControlTreeModifier.bySelector(this.getSelector());
250
-
251
- var oChange = this.getPreparedChange();
245
+ const vControl = this.getElement() || JsControlTreeModifier.bySelector(this.getSelector());
246
+ const oChange = this.getPreparedChange();
252
247
 
253
248
  return ChangesWriteAPI.revert({change: oChange, element: vControl});
254
249
  };
255
250
 
256
251
  /**
257
252
  * @private
258
- * @param {sap.ui.fl.apply._internal.flexObjects.UIChange|Object} vChange Change object or map containing the change object
259
- * @returns {Promise} Returns an empty promise
253
+ * @param {sap.ui.fl.apply._internal.flexObjects.UIChange|Object} oChange Change object
260
254
  */
261
- FlexCommand.prototype._applyChange = function(oChange) {
262
- var oAppComponent = this.getAppComponent();
263
- var oSelectorElement = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
255
+ FlexCommand.prototype._applyChange = async function(oChange) {
256
+ const oAppComponent = this.getAppComponent();
257
+ const oSelectorElement = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
264
258
 
265
- var mPropertyBag = {
259
+ const mPropertyBag = {
266
260
  modifier: JsControlTreeModifier,
267
261
  appComponent: oAppComponent,
268
262
  view: FlUtils.getViewForControl(oSelectorElement)
269
263
  };
270
- return ChangesWriteAPI.apply({ change: oChange, element: oSelectorElement, ...mPropertyBag })
271
-
272
- .then(function(oResult) {
273
- if (!oResult.success) {
274
- return Promise.reject(oResult.error);
275
- }
276
- return undefined;
277
- });
264
+ const oResult = await ChangesWriteAPI.apply({ change: oChange, element: oSelectorElement, ...mPropertyBag });
265
+ if (!oResult.success) {
266
+ throw new Error(oResult.error);
267
+ }
278
268
  };
279
269
 
280
270
  FlexCommand.prototype._validateControlForChange = function(mFlexSettings) {
281
- if (mFlexSettings && mFlexSettings.originalSelector && mFlexSettings.content && mFlexSettings.content.boundAggregation) {
271
+ if (mFlexSettings?.originalSelector && mFlexSettings?.content?.boundAggregation) {
282
272
  return {
283
273
  id: mFlexSettings.originalSelector,
284
274
  appComponent: this.getAppComponent(),