@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,37 +8,29 @@ sap.ui.define([
8
8
  "sap/ui/core/Fragment",
9
9
  "sap/ui/model/json/JSONModel",
10
10
  "sap/ui/core/Control",
11
- "sap/m/Text",
12
11
  "sap/ui/core/format/DateFormat",
13
12
  "sap/ui/events/KeyCodes",
14
- "sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory",
13
+ "sap/ui/rta/util/changeVisualization/commands/getCommandVisualization",
15
14
  "sap/ui/fl/Utils",
16
15
  "sap/ui/fl/util/resolveBinding",
17
16
  "sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils",
18
- "sap/ui/core/Core"
17
+ "sap/ui/core/Core",
18
+ "sap/ui/rta/util/changeVisualization/ChangeCategories"
19
19
  ], function(
20
20
  Fragment,
21
21
  JSONModel,
22
22
  Control,
23
- Text,
24
23
  DateFormat,
25
24
  KeyCodes,
26
- getVisualizationCategory,
25
+ getCommandVisualization,
27
26
  FlUtils,
28
27
  resolveBinding,
29
28
  ChangeVisualizationUtils,
30
- Core
29
+ Core,
30
+ ChangeCategories
31
31
  ) {
32
32
  "use strict";
33
33
 
34
- var CATEGORY_ICONS = {
35
- add: "sap-icon://add",
36
- move: "sap-icon://move",
37
- rename: "sap-icon://edit",
38
- combinesplit: "sap-icon://combine",
39
- remove: "sap-icon://less"
40
- };
41
-
42
34
  /**
43
35
  * @class
44
36
  * Constructor for a new <code>sap.ui.rta.util.changeVisualization.ChangeIndicator</code> class.
@@ -48,7 +40,7 @@ sap.ui.define([
48
40
  * @alias sap.ui.rta.util.changeVisualization.ChangeIndicator
49
41
  * @author SAP SE
50
42
  * @since 1.84.0
51
- * @version 1.103.1
43
+ * @version 1.106.0
52
44
  * @private
53
45
  */
54
46
  var ChangeIndicator = Control.extend("sap.ui.rta.util.changeVisualization.ChangeIndicator", {
@@ -160,7 +152,7 @@ sap.ui.define([
160
152
 
161
153
  function centerVertically(oIndicator) {
162
154
  var oIndicatorDomRef = oIndicator.getDomRef();
163
- var iOverlayHeight = document.getElementById(oIndicator.getOverlayId()).offsetHeight;
155
+ var iOverlayHeight = Core.byId(oIndicator.getOverlayId()).getDomRef().offsetHeight;
164
156
  var iIndicatorHeight = oIndicatorDomRef.offsetHeight;
165
157
  // the indicator should be centered only if the element has a small enough height to improve the design and visibility
166
158
  if (iOverlayHeight < iIndicatorHeight * 5) {
@@ -168,6 +160,93 @@ sap.ui.define([
168
160
  }
169
161
  }
170
162
 
163
+ function getTexts(mChangeInformation, oRtaResourceBundle, sOverlayId) {
164
+ var oAffectedElement = Core.byId(mChangeInformation.affectedElementId);
165
+ var mPayload = Object.keys(mChangeInformation.payload || {}).reduce(function(mPayload, sKey) {
166
+ var vOriginalValue = mChangeInformation.payload[sKey];
167
+ var bIsBinding = FlUtils.isBinding(vOriginalValue);
168
+ var vValue = bIsBinding
169
+ ? resolveBinding(vOriginalValue, oAffectedElement)
170
+ : vOriginalValue;
171
+ mPayload[sKey] = vValue;
172
+ return mPayload;
173
+ }, {});
174
+
175
+ var mPropertyBag = { appComponent: FlUtils.getAppComponentForControl(oAffectedElement) };
176
+ var oOverlay = Core.byId(sOverlayId);
177
+ var sElementLabel = oOverlay.getDesignTimeMetadata().getLabel(oAffectedElement);
178
+ var oCommandVisualization = getCommandVisualization(mChangeInformation);
179
+ var oDescription = oCommandVisualization && oCommandVisualization.getDescription(mPayload, sElementLabel, mPropertyBag) || {};
180
+ var sCommandName = mChangeInformation.commandName;
181
+ var sDescriptionText;
182
+ var sDescriptionTooltip;
183
+
184
+ // 'Settings' with a custom description should overwrite the description from the CommandVisualization
185
+ if (sCommandName === "settings" && mPayload.description) {
186
+ oDescription.descriptionText = mPayload.description;
187
+ oDescription.descriptionTooltip = mPayload.descriptionTooltip;
188
+ } else if (mChangeInformation.changeCategory === "other") {
189
+ // To retrieve the generic description for commands without visualization
190
+ sCommandName = "other";
191
+ }
192
+
193
+ if (oDescription.descriptionText) {
194
+ sDescriptionText = oDescription.descriptionText;
195
+ sDescriptionTooltip = oDescription.descriptionTooltip || "";
196
+ } else {
197
+ sElementLabel = sElementLabel && "'" + sElementLabel + "'";
198
+ var sShortenedElementLabel = ChangeVisualizationUtils.shortenString(sElementLabel);
199
+ var sChangeTextKey = (
200
+ "TXT_CHANGEVISUALIZATION_CHANGE_"
201
+ + sCommandName.toUpperCase()
202
+ );
203
+ sDescriptionText = oRtaResourceBundle.getText(sChangeTextKey, sShortenedElementLabel);
204
+ sDescriptionTooltip = oRtaResourceBundle.getText(sChangeTextKey, sElementLabel);
205
+ }
206
+ sDescriptionTooltip = sDescriptionText.length < sDescriptionTooltip.length ? sDescriptionTooltip : null;
207
+ var sDetailButtonText = oDescription && oDescription.buttonText;
208
+ var sIconTooltip = oRtaResourceBundle.getText(
209
+ "TXT_CHANGEVISUALIZATION_OVERVIEW_"
210
+ + mChangeInformation.changeCategory.toUpperCase()
211
+ );
212
+
213
+ return {
214
+ description: sDescriptionText,
215
+ tooltip: sDescriptionTooltip,
216
+ buttonText: sDetailButtonText,
217
+ iconTooltip: sIconTooltip
218
+ };
219
+ }
220
+
221
+ function getDates(mChangeInformation, oRtaResourceBundle) {
222
+ var sCreationDate = mChangeInformation.change.getCreation();
223
+ var oDate = new Date(sCreationDate);
224
+ var sFallbackDate = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CREATED_IN_SESSION_DATE");
225
+
226
+ return {
227
+ fullDate: sCreationDate ? DateFormat.getDateTimeInstance().format(oDate) : sFallbackDate,
228
+ relativeDate: sCreationDate ? DateFormat.getDateTimeInstance({ relative: "true" }).format(oDate) : sFallbackDate
229
+ };
230
+ }
231
+
232
+ function formatChangesModelItem(sOverlayId, mChangeInformation) {
233
+ var oRtaResourceBundle = Core.getLibraryResourceBundle("sap.ui.rta");
234
+ var oTexts = getTexts(mChangeInformation, oRtaResourceBundle, sOverlayId);
235
+ var oDates = getDates(mChangeInformation, oRtaResourceBundle);
236
+
237
+ return {
238
+ id: mChangeInformation.id,
239
+ change: mChangeInformation,
240
+ description: oTexts.description,
241
+ descriptionTooltip: oTexts.tooltip,
242
+ fullDate: oDates.fullDate,
243
+ relativeDate: oDates.relativeDate,
244
+ detailButtonText: oTexts.buttonText,
245
+ icon: ChangeCategories.getIconForCategory(mChangeInformation.changeCategory),
246
+ iconTooltip: oTexts.iconTooltip
247
+ };
248
+ }
249
+
171
250
  ChangeIndicator.prototype.init = function() {
172
251
  this._iOldTabIndex = 0;
173
252
  handleBrowserEventsOnElement.call(this, this, "attachBrowserEvent");
@@ -203,11 +282,28 @@ sap.ui.define([
203
282
  this._bScheduledForFocus = true;
204
283
  };
205
284
 
285
+ ChangeIndicator.prototype.setOverlayId = function(sOverlayId) {
286
+ // Overlays don't have aggregations, thus the indicator dom ref must be placed as
287
+ // a child of the overlay dom ref manually
288
+ // If the overlay that the indicator should be attached to changes, it is possible that the
289
+ // indicator is not rendered yet or that the old overlay and thus the nested indicator were destroyed
290
+ // To properly render it, the indicator must temporarily be placed in the static area
291
+ // Once it is rendered, it can move itself to the actual overlay dom ref (see onAfterRendering)
292
+ var oDomRef = this.getDomRef();
293
+ if (oDomRef) {
294
+ oDomRef.parentNode.removeChild(oDomRef);
295
+ }
296
+ this.placeAt(Core.getStaticAreaRef());
297
+
298
+ this.setProperty("overlayId", sOverlayId);
299
+ return this;
300
+ };
301
+
206
302
  ChangeIndicator.prototype.onAfterRendering = function() {
207
- var oOverlay = document.getElementById(this.getOverlayId());
303
+ var oOverlay = Core.getElementById(this.getOverlayId());
208
304
  if (oOverlay) {
209
305
  // Attach to the overlay
210
- oOverlay.appendChild(this.getDomRef());
306
+ oOverlay.getDomRef().appendChild(this.getDomRef());
211
307
  centerVertically(this);
212
308
  }
213
309
  // Restore the Tabindex if stored before; set to 0 as default
@@ -237,7 +333,7 @@ sap.ui.define([
237
333
 
238
334
  ChangeIndicator.prototype.setChanges = function(aChanges) {
239
335
  this.setProperty("changes", aChanges);
240
- this._oDetailModel.setData((aChanges || []).reverse().map(this._formatChangesModelItem.bind(this)));
336
+ this._oDetailModel.setData((aChanges || []).reverse().map(formatChangesModelItem.bind(this, this.getOverlayId())));
241
337
  };
242
338
 
243
339
  ChangeIndicator.prototype._onSelect = function(oEvent) {
@@ -270,50 +366,6 @@ sap.ui.define([
270
366
  this[sFunctionName]("sapUiRtaHover");
271
367
  };
272
368
 
273
- ChangeIndicator.prototype._formatChangesModelItem = function(mChangeInformation) {
274
- var oAffectedElement = Core.byId(mChangeInformation.affectedElementId);
275
- var mPayload = Object.keys(mChangeInformation.payload || {}).reduce(function(mPayload, sKey) {
276
- var vOriginalValue = mChangeInformation.payload[sKey];
277
- var bIsBinding = FlUtils.isBinding(vOriginalValue);
278
- var vValue = bIsBinding
279
- ? resolveBinding(vOriginalValue, oAffectedElement)
280
- : vOriginalValue;
281
- mPayload[sKey] = vValue;
282
- return mPayload;
283
- }, {});
284
-
285
- var mPropertyBag = { appComponent: FlUtils.getAppComponentForControl(oAffectedElement) };
286
- var oOverlay = Core.byId(this.getOverlayId());
287
- var sElementLabel = oOverlay.getDesignTimeMetadata().getLabel(oAffectedElement);
288
- var oVisualizationUtil = getVisualizationCategory(mChangeInformation.commandName);
289
- var oDescription = oVisualizationUtil && oVisualizationUtil.getDescription(mPayload, sElementLabel, mPropertyBag);
290
- var oRtaResourceBundle = Core.getLibraryResourceBundle("sap.ui.rta");
291
- sElementLabel = sElementLabel && "'" + sElementLabel + "'";
292
- var sShortenedElementLabel = ChangeVisualizationUtils.shortenString(sElementLabel);
293
- var sChangeTextKey = (
294
- "TXT_CHANGEVISUALIZATION_CHANGE_"
295
- + mChangeInformation.commandName.toUpperCase()
296
- );
297
- var sDescriptionText = oDescription ? oDescription.descriptionText : oRtaResourceBundle.getText(sChangeTextKey, sShortenedElementLabel);
298
- var sDescriptionTooltip = oDescription ? oDescription.descriptionTooltip : oRtaResourceBundle.getText(sChangeTextKey, sElementLabel);
299
- var sCreationDate = mChangeInformation.change.getCreation();
300
- var oDate = new Date(sCreationDate);
301
- var sFallbackDate = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CREATED_IN_SESSION_DATE");
302
- var sFullDate = sCreationDate ? DateFormat.getDateTimeInstance().format(oDate) : sFallbackDate;
303
- var sRelativeDate = sCreationDate ? DateFormat.getDateTimeInstance({ relative: "true" }).format(oDate) : sFallbackDate;
304
- var sDetailButtonText = oDescription && oDescription.buttonText;
305
- return {
306
- id: mChangeInformation.id,
307
- change: mChangeInformation,
308
- description: sDescriptionText,
309
- descriptionTooltip: sDescriptionTooltip && sDescriptionText.length < sDescriptionTooltip.length ? sDescriptionTooltip : null,
310
- fullDate: sFullDate,
311
- relativeDate: sRelativeDate,
312
- detailButtonText: sDetailButtonText,
313
- icon: CATEGORY_ICONS[mChangeInformation.commandCategory]
314
- };
315
- };
316
-
317
369
  ChangeIndicator.prototype._openDetailPopover = function() {
318
370
  if (!this.getAggregation("_popover")) {
319
371
  //store the tabindex (tabindex will be removed on opening the popover)
@@ -18,13 +18,13 @@
18
18
  </MessageStrip>
19
19
  <List
20
20
  class="sapUiRtaChangesList"
21
- items="{visualizationModel>/commandCategories/}">
21
+ items="{visualizationModel>/changeCategories/}">
22
22
  <StandardListItem
23
23
  title="{visualizationModel>title}"
24
24
  counter="{visualizationModel>count}"
25
25
  type="{= ${visualizationModel>count} > 0 ? 'Active' : 'Inactive'}"
26
26
  icon="{visualizationModel>icon}"
27
- press=".onCommandCategorySelection"/>
27
+ press=".onChangeCategorySelection"/>
28
28
  </List>
29
29
  </Popover>
30
30
  </core:FragmentDefinition>
@@ -31,7 +31,8 @@
31
31
  <cells>
32
32
  <core:Icon
33
33
  src="{details>icon}"
34
- class="sapUiTinyMarginBegin"/>
34
+ class="sapUiTinyMarginBegin"
35
+ tooltip="{details>iconTooltip}"/>
35
36
  <HBox alignItems="Center">
36
37
  <Text
37
38
  text="{details>description}"
@@ -5,15 +5,29 @@
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",
17
+ "sap/ui/fl/changeHandler/common/ChangeCategories",
18
+ "sap/ui/core/Core"
12
19
  ], function(
13
- ManagedObject,
14
20
  includes,
15
21
  values,
16
- _omit
22
+ _omit,
23
+ Log,
24
+ ManagedObject,
25
+ JsControlTreeModifier,
26
+ ElementUtil,
27
+ ChangesWriteAPI,
28
+ FlUtils,
29
+ ChangeCategories,
30
+ Core
17
31
  ) {
18
32
  "use strict";
19
33
 
@@ -25,7 +39,7 @@ sap.ui.define([
25
39
  * @alias sap.ui.rta.util.changeVisualization.ChangeIndicatorRegistry
26
40
  * @author SAP SE
27
41
  * @since 1.86.0
28
- * @version 1.103.1
42
+ * @version 1.106.0
29
43
  * @private
30
44
  */
31
45
  var ChangeIndicatorRegistry = ManagedObject.extend("sap.ui.rta.util.changeVisualization.ChangeIndicatorRegistry", {
@@ -34,15 +48,25 @@ sap.ui.define([
34
48
  /**
35
49
  * Available command categories
36
50
  */
37
- commandCategories: {
51
+ changeCategories: {
38
52
  type: "object",
39
53
  defaultValue: []
54
+ },
55
+ /**
56
+ * Id of the component or control to visualize the changes for
57
+ */
58
+ rootControlId: {
59
+ type: "string"
40
60
  }
41
61
  }
42
62
  },
43
63
  constructor: function () {
44
64
  ManagedObject.prototype.constructor.apply(this, arguments);
45
- this._oChanges = {};
65
+
66
+ // List of entries with indicator data, grouped by Change ID
67
+ this._oRegisteredChanges = {};
68
+
69
+ // List of actual change indicator objects, grouped by selector
46
70
  this._oChangeIndicators = {};
47
71
  }
48
72
  });
@@ -52,12 +76,12 @@ sap.ui.define([
52
76
  };
53
77
 
54
78
  /**
55
- * Returns all registered changes.
79
+ * Returns the change indicator data for all registered changes.
56
80
  *
57
- * @returns {object[]} Registered changes
81
+ * @returns {object[]} Change indicator data for all registered changes
58
82
  */
59
- ChangeIndicatorRegistry.prototype.getChanges = function () {
60
- return values(this._oChanges || {}).map(function (oChange) {
83
+ ChangeIndicatorRegistry.prototype.getAllRegisteredChanges = function () {
84
+ return values(this._oRegisteredChanges || {}).map(function (oChange) {
61
85
  return Object.assign({}, oChange);
62
86
  });
63
87
  };
@@ -65,69 +89,65 @@ sap.ui.define([
65
89
  /**
66
90
  * Returns the IDs of all registered changes.
67
91
  *
68
- * @returns {string[]} Promise with both design time and runtime change
92
+ * @returns {string[]} Array with both design time and runtime registered changes
69
93
  */
70
- ChangeIndicatorRegistry.prototype.getChangeIds = function () {
71
- return Object.keys(this._oChanges || {});
94
+ ChangeIndicatorRegistry.prototype.getRegisteredChangeIds = function () {
95
+ return Object.keys(this._oRegisteredChanges || {});
72
96
  };
73
97
 
74
98
  /**
75
- * Returns a registered change.
99
+ * Returns a data entry of a registered change indicator for a change ID.
76
100
  *
77
101
  * @param {string} sChangeId - ID of the registered change
78
102
  * @returns {object} Registered change
79
103
  */
80
- ChangeIndicatorRegistry.prototype.getChange = function (sChangeId) {
81
- return this._oChanges[sChangeId] && Object.assign({}, this._oChanges[sChangeId]);
104
+ ChangeIndicatorRegistry.prototype.getRegisteredChange = function (sChangeId) {
105
+ return this._oRegisteredChanges[sChangeId] && Object.assign({}, this._oRegisteredChanges[sChangeId]);
82
106
  };
83
107
 
84
108
  /**
85
109
  * Groups all registered changes by their selectors and returns a list of selectors
86
- * with all dependent and non-dependent changes.
110
+ * with all dependent and non-dependent change indicator data.
87
111
  *
88
- * @returns {object[]} Change indicators
112
+ * @returns {object} List of selectors with change indicator data.
89
113
  */
90
- ChangeIndicatorRegistry.prototype.getChangeIndicatorData = function () {
114
+ ChangeIndicatorRegistry.prototype.getSelectorsWithRegisteredChanges = function () {
91
115
  var oChangeIndicators = {};
92
116
 
93
- function addSelector (sSelectorId, sAffectedElementId, oChange, bDependent) {
117
+ function addSelector (sSelectorId, sAffectedElementId, oChangeIndicatorData, bDependent) {
94
118
  if (oChangeIndicators[sSelectorId] === undefined) {
95
119
  oChangeIndicators[sSelectorId] = [];
96
120
  }
97
121
  oChangeIndicators[sSelectorId].push(Object.assign(
98
122
  {
99
- id: oChange.change.getId(),
123
+ id: oChangeIndicatorData.change.getId(),
100
124
  dependent: bDependent,
101
125
  affectedElementId: sAffectedElementId,
102
- payload: oChange.visualizationInfo.payload || {}
126
+ payload: oChangeIndicatorData.visualizationInfo.payload || {}
103
127
  },
104
- _omit(oChange, ["visualizationInfo"])
128
+ _omit(oChangeIndicatorData, ["visualizationInfo"])
105
129
  ));
106
130
  }
107
131
 
108
- values(this._oChanges).forEach(function (oChange) {
109
- oChange.visualizationInfo.displayElementIds.forEach(function (sSelectorId, iIndex) {
110
- addSelector(sSelectorId, oChange.visualizationInfo.affectedElementIds[iIndex], oChange, false);
111
- });
132
+ values(this._oRegisteredChanges)
133
+ .forEach(function (oChangeIndicatorData) {
134
+ oChangeIndicatorData.visualizationInfo.displayElementIds
135
+ .forEach(function (sId, iIndex) {
136
+ // in some cases (like with simple forms) you have to pass the stable id of the child element because the parent id is unstable
137
+ if (oChangeIndicatorData.visualizationInfo.hasParentWithUnstableId) {
138
+ sId = Core.byId(sId).getParent().getId();
139
+ }
140
+ addSelector(sId, oChangeIndicatorData.visualizationInfo.affectedElementIds[iIndex], oChangeIndicatorData, false);
141
+ });
112
142
 
113
- oChange.visualizationInfo.dependentElementIds.forEach(function (sSelectorId) {
114
- addSelector(sSelectorId, sSelectorId, oChange, true);
143
+ oChangeIndicatorData.visualizationInfo.dependentElementIds.forEach(function (sId) {
144
+ addSelector(sId, sId, oChangeIndicatorData, true);
145
+ });
115
146
  });
116
- });
117
147
 
118
148
  return oChangeIndicators;
119
149
  };
120
150
 
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
151
  /**
132
152
  * Returns the registered change indicator for the given element ID.
133
153
  *
@@ -152,25 +172,88 @@ sap.ui.define([
152
172
  *
153
173
  * @param {object} oChange - The change to register
154
174
  * @param {string} sCommandName - Command name of the change
175
+ * @returns {Promise<undefined>} Resolves as soon as the change is registered
155
176
  */
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: []
177
+ ChangeIndicatorRegistry.prototype.registerChange = function(oChange, sCommandName) {
178
+ var oAppComponent = FlUtils.getAppComponentForControl(ElementUtil.getElementInstance(this.getRootControlId()));
179
+ return getVisualizationInfo(oChange, oAppComponent).then(function(mChangeVisualizationInfo) {
180
+ var aCategories = this.getChangeCategories();
181
+ var sChangeCategory;
182
+ // For "settings", the control developer can choose one of the existing categories
183
+ if (sCommandName === "settings" && includes(Object.keys(aCategories), mChangeVisualizationInfo.payload.category)) {
184
+ sChangeCategory = mChangeVisualizationInfo.payload.category;
185
+ } else {
186
+ sChangeCategory = Object.keys(aCategories).find(function (sChangeCategoryName) {
187
+ return includes(aCategories[sChangeCategoryName], sCommandName);
188
+ });
189
+ if (!sChangeCategory) {
190
+ sChangeCategory = ChangeCategories.OTHER;
191
+ }
168
192
  }
169
- };
170
193
 
171
- this._oChanges[oChange.getId()] = oNewChangeInformation;
194
+ this._oRegisteredChanges[oChange.getId()] = {
195
+ change: oChange,
196
+ commandName: sCommandName,
197
+ changeCategory: sChangeCategory,
198
+ visualizationInfo: mChangeVisualizationInfo
199
+ };
200
+ }.bind(this));
172
201
  };
173
202
 
203
+ function getVisualizationInfo(oChange, oAppComponent) {
204
+ function getSelectorIds(aSelectorList) {
205
+ if (!aSelectorList) {
206
+ return undefined;
207
+ }
208
+ return aSelectorList
209
+ .map(function(vSelector) {
210
+ var oElement = typeof vSelector.getId === "function"
211
+ ? vSelector
212
+ : JsControlTreeModifier.bySelector(vSelector, oAppComponent);
213
+ return oElement && oElement.getId();
214
+ })
215
+ .filter(Boolean);
216
+ }
217
+
218
+ return getInfoFromChangeHandler(oAppComponent, oChange)
219
+ .then(function(oInfoFromChangeHandler) {
220
+ var mVisualizationInfo = oInfoFromChangeHandler || {};
221
+ var aAffectedElementIds = getSelectorIds(mVisualizationInfo.affectedControls || [oChange.getSelector()]);
222
+
223
+ return {
224
+ affectedElementIds: aAffectedElementIds,
225
+ dependentElementIds: getSelectorIds(mVisualizationInfo.dependentControls) || [],
226
+ displayElementIds: getSelectorIds(mVisualizationInfo.displayControls) || aAffectedElementIds,
227
+ hasParentWithUnstableId: mVisualizationInfo.hasParentWithUnstableId,
228
+ payload: mVisualizationInfo.payload || {}
229
+ };
230
+ });
231
+ }
232
+
233
+ function getInfoFromChangeHandler(oAppComponent, oChange) {
234
+ var oControl = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
235
+ if (oControl) {
236
+ return ChangesWriteAPI.getChangeHandler({
237
+ changeType: oChange.getChangeType(),
238
+ element: oControl,
239
+ modifier: JsControlTreeModifier,
240
+ layer: oChange.getLayer()
241
+ })
242
+ .then(function(oChangeHandler) {
243
+ if (oChangeHandler && typeof oChangeHandler.getChangeVisualizationInfo === "function") {
244
+ return oChangeHandler.getChangeVisualizationInfo(oChange, oAppComponent);
245
+ }
246
+ return undefined;
247
+ })
248
+ .catch(function(vErr) {
249
+ Log.error(vErr);
250
+ return undefined;
251
+ });
252
+ }
253
+
254
+ return Promise.resolve();
255
+ }
256
+
174
257
  /**
175
258
  * Adds a change indicator to the registry.
176
259
  *
@@ -181,31 +264,12 @@ sap.ui.define([
181
264
  this._oChangeIndicators[sSelectorId] = oChangeIndicator;
182
265
  };
183
266
 
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
267
  /**
204
268
  * Resets the change and change indicator registries.
205
269
  */
206
270
  ChangeIndicatorRegistry.prototype.reset = function () {
207
- Object.keys(this._oChanges).forEach(function (sKeyToRemove) {
208
- this.removeChange(sKeyToRemove);
271
+ Object.keys(this._oRegisteredChanges).forEach(function (sKeyToRemove) {
272
+ this.removeRegisteredChange(sKeyToRemove);
209
273
  }.bind(this));
210
274
 
211
275
  values(this._oChangeIndicators).forEach(function (oIndicator) {
@@ -215,12 +279,12 @@ sap.ui.define([
215
279
  };
216
280
 
217
281
  /**
218
- * Removes a change.
282
+ * Removes a data entry of a registered change indicator.
219
283
  *
220
284
  * @param {string} sChangeId - ID of the registered change
221
285
  */
222
- ChangeIndicatorRegistry.prototype.removeChange = function (sChangeId) {
223
- delete this._oChanges[sChangeId];
286
+ ChangeIndicatorRegistry.prototype.removeRegisteredChange = function (sChangeId) {
287
+ delete this._oRegisteredChanges[sChangeId];
224
288
  };
225
289
 
226
290
  return ChangeIndicatorRegistry;