@openui5/sap.ui.rta 1.104.0 → 1.105.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/.reuse/dep5 +1 -1
  2. package/THIRDPARTY.txt +1 -1
  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 +12 -6
  7. package/src/sap/ui/rta/Utils.js +1 -1
  8. package/src/sap/ui/rta/api/startAdaptation.js +2 -2
  9. package/src/sap/ui/rta/api/startKeyUserAdaptation.js +2 -2
  10. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  11. package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +5 -3
  12. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  13. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  14. package/src/sap/ui/rta/command/AddXML.js +1 -1
  15. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  16. package/src/sap/ui/rta/command/AppDescriptorCommand.js +8 -3
  17. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  18. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  19. package/src/sap/ui/rta/command/Combine.js +1 -1
  20. package/src/sap/ui/rta/command/CommandFactory.js +1 -1
  21. package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
  22. package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
  23. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  24. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +2 -2
  25. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +2 -2
  26. package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
  27. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  28. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  29. package/src/sap/ui/rta/command/FlexCommand.js +1 -1
  30. package/src/sap/ui/rta/command/LREPSerializer.js +11 -8
  31. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  32. package/src/sap/ui/rta/command/Move.js +1 -1
  33. package/src/sap/ui/rta/command/Property.js +1 -1
  34. package/src/sap/ui/rta/command/Remove.js +1 -1
  35. package/src/sap/ui/rta/command/Rename.js +1 -1
  36. package/src/sap/ui/rta/command/Resize.js +1 -1
  37. package/src/sap/ui/rta/command/Reveal.js +1 -1
  38. package/src/sap/ui/rta/command/Settings.js +1 -1
  39. package/src/sap/ui/rta/command/Split.js +1 -1
  40. package/src/sap/ui/rta/command/Stack.js +3 -3
  41. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  42. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  43. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
  44. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  45. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
  46. package/src/sap/ui/rta/enablement/elementActionTest.js +1 -1
  47. package/src/sap/ui/rta/library.js +2 -2
  48. package/src/sap/ui/rta/messagebundle_ar.properties +13 -1
  49. package/src/sap/ui/rta/messagebundle_bg.properties +13 -1
  50. package/src/sap/ui/rta/messagebundle_ca.properties +13 -1
  51. package/src/sap/ui/rta/messagebundle_cs.properties +13 -1
  52. package/src/sap/ui/rta/messagebundle_cy.properties +13 -1
  53. package/src/sap/ui/rta/messagebundle_da.properties +13 -1
  54. package/src/sap/ui/rta/messagebundle_de.properties +13 -1
  55. package/src/sap/ui/rta/messagebundle_el.properties +13 -1
  56. package/src/sap/ui/rta/messagebundle_en.properties +13 -1
  57. package/src/sap/ui/rta/messagebundle_en_GB.properties +13 -1
  58. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +5 -0
  59. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +13 -1
  60. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +13 -1
  61. package/src/sap/ui/rta/messagebundle_es.properties +13 -1
  62. package/src/sap/ui/rta/messagebundle_es_MX.properties +13 -1
  63. package/src/sap/ui/rta/messagebundle_et.properties +13 -1
  64. package/src/sap/ui/rta/messagebundle_fi.properties +13 -1
  65. package/src/sap/ui/rta/messagebundle_fr.properties +13 -1
  66. package/src/sap/ui/rta/messagebundle_fr_CA.properties +13 -1
  67. package/src/sap/ui/rta/messagebundle_hi.properties +13 -1
  68. package/src/sap/ui/rta/messagebundle_hr.properties +13 -1
  69. package/src/sap/ui/rta/messagebundle_hu.properties +13 -1
  70. package/src/sap/ui/rta/messagebundle_id.properties +13 -1
  71. package/src/sap/ui/rta/messagebundle_it.properties +13 -1
  72. package/src/sap/ui/rta/messagebundle_iw.properties +13 -1
  73. package/src/sap/ui/rta/messagebundle_ja.properties +13 -1
  74. package/src/sap/ui/rta/messagebundle_kk.properties +13 -1
  75. package/src/sap/ui/rta/messagebundle_ko.properties +13 -1
  76. package/src/sap/ui/rta/messagebundle_lt.properties +13 -1
  77. package/src/sap/ui/rta/messagebundle_lv.properties +13 -1
  78. package/src/sap/ui/rta/messagebundle_ms.properties +13 -1
  79. package/src/sap/ui/rta/messagebundle_nl.properties +13 -1
  80. package/src/sap/ui/rta/messagebundle_no.properties +13 -1
  81. package/src/sap/ui/rta/messagebundle_pl.properties +13 -1
  82. package/src/sap/ui/rta/messagebundle_pt.properties +13 -1
  83. package/src/sap/ui/rta/messagebundle_pt_PT.properties +13 -1
  84. package/src/sap/ui/rta/messagebundle_ro.properties +13 -1
  85. package/src/sap/ui/rta/messagebundle_ru.properties +13 -1
  86. package/src/sap/ui/rta/messagebundle_sh.properties +13 -1
  87. package/src/sap/ui/rta/messagebundle_sk.properties +13 -1
  88. package/src/sap/ui/rta/messagebundle_sl.properties +13 -1
  89. package/src/sap/ui/rta/messagebundle_sv.properties +13 -1
  90. package/src/sap/ui/rta/messagebundle_th.properties +13 -1
  91. package/src/sap/ui/rta/messagebundle_tr.properties +13 -1
  92. package/src/sap/ui/rta/messagebundle_uk.properties +13 -1
  93. package/src/sap/ui/rta/messagebundle_vi.properties +13 -1
  94. package/src/sap/ui/rta/messagebundle_zh_CN.properties +13 -1
  95. package/src/sap/ui/rta/messagebundle_zh_TW.properties +13 -1
  96. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +1 -1
  97. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  98. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  99. package/src/sap/ui/rta/plugin/CompVariant.js +2 -2
  100. package/src/sap/ui/rta/plugin/ControlVariant.js +21 -15
  101. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  102. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  103. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  104. package/src/sap/ui/rta/plugin/EasyAdd.js +1 -1
  105. package/src/sap/ui/rta/plugin/EasyRemove.js +1 -1
  106. package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
  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/Rename.js +1 -1
  111. package/src/sap/ui/rta/plugin/RenameHandler.js +1 -1
  112. package/src/sap/ui/rta/plugin/Resize.js +1 -1
  113. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  114. package/src/sap/ui/rta/plugin/Settings.js +1 -1
  115. package/src/sap/ui/rta/plugin/Split.js +1 -1
  116. package/src/sap/ui/rta/plugin/Stretch.js +1 -1
  117. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  118. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  119. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
  120. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  121. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
  122. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
  123. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  124. package/src/sap/ui/rta/service/Action.js +1 -1
  125. package/src/sap/ui/rta/service/ControllerExtension.js +8 -9
  126. package/src/sap/ui/rta/service/Outline.js +1 -1
  127. package/src/sap/ui/rta/service/Property.js +1 -1
  128. package/src/sap/ui/rta/service/Selection.js +1 -1
  129. package/src/sap/ui/rta/toolbar/Adaptation.js +1 -1
  130. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  131. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  132. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  133. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  134. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  135. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  136. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  137. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  138. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  139. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  140. package/src/sap/ui/rta/util/ReloadManager.js +3 -2
  141. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  142. package/src/sap/ui/rta/util/adaptationStarter.js +2 -2
  143. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +80 -48
  144. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +100 -55
  145. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +21 -101
  146. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +2 -2
  147. package/src/sap/ui/rta/util/changeVisualization/categories/CombineVisualization.js +2 -2
  148. package/src/sap/ui/rta/util/changeVisualization/categories/MoveVisualization.js +3 -3
  149. package/src/sap/ui/rta/util/changeVisualization/categories/RenameVisualization.js +2 -2
  150. package/src/sap/ui/rta/util/changeVisualization/categories/SplitVisualization.js +2 -2
  151. package/src/sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory.js +8 -3
