@openui5/sap.ui.rta 1.105.0 → 1.106.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 (159) hide show
  1. package/.reuse/dep5 +20 -17
  2. package/THIRDPARTY.txt +31 -21
  3. package/package.json +6 -6
  4. package/src/sap/ui/rta/.library +1 -1
  5. package/src/sap/ui/rta/Client.js +1 -1
  6. package/src/sap/ui/rta/RuntimeAuthoring.js +25 -13
  7. package/src/sap/ui/rta/Utils.js +1 -1
  8. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  9. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  10. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  11. package/src/sap/ui/rta/command/AddXML.js +1 -1
  12. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  13. package/src/sap/ui/rta/command/AppDescriptorCommand.js +1 -1
  14. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  15. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  16. package/src/sap/ui/rta/command/Combine.js +1 -1
  17. package/src/sap/ui/rta/command/CommandFactory.js +1 -1
  18. package/src/sap/ui/rta/command/CompositeCommand.js +7 -5
  19. package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
  20. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  21. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +1 -1
  22. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -1
  23. package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
  24. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  25. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  26. package/src/sap/ui/rta/command/FlexCommand.js +2 -2
  27. package/src/sap/ui/rta/command/LREPSerializer.js +1 -1
  28. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  29. package/src/sap/ui/rta/command/Move.js +1 -1
  30. package/src/sap/ui/rta/command/Property.js +1 -1
  31. package/src/sap/ui/rta/command/Remove.js +1 -1
  32. package/src/sap/ui/rta/command/Rename.js +1 -1
  33. package/src/sap/ui/rta/command/Resize.js +1 -1
  34. package/src/sap/ui/rta/command/Reveal.js +1 -1
  35. package/src/sap/ui/rta/command/Settings.js +1 -1
  36. package/src/sap/ui/rta/command/Split.js +1 -1
  37. package/src/sap/ui/rta/command/Stack.js +15 -5
  38. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  39. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  40. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
  41. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  42. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
  43. package/src/sap/ui/rta/enablement/elementActionTest.js +89 -15
  44. package/src/sap/ui/rta/library.js +2 -2
  45. package/src/sap/ui/rta/messagebundle.properties +31 -0
  46. package/src/sap/ui/rta/messagebundle_ar.properties +13 -11
  47. package/src/sap/ui/rta/messagebundle_bg.properties +13 -11
  48. package/src/sap/ui/rta/messagebundle_ca.properties +13 -11
  49. package/src/sap/ui/rta/messagebundle_cs.properties +13 -11
  50. package/src/sap/ui/rta/messagebundle_cy.properties +13 -11
  51. package/src/sap/ui/rta/messagebundle_da.properties +13 -11
  52. package/src/sap/ui/rta/messagebundle_de.properties +3 -1
  53. package/src/sap/ui/rta/messagebundle_el.properties +13 -11
  54. package/src/sap/ui/rta/messagebundle_en.properties +4 -2
  55. package/src/sap/ui/rta/messagebundle_en_GB.properties +4 -2
  56. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +13 -1
  57. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +6 -1
  58. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +3 -1
  59. package/src/sap/ui/rta/messagebundle_es.properties +13 -11
  60. package/src/sap/ui/rta/messagebundle_es_MX.properties +13 -11
  61. package/src/sap/ui/rta/messagebundle_et.properties +13 -11
  62. package/src/sap/ui/rta/messagebundle_fi.properties +13 -11
  63. package/src/sap/ui/rta/messagebundle_fr.properties +13 -11
  64. package/src/sap/ui/rta/messagebundle_fr_CA.properties +13 -11
  65. package/src/sap/ui/rta/messagebundle_hi.properties +13 -11
  66. package/src/sap/ui/rta/messagebundle_hr.properties +13 -11
  67. package/src/sap/ui/rta/messagebundle_hu.properties +13 -11
  68. package/src/sap/ui/rta/messagebundle_id.properties +13 -11
  69. package/src/sap/ui/rta/messagebundle_it.properties +13 -11
  70. package/src/sap/ui/rta/messagebundle_iw.properties +13 -11
  71. package/src/sap/ui/rta/messagebundle_ja.properties +13 -11
  72. package/src/sap/ui/rta/messagebundle_kk.properties +13 -11
  73. package/src/sap/ui/rta/messagebundle_ko.properties +13 -11
  74. package/src/sap/ui/rta/messagebundle_lt.properties +13 -11
  75. package/src/sap/ui/rta/messagebundle_lv.properties +13 -11
  76. package/src/sap/ui/rta/messagebundle_ms.properties +13 -11
  77. package/src/sap/ui/rta/messagebundle_nl.properties +13 -11
  78. package/src/sap/ui/rta/messagebundle_no.properties +13 -11
  79. package/src/sap/ui/rta/messagebundle_pl.properties +13 -11
  80. package/src/sap/ui/rta/messagebundle_pt.properties +13 -11
  81. package/src/sap/ui/rta/messagebundle_pt_PT.properties +13 -11
  82. package/src/sap/ui/rta/messagebundle_ro.properties +13 -11
  83. package/src/sap/ui/rta/messagebundle_ru.properties +13 -11
  84. package/src/sap/ui/rta/messagebundle_sh.properties +13 -11
  85. package/src/sap/ui/rta/messagebundle_sk.properties +13 -11
  86. package/src/sap/ui/rta/messagebundle_sl.properties +13 -11
  87. package/src/sap/ui/rta/messagebundle_sv.properties +13 -11
  88. package/src/sap/ui/rta/messagebundle_th.properties +13 -11
  89. package/src/sap/ui/rta/messagebundle_tr.properties +13 -11
  90. package/src/sap/ui/rta/messagebundle_uk.properties +13 -11
  91. package/src/sap/ui/rta/messagebundle_vi.properties +13 -11
  92. package/src/sap/ui/rta/messagebundle_zh_CN.properties +13 -11
  93. package/src/sap/ui/rta/messagebundle_zh_TW.properties +13 -11
  94. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +2 -2
  95. package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
  96. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  97. package/src/sap/ui/rta/plugin/CompVariant.js +8 -6
  98. package/src/sap/ui/rta/plugin/ControlVariant.js +1 -1
  99. package/src/sap/ui/rta/plugin/CreateContainer.js +9 -4
  100. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  101. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  102. package/src/sap/ui/rta/plugin/EasyAdd.js +3 -1
  103. package/src/sap/ui/rta/plugin/EasyRemove.js +3 -1
  104. package/src/sap/ui/rta/plugin/LocalReset.js +2 -2
  105. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  106. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  107. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  108. package/src/sap/ui/rta/plugin/Rename.js +3 -3
  109. package/src/sap/ui/rta/plugin/RenameHandler.js +2 -2
  110. package/src/sap/ui/rta/plugin/Resize.js +3 -3
  111. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  112. package/src/sap/ui/rta/plugin/Settings.js +2 -2
  113. package/src/sap/ui/rta/plugin/Split.js +2 -2
  114. package/src/sap/ui/rta/plugin/Stretch.js +3 -1
  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 +9 -6
  118. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +9 -9
  119. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  120. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +2 -2
  121. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +3 -3
  122. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  123. package/src/sap/ui/rta/service/Action.js +1 -1
  124. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  125. package/src/sap/ui/rta/service/Outline.js +1 -1
  126. package/src/sap/ui/rta/service/Property.js +1 -1
  127. package/src/sap/ui/rta/service/Selection.js +1 -1
  128. package/src/sap/ui/rta/service/SupportTools.js +189 -0
  129. package/src/sap/ui/rta/service/index.js +7 -6
  130. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +11 -1
  131. package/src/sap/ui/rta/toolbar/Adaptation.js +8 -1
  132. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  133. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  134. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  135. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  136. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  137. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  138. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation.js +132 -0
  139. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptationDialog.fragment.xml +79 -0
  140. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -5
  141. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  142. package/src/sap/ui/rta/util/BindingsExtractor.js +89 -42
  143. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  144. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  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/adaptationStarter.js +13 -4
  148. package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +50 -0
  149. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +40 -37
  150. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorCategorySelection.fragment.xml +2 -2
  151. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorPopover.fragment.xml +2 -1
  152. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +60 -41
  153. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +52 -81
  154. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/CombineVisualization.js +0 -0
  155. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/MoveVisualization.js +2 -0
  156. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/RenameVisualization.js +0 -0
  157. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/SplitVisualization.js +0 -0
  158. package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +37 -0
  159. package/src/sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory.js +0 -35
