@openui5/sap.ui.rta 1.140.0 → 1.141.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 (105) hide show
  1. package/THIRDPARTY.txt +2 -2
  2. package/package.json +6 -6
  3. package/src/sap/ui/rta/.library +1 -1
  4. package/src/sap/ui/rta/Client.js +1 -1
  5. package/src/sap/ui/rta/RuntimeAuthoring.js +1 -1
  6. package/src/sap/ui/rta/Utils.js +1 -1
  7. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  8. package/src/sap/ui/rta/command/AddIFrame.js +6 -8
  9. package/src/sap/ui/rta/command/AddProperty.js +2 -2
  10. package/src/sap/ui/rta/command/AddXML.js +3 -3
  11. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +17 -19
  12. package/src/sap/ui/rta/command/AnnotationCommand.js +1 -1
  13. package/src/sap/ui/rta/command/BaseCommand.js +3 -4
  14. package/src/sap/ui/rta/command/BindProperty.js +4 -4
  15. package/src/sap/ui/rta/command/Combine.js +4 -4
  16. package/src/sap/ui/rta/command/CommandFactory.js +55 -77
  17. package/src/sap/ui/rta/command/CompositeCommand.js +19 -39
  18. package/src/sap/ui/rta/command/ControlVariantConfigure.js +16 -20
  19. package/src/sap/ui/rta/command/ControlVariantSave.js +19 -28
  20. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +38 -43
  21. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +15 -26
  22. package/src/sap/ui/rta/command/ControlVariantSwitch.js +29 -50
  23. package/src/sap/ui/rta/command/CreateContainer.js +3 -3
  24. package/src/sap/ui/rta/command/CustomAdd.js +2 -2
  25. package/src/sap/ui/rta/command/ExtendControllerCommand.js +2 -4
  26. package/src/sap/ui/rta/command/FlexCommand.js +34 -44
  27. package/src/sap/ui/rta/command/LREPSerializer.js +20 -23
  28. package/src/sap/ui/rta/command/LocalReset.js +3 -3
  29. package/src/sap/ui/rta/command/ManifestCommand.js +1 -1
  30. package/src/sap/ui/rta/command/Move.js +5 -5
  31. package/src/sap/ui/rta/command/Property.js +3 -3
  32. package/src/sap/ui/rta/command/Remove.js +4 -4
  33. package/src/sap/ui/rta/command/Rename.js +3 -3
  34. package/src/sap/ui/rta/command/Resize.js +2 -2
  35. package/src/sap/ui/rta/command/Reveal.js +3 -3
  36. package/src/sap/ui/rta/command/Settings.js +2 -2
  37. package/src/sap/ui/rta/command/Split.js +3 -3
  38. package/src/sap/ui/rta/command/Stack.js +51 -55
  39. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +10 -10
  40. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +4 -4
  41. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +2 -2
  42. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +11 -11
  43. package/src/sap/ui/rta/command/manifest/AddLibrary.js +4 -8
  44. package/src/sap/ui/rta/enablement/elementActionTest.js +21 -9
  45. package/src/sap/ui/rta/library.js +2 -2
  46. package/src/sap/ui/rta/messagebundle_da.properties +1 -1
  47. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +1 -1
  48. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +1 -1
  49. package/src/sap/ui/rta/plugin/AddXMLPlugin.js +1 -1
  50. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  51. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  52. package/src/sap/ui/rta/plugin/ControlVariant.js +65 -87
  53. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  54. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  55. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  56. package/src/sap/ui/rta/plugin/ExtendControllerPlugin.js +1 -1
  57. package/src/sap/ui/rta/plugin/LocalReset.js +26 -35
  58. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  59. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  60. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  61. package/src/sap/ui/rta/plugin/Resize.js +1 -1
  62. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  63. package/src/sap/ui/rta/plugin/Settings.js +1 -1
  64. package/src/sap/ui/rta/plugin/Split.js +1 -1
  65. package/src/sap/ui/rta/plugin/Stretch.js +7 -6
  66. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  67. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  68. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +17 -5
  69. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
  70. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  71. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
  72. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +1 -1
  73. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +1 -1
  74. package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +1 -1
  75. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
  76. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  77. package/src/sap/ui/rta/plugin/rename/Rename.js +1 -1
  78. package/src/sap/ui/rta/plugin/rename/RenameDialog.js +2 -4
  79. package/src/sap/ui/rta/service/Action.js +1 -1
  80. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  81. package/src/sap/ui/rta/service/Outline.js +1 -1
  82. package/src/sap/ui/rta/service/Property.js +1 -1
  83. package/src/sap/ui/rta/service/Selection.js +1 -1
  84. package/src/sap/ui/rta/service/SupportTools.js +1 -1
  85. package/src/sap/ui/rta/toolbar/Adaptation.js +1 -1
  86. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  87. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  88. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  89. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  90. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  91. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +1 -1
  92. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  93. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  94. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  95. package/src/sap/ui/rta/util/PopupManager.js +3 -3
  96. package/src/sap/ui/rta/util/ReloadManager.js +1 -1
  97. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  98. package/src/sap/ui/rta/util/ServiceManager.js +1 -1
  99. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +1 -1
  100. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +1 -1
  101. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +1 -1
  102. package/src/sap/ui/rta/util/changeVisualization/resolveBinding.js +1 -1
  103. package/src/sap/ui/rta/util/guidedTour/GuidedTour.js +1 -1
  104. package/src/sap/ui/rta/util/guidedTour/content/GeneralTour.js +1 -1
  105. package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +1 -1