@@ -5,15 +5,25 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
- "sap/ui/base/ManagedObject",
9
8
  "sap/base/util/includes",
10
9
  "sap/base/util/values",
11
- "sap/base/util/restricted/_omit"
10
+ "sap/base/util/restricted/_omit",
11
+ "sap/base/Log",
12
+ "sap/ui/base/ManagedObject",
13
+ "sap/ui/core/util/reflection/JsControlTreeModifier",
14
+ "sap/ui/dt/ElementUtil",
15
+ "sap/ui/fl/write/api/ChangesWriteAPI",
16
+ "sap/ui/fl/Utils"
12
17
  ], function(
13
- ManagedObject,
14
18
  includes,
15
19
  values,
16
- _omit
20
+ _omit,
21
+ Log,
22
+ ManagedObject,
23
+ JsControlTreeModifier,
24
+ ElementUtil,
25
+ ChangesWriteAPI,
26
+ FlUtils
17
27
  ) {
18
28
  "use strict";
19
29
 
@@ -25,7 +35,7 @@ sap.ui.define([
25
35
  * @alias sap.ui.rta.util.changeVisualization.ChangeIndicatorRegistry
26
36
  * @author SAP SE
27
37
  * @since 1.86.0
28
- * @version 1.104.0
38
+ * @version 1.105.1
29
39
  * @private
30
40
  */
31
41
  var ChangeIndicatorRegistry = ManagedObject.extend("sap.ui.rta.util.changeVisualization.ChangeIndicatorRegistry", {
@@ -37,12 +47,18 @@ sap.ui.define([
37
47
  commandCategories: {
38
48
  type: "object",
39
49
  defaultValue: []
50
+ },
51
+ /**
52
+ * Id of the component or control to visualize the changes for
53
+ */
54
+ rootControlId: {
55
+ type: "string"
40
56
  }
41
57
  }
42
58
  },
43
59
  constructor: function () {
44
60
  ManagedObject.prototype.constructor.apply(this, arguments);
45
- this._oChanges = {};
61
+ this._oChangeIndicatorData = {};
46
62
  this._oChangeIndicators = {};
47
63
  }
48
64
  });
@@ -57,7 +73,7 @@ sap.ui.define([
57
73
  * @returns {object[]} Registered changes
58
74
  */
59
75
  ChangeIndicatorRegistry.prototype.getChanges = function () {
60
- return values(this._oChanges || {}).map(function (oChange) {
76
+ return values(this._oChangeIndicatorData || {}).map(function (oChange) {
61
77
  return Object.assign({}, oChange);
62
78
  });
63
79
  };
@@ -68,7 +84,7 @@ sap.ui.define([
68
84
  * @returns {string[]} Promise with both design time and runtime change
69
85
  */
70
86
  ChangeIndicatorRegistry.prototype.getChangeIds = function () {
71
- return Object.keys(this._oChanges || {});
87
+ return Object.keys(this._oChangeIndicatorData || {});
72
88
  };
73
89
 
74
90
  /**
@@ -78,7 +94,7 @@ sap.ui.define([
78
94
  * @returns {object} Registered change
79
95
  */
80
96
  ChangeIndicatorRegistry.prototype.getChange = function (sChangeId) {
81
- return this._oChanges[sChangeId] && Object.assign({}, this._oChanges[sChangeId]);
97
+ return this._oChangeIndicatorData[sChangeId] && Object.assign({}, this._oChangeIndicatorData[sChangeId]);
82
98
  };
83
99
 
84
100
  /**
@@ -105,7 +121,7 @@ sap.ui.define([
105
121
  ));
106
122
  }
107
123
 
108
- values(this._oChanges).forEach(function (oChange) {
124
+ values(this._oChangeIndicatorData).forEach(function (oChange) {
109
125
  oChange.visualizationInfo.displayElementIds.forEach(function (sSelectorId, iIndex) {
110
126
  addSelector(sSelectorId, oChange.visualizationInfo.affectedElementIds[iIndex], oChange, false);
111
127
  });
@@ -118,16 +134,6 @@ sap.ui.define([
118
134
  return oChangeIndicators;
119
135
  };
120
136
 
121
- /**
122
- * Checks if the given element ID was registered as a change indicator.
123
- *
124
- * @param {string} sSelectorId - ID of the element to check
125
- * @returns {boolean} Whether the element was registered as an indicator
126
- */
127
- ChangeIndicatorRegistry.prototype.hasChangeIndicator = function (sSelectorId) {
128
- return !!this._oChangeIndicators[sSelectorId];
129
- };
130
-
131
137
  /**
132
138
  * Returns the registered change indicator for the given element ID.
133
139
  *
@@ -152,25 +158,83 @@ sap.ui.define([
152
158
  *
153
159
  * @param {object} oChange - The change to register
154
160
  * @param {string} sCommandName - Command name of the change
161
+ * @returns {Promise<undefined>} Resolves as soon as the change is registered
155
162
  */
156
- ChangeIndicatorRegistry.prototype.registerChange = function (oChange, sCommandName) {
157
- var aCategories = this.getCommandCategories();
158
- var oNewChangeInformation = {
159
- change: oChange,
160
- commandName: sCommandName,
161
- commandCategory: Object.keys(aCategories).find(function (sCommandCategoryName) {
162
- return includes(aCategories[sCommandCategoryName], sCommandName);
163
- }),
164
- visualizationInfo: {
165
- affectedElementIds: [],
166
- displayElementIds: [],
167
- dependentElementIds: []
163
+ ChangeIndicatorRegistry.prototype.registerChange = function(oChange, sCommandName) {
164
+ var oAppComponent = FlUtils.getAppComponentForControl(ElementUtil.getElementInstance(this.getRootControlId()));
165
+ return getVisualizationInfo(oChange, oAppComponent).then(function(mChangeVisualizationInfo) {
166
+ var aCategories = this.getCommandCategories();
167
+ var sCommandCategory;
168
+ if (sCommandName === "settings" && includes(Object.keys(aCategories), mChangeVisualizationInfo.payload.category)) {
169
+ sCommandCategory = mChangeVisualizationInfo.payload.category;
170
+ } else {
171
+ sCommandCategory = Object.keys(aCategories).find(function (sCommandCategoryName) {
172
+ return includes(aCategories[sCommandCategoryName], sCommandName);
173
+ });
168
174
  }
169
- };
170
175
 
171
- this._oChanges[oChange.getId()] = oNewChangeInformation;
176
+ this._oChangeIndicatorData[oChange.getId()] = {
177
+ change: oChange,
178
+ commandName: sCommandName,
179
+ commandCategory: sCommandCategory,
180
+ visualizationInfo: mChangeVisualizationInfo
181
+ };
182
+ }.bind(this));
172
183
  };
173
184
 
185
+ function getVisualizationInfo(oChange, oAppComponent) {
186
+ function getSelectorIds(aSelectorList) {
187
+ if (!aSelectorList) {
188
+ return undefined;
189
+ }
190
+ return aSelectorList
191
+ .map(function(vSelector) {
192
+ var oElement = typeof vSelector.getId === "function"
193
+ ? vSelector
194
+ : JsControlTreeModifier.bySelector(vSelector, oAppComponent);
195
+ return oElement && oElement.getId();
196
+ })
197
+ .filter(Boolean);
198
+ }
199
+
200
+ return getInfoFromChangeHandler(oAppComponent, oChange)
201
+ .then(function(oInfoFromChangeHandler) {
202
+ var mVisualizationInfo = oInfoFromChangeHandler || {};
203
+ var aAffectedElementIds = getSelectorIds(mVisualizationInfo.affectedControls || [oChange.getSelector()]);
204
+
205
+ return {
206
+ affectedElementIds: aAffectedElementIds,
207
+ dependentElementIds: getSelectorIds(mVisualizationInfo.dependentControls) || [],
208
+ displayElementIds: getSelectorIds(mVisualizationInfo.displayControls) || aAffectedElementIds,
209
+ payload: mVisualizationInfo.payload || {}
210
+ };
211
+ });
212
+ }
213
+
214
+ function getInfoFromChangeHandler(oAppComponent, oChange) {
215
+ var oControl = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
216
+ if (oControl) {
217
+ return ChangesWriteAPI.getChangeHandler({
218
+ changeType: oChange.getChangeType(),
219
+ element: oControl,
220
+ modifier: JsControlTreeModifier,
221
+ layer: oChange.getLayer()
222
+ })
223
+ .then(function(oChangeHandler) {
224
+ if (oChangeHandler && typeof oChangeHandler.getChangeVisualizationInfo === "function") {
225
+ return oChangeHandler.getChangeVisualizationInfo(oChange, oAppComponent);
226
+ }
227
+ return undefined;
228
+ })
229
+ .catch(function(vErr) {
230
+ Log.error(vErr);
231
+ return undefined;
232
+ });
233
+ }
234
+
235
+ return Promise.resolve();
236
+ }
237
+
174
238
  /**
175
239
  * Adds a change indicator to the registry.
176
240
  *
@@ -181,30 +245,11 @@ sap.ui.define([
181
245
  this._oChangeIndicators[sSelectorId] = oChangeIndicator;
182
246
  };
183
247
 
184
- /**
185
- * Adds selectors for a registered change.
186
- *
187
- * @param {string} sChangeId - ID of the registered change
188
- * @param {object} mVisualizationInfo - Map of selector IDs to register
189
- * @param {string[]} [mVisualizationInfo.affectedElementIds] - Array of affected element IDs
190
- * @param {string[]} [mVisualizationInfo.displayElementIds] - Array of element IDs that the indicators are attached to
191
- * @param {string[]} [mVisualizationInfo.dependentElementIds] - Array of element IDs that the dependent indicators are attached to
192
- * @param {object} [mVisualizationInfo.payload] - Command category specific visualization information
193
- */
194
- ChangeIndicatorRegistry.prototype.addVisualizationInfo = function (sChangeId, mVisualizationInfo) {
195
- var oChange = this._oChanges[sChangeId];
196
- if (oChange === undefined) {
197
- throw new Error("Change id is not registered");
198
- }
199
-
200
- oChange.visualizationInfo = Object.assign({}, oChange.visualizationInfo, mVisualizationInfo);
201
- };
202
-
203
248
  /**
204
249
  * Resets the change and change indicator registries.
205
250
  */
206
251
  ChangeIndicatorRegistry.prototype.reset = function () {
207
- Object.keys(this._oChanges).forEach(function (sKeyToRemove) {
252
+ Object.keys(this._oChangeIndicatorData).forEach(function (sKeyToRemove) {
208
253
  this.removeChange(sKeyToRemove);
209
254
  }.bind(this));
210
255
 
@@ -220,7 +265,7 @@ sap.ui.define([
220
265
  * @param {string} sChangeId - ID of the registered change
221
266
  */
222
267
  ChangeIndicatorRegistry.prototype.removeChange = function (sChangeId) {
223
- delete this._oChanges[sChangeId];
268
+ delete this._oChangeIndicatorData[sChangeId];
224
269
  };
225
270
 
226
271
  return ChangeIndicatorRegistry;
@@ -8,14 +8,10 @@ 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
- "sap/ui/dt/OverlayUtil",
16
14
  "sap/ui/dt/ElementUtil",
17
- "sap/ui/fl/apply/_internal/changes/Utils",
18
- "sap/ui/fl/write/api/ChangesWriteAPI",
19
15
  "sap/ui/fl/write/api/PersistenceWriteAPI",
20
16
  "sap/ui/fl/Layer",
21
17
  "sap/ui/fl/Utils",
@@ -27,14 +23,10 @@ sap.ui.define([
27
23
  Fragment,
28
24
  difference,
29
25
  deepEqual,
30
- Log,
31
26
  JsControlTreeModifier,
32
27
  Control,
33
28
  OverlayRegistry,
34
- OverlayUtil,
35
29
  ElementUtil,
36
- ChangesUtils,
37
- ChangesWriteAPI,
38
30
  PersistenceWriteAPI,
39
31
  Layer,
40
32
  FlUtils,
@@ -95,7 +87,7 @@ sap.ui.define([
95
87
  * @alias sap.ui.rta.util.changeVisualization.ChangeVisualization
96
88
  * @author SAP SE
97
89
  * @since 1.84.0
98
- * @version 1.104.0
90
+ * @version 1.105.1
99
91
  * @private
100
92
  */
101
93
  var ChangeVisualization = Control.extend("sap.ui.rta.util.changeVisualization.ChangeVisualization", {
@@ -124,11 +116,12 @@ sap.ui.define([
124
116
  }
125
117
  },
126
118
  constructor: function() {
127
- Control.prototype.constructor.apply(this, arguments);
128
-
129
119
  this._oChangeIndicatorRegistry = new ChangeIndicatorRegistry({
130
120
  commandCategories: VALID_COMMANDS
131
121
  });
122
+
123
+ Control.prototype.constructor.apply(this, arguments);
124
+
132
125
  this._oTextBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
133
126
  this.setModel(new ResourceModel({
134
127
  bundle: this._oTextBundle
@@ -151,6 +144,7 @@ sap.ui.define([
151
144
  this._reset();
152
145
  }
153
146
  this.setProperty("rootControlId", sRootControlId);
147
+ this._oChangeIndicatorRegistry.setRootControlId(sRootControlId);
154
148
  };
155
149
 
156
150
  ChangeVisualization.prototype._getComponent = function() {
@@ -276,15 +270,12 @@ sap.ui.define([
276
270
  */
277
271
  ChangeVisualization.prototype.onCommandCategorySelection = function(oEvent) {
278
272
  var sSelectedCommandCategory = oEvent.getSource().getBindingContext("visualizationModel").getObject().key;
279
- return this._selectCommandCategory(sSelectedCommandCategory);
273
+ this._selectCommandCategory(sSelectedCommandCategory);
280
274
  };
281
275
 
282
276
  ChangeVisualization.prototype._selectCommandCategory = function(sSelectedCommandCategory) {
283
277
  this._sSelectedCommandCategory = sSelectedCommandCategory;
284
278
 
285
- var aRegisteredChanges = this._oChangeIndicatorRegistry.getChanges();
286
- var aRelevantChanges = this._getChangesForCommandCategory(sSelectedCommandCategory, aRegisteredChanges);
287
-
288
279
  var sCommandCategoryText = this._getCommandCategoryButton(sSelectedCommandCategory);
289
280
 
290
281
  this._updateVisualizationModel({
@@ -292,52 +283,8 @@ sap.ui.define([
292
283
  commandCategoryText: sCommandCategoryText
293
284
  });
294
285
 
295
- return Promise.all(aRelevantChanges.map(function(oChange) {
296
- return this._getVisualizationInfo(oChange)
297
- .then(function(mVisualizationInfo) {
298
- this._oChangeIndicatorRegistry.addVisualizationInfo(
299
- oChange.change.getId(),
300
- mVisualizationInfo
301
- );
302
- }.bind(this));
303
- }.bind(this)))
304
- .then(function() {
305
- this._updateChangeIndicators();
306
- this._setFocusedIndicator();
307
- }.bind(this));
308
- };
309
-
310
- ChangeVisualization.prototype._getVisualizationInfo = function(mChangeInformation) {
311
- var oComponent = this._getComponent();
312
-
313
- function getSelectorIds(aSelectorList) {
314
- if (!aSelectorList) {
315
- return undefined;
316
- }
317
- return aSelectorList
318
- .map(function(vSelector) {
319
- var oElement = typeof vSelector.getId === "function"
320
- ? vSelector
321
- : JsControlTreeModifier.bySelector(vSelector, oComponent);
322
- return oElement && oElement.getId();
323
- })
324
- .filter(Boolean);
325
- }
326
-
327
- return this._getInfoFromChangeHandler(oComponent, mChangeInformation.change)
328
- .then(function(oInfoFromChangeHandler) {
329
- var mVisualizationInfo = oInfoFromChangeHandler || {};
330
- var aAffectedElementIds = (
331
- getSelectorIds(mVisualizationInfo.affectedControls || [mChangeInformation.change.getSelector()])
332
- );
333
-
334
- return {
335
- affectedElementIds: aAffectedElementIds,
336
- dependentElementIds: getSelectorIds(mVisualizationInfo.dependentControls) || [],
337
- displayElementIds: getSelectorIds(mVisualizationInfo.displayControls) || aAffectedElementIds,
338
- payload: mVisualizationInfo.payload
339
- };
340
- });
286
+ this._updateChangeIndicators();
287
+ this._setFocusedIndicator();
341
288
  };
342
289
 
343
290
  ChangeVisualization.prototype._getCommandForChange = function(oChange) {
@@ -384,36 +331,6 @@ sap.ui.define([
384
331
  && searchForCommand(OverlayRegistry.getOverlay(oLastDependentSelectorControl));
385
332
  };
386
333
 
387
- ChangeVisualization.prototype._getInfoFromChangeHandler = function(oAppComponent, oChange) {
388
- var oControl = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
389
- if (oControl) {
390
- var mPropertyBag = {
391
- modifier: JsControlTreeModifier,
392
- appComponent: oAppComponent,
393
- view: FlUtils.getViewForControl(oControl)
394
- };
395
- var mControl = ChangesUtils.getControlIfTemplateAffected(oChange, oControl, mPropertyBag);
396
- return ChangesWriteAPI.getChangeHandler({
397
- changeType: oChange.getChangeType(),
398
- element: mControl.control,
399
- modifier: JsControlTreeModifier,
400
- layer: oChange.getLayer()
401
- })
402
- .then(function(oChangeHandler) {
403
- if (oChangeHandler && typeof oChangeHandler.getChangeVisualizationInfo === "function") {
404
- return oChangeHandler.getChangeVisualizationInfo(oChange, oAppComponent);
405
- }
406
- return undefined;
407
- })
408
- .catch(function(vErr) {
409
- Log.error(vErr);
410
- return undefined;
411
- });
412
- }
413
-
414
- return Promise.resolve();
415
- };
416
-
417
334
  ChangeVisualization.prototype._collectChanges = function() {
418
335
  var oComponent = this._getComponent();
419
336
  var mPropertyBag = {
@@ -432,7 +349,7 @@ sap.ui.define([
432
349
  var aRegisteredChangeIds = this._oChangeIndicatorRegistry.getChangeIds();
433
350
  var oCurrentChanges = aChanges
434
351
  .filter(function(oChange) {
435
- return oChange.getFileType() === 'change';
352
+ return oChange.getFileType() === "change";
436
353
  })
437
354
  .reduce(function(oChanges, oChange) {
438
355
  oChanges[oChange.getId()] = oChange;
@@ -445,12 +362,14 @@ sap.ui.define([
445
362
  this._oChangeIndicatorRegistry.removeChange(sChangeIdToRemove);
446
363
  }.bind(this));
447
364
 
365
+ var aPromises = [];
448
366
  // Register missing changes
449
367
  difference(aCurrentChangeIds, aRegisteredChangeIds).forEach(function(sChangeIdToAdd) {
450
368
  var oChangeToAdd = oCurrentChanges[sChangeIdToAdd];
451
369
  var sCommandName = this._getCommandForChange(oChangeToAdd);
452
- this._oChangeIndicatorRegistry.registerChange(oChangeToAdd, sCommandName);
370
+ aPromises.push(this._oChangeIndicatorRegistry.registerChange(oChangeToAdd, sCommandName));
453
371
  }.bind(this));
372
+ return Promise.all(aPromises);
454
373
  }.bind(this));
455
374
  };
456
375
 
@@ -541,18 +460,19 @@ sap.ui.define([
541
460
  }
542
461
  };
543
462
 
544
- ChangeVisualization.prototype._filterRelevantChanges = function(aChanges) {
545
- if (!Array.isArray(aChanges)) {
546
- return aChanges;
463
+ ChangeVisualization.prototype._filterRelevantChanges = function(aChangeVizInfo) {
464
+ if (!Array.isArray(aChangeVizInfo)) {
465
+ return aChangeVizInfo;
547
466
  }
548
467
  var oRootData = this._oChangeVisualizationModel.getData();
549
468
 
550
- return aChanges.filter(function(oChange) {
469
+ return aChangeVizInfo.filter(function(oChangeVizInfo) {
551
470
  return (
552
- !oChange.dependent
471
+ !oChangeVizInfo.dependent
472
+ && oChangeVizInfo.commandCategory
553
473
  && (
554
- oRootData.commandCategory === 'all'
555
- || oRootData.commandCategory === oChange.commandCategory
474
+ oRootData.commandCategory === CATEGORY_ALL
475
+ || oRootData.commandCategory === oChangeVizInfo.commandCategory
556
476
  )
557
477
  );
558
478
  });
@@ -641,8 +561,8 @@ sap.ui.define([
641
561
  this.setIsActive(true);
642
562
  // show all change visualizations at startup
643
563
  this._updateChangeRegistry()
644
- .then(this._selectCommandCategory.bind(this, this._sSelectedCommandCategory))
645
564
  .then(function() {
565
+ this._selectCommandCategory(this._sSelectedCommandCategory);
646
566
  this._updateVisualizationModelMenuData();
647
567
  oToolbar.setModel(this._oChangeVisualizationModel, "visualizationModel");
648
568
  }.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
  */
@@ -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,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
  */
@@ -41,8 +41,8 @@ sap.ui.define([
41
41
 
42
42
  if (sSourceParentId !== sTargetParentId) {
43
43
  sDescriptionText = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_MOVE", ChangeVisualizationUtils.shortenString(sLabel));
44
+ sDescriptionTooltip = (sSourceParentId && oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_MOVE", sLabel)) || "";
44
45
  sButtonText = sSourceParentId && oRtaResourceBundle.getText("BTN_CHANGEVISUALIZATION_SHOW_DEPENDENT_CONTAINER_MOVE");
45
- sDescriptionTooltip = sSourceParentId && oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CHANGE_MOVE", sLabel);
46
46
  }
47
47
  return { descriptionText: sDescriptionText, descriptionTooltip: sDescriptionTooltip, buttonText: sButtonText };
48
48
  };
@@ -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,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,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
  */
@@ -24,7 +24,12 @@ sap.ui.define([
24
24
  split: SplitVisualization
25
25
  };
26
26
 
27
- return function(sCategoryName) {
27
+ return function(mIndicatorInformation) {
28
+ var sCategoryName = mIndicatorInformation.commandName;
29
+ // to enable e.g. move changes in settings commands to show the 'Show Source' button
30
+ if (sCategoryName === "settings") {
31
+ sCategoryName = mIndicatorInformation.commandCategory;
32
+ }
28
33
  return mCategories[sCategoryName];
29
34
  };
30
35
  });