@@ -7,7 +7,6 @@
7
7
  sap.ui.define([
8
8
  "sap/base/util/isPlainObject",
9
9
  "sap/base/util/ObjectPath",
10
- "sap/base/Log",
11
10
  "sap/ui/core/util/reflection/JsControlTreeModifier",
12
11
  "sap/ui/dt/ElementUtil",
13
12
  "sap/ui/fl/apply/api/DelegateMediatorAPI",
@@ -15,7 +14,6 @@ sap.ui.define([
15
14
  ], function(
16
15
  isPlainObject,
17
16
  ObjectPath,
18
- Log,
19
17
  JsControlTreeModifier,
20
18
  ElementUtil,
21
19
  DelegateMediatorAPI,
@@ -264,9 +262,11 @@ sap.ui.define([
264
262
  var aBindingPaths = [];
265
263
 
266
264
  aRelevantElements.forEach(function(oElement) {
267
- aBindingPaths = aBindingPaths.concat(BindingsExtractor.getBindings(oElement, oModel)
268
- .map(_vBindingToPath)
269
- );
265
+ aBindingPaths = aBindingPaths.concat(BindingsExtractor.getBindings({
266
+ element: oElement,
267
+ model: oModel,
268
+ parent: oElement.getParent()
269
+ }).map(_vBindingToPath));
270
270
  });
271
271
  return aBindingPaths;
272
272
  }
@@ -399,7 +399,10 @@ sap.ui.define([
399
399
  // BCP: 1880498671
400
400
  } else if (_getBindingContextPath(oElement, sAggregationName, sModelName) === _getBindingContextPath(oInvisibleElement, sAggregationName, sModelName)) {
401
401
  aBindingPaths = BindingsExtractor.collectBindingPaths(oInvisibleElement, oModel).bindingPaths;
402
- } else if (mAddViaDelegate && BindingsExtractor.getBindings(oInvisibleElement, oModel).length > 0) {
402
+ } else if (mAddViaDelegate && BindingsExtractor.getBindings({
403
+ element: oInvisibleElement,
404
+ model: oModel
405
+ }).length > 0) {
403
406
  bIncludeElement = false;
404
407
  }
405
408
 
@@ -75,7 +75,7 @@ sap.ui.define([
75
75
  * @class The plugin allows to add additional elements that exist either hidden in the UI or in the OData service
76
76
  * @extends sap.ui.rta.plugin.Plugin
77
77
  * @author SAP SE
78
- * @version 1.105.0
78
+ * @version 1.106.0
79
79
  * @constructor
80
80
  * @private
81
81
  * @since 1.44
@@ -144,13 +144,13 @@ sap.ui.define([
144
144
  return AdditionalElementsUtils.getText("CTX_ADD_ELEMENTS", mActions, mParents.parent, SINGULAR);
145
145
  },
146
146
 
147
- isAvailable: function (bOverlayIsSibling, aElementOverlays) {
147
+ isAvailable: function(aElementOverlays, bOverlayIsSibling) {
148
148
  return aElementOverlays.every(function (oElementOverlay) {
149
149
  return this._isEditableByPlugin(oElementOverlay, bOverlayIsSibling);
150
150
  }, this);
151
151
  },
152
152
 
153
- isEnabled: function(bOverlayIsSibling, aElementOverlays, sAggregationName) {
153
+ isEnabled: function(aElementOverlays, bOverlayIsSibling, sAggregationName) {
154
154
  if (aElementOverlays.length > 1) {
155
155
  return false;
156
156
  }
@@ -452,8 +452,8 @@ sap.ui.define([
452
452
  var bHasChildren = aElementsWithAggregations[0].length > 0;
453
453
  var bHasMultipleAggregations = aElementsWithAggregations[0].length > 1;
454
454
  var bHasSiblings = aElementsWithAggregations[1].length > 0;
455
- var bIsAvailableForChildren = this.isAvailable(false, aElementOverlays);
456
- var bIsAvailableForSibling = this.isAvailable(true, aElementOverlays);
455
+ var bIsAvailableForChildren = this.isAvailable(aElementOverlays, false);
456
+ var bIsAvailableForSibling = this.isAvailable(aElementOverlays, true);
457
457
  if (bIsAvailableForSibling && (!bIsAvailableForChildren || !bHasChildren)) {
458
458
  // Case 1: Only siblings -> No submenu required
459
459
  oMenuItem = this._buildMenuItem("CTX_ADD_ELEMENTS_AS_SIBLING", true, aElementOverlays, aElementsWithAggregations, false);
@@ -507,7 +507,7 @@ sap.ui.define([
507
507
  id: sPluginId,
508
508
  text: this.getContextMenuText.bind(this, bOverlayIsSibling, oSelectedOverlay, sAggregationName, bHasSubMenu),
509
509
  enabled: bHasSubMenu || function(bOverlayIsSibling, aElementOverlays) {
510
- return this.isEnabled(bOverlayIsSibling, aElementOverlays, sAggregationName);
510
+ return this.isEnabled(aElementOverlays, bOverlayIsSibling, sAggregationName);
511
511
  }.bind(this, bOverlayIsSibling),
512
512
  rank: 20,
513
513
  icon: "sap-icon://add",
@@ -544,9 +544,9 @@ sap.ui.define([
544
544
  var oItem = {
545
545
  id: sPluginId + '_' + iPosition,
546
546
  text: sDisplayText,
547
- enabled: function(bOverlayIsSibling, aElementOverlays) {
548
- return this.isEnabled(bOverlayIsSibling, aElementOverlays, sAggregationName);
549
- }.bind(this, bOverlayIsSibling),
547
+ enabled: function(aElementOverlays) {
548
+ return this.isEnabled(aElementOverlays, bOverlayIsSibling, sAggregationName);
549
+ }.bind(this),
550
550
  handler: function (bOverlayIsSibling, aElementOverlays) {
551
551
  // showAvailableElements has optional parameters
552
552
  return this.showAvailableElements(bOverlayIsSibling, sAggregationName, aElementOverlays, undefined, undefined, sDisplayText);
@@ -15,7 +15,7 @@ sap.ui.define([
15
15
  * Helper object containing methods for the AdditionalElements plugin
16
16
  *
17
17
  * @author SAP SE
18
- * @version 1.105.0
18
+ * @version 1.106.0
19
19
  * @private
20
20
  * @since 1.94
21
21
  * @experimental Since 1.94. This class is experimental and provides only limited functionality. Also the API might be changed in future.
@@ -25,7 +25,7 @@ sap.ui.define([
25
25
  * Helper object to build the RTA commands resulting from the AdditionalElements Plugin
26
26
  *
27
27
  * @author SAP SE
28
- * @version 1.105.0
28
+ * @version 1.106.0
29
29
  * @private
30
30
  * @since 1.94
31
31
  * @experimental Since 1.94. This class is experimental and provides only limited functionality. Also the API might be changed in future.
@@ -295,7 +295,7 @@ sap.ui.define([
295
295
  throw DtUtils.propagateError(
296
296
  vMessage,
297
297
  "AdditionalElementsPlugin#_createCommands",
298
- "Error occured during _createCommands execution",
298
+ "Error occurred during _createCommands execution",
299
299
  "sap.ui.rta.plugin"
300
300
  );
301
301
  });
@@ -110,7 +110,7 @@ sap.ui.define([
110
110
  * @class The AddIFrame allows trigger AddIFrame operations on the overlay.
111
111
  * @extends sap.ui.rta.plugin.BaseCreate
112
112
  * @author SAP SE
113
- * @version 1.105.0
113
+ * @version 1.106.0
114
114
  * @constructor
115
115
  * @private
116
116
  * @since 1.75
@@ -172,7 +172,7 @@ sap.ui.define([
172
172
  var aMenuItems = [];
173
173
 
174
174
  var bIsSibling = true;
175
- if (this.isAvailable(bIsSibling, aElementOverlays)) {
175
+ if (this.isAvailable(aElementOverlays, bIsSibling)) {
176
176
  var oAction = this.getCreateAction(bIsSibling, aElementOverlays[0]);
177
177
  if (oAction) {
178
178
  var oSiblingMenuItem = Object.assign({
@@ -187,7 +187,7 @@ sap.ui.define([
187
187
  }
188
188
 
189
189
  bIsSibling = false;
190
- if (this.isAvailable(bIsSibling, aElementOverlays)) {
190
+ if (this.isAvailable(aElementOverlays, bIsSibling)) {
191
191
  aMenuItems = aMenuItems.concat(this.getCreateActions(bIsSibling, aElementOverlays[0])
192
192
  .map(function(oAction, iIndex) {
193
193
  var oParentMenuItem = Object.assign({
@@ -113,7 +113,7 @@ sap.ui.define([
113
113
  * @class Context - Dialog for IFrame settings in Runtime Authoring
114
114
  * @extends sap.ui.base.ManagedObject
115
115
  * @author SAP SE
116
- * @version 1.105.0
116
+ * @version 1.106.0
117
117
  * @constructor
118
118
  * @private
119
119
  * @since 1.78
@@ -25,7 +25,7 @@ sap.ui.define([
25
25
  * @author SAP SE
26
26
  * @experimental Since 1.58
27
27
  * @since 1.58
28
- * @version 1.105.0
28
+ * @version 1.106.0
29
29
  * @private
30
30
  * @ui5-restricted
31
31
  *
@@ -31,7 +31,7 @@ sap.ui.define([
31
31
  * @author SAP SE
32
32
  * @experimental Since 1.58
33
33
  * @since 1.58
34
- * @version 1.105.0
34
+ * @version 1.106.0
35
35
  * @private
36
36
  * @ui5-restricted
37
37
  */
@@ -42,7 +42,7 @@ sap.ui.define([
42
42
  * @author SAP SE
43
43
  * @experimental Since 1.56
44
44
  * @since 1.56
45
- * @version 1.105.0
45
+ * @version 1.106.0
46
46
  * @private
47
47
  * @ui5-restricted
48
48
  */
@@ -28,7 +28,7 @@ sap.ui.define([
28
28
  * @author SAP SE
29
29
  * @experimental Since 1.58
30
30
  * @since 1.58
31
- * @version 1.105.0
31
+ * @version 1.106.0
32
32
  * @private
33
33
  * @ui5-restricted
34
34
  */
@@ -15,7 +15,7 @@ sap.ui.define(function () {
15
15
  * @author SAP SE
16
16
  * @experimental Since 1.58
17
17
  * @since 1.58
18
- * @version 1.105.0
18
+ * @version 1.106.0
19
19
  * @private
20
20
  * @ui5-restricted
21
21
  */
@@ -0,0 +1,189 @@
1
+ /*!
2
+ * OpenUI5
3
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+
7
+ sap.ui.define([
8
+ "sap/ui/core/Core",
9
+ "sap/ui/core/util/reflection/JsControlTreeModifier",
10
+ "sap/ui/fl/write/api/ChangesWriteAPI"
11
+ ], function(
12
+ Core,
13
+ JsControlTreeModifier,
14
+ ChangesWriteAPI
15
+ ) {
16
+ "use strict";
17
+
18
+ /**
19
+ * Service to register message event listeners for the communication with the
20
+ * Flex Support web extension.
21
+ *
22
+ * This is implemented as a service and not as part of the injected script because
23
+ * there is no easy way to retrieve the RuntimeAuthoring instance otherwise.
24
+ *
25
+ * @namespace
26
+ * @name sap.ui.rta.service.SupportTools
27
+ * @author SAP SE
28
+ * @experimental Since 1.106
29
+ * @since 1.106
30
+ * @version 1.106.0
31
+ * @private
32
+ * @ui5-restricted
33
+ */
34
+
35
+ function getPluginChangeHandler(oPlugin, oElementOverlay, oRta) {
36
+ var oAction = oPlugin.getAction(oElementOverlay);
37
+ if (oAction && oAction.changeType) {
38
+ var oElement = oAction.changeOnRelevantContainer
39
+ ? oElementOverlay.getRelevantContainer()
40
+ : oElementOverlay.getElement();
41
+ return ChangesWriteAPI.getChangeHandler({
42
+ changeType: oAction.changeType,
43
+ element: oElement,
44
+ modifier: JsControlTreeModifier,
45
+ layer: oRta.getLayer()
46
+ })
47
+ .then(function(oChangeHandler) {
48
+ return oChangeHandler;
49
+ })
50
+ .catch(function() {
51
+ return;
52
+ });
53
+ }
54
+ return Promise.resolve(undefined);
55
+ }
56
+
57
+ function isPluginForSibling(sPluginName) {
58
+ if (sPluginName.endsWith(".asSibling")) {
59
+ return true;
60
+ }
61
+ if (sPluginName.endsWith(".asChild")) {
62
+ return false;
63
+ }
64
+ return undefined;
65
+ }
66
+
67
+ function getPluginByName(oRta, sPluginName) {
68
+ var bIsSibling = isPluginForSibling(sPluginName);
69
+ var oAllPlugins = oRta.getPlugins();
70
+ return Object.values(oAllPlugins).find(function(oPlugin) {
71
+ var sName = oPlugin._retrievePluginName
72
+ ? oPlugin._retrievePluginName(bIsSibling)
73
+ : oPlugin.getMetadata().getName();
74
+ return sName === sPluginName;
75
+ });
76
+ }
77
+
78
+ /*
79
+ * Returns information about an overlay, namely:
80
+ * For every plugin that is part of the "editableByPlugins"
81
+ * aggregation, we return the plugin name and the result for
82
+ * isAvailable(). If the change handler can be determined, we
83
+ * return this information, which enables a button allowing the
84
+ * key user to print the change handler to the console.
85
+ *
86
+ * @method sap.ui.rta.service.SupportTools.getOverlayInfo
87
+ * @param {sap.ui.rta.RuntimeAuthoring} oRta - Instance of the RuntimeAuthoring class
88
+ * @param {object} mPayload - Property Bag
89
+ * @param {string} mPayload.overlayId
90
+ */
91
+ function getOverlayInfo(oRta, mPayload) {
92
+ var oOverlay = Core.byId(mPayload.overlayId);
93
+ var oElement = oOverlay.getElement();
94
+
95
+ return Promise.all(oOverlay.getEditableByPlugins().map(function(sPluginName) {
96
+ var oInstance = getPluginByName(oRta, sPluginName);
97
+ var bIsSibling = isPluginForSibling(sPluginName);
98
+
99
+ return getPluginChangeHandler(oInstance, oOverlay, oRta)
100
+ .then(function(oChangeHandler) {
101
+ return {
102
+ name: sPluginName,
103
+ isAvailable: oInstance.isAvailable([oOverlay], bIsSibling),
104
+ hasChangeHandler: !!oChangeHandler
105
+ };
106
+ });
107
+ }))
108
+ .then(function(aPlugins) {
109
+ return {
110
+ elementId: oElement.getId(),
111
+ elementControlType: oElement.getMetadata().getName(),
112
+ overlayId: oOverlay.getId(),
113
+ plugins: aPlugins
114
+ };
115
+ });
116
+ }
117
+
118
+ function printChangeHandler(oRta, mPayload) {
119
+ var oOverlay = Core.byId(mPayload.overlayId);
120
+ var oPlugin = getPluginByName(oRta, mPayload.pluginName);
121
+ getPluginChangeHandler(oPlugin, oOverlay, oRta)
122
+ .then(console.log); // eslint-disable-line no-console
123
+ }
124
+
125
+ // List of supported handlers
126
+ var mHandlers = {
127
+ getOverlayInfo: {
128
+ handler: getOverlayInfo,
129
+ returnMessageType: "overlayInfo",
130
+ id: "ui5FlexibilitySupport.submodules.overlayInfo"
131
+ },
132
+ printChangeHandler: {
133
+ handler: printChangeHandler,
134
+ id: "ui5FlexibilitySupport.submodules.overlayInfo"
135
+ }
136
+ };
137
+
138
+ /*
139
+ * Event handler for the messages sent by the support extension.
140
+ *
141
+ * Messages are contained in oEvent.data - the following properties
142
+ * are sent:
143
+ * - type: specifies, what action should be taken. Possible values:
144
+ * - getOverlayInfo (request information about an overlay)
145
+ * - printChangeHandler (a specified change handler object is to be printed to the console)
146
+ * - content: type-specific information, e.g. for getOverlayInfo, an 'overlayId' is provided
147
+ *
148
+ * @method sap.ui.rta.service.SupportTools.onMessageReceived
149
+ * @param {sap.ui.rta.RuntimeAuthoring} oRta - Instance of the RuntimeAuthoring class
150
+ * @param {object} oEvent - Event thrown by the browser on received message
151
+ */
152
+ function onMessageReceived(oRta, oEvent) {
153
+ if (oEvent.source !== window) {
154
+ return;
155
+ }
156
+
157
+ var aHandler = Object.entries(mHandlers).find(function(aEntry) {
158
+ return (
159
+ aEntry[0] === oEvent.data.type
160
+ && aEntry[1].id === oEvent.data.id
161
+ );
162
+ });
163
+ var mHandler = aHandler && aHandler[1];
164
+
165
+ if (mHandler) {
166
+ Promise.resolve(mHandler.handler(oRta, oEvent.data.content))
167
+ .then(function(oResult) {
168
+ if (mHandler.returnMessageType) {
169
+ oEvent.source.postMessage({
170
+ id: mHandler.id,
171
+ type: mHandler.returnMessageType,
172
+ content: oResult
173
+ });
174
+ }
175
+ });
176
+ }
177
+ }
178
+
179
+ return function(oRta) {
180
+ var fnOnMessageReceivedBound = onMessageReceived.bind(null, oRta);
181
+ window.addEventListener("message", fnOnMessageReceivedBound);
182
+
183
+ return {
184
+ destroy: function() {
185
+ window.removeEventListener("message", fnOnMessageReceivedBound);
186
+ }
187
+ };
188
+ };
189
+ });
@@ -8,11 +8,12 @@ sap.ui.define(function () {
8
8
  "use strict";
9
9
 
10
10
  return Object.freeze({
11
- selection: 'sap.ui.rta.service.Selection',
12
- receiver: 'sap.ui.rta.service.Receiver',
13
- controllerExtension: 'sap.ui.rta.service.ControllerExtension',
14
- outline: 'sap.ui.rta.service.Outline',
15
- action: 'sap.ui.rta.service.Action',
16
- property: 'sap.ui.rta.service.Property'
11
+ selection: "sap.ui.rta.service.Selection",
12
+ receiver: "sap.ui.rta.service.Receiver",
13
+ controllerExtension: "sap.ui.rta.service.ControllerExtension",
14
+ outline: "sap.ui.rta.service.Outline",
15
+ action: "sap.ui.rta.service.Action",
16
+ property: "sap.ui.rta.service.Property",
17
+ supportTools: "sap.ui.rta.service.SupportTools"
17
18
  });
18
19
  });
@@ -119,7 +119,7 @@
119
119
  <Button
120
120
  id="sapUiRta_toggleChangeVisualizationMenuButton"
121
121
  visible="{= ${controls>/modeSwitcher} === 'visualization'}"
122
- text="{visualizationModel>/commandCategoryText}"
122
+ text="{visualizationModel>/changeCategoryText}"
123
123
  type="Transparent"
124
124
  icon="sap-icon://slim-arrow-down"
125
125
  iconFirst="false"
@@ -204,6 +204,16 @@
204
204
  <OverflowToolbarLayoutData priority="Low" />
205
205
  </layoutData>
206
206
  </MenuButton>
207
+ <toolbar:OverflowToolbarButton
208
+ id="sapUiRta_saveAsContextBasedAdaptation"
209
+ visible="{= (${controls>/contextBasedAdaptationVisible} &amp;&amp; ${controls>/modeSwitcher} === 'adaptation')}"
210
+ press=".saveAsContextBasedAdaptation"
211
+ type="Transparent"
212
+ text="{i18n>BTN_SAVE_AS}" >
213
+ <toolbar:layoutData>
214
+ <OverflowToolbarLayoutData priority="Low" />
215
+ </toolbar:layoutData>
216
+ </toolbar:OverflowToolbarButton>
207
217
  <toolbar:OverflowToolbarButton
208
218
  id="sapUiRta_saveAs"
209
219
  visible="{= (${controls>/saveAsVisible} &amp;&amp; ${controls>/modeSwitcher} === 'adaptation')}"
@@ -7,6 +7,7 @@
7
7
  sap.ui.define([
8
8
  "sap/ui/core/Fragment",
9
9
  "sap/ui/fl/write/api/Version",
10
+ "sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation",
10
11
  "sap/ui/rta/toolbar/translation/Translation",
11
12
  "sap/ui/rta/toolbar/versioning/Versioning",
12
13
  "sap/ui/rta/appVariant/Feature",
@@ -16,6 +17,7 @@ sap.ui.define([
16
17
  ], function(
17
18
  Fragment,
18
19
  Version,
20
+ SaveAsContextBasedAdaptation,
19
21
  Translation,
20
22
  Versioning,
21
23
  AppVariantFeature,
@@ -33,7 +35,7 @@ sap.ui.define([
33
35
  * @extends sap.ui.rta.toolbar.Base
34
36
  *
35
37
  * @author SAP SE
36
- * @version 1.105.0
38
+ * @version 1.106.0
37
39
  *
38
40
  * @constructor
39
41
  * @private
@@ -207,6 +209,7 @@ sap.ui.define([
207
209
  manageApps: onManageAppsPressed.bind(this),
208
210
  appVariantOverview: onOverviewPressed.bind(this),
209
211
  saveAs: onSaveAsPressed.bind(this),
212
+ saveAsContextBasedAdaptation: onSaveAsContextBasedAdaptation.bind(this),
210
213
  formatSaveAsEnabled: formatSaveAsEnabled,
211
214
  restore: this.eventHandler.bind(this, "Restore"),
212
215
  publish: this.eventHandler.bind(this, "Transport"),
@@ -239,6 +242,10 @@ sap.ui.define([
239
242
  AppVariantFeature.onSaveAs(true, true, this.getRtaInformation().flexSettings.layer, null);
240
243
  }
241
244
 
245
+ function onSaveAsContextBasedAdaptation() {
246
+ this.getExtension("adaptation", SaveAsContextBasedAdaptation).openAddAdaptationDialog(this.getRtaInformation().flexSettings.layer);
247
+ }
248
+
242
249
  function onOverviewPressed(oEvent) {
243
250
  var oItem = oEvent.getParameter("item");
244
251
  var bTriggeredForKeyUser = oItem.getId().endsWith("keyUser");
@@ -27,7 +27,7 @@ sap.ui.define([
27
27
  * @extends sap.m.HBox
28
28
  *
29
29
  * @author SAP SE
30
- * @version 1.105.0
30
+ * @version 1.106.0
31
31
  *
32
32
  * @constructor
33
33
  * @private
@@ -32,7 +32,7 @@ function(
32
32
  * @extends sap.ui.rta.toolbar.Adaptation
33
33
  *
34
34
  * @author SAP SE
35
- * @version 1.105.0
35
+ * @version 1.106.0
36
36
  *
37
37
  * @constructor
38
38
  * @private
@@ -20,7 +20,7 @@ function(
20
20
  * @extends sap.ui.rta.toolbar.Adaptation
21
21
  *
22
22
  * @author SAP SE
23
- * @version 1.105.0
23
+ * @version 1.106.0
24
24
  *
25
25
  * @constructor
26
26
  * @private
@@ -23,7 +23,7 @@ sap.ui.define([
23
23
  * @extends sap.m.OverflowToolbarButton
24
24
  *
25
25
  * @author SAP SE
26
- * @version 1.105.0
26
+ * @version 1.106.0
27
27
  *
28
28
  * @constructor
29
29
  * @private
@@ -22,7 +22,7 @@ function(
22
22
  * @extends sap.ui.rta.toolbar.Base
23
23
  *
24
24
  * @author SAP SE
25
- * @version 1.105.0
25
+ * @version 1.106.0
26
26
  *
27
27
  * @constructor
28
28
  * @private
@@ -20,7 +20,7 @@ function(
20
20
  * @extends sap.ui.rta.toolbar.Adaptation
21
21
  *
22
22
  * @author SAP SE
23
- * @version 1.105.0
23
+ * @version 1.106.0
24
24
  *
25
25
  * @constructor
26
26
  * @private