@openui5/sap.ui.rta 1.103.1 → 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 (167) hide show
  1. package/.reuse/dep5 +35 -15
  2. package/LICENSES/LicenseRef-tzdata-PublicDomain.txt +5 -0
  3. package/THIRDPARTY.txt +64 -21
  4. package/package.json +6 -6
  5. package/src/sap/ui/rta/.library +1 -1
  6. package/src/sap/ui/rta/Client.js +1 -1
  7. package/src/sap/ui/rta/RuntimeAuthoring.js +107 -418
  8. package/src/sap/ui/rta/Utils.js +2 -2
  9. package/src/sap/ui/rta/api/startAdaptation.js +2 -2
  10. package/src/sap/ui/rta/api/startKeyUserAdaptation.js +2 -2
  11. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  12. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +6 -22
  13. package/src/sap/ui/rta/appVariant/Feature.js +4 -12
  14. package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +5 -3
  15. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  16. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  17. package/src/sap/ui/rta/command/AddXML.js +1 -1
  18. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  19. package/src/sap/ui/rta/command/AppDescriptorCommand.js +8 -3
  20. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  21. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  22. package/src/sap/ui/rta/command/Combine.js +1 -1
  23. package/src/sap/ui/rta/command/CommandFactory.js +1 -1
  24. package/src/sap/ui/rta/command/CompositeCommand.js +7 -5
  25. package/src/sap/ui/rta/command/ControlVariantConfigure.js +4 -2
  26. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  27. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +5 -3
  28. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +5 -4
  29. package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
  30. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  31. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  32. package/src/sap/ui/rta/command/FlexCommand.js +5 -3
  33. package/src/sap/ui/rta/command/LREPSerializer.js +11 -8
  34. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  35. package/src/sap/ui/rta/command/Move.js +1 -1
  36. package/src/sap/ui/rta/command/Property.js +1 -1
  37. package/src/sap/ui/rta/command/Remove.js +1 -1
  38. package/src/sap/ui/rta/command/Rename.js +1 -1
  39. package/src/sap/ui/rta/command/Resize.js +1 -1
  40. package/src/sap/ui/rta/command/Reveal.js +1 -1
  41. package/src/sap/ui/rta/command/Settings.js +1 -1
  42. package/src/sap/ui/rta/command/Split.js +1 -1
  43. package/src/sap/ui/rta/command/Stack.js +17 -7
  44. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  45. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  46. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +6 -4
  47. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  48. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +6 -4
  49. package/src/sap/ui/rta/enablement/elementActionTest.js +89 -15
  50. package/src/sap/ui/rta/library.js +2 -2
  51. package/src/sap/ui/rta/messagebundle.properties +46 -11
  52. package/src/sap/ui/rta/messagebundle_ar.properties +24 -8
  53. package/src/sap/ui/rta/messagebundle_bg.properties +25 -9
  54. package/src/sap/ui/rta/messagebundle_ca.properties +25 -9
  55. package/src/sap/ui/rta/messagebundle_cs.properties +24 -8
  56. package/src/sap/ui/rta/messagebundle_cy.properties +22 -6
  57. package/src/sap/ui/rta/messagebundle_da.properties +26 -10
  58. package/src/sap/ui/rta/messagebundle_de.properties +27 -11
  59. package/src/sap/ui/rta/messagebundle_el.properties +25 -9
  60. package/src/sap/ui/rta/messagebundle_en.properties +26 -10
  61. package/src/sap/ui/rta/messagebundle_en_GB.properties +26 -10
  62. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +30 -11
  63. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +18 -1
  64. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +27 -11
  65. package/src/sap/ui/rta/messagebundle_es.properties +22 -6
  66. package/src/sap/ui/rta/messagebundle_es_MX.properties +20 -4
  67. package/src/sap/ui/rta/messagebundle_et.properties +22 -6
  68. package/src/sap/ui/rta/messagebundle_fi.properties +26 -10
  69. package/src/sap/ui/rta/messagebundle_fr.properties +23 -7
  70. package/src/sap/ui/rta/messagebundle_fr_CA.properties +25 -9
  71. package/src/sap/ui/rta/messagebundle_hi.properties +25 -9
  72. package/src/sap/ui/rta/messagebundle_hr.properties +25 -9
  73. package/src/sap/ui/rta/messagebundle_hu.properties +18 -2
  74. package/src/sap/ui/rta/messagebundle_id.properties +24 -8
  75. package/src/sap/ui/rta/messagebundle_it.properties +25 -9
  76. package/src/sap/ui/rta/messagebundle_iw.properties +25 -9
  77. package/src/sap/ui/rta/messagebundle_ja.properties +25 -9
  78. package/src/sap/ui/rta/messagebundle_kk.properties +25 -9
  79. package/src/sap/ui/rta/messagebundle_ko.properties +25 -9
  80. package/src/sap/ui/rta/messagebundle_lt.properties +24 -8
  81. package/src/sap/ui/rta/messagebundle_lv.properties +22 -6
  82. package/src/sap/ui/rta/messagebundle_ms.properties +26 -10
  83. package/src/sap/ui/rta/messagebundle_nl.properties +26 -10
  84. package/src/sap/ui/rta/messagebundle_no.properties +25 -9
  85. package/src/sap/ui/rta/messagebundle_pl.properties +24 -8
  86. package/src/sap/ui/rta/messagebundle_pt.properties +25 -9
  87. package/src/sap/ui/rta/messagebundle_pt_PT.properties +24 -8
  88. package/src/sap/ui/rta/messagebundle_ro.properties +24 -8
  89. package/src/sap/ui/rta/messagebundle_ru.properties +25 -9
  90. package/src/sap/ui/rta/messagebundle_sh.properties +26 -10
  91. package/src/sap/ui/rta/messagebundle_sk.properties +24 -8
  92. package/src/sap/ui/rta/messagebundle_sl.properties +22 -6
  93. package/src/sap/ui/rta/messagebundle_sv.properties +26 -10
  94. package/src/sap/ui/rta/messagebundle_th.properties +28 -12
  95. package/src/sap/ui/rta/messagebundle_tr.properties +25 -9
  96. package/src/sap/ui/rta/messagebundle_uk.properties +26 -10
  97. package/src/sap/ui/rta/messagebundle_vi.properties +25 -9
  98. package/src/sap/ui/rta/messagebundle_zh_CN.properties +25 -9
  99. package/src/sap/ui/rta/messagebundle_zh_TW.properties +24 -8
  100. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +2 -2
  101. package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
  102. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  103. package/src/sap/ui/rta/plugin/CompVariant.js +10 -8
  104. package/src/sap/ui/rta/plugin/ControlVariant.js +21 -15
  105. package/src/sap/ui/rta/plugin/CreateContainer.js +9 -4
  106. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  107. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  108. package/src/sap/ui/rta/plugin/EasyAdd.js +3 -1
  109. package/src/sap/ui/rta/plugin/EasyRemove.js +3 -1
  110. package/src/sap/ui/rta/plugin/LocalReset.js +2 -2
  111. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  112. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  113. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  114. package/src/sap/ui/rta/plugin/Rename.js +3 -3
  115. package/src/sap/ui/rta/plugin/RenameHandler.js +23 -5
  116. package/src/sap/ui/rta/plugin/Resize.js +3 -3
  117. package/src/sap/ui/rta/plugin/Selection.js +12 -1
  118. package/src/sap/ui/rta/plugin/Settings.js +2 -2
  119. package/src/sap/ui/rta/plugin/Split.js +2 -2
  120. package/src/sap/ui/rta/plugin/Stretch.js +7 -3
  121. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  122. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  123. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +14 -11
  124. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +9 -9
  125. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  126. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +2 -2
  127. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +3 -3
  128. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  129. package/src/sap/ui/rta/service/Action.js +1 -1
  130. package/src/sap/ui/rta/service/ControllerExtension.js +8 -9
  131. package/src/sap/ui/rta/service/Outline.js +1 -1
  132. package/src/sap/ui/rta/service/Property.js +1 -1
  133. package/src/sap/ui/rta/service/Selection.js +1 -1
  134. package/src/sap/ui/rta/service/SupportTools.js +189 -0
  135. package/src/sap/ui/rta/service/index.js +7 -6
  136. package/src/sap/ui/rta/themes/base/Toolbar.adaptation.less +19 -4
  137. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +11 -1
  138. package/src/sap/ui/rta/toolbar/Adaptation.js +13 -4
  139. package/src/sap/ui/rta/toolbar/Base.js +8 -4
  140. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  141. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  142. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  143. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  144. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  145. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation.js +132 -0
  146. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptationDialog.fragment.xml +79 -0
  147. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -5
  148. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  149. package/src/sap/ui/rta/util/BindingsExtractor.js +89 -42
  150. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  151. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  152. package/src/sap/ui/rta/util/ReloadManager.js +331 -0
  153. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  154. package/src/sap/ui/rta/util/adaptationStarter.js +27 -12
  155. package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +50 -0
  156. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +115 -63
  157. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorCategorySelection.fragment.xml +2 -2
  158. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorPopover.fragment.xml +2 -1
  159. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +143 -79
  160. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +86 -180
  161. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +2 -2
  162. package/src/sap/ui/rta/util/changeVisualization/commands/CombineVisualization.js +87 -0
  163. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/MoveVisualization.js +6 -4
  164. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/RenameVisualization.js +2 -2
  165. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/SplitVisualization.js +6 -4
  166. package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +37 -0
  167. package/src/sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory.js +0 -27