@@ -14,7 +14,6 @@ sap.ui.define([
14
14
  "sap/ui/dt/OverlayRegistry",
15
15
  "sap/ui/dt/OverlayUtil",
16
16
  "sap/ui/dt/Util",
17
- "sap/ui/fl/apply/api/ControlVariantApplyAPI",
18
17
  "sap/ui/fl/variants/VariantManagement",
19
18
  "sap/ui/fl/variants/VariantManager",
20
19
  "sap/ui/fl/write/api/ContextSharingAPI",
@@ -33,7 +32,6 @@ sap.ui.define([
33
32
  OverlayRegistry,
34
33
  OverlayUtil,
35
34
  DtUtil,
36
- ControlVariantApplyAPI,
37
35
  VariantManagement,
38
36
  VariantManager,
39
37
  ContextSharingAPI,
@@ -53,7 +51,7 @@ sap.ui.define([
53
51
  * @class The ControlVariant allows propagation of variantManagement key
54
52
  * @extends sap.ui.rta.plugin.Plugin
55
53
  * @author SAP SE
56
- * @version 1.140.0
54
+ * @version 1.141.1
57
55
  * @constructor
58
56
  * @private
59
57
  * @since 1.50
@@ -67,13 +65,13 @@ sap.ui.define([
67
65
  ElementOverlay.prototype.hasVariantManagement = function() { return !!this._variantManagement; };
68
66
 
69
67
  function destroyManageDialog(oOverlay) {
70
- var oManageDialog = oOverlay.getElement().getManageDialog();
68
+ const oManageDialog = oOverlay.getElement().getManageDialog();
71
69
  if (oManageDialog && !oManageDialog.bIsDestroyed) {
72
70
  oManageDialog.destroy();
73
71
  }
74
72
  }
75
73
 
76
- var ControlVariant = Plugin.extend("sap.ui.rta.plugin.ControlVariant", /** @lends sap.ui.rta.plugin.ControlVariant.prototype */ {
74
+ const ControlVariant = Plugin.extend("sap.ui.rta.plugin.ControlVariant", /** @lends sap.ui.rta.plugin.ControlVariant.prototype */ {
77
75
  metadata: {
78
76
  library: "sap.ui.rta",
79
77
  properties: {
@@ -85,19 +83,16 @@ sap.ui.define([
85
83
  });
86
84
 
87
85
  function getCommandForSave(oOverlay) {
88
- var oElement = oOverlay.getElement();
89
- var oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
90
- var oModel = this._getVariantModel(oElement);
91
- var sVariantManagementReference = oOverlay.getVariantManagement();
92
-
93
- return this.getCommandFactory().getCommandFor(oElement, "save", {
94
- model: oModel
95
- }, oDesignTimeMetadata, sVariantManagementReference);
86
+ const oElement = oOverlay.getElement();
87
+ const oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
88
+ const sVariantManagementReference = oOverlay.getVariantManagement();
89
+
90
+ return this.getCommandFactory().getCommandFor(oElement, "save", {}, oDesignTimeMetadata, sVariantManagementReference);
96
91
  }
97
92
 
98
93
  function getCommandForSwitch(oOverlay, sNewVariantReference, sCurrentVariantReference, bDiscardVariantContent) {
99
- var oElement = oOverlay.getElement();
100
- var oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
94
+ const oElement = oOverlay.getElement();
95
+ const oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
101
96
 
102
97
  return this.getCommandFactory().getCommandFor(oElement, "switch", {
103
98
  targetVariantReference: sNewVariantReference,
@@ -119,16 +114,15 @@ sap.ui.define([
119
114
  */
120
115
  ControlVariant.prototype.registerElementOverlay = function(...aArgs) {
121
116
  const [oOverlay] = aArgs;
122
- var oControl = oOverlay.getElement();
123
- var sVariantManagementReference;
117
+ const oControl = oOverlay.getElement();
118
+ let sVariantManagementReference;
124
119
 
125
120
  Plugin.prototype.registerElementOverlay.apply(this, aArgs);
126
121
 
127
122
  if (oControl instanceof VariantManagement) {
128
- var vAssociationElement = oControl.getFor();
129
- var aVariantManagementTargetElements;
130
- var oAppComponent = flUtils.getAppComponentForControl(oControl);
131
- var sControlId = oControl.getId();
123
+ const vAssociationElement = oControl.getFor();
124
+ const oAppComponent = flUtils.getAppComponentForControl(oControl);
125
+ const sControlId = oControl.getId();
132
126
  sVariantManagementReference = oAppComponent.getLocalId(sControlId) || sControlId;
133
127
  oOverlay.setVariantManagement(sVariantManagementReference);
134
128
 
@@ -140,13 +134,13 @@ sap.ui.define([
140
134
  return;
141
135
  }
142
136
 
143
- aVariantManagementTargetElements = !Array.isArray(vAssociationElement) ? [vAssociationElement] : vAssociationElement;
137
+ const aVariantManagementTargetElements = !Array.isArray(vAssociationElement) ? [vAssociationElement] : vAssociationElement;
144
138
 
145
139
  // Propagate variant management reference to all children overlays starting from the "for" association element as the root
146
140
  aVariantManagementTargetElements.forEach(function(sVariantManagementTargetElement) {
147
- var oVariantManagementTargetElement = sVariantManagementTargetElement instanceof ManagedObject
141
+ const oVariantManagementTargetElement = sVariantManagementTargetElement instanceof ManagedObject
148
142
  ? sVariantManagementTargetElement : Element.getElementById(sVariantManagementTargetElement);
149
- var oVariantManagementTargetOverlay = OverlayRegistry.getOverlay(oVariantManagementTargetElement);
143
+ const oVariantManagementTargetOverlay = OverlayRegistry.getOverlay(oVariantManagementTargetElement);
150
144
 
151
145
  // the control or overlay might not be available on rta start (e.g. dialog or view hidden by navigation)
152
146
  if (!oVariantManagementTargetOverlay) {
@@ -186,9 +180,8 @@ sap.ui.define([
186
180
  * @private
187
181
  */
188
182
  ControlVariant.prototype._propagateVariantManagement = function(oParentElementOverlay, sVariantManagementReference) {
189
- var aElementOverlaysRendered = [];
190
183
  oParentElementOverlay.setVariantManagement(sVariantManagementReference);
191
- aElementOverlaysRendered = OverlayUtil.getAllChildOverlays(oParentElementOverlay);
184
+ let aElementOverlaysRendered = OverlayUtil.getAllChildOverlays(oParentElementOverlay);
192
185
 
193
186
  aElementOverlaysRendered.forEach(function(oElementOverlay) {
194
187
  aElementOverlaysRendered = aElementOverlaysRendered.concat(
@@ -207,7 +200,7 @@ sap.ui.define([
207
200
  * @private
208
201
  */
209
202
  ControlVariant.prototype._getVariantManagementFromParent = function(oOverlay) {
210
- var sVariantManagementReference = oOverlay.getVariantManagement();
203
+ const sVariantManagementReference = oOverlay.getVariantManagement();
211
204
  if (!sVariantManagementReference && oOverlay.getParentElementOverlay()) {
212
205
  return this._getVariantManagementFromParent(oOverlay.getParentElementOverlay());
213
206
  }
@@ -229,11 +222,6 @@ sap.ui.define([
229
222
  Plugin.prototype.deregisterElementOverlay.apply(this, aArgs);
230
223
  };
231
224
 
232
- ControlVariant.prototype._getVariantModel = function(oElement) {
233
- var oAppComponent = flUtils.getAppComponentForControl(oElement);
234
- return oAppComponent ? oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName()) : undefined;
235
- };
236
-
237
225
  /**
238
226
  * @param {sap.ui.dt.ElementOverlay} oOverlay overlay
239
227
  * @returns {boolean} editable or not
@@ -247,8 +235,8 @@ sap.ui.define([
247
235
  };
248
236
 
249
237
  ControlVariant.prototype._isVariantManagementControl = function(oOverlay) {
250
- var oElement = oOverlay.getElement();
251
- var vAssociationElement = oElement.getAssociation("for");
238
+ const oElement = oOverlay.getElement();
239
+ const vAssociationElement = oElement.getAssociation("for");
252
240
  return !!(vAssociationElement && oElement instanceof VariantManagement);
253
241
  };
254
242
 
@@ -269,24 +257,20 @@ sap.ui.define([
269
257
  * @public
270
258
  */
271
259
  ControlVariant.prototype.isVariantSwitchEnabled = function(aElementOverlays) {
272
- var oElementOverlay = aElementOverlays[0];
273
- var aVariants = [];
260
+ const oElementOverlay = aElementOverlays[0];
274
261
  if (this._isVariantManagementControl(oElementOverlay)) {
275
- var oElement = oElementOverlay.getElement();
276
- var sVariantManagementReference = oElementOverlay.getVariantManagement ? oElementOverlay.getVariantManagement() : undefined;
262
+ const oVMControl = oElementOverlay.getElement();
263
+ const sVariantManagementReference = oElementOverlay.getVariantManagement ? oElementOverlay.getVariantManagement() : undefined;
277
264
  if (!sVariantManagementReference) {
278
265
  return false;
279
266
  }
280
- var oModel = this._getVariantModel(oElement);
281
- if (oModel) {
282
- aVariants = oModel.getData()[sVariantManagementReference].variants.reduce(function(aReducedVariants, oVariant) {
283
- if (oVariant.visible) {
284
- return aReducedVariants.concat(oVariant);
285
- }
286
- return aReducedVariants;
287
- }, []);
288
- }
289
- var bEnabled = aVariants.length > 1;
267
+ const aVariants = oVMControl.getVariants().reduce(function(aReducedVariants, oVariant) {
268
+ if (oVariant.getVisible()) {
269
+ return aReducedVariants.concat(oVariant);
270
+ }
271
+ return aReducedVariants;
272
+ }, []);
273
+ const bEnabled = aVariants.length > 1;
290
274
  return bEnabled;
291
275
  }
292
276
  return false;
@@ -330,11 +314,9 @@ sap.ui.define([
330
314
  * @public
331
315
  */
332
316
  ControlVariant.prototype.isVariantSaveEnabled = function(aElementOverlays) {
333
- var oOverlay = aElementOverlays[0];
334
- var oElement = oOverlay.getElement();
335
- var oModel = this._getVariantModel(oElement);
336
- var sVariantManagementReference = oOverlay.getVariantManagement();
337
- return oModel.oData[sVariantManagementReference] && oModel.oData[sVariantManagementReference].modified;
317
+ const oOverlay = aElementOverlays[0];
318
+ const oVMControl = oOverlay.getElement();
319
+ return oVMControl.getModified();
338
320
  };
339
321
 
340
322
  /**
@@ -386,8 +368,8 @@ sap.ui.define([
386
368
  * @public
387
369
  */
388
370
  ControlVariant.prototype.switchVariant = function(oTargetOverlay, sNewVariantReference, sCurrentVariantReference) {
389
- var oTargetElement = oTargetOverlay.getElement();
390
- var oLibraryBundle = Lib.getResourceBundleFor("sap.ui.rta");
371
+ const oTargetElement = oTargetOverlay.getElement();
372
+ const oLibraryBundle = Lib.getResourceBundleFor("sap.ui.rta");
391
373
 
392
374
  function onDirtySwitchWarningClose(sAction) {
393
375
  if (sAction === MessageBox.Action.CANCEL) {
@@ -395,7 +377,7 @@ sap.ui.define([
395
377
  }
396
378
 
397
379
  if (sAction === oLibraryBundle.getText("BTN_MODIFIED_VARIANT_SAVE")) {
398
- var oCompositeCommand;
380
+ let oCompositeCommand;
399
381
  this.getCommandFactory().getCommandFor(oTargetElement, "composite")
400
382
  .then(function(_oCompositeCommand) {
401
383
  oCompositeCommand = _oCompositeCommand;
@@ -488,7 +470,7 @@ sap.ui.define([
488
470
  };
489
471
 
490
472
  ControlVariant.prototype.createSaveCommand = function(aElementOverlays) {
491
- var oOverlay = aElementOverlays[0];
473
+ const oOverlay = aElementOverlays[0];
492
474
  return getCommandForSave.call(this, oOverlay)
493
475
  .then(function(oSaveCommand) {
494
476
  this.fireElementModified({
@@ -498,16 +480,13 @@ sap.ui.define([
498
480
  };
499
481
 
500
482
  ControlVariant.prototype.createSaveAsCommand = function(aElementOverlays) {
501
- var oOverlay = aElementOverlays[0];
502
- var oElement = oOverlay.getElement();
503
- var oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
504
- var oModel = this._getVariantModel(oElement);
505
- var sVariantManagementReference = oOverlay.getVariantManagement();
506
- var sCurrentVariantReference = oModel.getCurrentVariantReference(sVariantManagementReference);
507
-
508
- return this.getCommandFactory().getCommandFor(oElement, "saveAs", {
509
- sourceVariantReference: sCurrentVariantReference,
510
- model: oModel
483
+ const oOverlay = aElementOverlays[0];
484
+ const oVMControl = oOverlay.getElement();
485
+ const oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
486
+ const sVariantManagementReference = oOverlay.getVariantManagement();
487
+
488
+ return this.getCommandFactory().getCommandFor(oVMControl, "saveAs", {
489
+ sourceVariantReference: oVMControl.getCurrentVariantKey()
511
490
  }, oDesignTimeMetadata, sVariantManagementReference)
512
491
  .then(function(oSaveAsCommand) {
513
492
  this.fireElementModified({
@@ -539,12 +518,12 @@ sap.ui.define([
539
518
  * @public
540
519
  */
541
520
  ControlVariant.prototype.configureVariants = function(aElementOverlays) {
542
- var oElementOverlay = aElementOverlays[0];
543
- var oVariantManagementControl = oElementOverlay.getElement();
544
- var sVariantManagementReference = oElementOverlay.getVariantManagement();
545
- var oDesignTimeMetadata = oElementOverlay.getDesignTimeMetadata();
546
- var mFlexSettings = this.getCommandFactory().getFlexSettings();
547
- var mComponentPropertyBag = mFlexSettings;
521
+ const oElementOverlay = aElementOverlays[0];
522
+ const oVariantManagementControl = oElementOverlay.getElement();
523
+ const sVariantManagementReference = oElementOverlay.getVariantManagement();
524
+ const oDesignTimeMetadata = oElementOverlay.getDesignTimeMetadata();
525
+ const mFlexSettings = this.getCommandFactory().getFlexSettings();
526
+ const mComponentPropertyBag = mFlexSettings;
548
527
  mComponentPropertyBag.variantManagementControl = oVariantManagementControl;
549
528
 
550
529
  return VariantManager.manageVariants(
@@ -590,8 +569,9 @@ sap.ui.define([
590
569
  * @return {object[]} - array containing the items with required data
591
570
  */
592
571
  ControlVariant.prototype.getMenuItems = function(aElementOverlays) {
593
- var oElementOverlay = aElementOverlays[0];
594
- var aMenuItems = [];
572
+ const oElementOverlay = aElementOverlays[0];
573
+ const oVMControl = oElementOverlay.getElement();
574
+ const aMenuItems = [];
595
575
 
596
576
  if (this.isRenameAvailable(oElementOverlay)) {
597
577
  aMenuItems.push({
@@ -639,15 +619,13 @@ sap.ui.define([
639
619
  }
640
620
 
641
621
  if (this.isVariantSwitchAvailable(oElementOverlay)) {
642
- var oModel = this._getVariantModel(oElementOverlay.getElement());
643
- var sManagementReferenceId = oElementOverlay.getVariantManagement();
644
-
645
- var aSubmenuItems = oModel.getData()[sManagementReferenceId].variants.reduce(function(aReducedVariants, oVariant) {
646
- if (oVariant.visible) {
647
- var bCurrentItem = oModel.getData()[sManagementReferenceId].currentVariant === oVariant.key;
648
- var oItem = {
649
- id: oVariant.key,
650
- text: oVariant.title,
622
+ const oCurrentVariant = oVMControl.getVariantByKey(oVMControl.getCurrentVariantKey());
623
+ const aSubmenuItems = oVMControl.getVariants().reduce(function(aReducedVariants, oVariant) {
624
+ if (oVariant.getVisible()) {
625
+ const bCurrentItem = oCurrentVariant.getKey() === oVariant.getKey();
626
+ const oItem = {
627
+ id: oVariant.getKey(),
628
+ text: oVariant.getTitle(),
651
629
  icon: bCurrentItem ? "sap-icon://accept" : "blank",
652
630
  enabled: !bCurrentItem
653
631
  };
@@ -660,9 +638,9 @@ sap.ui.define([
660
638
  id: "CTX_VARIANT_SWITCH_SUBMENU",
661
639
  text: Lib.getResourceBundleFor("sap.ui.rta").getText("CTX_VARIANT_SWITCH"),
662
640
  handler: function(aElementOverlays, mPropertyBag) {
663
- var sNewVariantKey = mPropertyBag.eventItem.getParameters().item.getProperty("key");
664
- var oTargetOverlay = aElementOverlays[0];
665
- var sCurrentVariantKey = oModel.getData()[sManagementReferenceId].currentVariant;
641
+ const sNewVariantKey = mPropertyBag.eventItem.getParameters().item.getProperty("key");
642
+ const oTargetOverlay = aElementOverlays[0];
643
+ const sCurrentVariantKey = oCurrentVariant.getKey();
666
644
  return this.switchVariant(oTargetOverlay, sNewVariantKey, sCurrentVariantKey);
667
645
  }.bind(this),
668
646
  enabled: this.isVariantSwitchEnabled.bind(this),
@@ -29,7 +29,7 @@ sap.ui.define([
29
29
  * @class The CreateContainer allows trigger CreateContainer operations on the overlay
30
30
  * @extends sap.ui.rta.plugin.BaseCreate
31
31
  * @author SAP SE
32
- * @version 1.140.0
32
+ * @version 1.141.1
33
33
  * @constructor
34
34
  * @private
35
35
  * @since 1.34
@@ -32,7 +32,7 @@ sap.ui.define([
32
32
  * @extends sap.ui.dt.plugin.CutPaste
33
33
  *
34
34
  * @author SAP SE
35
- * @version 1.140.0
35
+ * @version 1.141.1
36
36
  *
37
37
  * @constructor
38
38
  * @private
@@ -33,7 +33,7 @@ function(
33
33
  * @extends sap.ui.dt.plugin.ControlDragDrop
34
34
  *
35
35
  * @author SAP SE
36
- * @version 1.140.0
36
+ * @version 1.141.1
37
37
  *
38
38
  * @constructor
39
39
  * @private
@@ -32,7 +32,7 @@ sap.ui.define([
32
32
  * @class
33
33
  * @extends sap.ui.rta.plugin.Plugin
34
34
  * @author SAP SE
35
- * @version 1.140.0
35
+ * @version 1.141.1
36
36
  * @constructor
37
37
  * @private
38
38
  * @since 1.134
@@ -29,25 +29,19 @@ sap.ui.define([
29
29
  ) {
30
30
  "use strict";
31
31
 
32
- function getCurrentVariant(oVariantModel, sVariantManagement) {
33
- return sVariantManagement
34
- ? oVariantModel.getCurrentVariantReference(sVariantManagement)
35
- : "";
36
- }
37
-
38
32
  /**
39
33
  * Constructor for a new LocalReset plugin.
40
34
  *
41
35
  * @class
42
36
  * @extends sap.ui.rta.plugin.Plugin
43
37
  * @author SAP SE
44
- * @version 1.140.0
38
+ * @version 1.141.1
45
39
  * @constructor
46
40
  * @private
47
41
  * @since 1.90
48
42
  * @alias sap.ui.rta.plugin.LocalReset
49
43
  */
50
- var LocalReset = Plugin.extend("sap.ui.rta.plugin.LocalReset", /** @lends sap.ui.rta.plugin.LocalReset.prototype */ {
44
+ const LocalReset = Plugin.extend("sap.ui.rta.plugin.LocalReset", /** @lends sap.ui.rta.plugin.LocalReset.prototype */ {
51
45
  metadata: {
52
46
  library: "sap.ui.rta",
53
47
  properties: {},
@@ -63,7 +57,7 @@ sap.ui.define([
63
57
  if (!this.hasStableId(oOverlay)) {
64
58
  return false;
65
59
  }
66
- var vLocalResetAction = this.getAction(oOverlay);
60
+ const vLocalResetAction = this.getAction(oOverlay);
67
61
  return !!vLocalResetAction;
68
62
  };
69
63
 
@@ -74,14 +68,14 @@ sap.ui.define([
74
68
  if (aElementOverlays.length !== 1) {
75
69
  return false;
76
70
  }
77
- var oElementOverlay = aElementOverlays[0];
78
- var oElement = oElementOverlay.getElement();
79
- var oAction = this.getAction(oElementOverlay);
71
+ const oElementOverlay = aElementOverlays[0];
72
+ const oElement = oElementOverlay.getElement();
73
+ const oAction = this.getAction(oElementOverlay);
80
74
  if (!oAction) {
81
75
  return false;
82
76
  }
83
77
 
84
- var bIsActionEnabled = true;
78
+ let bIsActionEnabled = true;
85
79
  if (typeof oAction.isEnabled !== "undefined") {
86
80
  if (typeof oAction.isEnabled === "function") {
87
81
  bIsActionEnabled = oAction.isEnabled(oElement);
@@ -90,18 +84,18 @@ sap.ui.define([
90
84
  }
91
85
  }
92
86
 
93
- var oRelevantElement = oAction.changeOnRelevantContainer ? oElementOverlay.getRelevantContainer() : oElement;
94
- var oRelevantOverlay = OverlayRegistry.getOverlay(oRelevantElement);
95
- var oAppComponent = FlUtils.getAppComponentForControl(oRelevantElement);
96
- var oVariantModel = oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
97
- var sCurrentVariant = getCurrentVariant(oVariantModel, this.getVariantManagementReference(oRelevantOverlay));
87
+ const oRelevantElement = oAction.changeOnRelevantContainer ? oElementOverlay.getRelevantContainer() : oElement;
88
+ const oRelevantOverlay = OverlayRegistry.getOverlay(oRelevantElement);
89
+ const oAppComponent = FlUtils.getAppComponentForControl(oRelevantElement);
90
+ const sVariantManagementReference = this.getVariantManagementReference(oRelevantOverlay);
91
+ const oVMControl = ControlVariantApplyAPI.getVariantManagementControlByVMReference(sVariantManagementReference, oAppComponent);
98
92
  return (
99
93
  bIsActionEnabled
100
94
  && LocalResetAPI.isResetEnabled(
101
95
  oRelevantElement,
102
96
  {
103
97
  layer: this.getCommandFactory().getFlexSettings().layer,
104
- currentVariant: sCurrentVariant
98
+ currentVariant: oVMControl?.getCurrentVariantKey()
105
99
  }
106
100
  )
107
101
  );
@@ -129,27 +123,27 @@ sap.ui.define([
129
123
  };
130
124
 
131
125
  LocalReset.prototype.handler = function(aOverlays) {
132
- var oOverlay = aOverlays[0];
133
- var oElement = oOverlay.getElement();
134
- var oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
135
- var sVariantManagementReference = this.getVariantManagementReference(oOverlay);
136
- var oAppComponent = FlUtils.getAppComponentForControl(oElement);
137
- var oVariantModel = oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
138
- var sCurrentVariant = getCurrentVariant(oVariantModel, sVariantManagementReference);
139
- var bHasVariant = !!sCurrentVariant;
140
- var oVariantManagementControl = bHasVariant
126
+ const oOverlay = aOverlays[0];
127
+ const oElement = oOverlay.getElement();
128
+ const oDesignTimeMetadata = oOverlay.getDesignTimeMetadata();
129
+ const sVariantManagementReference = this.getVariantManagementReference(oOverlay);
130
+ const oAppComponent = FlUtils.getAppComponentForControl(oElement);
131
+ const oVMControl = ControlVariantApplyAPI.getVariantManagementControlByVMReference(sVariantManagementReference, oAppComponent);
132
+ const sCurrentVariantKey = oVMControl?.getCurrentVariantKey();
133
+ const bHasVariant = !!sCurrentVariantKey;
134
+ const oVariantManagementControl = bHasVariant
141
135
  ? oAppComponent.byId(sVariantManagementReference) || Element.getElementById(sVariantManagementReference)
142
136
  : undefined;
143
- var oCommandFactory = this.getCommandFactory();
137
+ const oCommandFactory = this.getCommandFactory();
144
138
 
145
- var oCompositeCommand = new CompositeCommand();
139
+ const oCompositeCommand = new CompositeCommand();
146
140
 
147
141
  return Promise.all([
148
142
  oCommandFactory.getCommandFor(
149
143
  oElement,
150
144
  "localReset",
151
145
  {
152
- currentVariant: sCurrentVariant
146
+ currentVariant: sCurrentVariantKey
153
147
  },
154
148
  oDesignTimeMetadata,
155
149
  sVariantManagementReference
@@ -157,9 +151,6 @@ sap.ui.define([
157
151
  bHasVariant && oCommandFactory.getCommandFor(
158
152
  oVariantManagementControl,
159
153
  "save",
160
- {
161
- model: oVariantModel
162
- },
163
154
  oDesignTimeMetadata,
164
155
  sVariantManagementReference
165
156
  )
@@ -172,7 +163,7 @@ sap.ui.define([
172
163
  command: oCompositeCommand
173
164
  });
174
165
  if (bHasVariant) {
175
- var sMessage = Lib.getResourceBundleFor("sap.ui.rta").getText("MSG_LOCAL_RESET_VARIANT_SAVE");
166
+ const sMessage = Lib.getResourceBundleFor("sap.ui.rta").getText("MSG_LOCAL_RESET_VARIANT_SAVE");
176
167
  MessageToast.show(sMessage, {
177
168
  duration: 5000
178
169
  });
@@ -114,7 +114,7 @@ sap.ui.define([
114
114
  * @extends sap.ui.dt.Plugin
115
115
  *
116
116
  * @author SAP SE
117
- * @version 1.140.0
117
+ * @version 1.141.1
118
118
  *
119
119
  * @constructor
120
120
  * @private
@@ -35,7 +35,7 @@ function(
35
35
  * The RTAElementMover is responsible for the RTA specific adaptation of element movements.
36
36
  *
37
37
  * @author SAP SE
38
- * @version 1.140.0
38
+ * @version 1.141.1
39
39
  *
40
40
  * @constructor
41
41
  * @private
@@ -29,7 +29,7 @@ sap.ui.define([
29
29
  * @class The Remove allows trigger remove operations on the overlay
30
30
  * @extends sap.ui.rta.plugin.Plugin
31
31
  * @author SAP SE
32
- * @version 1.140.0
32
+ * @version 1.141.1
33
33
  * @constructor
34
34
  * @private
35
35
  * @since 1.34
@@ -27,7 +27,7 @@ sap.ui.define([
27
27
  * @class
28
28
  * @extends sap.ui.rta.plugin.Plugin
29
29
  * @author SAP SE
30
- * @version 1.140.0
30
+ * @version 1.141.1
31
31
  * @constructor
32
32
  * @private
33
33
  * @since 1.101
@@ -31,7 +31,7 @@ sap.ui.define([
31
31
  * @class The Selection plugin allows you to select or focus overlays with mouse or keyboard and navigate to others.
32
32
  * @extends sap.ui.rta.plugin.Plugin
33
33
  * @author SAP SE
34
- * @version 1.140.0
34
+ * @version 1.141.1
35
35
  * @constructor
36
36
  * @private
37
37
  * @since 1.34
@@ -30,7 +30,7 @@ sap.ui.define([
30
30
  * @class The Settings allows trigger change of settings operations on the overlay
31
31
  * @extends sap.ui.rta.plugin.Plugin
32
32
  * @author SAP SE
33
- * @version 1.140.0
33
+ * @version 1.141.1
34
34
  * @constructor
35
35
  * @private
36
36
  * @since 1.44
@@ -23,7 +23,7 @@ sap.ui.define([
23
23
  * @class
24
24
  * @extends sap.ui.rta.plugin.Plugin
25
25
  * @author SAP SE
26
- * @version 1.140.0
26
+ * @version 1.141.1
27
27
  * @constructor
28
28
  * @private
29
29
  * @since 1.46
@@ -29,7 +29,7 @@ sap.ui.define([
29
29
  * @extends sap.ui.rta.plugin.Plugin
30
30
  *
31
31
  * @author SAP SE
32
- * @version 1.140.0
32
+ * @version 1.141.1
33
33
  *
34
34
  * @constructor
35
35
  * @private
@@ -64,7 +64,7 @@ sap.ui.define([
64
64
  }
65
65
 
66
66
  function toggleStyleClass(oOverlay, bAddClass) {
67
- var oElement = oOverlay.getElement();
67
+ const oElement = oOverlay.getElement();
68
68
  if (oElement.addStyleClass && oElement.removeStyleClass) {
69
69
  if (bAddClass) {
70
70
  oElement.addStyleClass(Stretch.STRETCHSTYLECLASS);
@@ -72,12 +72,13 @@ sap.ui.define([
72
72
  oElement.removeStyleClass(Stretch.STRETCHSTYLECLASS);
73
73
  }
74
74
  } else {
75
- var oElementDomRef = oOverlay.getAssociatedDomRef();
76
- if (oElementDomRef) {
75
+ const vElementDomRef = oOverlay.getAssociatedDomRef();
76
+ if (vElementDomRef) {
77
+ const aElementDomRef = Array.isArray(vElementDomRef) ? vElementDomRef : [vElementDomRef];
77
78
  if (bAddClass) {
78
- oElementDomRef.classList.add(Stretch.STRETCHSTYLECLASS);
79
+ aElementDomRef.forEach((oElementDomRef) => oElementDomRef.classList.add(Stretch.STRETCHSTYLECLASS));
79
80
  } else {
80
- oElementDomRef.classList.remove(Stretch.STRETCHSTYLECLASS);
81
+ aElementDomRef.forEach((oElementDomRef) => oElementDomRef.classList.remove(Stretch.STRETCHSTYLECLASS));
81
82
  }
82
83
  }
83
84
  }
@@ -32,7 +32,7 @@ sap.ui.define([
32
32
  * handled by the AdditionalElements Plugin (Reveal, Add Via Delegate, Add Custom)
33
33
  *
34
34
  * @author SAP SE
35
- * @version 1.140.0
35
+ * @version 1.141.1
36
36
  * @private
37
37
  * @since 1.94
38
38
  */
@@ -32,7 +32,7 @@ sap.ui.define([
32
32
  * @class Context - Dialog for available Fields in Runtime Authoring
33
33
  * @extends sap.ui.base.ManagedObject
34
34
  * @author SAP SE
35
- * @version 1.140.0
35
+ * @version 1.141.1
36
36
  * @constructor
37
37
  * @private
38
38
  * @since 1.44