@@ -8,73 +8,37 @@ sap.ui.define([
8
8
  "sap/ui/core/Fragment",
9
9
  "sap/base/util/restricted/_difference",
10
10
  "sap/base/util/deepEqual",
11
- "sap/base/Log",
12
11
  "sap/ui/core/util/reflection/JsControlTreeModifier",
13
12
  "sap/ui/core/Control",
14
13
  "sap/ui/dt/OverlayRegistry",
15
14
  "sap/ui/dt/ElementUtil",
16
- "sap/ui/fl/apply/_internal/changes/Utils",
17
- "sap/ui/fl/write/api/ChangesWriteAPI",
18
15
  "sap/ui/fl/write/api/PersistenceWriteAPI",
19
16
  "sap/ui/fl/Layer",
20
17
  "sap/ui/fl/Utils",
21
18
  "sap/ui/model/resource/ResourceModel",
22
19
  "sap/ui/model/json/JSONModel",
23
20
  "sap/ui/rta/util/changeVisualization/ChangeIndicator",
24
- "sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry"
21
+ "sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry",
22
+ "sap/ui/rta/util/changeVisualization/ChangeCategories"
25
23
  ], function(
26
24
  Fragment,
27
25
  difference,
28
26
  deepEqual,
29
- Log,
30
27
  JsControlTreeModifier,
31
28
  Control,
32
29
  OverlayRegistry,
33
30
  ElementUtil,
34
- ChangesUtils,
35
- ChangesWriteAPI,
36
31
  PersistenceWriteAPI,
37
32
  Layer,
38
33
  FlUtils,
39
34
  ResourceModel,
40
35
  JSONModel,
41
36
  ChangeIndicator,
42
- ChangeIndicatorRegistry
37
+ ChangeIndicatorRegistry,
38
+ ChangeCategories
43
39
  ) {
44
40
  "use strict";
45
41
 
46
- var VALID_COMMANDS = {
47
- add: [
48
- "createContainer",
49
- "addDelegateProperty",
50
- "reveal",
51
- "addIFrame"
52
- ],
53
- move: [
54
- "move"
55
- ],
56
- rename: [
57
- "rename"
58
- ],
59
- combinesplit: [
60
- "combine",
61
- "split"
62
- ],
63
- remove: [
64
- "remove"
65
- ]
66
- };
67
- var CATEGORY_ALL = "all";
68
-
69
- var CATEGORY_ICONS = {
70
- all: "sap-icon://show",
71
- add: "sap-icon://add",
72
- move: "sap-icon://move",
73
- rename: "sap-icon://edit",
74
- combinesplit: "sap-icon://combine",
75
- remove: "sap-icon://less"
76
- };
77
-
78
42
  /**
79
43
  * When clicking anywhere on the application, the menu must close
80
44
  */
@@ -93,7 +57,7 @@ sap.ui.define([
93
57
  * @alias sap.ui.rta.util.changeVisualization.ChangeVisualization
94
58
  * @author SAP SE
95
59
  * @since 1.84.0
96
- * @version 1.103.1
60
+ * @version 1.106.0
97
61
  * @private
98
62
  */
99
63
  var ChangeVisualization = Control.extend("sap.ui.rta.util.changeVisualization.ChangeVisualization", {
@@ -122,11 +86,12 @@ sap.ui.define([
122
86
  }
123
87
  },
124
88
  constructor: function() {
125
- Control.prototype.constructor.apply(this, arguments);
126
-
127
89
  this._oChangeIndicatorRegistry = new ChangeIndicatorRegistry({
128
- commandCategories: VALID_COMMANDS
90
+ changeCategories: ChangeCategories.getCategories()
129
91
  });
92
+
93
+ Control.prototype.constructor.apply(this, arguments);
94
+
130
95
  this._oTextBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
131
96
  this.setModel(new ResourceModel({
132
97
  bundle: this._oTextBundle
@@ -136,7 +101,7 @@ sap.ui.define([
136
101
  active: this.getIsActive()
137
102
  });
138
103
  this._oChangeVisualizationModel.setDefaultBindingMode("OneWay");
139
- this._sSelectedCommandCategory = "all";
104
+ this._sSelectedChangeCategory = ChangeCategories.ALL;
140
105
  this._bSetModeChanged = false;
141
106
 
142
107
  // For the event handlers to work, the function instance has to remain stable
@@ -149,6 +114,7 @@ sap.ui.define([
149
114
  this._reset();
150
115
  }
151
116
  this.setProperty("rootControlId", sRootControlId);
117
+ this._oChangeIndicatorRegistry.setRootControlId(sRootControlId);
152
118
  };
153
119
 
154
120
  ChangeVisualization.prototype._getComponent = function() {
@@ -180,37 +146,37 @@ sap.ui.define([
180
146
  ChangeVisualization.prototype._updateVisualizationModelMenuData = function() {
181
147
  var aVisualizedChanges = this._oChangeVisualizationModel.getData().visualizedChanges;
182
148
  var aHiddenChanges = [];
183
- var aRegisteredChanges = this._oChangeIndicatorRegistry.getChanges();
184
- aRegisteredChanges.forEach(function(oChange) {
149
+ var aAllRegisteredChanges = this._oChangeIndicatorRegistry.getAllRegisteredChanges();
150
+ aAllRegisteredChanges.forEach(function(oRegisteredChange) {
185
151
  var oVisualizedChange = aVisualizedChanges.find(function(oVisualizedChange) {
186
- return oChange.change.getId() === oVisualizedChange.id;
152
+ return oRegisteredChange.change.getId() === oVisualizedChange.id;
187
153
  });
188
- if (!oVisualizedChange && !oChange.dependent) {
189
- aHiddenChanges.push(oChange);
154
+ if (!oVisualizedChange && !oRegisteredChange.dependent) {
155
+ aHiddenChanges.push(oRegisteredChange);
190
156
  }
191
157
  });
192
- var aCommandData = Object.keys(VALID_COMMANDS).map(function(sCommandCategoryName) {
193
- var sTitle = this._getCommandCategoryLabel(
194
- sCommandCategoryName,
195
- this._getChangesForCommandCategory(sCommandCategoryName, aVisualizedChanges).length
158
+ var aCommandData = Object.keys(ChangeCategories.getCategories()).map(function(sChangeCategoryName) {
159
+ var sTitle = this._getChangeCategoryLabel(
160
+ sChangeCategoryName,
161
+ this._getChangesForChangeCategory(sChangeCategoryName, aVisualizedChanges).length
196
162
  );
197
163
  return {
198
- key: sCommandCategoryName,
199
- count: this._getChangesForCommandCategory(sCommandCategoryName, aVisualizedChanges).length,
164
+ key: sChangeCategoryName,
165
+ count: this._getChangesForChangeCategory(sChangeCategoryName, aVisualizedChanges).length,
200
166
  title: sTitle,
201
- icon: CATEGORY_ICONS[sCommandCategoryName]
167
+ icon: ChangeCategories.getIconForCategory(sChangeCategoryName)
202
168
  };
203
169
  }.bind(this));
204
170
 
205
171
  aCommandData.unshift({
206
- key: CATEGORY_ALL,
207
- count: this._getChangesForCommandCategory(CATEGORY_ALL, aVisualizedChanges).length,
208
- title: this._getCommandCategoryLabel(CATEGORY_ALL, this._getChangesForCommandCategory(CATEGORY_ALL, aVisualizedChanges).length),
209
- icon: CATEGORY_ICONS[CATEGORY_ALL]
172
+ key: ChangeCategories.ALL,
173
+ count: this._getChangesForChangeCategory(ChangeCategories.ALL, aVisualizedChanges).length,
174
+ title: this._getChangeCategoryLabel(ChangeCategories.ALL, this._getChangesForChangeCategory(ChangeCategories.ALL, aVisualizedChanges).length),
175
+ icon: ChangeCategories.getIconForCategory(ChangeCategories.ALL)
210
176
  });
211
177
 
212
178
  this._updateVisualizationModel({
213
- commandCategories: aCommandData,
179
+ changeCategories: aCommandData,
214
180
  hiddenChanges: aHiddenChanges,
215
181
  popupInfoMessage: this._oTextBundle.getText(
216
182
  "MSG_CHANGEVISUALIZATION_HIDDEN_CHANGES_INFO",
@@ -219,21 +185,21 @@ sap.ui.define([
219
185
  });
220
186
  };
221
187
 
222
- ChangeVisualization.prototype._getChangesForCommandCategory = function(sCommandCategory, aChanges) {
188
+ ChangeVisualization.prototype._getChangesForChangeCategory = function(sChangeCategory, aChanges) {
223
189
  return aChanges.filter(function(oChange) {
224
- return sCommandCategory === CATEGORY_ALL
225
- ? oChange.commandCategory !== undefined
226
- : sCommandCategory === oChange.commandCategory;
190
+ return sChangeCategory === ChangeCategories.ALL
191
+ ? oChange.changeCategory !== undefined
192
+ : sChangeCategory === oChange.changeCategory;
227
193
  });
228
194
  };
229
195
 
230
- ChangeVisualization.prototype._getCommandCategoryLabel = function(sCommandCategoryName, iChangesCount) {
231
- var sLabelKey = "TXT_CHANGEVISUALIZATION_OVERVIEW_" + sCommandCategoryName.toUpperCase();
196
+ ChangeVisualization.prototype._getChangeCategoryLabel = function(sChangeCategoryName, iChangesCount) {
197
+ var sLabelKey = "TXT_CHANGEVISUALIZATION_OVERVIEW_" + sChangeCategoryName.toUpperCase();
232
198
  return this._oTextBundle.getText(sLabelKey, [iChangesCount]);
233
199
  };
234
200
 
235
- ChangeVisualization.prototype._getCommandCategoryButton = function(sCommandCategoryName) {
236
- var sButtonKey = "BTN_CHANGEVISUALIZATION_OVERVIEW_" + sCommandCategoryName.toUpperCase();
201
+ ChangeVisualization.prototype._getChangeCategoryButton = function(sChangeCategoryName) {
202
+ var sButtonKey = "BTN_CHANGEVISUALIZATION_OVERVIEW_" + sChangeCategoryName.toUpperCase();
237
203
  return this._oTextBundle.getText(sButtonKey);
238
204
  };
239
205
 
@@ -267,79 +233,31 @@ sap.ui.define([
267
233
  };
268
234
 
269
235
  /**
270
- * Sets the selected command category and visualizes all changes for the given category
236
+ * Sets the selected change category and visualizes all changes for the given category
271
237
  *
272
238
  * @param {event} oEvent - Event
273
- * @returns {Promise} - Promise of category change
274
239
  */
275
- ChangeVisualization.prototype.onCommandCategorySelection = function(oEvent) {
276
- var sSelectedCommandCategory = oEvent.getSource().getBindingContext("visualizationModel").getObject().key;
277
- return this._selectCommandCategory(sSelectedCommandCategory);
240
+ ChangeVisualization.prototype.onChangeCategorySelection = function(oEvent) {
241
+ var sSelectedChangeCategory = oEvent.getSource().getBindingContext("visualizationModel").getObject().key;
242
+ this._selectChangeCategory(sSelectedChangeCategory);
278
243
  };
279
244
 
280
- ChangeVisualization.prototype._selectCommandCategory = function(sSelectedCommandCategory) {
281
- this._sSelectedCommandCategory = sSelectedCommandCategory;
245
+ ChangeVisualization.prototype._selectChangeCategory = function(sSelectedChangeCategory) {
246
+ this._sSelectedChangeCategory = sSelectedChangeCategory;
282
247
 
283
- var aRegisteredChanges = this._oChangeIndicatorRegistry.getChanges();
284
- var aRelevantChanges = this._getChangesForCommandCategory(sSelectedCommandCategory, aRegisteredChanges);
285
-
286
- var sCommandCategoryText = this._getCommandCategoryButton(sSelectedCommandCategory);
248
+ var sChangeCategoryText = this._getChangeCategoryButton(sSelectedChangeCategory);
287
249
 
288
250
  this._updateVisualizationModel({
289
- commandCategory: sSelectedCommandCategory,
290
- commandCategoryText: sCommandCategoryText
251
+ changeCategory: sSelectedChangeCategory,
252
+ changeCategoryText: sChangeCategoryText
291
253
  });
292
254
 
293
- return Promise.all(aRelevantChanges.map(function(oChange) {
294
- return this._getVisualizationInfo(oChange)
295
- .then(function(mVisualizationInfo) {
296
- this._oChangeIndicatorRegistry.addVisualizationInfo(
297
- oChange.change.getId(),
298
- mVisualizationInfo
299
- );
300
- }.bind(this));
301
- }.bind(this)))
302
- .then(function() {
303
- this._updateChangeIndicators();
304
- this._setFocusedIndicator();
305
- }.bind(this));
306
- };
307
-
308
- ChangeVisualization.prototype._getVisualizationInfo = function(mChangeInformation) {
309
- var oComponent = this._getComponent();
310
-
311
- function getSelectorIds(aSelectorList) {
312
- if (!aSelectorList) {
313
- return undefined;
314
- }
315
- return aSelectorList
316
- .map(function(vSelector) {
317
- var oElement = typeof vSelector.getId === "function"
318
- ? vSelector
319
- : JsControlTreeModifier.bySelector(vSelector, oComponent);
320
- return oElement && oElement.getId();
321
- })
322
- .filter(Boolean);
323
- }
324
-
325
- return this._getInfoFromChangeHandler(oComponent, mChangeInformation.change)
326
- .then(function(oInfoFromChangeHandler) {
327
- var mVisualizationInfo = oInfoFromChangeHandler || {};
328
- var aAffectedElementIds = (
329
- getSelectorIds(mVisualizationInfo.affectedControls || [mChangeInformation.change.getSelector()])
330
- );
331
-
332
- return {
333
- affectedElementIds: aAffectedElementIds,
334
- dependentElementIds: getSelectorIds(mVisualizationInfo.dependentControls) || [],
335
- displayElementIds: getSelectorIds(mVisualizationInfo.displayControls) || aAffectedElementIds,
336
- payload: mVisualizationInfo.payload
337
- };
338
- });
255
+ this._updateChangeIndicators();
256
+ this._setFocusedIndicator();
339
257
  };
340
258
 
341
259
  ChangeVisualization.prototype._getCommandForChange = function(oChange) {
342
- var sCommand = oChange.getDefinition().support.command;
260
+ var sCommand = oChange.getSupportInformation().command;
343
261
  if (sCommand) {
344
262
  return sCommand;
345
263
  }
@@ -382,36 +300,6 @@ sap.ui.define([
382
300
  && searchForCommand(OverlayRegistry.getOverlay(oLastDependentSelectorControl));
383
301
  };
384
302
 
385
- ChangeVisualization.prototype._getInfoFromChangeHandler = function(oAppComponent, oChange) {
386
- var oControl = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
387
- if (oControl) {
388
- var mPropertyBag = {
389
- modifier: JsControlTreeModifier,
390
- appComponent: oAppComponent,
391
- view: FlUtils.getViewForControl(oControl)
392
- };
393
- var mControl = ChangesUtils.getControlIfTemplateAffected(oChange, oControl, mPropertyBag);
394
- return ChangesWriteAPI.getChangeHandler({
395
- changeType: oChange.getChangeType(),
396
- element: mControl.control,
397
- modifier: JsControlTreeModifier,
398
- layer: oChange.getLayer()
399
- })
400
- .then(function(oChangeHandler) {
401
- if (oChangeHandler && typeof oChangeHandler.getChangeVisualizationInfo === "function") {
402
- return oChangeHandler.getChangeVisualizationInfo(oChange, oAppComponent);
403
- }
404
- return undefined;
405
- })
406
- .catch(function(vErr) {
407
- Log.error(vErr);
408
- return undefined;
409
- });
410
- }
411
-
412
- return Promise.resolve();
413
- };
414
-
415
303
  ChangeVisualization.prototype._collectChanges = function() {
416
304
  var oComponent = this._getComponent();
417
305
  var mPropertyBag = {
@@ -427,10 +315,12 @@ sap.ui.define([
427
315
 
428
316
  ChangeVisualization.prototype._updateChangeRegistry = function() {
429
317
  return this._collectChanges().then(function(aChanges) {
430
- var aRegisteredChangeIds = this._oChangeIndicatorRegistry.getChangeIds();
318
+ var aRegisteredChangeIds = this._oChangeIndicatorRegistry.getRegisteredChangeIds();
431
319
  var oCurrentChanges = aChanges
432
320
  .filter(function(oChange) {
433
- return oChange.getFileType() === 'change';
321
+ // Filter out changes with different fileTypes (e.g. variant)
322
+ // or without selectors (e.g. App Descriptor changes)
323
+ return oChange.getFileType() === "change" && oChange.getSelector();
434
324
  })
435
325
  .reduce(function(oChanges, oChange) {
436
326
  oChanges[oChange.getId()] = oChange;
@@ -443,12 +333,14 @@ sap.ui.define([
443
333
  this._oChangeIndicatorRegistry.removeChange(sChangeIdToRemove);
444
334
  }.bind(this));
445
335
 
336
+ var aPromises = [];
446
337
  // Register missing changes
447
338
  difference(aCurrentChangeIds, aRegisteredChangeIds).forEach(function(sChangeIdToAdd) {
448
339
  var oChangeToAdd = oCurrentChanges[sChangeIdToAdd];
449
340
  var sCommandName = this._getCommandForChange(oChangeToAdd);
450
- this._oChangeIndicatorRegistry.registerChange(oChangeToAdd, sCommandName);
341
+ aPromises.push(this._oChangeIndicatorRegistry.registerChange(oChangeToAdd, sCommandName));
451
342
  }.bind(this));
343
+ return Promise.all(aPromises);
452
344
  }.bind(this));
453
345
  };
454
346
 
@@ -458,7 +350,7 @@ sap.ui.define([
458
350
  };
459
351
 
460
352
  ChangeVisualization.prototype._selectChange = function(sChangeId) {
461
- var aDependentElements = this._oChangeIndicatorRegistry.getChange(sChangeId).visualizationInfo.dependentElementIds;
353
+ var aDependentElements = this._oChangeIndicatorRegistry.getRegisteredChange(sChangeId).visualizationInfo.dependentElementIds;
462
354
  aDependentElements.forEach(function(sElementId) {
463
355
  var oOverlayDomRef = OverlayRegistry.getOverlay(sElementId).getDomRef();
464
356
  oOverlayDomRef.scrollIntoViewIfNeeded();
@@ -478,19 +370,31 @@ sap.ui.define([
478
370
  };
479
371
 
480
372
  ChangeVisualization.prototype._updateChangeIndicators = function() {
481
- var oSelectors = this._oChangeIndicatorRegistry.getChangeIndicatorData();
373
+ var oSelectors = this._oChangeIndicatorRegistry.getSelectorsWithRegisteredChanges();
482
374
  var oIndicators = {};
483
375
  var aVisualizedChanges = [];
484
376
  Object.keys(oSelectors)
485
377
  .forEach(function(sSelectorId) {
486
- var aChanges = oSelectors[sSelectorId];
378
+ var aRelevantChanges = this._filterRelevantChanges(oSelectors[sSelectorId]);
487
379
  var oOverlay = OverlayRegistry.getOverlay(sSelectorId);
380
+ if (!oOverlay) {
381
+ // When the selector has no Overlay, check if there is a relevant container Overlay
382
+ // e.g. when a SmartForm group is removed
383
+ aRelevantChanges.some(function(oChange) {
384
+ var oElementOverlay = OverlayRegistry.getOverlay(oChange.affectedElementId);
385
+ var oRelevantContainer = oElementOverlay && oElementOverlay.getRelevantContainer();
386
+ if (oRelevantContainer) {
387
+ oOverlay = OverlayRegistry.getOverlay(oRelevantContainer);
388
+ return true;
389
+ }
390
+ return false;
391
+ });
392
+ }
488
393
  if (!oOverlay || !oOverlay.getDomRef() || !oOverlay.isVisible()) {
489
394
  // Change is not visible
490
395
  return undefined;
491
396
  }
492
397
  var oOverlayPosition = oOverlay.getDomRef().getClientRects()[0] || { left: 0, top: 0 };
493
- var aRelevantChanges = this._filterRelevantChanges(aChanges);
494
398
  aRelevantChanges.forEach(function (oChange) {
495
399
  aVisualizedChanges.push(oChange);
496
400
  });
@@ -500,8 +404,13 @@ sap.ui.define([
500
404
  changes: aRelevantChanges
501
405
  };
502
406
 
503
- if (!this._oChangeIndicatorRegistry.hasChangeIndicator(sSelectorId)) {
407
+ var oChangeIndicator = this._oChangeIndicatorRegistry.getChangeIndicator(sSelectorId);
408
+ var sOverlayId = oOverlay.getId();
409
+ if (!oChangeIndicator) {
504
410
  this._createChangeIndicator(oOverlay, sSelectorId);
411
+ } else if (oChangeIndicator.getOverlayId() !== sOverlayId) {
412
+ // Overlay id might change, e.g. during undo/redo of dirty changes
413
+ oChangeIndicator.setOverlayId(sOverlayId);
505
414
  }
506
415
  return undefined;
507
416
  }.bind(this));
@@ -522,18 +431,19 @@ sap.ui.define([
522
431
  }
523
432
  };
524
433
 
525
- ChangeVisualization.prototype._filterRelevantChanges = function(aChanges) {
526
- if (!Array.isArray(aChanges)) {
527
- return aChanges;
434
+ ChangeVisualization.prototype._filterRelevantChanges = function(aChangeVizInfo) {
435
+ if (!Array.isArray(aChangeVizInfo)) {
436
+ return aChangeVizInfo;
528
437
  }
529
438
  var oRootData = this._oChangeVisualizationModel.getData();
530
439
 
531
- return aChanges.filter(function(oChange) {
440
+ return aChangeVizInfo.filter(function(oChangeVizInfo) {
532
441
  return (
533
- !oChange.dependent
442
+ !oChangeVizInfo.dependent
443
+ && oChangeVizInfo.changeCategory
534
444
  && (
535
- oRootData.commandCategory === 'all'
536
- || oRootData.commandCategory === oChange.commandCategory
445
+ oRootData.changeCategory === ChangeCategories.ALL
446
+ || oRootData.changeCategory === oChangeVizInfo.changeCategory
537
447
  )
538
448
  );
539
449
  });
@@ -552,10 +462,6 @@ sap.ui.define([
552
462
  oChangeIndicator.setModel(this._oChangeVisualizationModel);
553
463
  oChangeIndicator.bindElement("/content/" + sSelectorId);
554
464
  oChangeIndicator.setModel(this.getModel("i18n"), "i18n");
555
-
556
- // Temporarily place the indicator in the static area
557
- // It will move itself to the correct overlay after rendering
558
- oChangeIndicator.placeAt(sap.ui.getCore().getStaticAreaRef());
559
465
  this._oChangeIndicatorRegistry.registerChangeIndicator(sSelectorId, oChangeIndicator);
560
466
  };
561
467
 
@@ -626,8 +532,8 @@ sap.ui.define([
626
532
  this.setIsActive(true);
627
533
  // show all change visualizations at startup
628
534
  this._updateChangeRegistry()
629
- .then(this._selectCommandCategory.bind(this, this._sSelectedCommandCategory))
630
535
  .then(function() {
536
+ this._selectChangeCategory(this._sSelectedChangeCategory);
631
537
  this._updateVisualizationModelMenuData();
632
538
  oToolbar.setModel(this._oChangeVisualizationModel, "visualizationModel");
633
539
  }.bind(this));
@@ -1,5 +1,5 @@
1
- /*
2
- * ! OpenUI5
1
+ /*!
2
+ * OpenUI5
3
3
  * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
@@ -0,0 +1,87 @@
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/dt/ElementUtil",
11
+ "sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils"
12
+ ], function(
13
+ Core,
14
+ JsControlTreeModifier,
15
+ ElementUtil,
16
+ ChangeVisualizationUtils
17
+ ) {
18
+ "use strict";
19
+
20
+ var oRtaResourceBundle = Core.getLibraryResourceBundle("sap.ui.rta");
21
+
22
+ var CombineVisualization = {};
23
+
24
+ /**
25
+ * Creates a localized description for combine changes based on the provided
26
+ * payload containing the combined elements.
27
+ *
28
+ * @param {object} mPayload - Change visualization payload from the change handler
29
+ * @param {array.<string>} mPayload.originalSelectors - Selectors of the elements that were combined
30
+ * @param {string} sLabel - Current element label
31
+ * @param {object} mPropertyBag - Additional properties
32
+ * @param {sap.ui.core.Component} mPropertyBag.appComponent - Application component
33
+ * @returns {object} Map containing localized description text and tooltip
34
+ */
35
+ CombineVisualization.getDescription = function (mPayload, sLabel, mPropertyBag) {
36
+ var iOriginalSelectorCount = (mPayload.originalSelectors || []).length;
37
+ if (iOriginalSelectorCount < 2) {
38
+ // Fallback if no payload was provided
39
+ return {
40
+ descriptionText: oRtaResourceBundle.getText(
41
+ "TXT_CHANGEVISUALIZATION_CHANGE_COMBINE",
42
+ [ChangeVisualizationUtils.shortenString(sLabel)]
43
+ ),
44
+ descriptionTooltip: oRtaResourceBundle.getText(
45
+ "TXT_CHANGEVISUALIZATION_CHANGE_COMBINE",
46
+ [sLabel]
47
+ )
48
+ };
49
+ }
50
+
51
+ var oAppComponent = mPropertyBag.appComponent;
52
+ var aOriginalSelectors = mPayload.originalSelectors;
53
+ var aLabels = aOriginalSelectors.map(function (oSelector) {
54
+ var sId = JsControlTreeModifier.getControlIdBySelector(oSelector, oAppComponent);
55
+ var oControl = Core.byId(sId);
56
+ return oControl ? ElementUtil.getLabelForElement(oControl) : sId;
57
+ });
58
+ var aShortLabels = aLabels.map(ChangeVisualizationUtils.shortenString);
59
+
60
+ if (iOriginalSelectorCount === 2) {
61
+ return {
62
+ descriptionText: oRtaResourceBundle.getText(
63
+ "TXT_CHANGEVISUALIZATION_CHANGE_COMBINE_TWO",
64
+ aShortLabels
65
+ ),
66
+ descriptionTooltip: oRtaResourceBundle.getText(
67
+ "TXT_CHANGEVISUALIZATION_CHANGE_COMBINE_TWO",
68
+ aLabels
69
+ )
70
+ };
71
+ }
72
+
73
+ return {
74
+ descriptionText: oRtaResourceBundle.getText(
75
+ "TXT_CHANGEVISUALIZATION_CHANGE_COMBINE_MANY",
76
+ [aLabels.length]
77
+ ),
78
+ descriptionTooltip: aLabels
79
+ .map(function(sLabel) {
80
+ return "\"" + sLabel + "\"";
81
+ })
82
+ .join(",\n")
83
+ };
84
+ };
85
+
86
+ return CombineVisualization;
87
+ });
@@ -1,5 +1,5 @@
1
- /*
2
- * ! OpenUI5
1
+ /*!
2
+ * OpenUI5
3
3
  * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
@@ -20,6 +20,8 @@ sap.ui.define([
20
20
  * current element label.
21
21
  *
22
22
  * @param {object} mPayload - Change visualization payload from the change handler
23
+ * @param {string} mPayload.sourceParentContainer - Parent container from where the element was moved
24
+ * @param {string} mPayload.targetParentContainer - Parent container to where the element was moved
23
25
  * @param {string} sLabel - Change handler label
24
26
  * @param {object} mPropertyBag - Additional properties
25
27
  * @returns {object} Localized description text and button text
@@ -40,9 +42,9 @@ sap.ui.define([
40
42
  );
41
43
 
42
44
  if (sSourceParentId !== sTargetParentId) {
43
- sButtonText = oRtaResourceBundle.getText("BTN_CHANGEVISUALIZATION_SHOW_DEPENDENT_CONTAINER_MOVE");
44
45
  sDescriptionText = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_MOVE", ChangeVisualizationUtils.shortenString(sLabel));
45
- sDescriptionTooltip = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_MOVE", sLabel);
46
+ sDescriptionTooltip = (sSourceParentId && oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_MOVE", sLabel)) || "";
47
+ sButtonText = sSourceParentId && oRtaResourceBundle.getText("BTN_CHANGEVISUALIZATION_SHOW_DEPENDENT_CONTAINER_MOVE");
46
48
  }
47
49
  return { descriptionText: sDescriptionText, descriptionTooltip: sDescriptionTooltip, buttonText: sButtonText };
48
50
  };
@@ -1,5 +1,5 @@
1
- /*
2
- * ! OpenUI5
1
+ /*!
2
+ * OpenUI5
3
3
  * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
@@ -1,12 +1,14 @@
1
- /*
2
- * ! OpenUI5
1
+ /*!
2
+ * OpenUI5
3
3
  * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
+ "sap/ui/core/Core",
8
9
  "sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils"
9
10
  ], function(
11
+ Core,
10
12
  ChangeVisualizationUtils
11
13
  ) {
12
14
  "use strict";
@@ -18,11 +20,11 @@ sap.ui.define([
18
20
  * current element label
19
21
  *
20
22
  * @param {object} mPayload - Change visualization payload from the change handler
21
- * @param {string} sLabel - Change handler label
23
+ * @param {string} sLabel - Current element label
22
24
  * @returns {object} Localized description text and button text
23
25
  */
24
26
  SplitVisualization.getDescription = function (mPayload, sLabel) {
25
- var oRtaResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
27
+ var oRtaResourceBundle = Core.getLibraryResourceBundle("sap.ui.rta");
26
28
  var sDescriptionText = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_SPLIT", ChangeVisualizationUtils.shortenString(sLabel));
27
29
  var sDescriptionTooltip = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_SPLIT", sLabel);
28
30
  var sButtonText = oRtaResourceBundle.getText("BTN_CHANGEVISUALIZATION_SHOW_DEPENDENT_CONTAINER_SPLIT");
@@ -0,0 +1,37 @@
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/rta/util/changeVisualization/commands/RenameVisualization",
9
+ "sap/ui/rta/util/changeVisualization/commands/MoveVisualization",
10
+ "sap/ui/rta/util/changeVisualization/commands/CombineVisualization",
11
+ "sap/ui/rta/util/changeVisualization/commands/SplitVisualization"
12
+ ], function(
13
+ RenameVisualization,
14
+ MoveVisualization,
15
+ CombineVisualization,
16
+ SplitVisualization
17
+ ) {
18
+ "use strict";
19
+
20
+ var mCommands = {
21
+ rename: RenameVisualization,
22
+ move: MoveVisualization,
23
+ combine: CombineVisualization,
24
+ split: SplitVisualization
25
+ };
26
+
27
+ return function(mIndicatorInformation) {
28
+ var sCommandName = mIndicatorInformation.commandName;
29
+
30
+ // Settings commands can be assigned to existing categories
31
+ // (e.g. "move" to display the "Show Source" button)
32
+ if (sCommandName === "settings") {
33
+ sCommandName = mIndicatorInformation.changeCategory;
34
+ }
35
+ return mCommands[sCommandName];
36
+ };
37
+ });