@openui5/sap.ui.rta 1.139.0 → 1.141.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 (154) 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 +7 -30
  8. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +6 -41
  9. package/src/sap/ui/rta/appVariant/Feature.js +5 -4
  10. package/src/sap/ui/rta/command/AddIFrame.js +6 -8
  11. package/src/sap/ui/rta/command/AddProperty.js +2 -2
  12. package/src/sap/ui/rta/command/AddXML.js +3 -3
  13. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +17 -19
  14. package/src/sap/ui/rta/command/AnnotationCommand.js +1 -1
  15. package/src/sap/ui/rta/command/BaseCommand.js +3 -4
  16. package/src/sap/ui/rta/command/BindProperty.js +4 -4
  17. package/src/sap/ui/rta/command/Combine.js +4 -4
  18. package/src/sap/ui/rta/command/CommandFactory.js +55 -77
  19. package/src/sap/ui/rta/command/CompositeCommand.js +19 -39
  20. package/src/sap/ui/rta/command/ControlVariantConfigure.js +16 -20
  21. package/src/sap/ui/rta/command/ControlVariantSave.js +19 -28
  22. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +38 -43
  23. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +15 -26
  24. package/src/sap/ui/rta/command/ControlVariantSwitch.js +29 -50
  25. package/src/sap/ui/rta/command/CreateContainer.js +3 -3
  26. package/src/sap/ui/rta/command/CustomAdd.js +2 -2
  27. package/src/sap/ui/rta/command/ExtendControllerCommand.js +2 -4
  28. package/src/sap/ui/rta/command/FlexCommand.js +34 -44
  29. package/src/sap/ui/rta/command/LREPSerializer.js +20 -23
  30. package/src/sap/ui/rta/command/LocalReset.js +3 -3
  31. package/src/sap/ui/rta/command/ManifestCommand.js +1 -1
  32. package/src/sap/ui/rta/command/Move.js +5 -5
  33. package/src/sap/ui/rta/command/Property.js +3 -3
  34. package/src/sap/ui/rta/command/Remove.js +4 -4
  35. package/src/sap/ui/rta/command/Rename.js +3 -3
  36. package/src/sap/ui/rta/command/Resize.js +2 -2
  37. package/src/sap/ui/rta/command/Reveal.js +3 -3
  38. package/src/sap/ui/rta/command/Settings.js +2 -2
  39. package/src/sap/ui/rta/command/Split.js +3 -3
  40. package/src/sap/ui/rta/command/Stack.js +51 -55
  41. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +10 -10
  42. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +4 -4
  43. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +2 -2
  44. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +11 -11
  45. package/src/sap/ui/rta/command/manifest/AddLibrary.js +4 -8
  46. package/src/sap/ui/rta/enablement/elementActionTest.js +21 -9
  47. package/src/sap/ui/rta/library.js +2 -2
  48. package/src/sap/ui/rta/messagebundle_ar.properties +32 -17
  49. package/src/sap/ui/rta/messagebundle_bg.properties +32 -17
  50. package/src/sap/ui/rta/messagebundle_ca.properties +32 -17
  51. package/src/sap/ui/rta/messagebundle_cnr.properties +31 -16
  52. package/src/sap/ui/rta/messagebundle_cs.properties +31 -16
  53. package/src/sap/ui/rta/messagebundle_cy.properties +30 -15
  54. package/src/sap/ui/rta/messagebundle_da.properties +32 -17
  55. package/src/sap/ui/rta/messagebundle_de.properties +33 -18
  56. package/src/sap/ui/rta/messagebundle_el.properties +32 -17
  57. package/src/sap/ui/rta/messagebundle_en.properties +32 -17
  58. package/src/sap/ui/rta/messagebundle_en_GB.properties +32 -17
  59. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +11 -1
  60. package/src/sap/ui/rta/messagebundle_es.properties +32 -17
  61. package/src/sap/ui/rta/messagebundle_es_MX.properties +39 -24
  62. package/src/sap/ui/rta/messagebundle_et.properties +31 -16
  63. package/src/sap/ui/rta/messagebundle_fi.properties +30 -15
  64. package/src/sap/ui/rta/messagebundle_fr.properties +32 -17
  65. package/src/sap/ui/rta/messagebundle_fr_CA.properties +30 -15
  66. package/src/sap/ui/rta/messagebundle_hi.properties +32 -17
  67. package/src/sap/ui/rta/messagebundle_hr.properties +31 -16
  68. package/src/sap/ui/rta/messagebundle_hu.properties +31 -16
  69. package/src/sap/ui/rta/messagebundle_id.properties +32 -17
  70. package/src/sap/ui/rta/messagebundle_it.properties +31 -16
  71. package/src/sap/ui/rta/messagebundle_iw.properties +30 -15
  72. package/src/sap/ui/rta/messagebundle_ja.properties +32 -17
  73. package/src/sap/ui/rta/messagebundle_kk.properties +32 -17
  74. package/src/sap/ui/rta/messagebundle_ko.properties +30 -15
  75. package/src/sap/ui/rta/messagebundle_lt.properties +31 -16
  76. package/src/sap/ui/rta/messagebundle_lv.properties +31 -16
  77. package/src/sap/ui/rta/messagebundle_mk.properties +31 -16
  78. package/src/sap/ui/rta/messagebundle_ms.properties +32 -17
  79. package/src/sap/ui/rta/messagebundle_nl.properties +32 -17
  80. package/src/sap/ui/rta/messagebundle_no.properties +31 -16
  81. package/src/sap/ui/rta/messagebundle_pl.properties +31 -16
  82. package/src/sap/ui/rta/messagebundle_pt.properties +32 -17
  83. package/src/sap/ui/rta/messagebundle_pt_PT.properties +32 -17
  84. package/src/sap/ui/rta/messagebundle_ro.properties +31 -16
  85. package/src/sap/ui/rta/messagebundle_ru.properties +31 -16
  86. package/src/sap/ui/rta/messagebundle_sh.properties +31 -16
  87. package/src/sap/ui/rta/messagebundle_sk.properties +31 -16
  88. package/src/sap/ui/rta/messagebundle_sl.properties +31 -16
  89. package/src/sap/ui/rta/messagebundle_sr.properties +31 -16
  90. package/src/sap/ui/rta/messagebundle_sv.properties +31 -16
  91. package/src/sap/ui/rta/messagebundle_th.properties +30 -15
  92. package/src/sap/ui/rta/messagebundle_tr.properties +31 -16
  93. package/src/sap/ui/rta/messagebundle_uk.properties +31 -16
  94. package/src/sap/ui/rta/messagebundle_vi.properties +33 -18
  95. package/src/sap/ui/rta/messagebundle_zh_CN.properties +31 -16
  96. package/src/sap/ui/rta/messagebundle_zh_TW.properties +32 -17
  97. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +10 -10
  98. package/src/sap/ui/rta/plugin/AddXMLPlugin.js +1 -1
  99. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  100. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  101. package/src/sap/ui/rta/plugin/ControlVariant.js +65 -87
  102. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  103. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  104. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  105. package/src/sap/ui/rta/plugin/ExtendControllerPlugin.js +1 -1
  106. package/src/sap/ui/rta/plugin/LocalReset.js +26 -35
  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/Resize.js +1 -1
  111. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  112. package/src/sap/ui/rta/plugin/Settings.js +1 -1
  113. package/src/sap/ui/rta/plugin/Split.js +1 -1
  114. package/src/sap/ui/rta/plugin/Stretch.js +7 -6
  115. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  116. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  117. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +17 -5
  118. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
  119. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  120. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
  121. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +1 -1
  122. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +1 -1
  123. package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +1 -1
  124. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
  125. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  126. package/src/sap/ui/rta/plugin/rename/Rename.js +1 -1
  127. package/src/sap/ui/rta/plugin/rename/RenameDialog.js +2 -7
  128. package/src/sap/ui/rta/service/Action.js +1 -1
  129. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  130. package/src/sap/ui/rta/service/Outline.js +1 -1
  131. package/src/sap/ui/rta/service/Property.js +1 -1
  132. package/src/sap/ui/rta/service/Selection.js +1 -1
  133. package/src/sap/ui/rta/service/SupportTools.js +1 -1
  134. package/src/sap/ui/rta/toolbar/Adaptation.js +1 -1
  135. package/src/sap/ui/rta/toolbar/Base.js +7 -7
  136. package/src/sap/ui/rta/toolbar/Fiori.js +8 -8
  137. package/src/sap/ui/rta/toolbar/FioriLike.js +2 -2
  138. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  139. package/src/sap/ui/rta/toolbar/Standalone.js +3 -3
  140. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +1 -1
  141. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  142. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  143. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  144. package/src/sap/ui/rta/util/PopupManager.js +3 -3
  145. package/src/sap/ui/rta/util/ReloadManager.js +1 -1
  146. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  147. package/src/sap/ui/rta/util/ServiceManager.js +1 -1
  148. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +6 -6
  149. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +1 -1
  150. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +1 -1
  151. package/src/sap/ui/rta/util/changeVisualization/resolveBinding.js +79 -0
  152. package/src/sap/ui/rta/util/guidedTour/GuidedTour.js +1 -1
  153. package/src/sap/ui/rta/util/guidedTour/content/GeneralTour.js +1 -1
  154. package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +1 -1
@@ -102,13 +102,9 @@ sap.ui.define([
102
102
  }
103
103
 
104
104
  function configureAddXmlCommand(oElement, mSettings, oDesignTimeMetadata) {
105
- let vAction;
106
- if (oDesignTimeMetadata) {
107
- vAction = oDesignTimeMetadata.getAction(mSettings.name, oElement);
108
- }
109
105
  // the change type is not configurable via designtime
110
106
  // it can also not be disabled with 'not-adaptable' or null
111
- const oAction = vAction || {};
107
+ const oAction = oDesignTimeMetadata?.getAction(mSettings.name, oElement) || {};
112
108
  Object.assign(oAction, {
113
109
  changeType: mSettings.name
114
110
  });
@@ -116,13 +112,9 @@ sap.ui.define([
116
112
  }
117
113
 
118
114
  function configureExtendControllerCommand(oElement, mSettings, oDesignTimeMetadata) {
119
- var vAction;
120
- if (oDesignTimeMetadata) {
121
- vAction = oDesignTimeMetadata.getAction(mSettings.name, oElement);
122
- }
123
115
  // the change type is not configurable via designtime
124
116
  // it can also not be disabled with 'not-adaptable' or null
125
- var oAction = vAction || {};
117
+ const oAction = oDesignTimeMetadata?.getAction(mSettings.name, oElement) || {};
126
118
  Object.assign(oAction, {
127
119
  changeType: mSettings.name
128
120
  });
@@ -188,10 +180,8 @@ sap.ui.define([
188
180
  }
189
181
 
190
182
  function configureRemoveCommand(oElement, mSettings, oDesignTimeMetadata) {
191
- let oRemovedElement = mSettings.removedElement;
192
- if (!oRemovedElement) {
193
- oRemovedElement = oElement;
194
- } else if (!(oRemovedElement instanceof ManagedObject)) {
183
+ const oRemovedElement = mSettings.removedElement || oElement;
184
+ if (!(oRemovedElement instanceof ManagedObject)) {
195
185
  throw new Error("No valid 'removedElement' found");
196
186
  }
197
187
  const oAction = oDesignTimeMetadata.getAction("remove", oRemovedElement);
@@ -252,9 +242,7 @@ sap.ui.define([
252
242
  }
253
243
 
254
244
  function configureRevealCommand(oElement, mSettings, oDesignTimeMetadata) {
255
- const oRevealedElement = mSettings.element;
256
- const oAction = oDesignTimeMetadata.getAction("reveal", oRevealedElement);
257
- return oAction;
245
+ return oDesignTimeMetadata.getAction("reveal", mSettings.element);
258
246
  }
259
247
 
260
248
  function adjustRevealCommand(mSettings) {
@@ -285,7 +273,8 @@ sap.ui.define([
285
273
  }
286
274
 
287
275
  function configureAddIFrame(oElement, mSettings, oDesignTimeMetadata) {
288
- return oDesignTimeMetadata.getAction("addIFrame", mSettings.element) || oDesignTimeMetadata.getActionDataFromAggregations("addIFrame", mSettings.element)[0];
276
+ return oDesignTimeMetadata.getAction("addIFrame", mSettings.element)
277
+ || oDesignTimeMetadata.getActionDataFromAggregations("addIFrame", mSettings.element)[0];
289
278
  }
290
279
 
291
280
  function configureBindPropertyCommand() {
@@ -429,85 +418,74 @@ sap.ui.define([
429
418
  }
430
419
  };
431
420
 
432
- function getCommandFor(vElement, sCommand, mSettings, oDesignTimeMetadata, mFlexSettings, sVariantManagementReference) {
433
- let oCommand;
434
- sCommand = sCommand[0].toLowerCase() + sCommand.slice(1); // first char of command name is lower case
435
- const mCommand = mCommands[sCommand];
436
- let mAllFlexSettings = mFlexSettings;
437
-
438
- if (!mCommand) {
439
- return Promise.reject(DtUtil.createError("CommandFactory#getCommandFor", `Command '${sCommand}' doesn't exist, check typing`, "sap.ui.rta"));
440
- }
441
-
421
+ function requireModule(mCommand) {
442
422
  return new Promise(function(fnResolve) {
443
423
  const sClassName = mCommand.clazz;
444
424
  sap.ui.require([sClassName], function(Command) {
445
425
  fnResolve(Command);
446
426
  });
447
- })
427
+ });
428
+ }
448
429
 
449
- .then(function(Command) {
450
- const bIsUiElement = vElement instanceof ManagedObject;
430
+ async function getCommandFor(vElement, sCommand, mSettings, oDesignTimeMetadata, mFlexSettings, sVariantManagementReference) {
431
+ const sAdjustedCommandName = sCommand[0].toLowerCase() + sCommand.slice(1); // first char of command name is lower case
432
+ const mCommand = mCommands[sAdjustedCommandName];
433
+ let mAllFlexSettings = mFlexSettings;
451
434
 
452
- // only sap.ui.rta.command.FlexCommand requires a selector property
453
- if (!mCommand.noSelector && !bIsUiElement) {
454
- mSettings = { ...mSettings, selector: vElement };
455
- }
435
+ if (!mCommand) {
436
+ return DtUtil.createError("CommandFactory#getCommandFor", `Command '${sAdjustedCommandName}' doesn't exist, check typing`, "sap.ui.rta");
437
+ }
456
438
 
457
- mSettings = {
458
- ...mSettings,
459
- element: bIsUiElement ? vElement : undefined,
460
- name: sCommand
461
- };
439
+ const Command = await requireModule(mCommand);
462
440
 
463
- let oAction;
464
- if (mCommand.configure) {
465
- oAction = mCommand.configure(vElement, mSettings, oDesignTimeMetadata);
466
- }
441
+ const bIsUiElement = vElement instanceof ManagedObject;
467
442
 
468
- let oElementOverlay;
469
- if (bIsUiElement) {
470
- oElementOverlay = OverlayRegistry.getOverlay(vElement);
471
- }
443
+ // only sap.ui.rta.command.FlexCommand requires a selector property
444
+ if (!mCommand.noSelector && !bIsUiElement) {
445
+ mSettings = { ...mSettings, selector: vElement };
446
+ }
472
447
 
473
- if (oAction && oAction.changeOnRelevantContainer) {
474
- Object.assign(mSettings, {
475
- element: oElementOverlay.getRelevantContainer()
476
- });
477
- vElement = mSettings.element;
478
- oElementOverlay = OverlayRegistry.getOverlay(vElement);
479
- }
448
+ mSettings = {
449
+ ...mSettings,
450
+ element: bIsUiElement ? vElement : undefined,
451
+ name: sAdjustedCommandName
452
+ };
480
453
 
481
- let mTemplateSettings;
482
- if (oElementOverlay && vElement.sParentAggregationName) {
483
- mTemplateSettings = evaluateTemplateBinding(oElementOverlay);
484
- }
454
+ const oAction = mCommand.configure ? mCommand.configure(vElement, mSettings, oDesignTimeMetadata) : undefined;
455
+
456
+ let oElementOverlay = bIsUiElement ? OverlayRegistry.getOverlay(vElement) : undefined;
457
+
458
+ if (oAction?.changeOnRelevantContainer) {
459
+ Object.assign(mSettings, {
460
+ element: oElementOverlay.getRelevantContainer()
461
+ });
462
+ vElement = mSettings.element;
463
+ oElementOverlay = OverlayRegistry.getOverlay(vElement);
464
+ }
485
465
 
466
+ if (oElementOverlay && vElement.sParentAggregationName) {
467
+ const mTemplateSettings = evaluateTemplateBinding(oElementOverlay);
486
468
  if (mTemplateSettings) {
487
469
  if (mCommand.adjustForBinding) {
488
470
  mCommand.adjustForBinding(mSettings);
489
471
  }
490
472
  mAllFlexSettings = merge(mTemplateSettings, mAllFlexSettings);
491
473
  }
474
+ }
492
475
 
493
- oCommand = new Command(mSettings);
476
+ const oCommand = new Command(mSettings);
494
477
 
495
- let bSuccessfullyConfigured = true; // configuration is optional
496
- if (mCommand.configure) {
497
- bSuccessfullyConfigured = configureActionCommand(oCommand, oAction);
498
- }
478
+ // configuration is optional
479
+ const bSuccessfullyConfigured = mCommand.configure ? configureActionCommand(oCommand, oAction) : true;
499
480
 
500
- if (bSuccessfullyConfigured) {
501
- return oCommand.prepare(mAllFlexSettings, sVariantManagementReference, sCommand);
502
- }
503
- return undefined;
504
- }).then(function(bPrepareStatus) {
481
+ if (bSuccessfullyConfigured) {
482
+ const bPrepareStatus = await oCommand.prepare(mAllFlexSettings, sVariantManagementReference, sAdjustedCommandName);
505
483
  if (bPrepareStatus) {
506
484
  return oCommand;
507
485
  }
508
- oCommand.destroy();
509
- return undefined;
510
- });
486
+ }
487
+ oCommand.destroy();
488
+ return undefined;
511
489
  }
512
490
 
513
491
  /**
@@ -517,7 +495,7 @@ sap.ui.define([
517
495
  * @extends sap.ui.base.ManagedObject
518
496
  *
519
497
  * @author SAP SE
520
- * @version 1.139.0
498
+ * @version 1.141.0
521
499
  *
522
500
  * @constructor
523
501
  * @private
@@ -568,7 +546,7 @@ sap.ui.define([
568
546
  * Static method for generating command
569
547
  * @param {sap.ui.core.Element|string} vElement - Could be either an element or a selector for the element for which the command is to be created
570
548
  * @param {string} sCommand - Command type
571
- * @param {object} mSettings - Initial settings for the new command (command specific settings, looks different for each and every command)
549
+ * @param {object} mSettings - Initial settings for the new command (command specific settings, looks different for each and every command)
572
550
  * @param {sap.ui.dt.DesignTimeMetadata} oDesignTimeMetadata - Contains the action used in the command
573
551
  * @param {object} [mFlexSettings] - Property bag
574
552
  * @param {string} [mFlexSettings.layer] - The Layer in which RTA should be started. Default: "CUSTOMER"
@@ -586,9 +564,9 @@ sap.ui.define([
586
564
  };
587
565
 
588
566
  if (mFlexSettings.scenario || mFlexSettings.baseId) {
589
- const sLRepRootNamespace = FlexUtils.buildLrepRootNamespace(mFlexSettings.baseId, mFlexSettings.scenario, mFlexSettings.projectId);
590
- mFlexSettings.rootNamespace = sLRepRootNamespace;
591
- mFlexSettings.namespace = `${sLRepRootNamespace}changes/`;
567
+ const sLRepNamespace = FlexUtils.buildLrepRootNamespace(mFlexSettings.baseId, mFlexSettings.scenario, mFlexSettings.projectId);
568
+ mFlexSettings.rootNamespace = sLRepNamespace;
569
+ mFlexSettings.namespace = `${sLRepNamespace}changes/`;
592
570
  }
593
571
 
594
572
  return getCommandFor(vElement, sCommand, mSettings, oDesignTimeMetadata, mFlexSettings);
@@ -21,7 +21,7 @@ sap.ui.define([
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  *
23
23
  * @author SAP SE
24
- * @version 1.139.0
24
+ * @version 1.141.0
25
25
  *
26
26
  * @constructor
27
27
  * @private
@@ -47,50 +47,30 @@ sap.ui.define([
47
47
  *
48
48
  * @returns {Promise} empty resolved promise or rejected promise
49
49
  */
50
- CompositeCommand.prototype.execute = function() {
51
- const aPromises = [];
52
- this._forEachCommand(function(oCommand) {
53
- aPromises.push(oCommand.execute.bind(oCommand));
54
- });
55
- return FlUtils.execPromiseQueueSequentially(aPromises, true)
56
-
57
- .catch(function(e) {
50
+ CompositeCommand.prototype.execute = async function() {
51
+ try {
52
+ await FlUtils.execPromiseQueueSequentially(this.getCommands().map((oCommand) => {
53
+ return oCommand.execute.bind(oCommand);
54
+ }), true);
55
+ } catch (oError) {
56
+ await this.undo();
58
57
  const aCommands = this.getCommands();
59
- aCommands.forEach(function(oCommand) {
58
+ aCommands.forEach((oCommand) => {
60
59
  if (oCommand instanceof FlexCommand) {
61
60
  this.removeCommand(oCommand);
62
61
  }
63
- }.bind(this));
64
-
65
- return this.undo()
66
-
67
- .then(function() {
68
- return Promise.reject(e);
69
62
  });
70
- }.bind(this));
63
+ throw oError;
64
+ }
71
65
  };
72
66
 
73
67
  CompositeCommand.prototype.undo = function() {
74
- const aPromises = [];
75
- this._forEachCommandInReverseOrder(function(oCommand) {
76
- aPromises.push(oCommand.undo.bind(oCommand));
77
- });
78
- return FlUtils.execPromiseQueueSequentially(aPromises);
79
- };
80
-
81
- CompositeCommand.prototype._forEachCommand = function(fnDo) {
82
- const aCommands = this.getCommands();
83
- aCommands.forEach(fnDo, this);
68
+ return FlUtils.execPromiseQueueSequentially(this.getCommands().toReversed().map((oCommand) => {
69
+ return oCommand.undo.bind(oCommand);
70
+ }));
84
71
  };
85
72
 
86
- CompositeCommand.prototype._forEachCommandInReverseOrder = function(fnDo) {
87
- const aCommands = this.getCommands();
88
- for (let i = aCommands.length - 1; i >= 0; i--) {
89
- fnDo.call(this, aCommands[i]);
90
- }
91
- };
92
-
93
- CompositeCommand.prototype._addCompositeIdToChange = function(oCommand) {
73
+ function addCompositeIdToChange(oCommand) {
94
74
  this._sCompositeId ||= FlUtils.createDefaultFileName("composite");
95
75
  const oPreparedChange = oCommand.getPreparedChange && oCommand.getPreparedChange();
96
76
  if (oPreparedChange) {
@@ -100,10 +80,10 @@ sap.ui.define([
100
80
  oPreparedChange.setSupportInformation(oChangeSupportInformation);
101
81
  }
102
82
  } else if (oCommand.setCompositeId) {
103
- // relevant for manifest commands
83
+ // relevant for manifest commands, as the change is not yet created when this function is called
104
84
  oCommand.setCompositeId(this._sCompositeId);
105
85
  }
106
- };
86
+ }
107
87
 
108
88
  /**
109
89
  * @override
@@ -112,7 +92,7 @@ sap.ui.define([
112
92
  * @returns {object} the composite command
113
93
  */
114
94
  CompositeCommand.prototype.addCommand = function(oCommand, bSuppressInvalidate) {
115
- this._addCompositeIdToChange(oCommand);
95
+ addCompositeIdToChange.call(this, oCommand);
116
96
  return this.addAggregation("commands", oCommand, bSuppressInvalidate);
117
97
  };
118
98
 
@@ -124,7 +104,7 @@ sap.ui.define([
124
104
  * @returns {object} the composite command
125
105
  */
126
106
  CompositeCommand.prototype.insertCommand = function(oCommand, iIndex, bSuppressInvalidate) {
127
- this._addCompositeIdToChange(oCommand);
107
+ addCompositeIdToChange.call(this, oCommand);
128
108
  return this.insertAggregation("commands", oCommand, iIndex, bSuppressInvalidate);
129
109
  };
130
110
 
@@ -4,7 +4,6 @@
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/core/util/reflection/JsControlTreeModifier",
8
7
  "sap/ui/fl/apply/api/ControlVariantApplyAPI",
9
8
  "sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
10
9
  "sap/ui/fl/variants/VariantManager",
@@ -13,7 +12,6 @@ sap.ui.define([
13
12
  "sap/ui/rta/command/BaseCommand",
14
13
  "sap/ui/rta/library"
15
14
  ], function(
16
- JsControlTreeModifier,
17
15
  ControlVariantApplyAPI,
18
16
  FlexRuntimeInfoAPI,
19
17
  VariantManager,
@@ -30,13 +28,13 @@ sap.ui.define([
30
28
  * @class
31
29
  * @extends sap.ui.rta.command.BaseCommand
32
30
  * @author SAP SE
33
- * @version 1.139.0
31
+ * @version 1.141.0
34
32
  * @constructor
35
33
  * @private
36
34
  * @since 1.52
37
35
  * @alias sap.ui.rta.command.ControlVariantConfigure
38
36
  */
39
- var ControlVariantConfigure = BaseCommand.extend("sap.ui.rta.command.ControlVariantConfigure", {
37
+ const ControlVariantConfigure = BaseCommand.extend("sap.ui.rta.command.ControlVariantConfigure", {
40
38
  metadata: {
41
39
  library: "sap.ui.rta",
42
40
  properties: {
@@ -76,25 +74,24 @@ sap.ui.define([
76
74
  * @returns {Promise} Returns resolve after execution
77
75
  */
78
76
  ControlVariantConfigure.prototype.execute = async function() {
79
- var oVariantManagementControl = this.getControl();
77
+ const oVariantManagementControl = this.getControl();
80
78
  this.oAppComponent = FlUtils.getAppComponentForControl(oVariantManagementControl);
81
- this.oModel = this.oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
82
- this.sVariantManagementReference = JsControlTreeModifier.getSelector(oVariantManagementControl, this.oAppComponent).id;
79
+ this.sVariantManagementReference = oVariantManagementControl.getVariantManagementReference();
83
80
 
84
81
  this._aPreparedChanges = [];
85
82
  if (this.getChanges().some((oChange) => {
86
83
  if (
87
84
  oChange.visible === false
88
- && oChange.variantReference === this.oModel.getCurrentVariantReference(this.sVariantManagementReference)
85
+ && oChange.variantReference === oVariantManagementControl.getCurrentVariantKey()
89
86
  ) {
90
87
  this._sOldVReference = oChange.variantReference;
91
88
  return true;
92
89
  }
93
90
  return false;
94
91
  })) {
95
- await this.oModel.updateCurrentVariant({
96
- variantManagementReference: this.sVariantManagementReference,
97
- newVariantReference: this.sVariantManagementReference
92
+ await ControlVariantApplyAPI.activateVariant({
93
+ element: oVariantManagementControl,
94
+ variantReference: this.sVariantManagementReference
98
95
  });
99
96
  }
100
97
 
@@ -126,12 +123,12 @@ sap.ui.define([
126
123
  });
127
124
  delete this._aDeletedFlexObjects;
128
125
 
129
- this.getChanges().forEach(function(mChangeProperties, index) {
126
+ this.getChanges().forEach((mChangeProperties, index) => {
130
127
  const mPropertyBag = {
131
128
  appComponent: this.oAppComponent
132
129
  };
133
130
  Object.keys(mChangeProperties).forEach(function(sProperty) {
134
- var sOriginalProperty = `original${sProperty.charAt(0).toUpperCase()}${sProperty.substr(1)}`;
131
+ const sOriginalProperty = `original${sProperty.charAt(0).toUpperCase()}${sProperty.substr(1)}`;
135
132
  if (sProperty === "visible") {
136
133
  mPropertyBag[sProperty] = true; /* visibility of the variant always set back to true on undo */
137
134
  } else if (mChangeProperties[sOriginalProperty]) {
@@ -141,18 +138,17 @@ sap.ui.define([
141
138
  mPropertyBag[sProperty] = mChangeProperties[sProperty];
142
139
  }
143
140
  });
144
- var oChange = this._aPreparedChanges[index];
141
+ const oChange = this._aPreparedChanges[index];
145
142
  VariantManager.deleteVariantChange(this.sVariantManagementReference, mPropertyBag, oChange);
146
- }.bind(this));
143
+ });
147
144
 
148
145
  this._aPreparedChanges = null;
149
146
  if (this._sOldVReference) {
150
- await this.oModel.updateCurrentVariant({
151
- variantManagementReference: this.sVariantManagementReference,
152
- newVariantReference: this._sOldVReference
153
- }).then(() => {
154
- delete this._sOldVReference;
147
+ await ControlVariantApplyAPI.activateVariant({
148
+ element: this.getControl(),
149
+ variantReference: this._sOldVReference
155
150
  });
151
+ delete this._sOldVReference;
156
152
  }
157
153
  };
158
154
 
@@ -4,13 +4,13 @@
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
  sap.ui.define([
7
- "sap/ui/rta/command/BaseCommand",
8
- "sap/ui/core/util/reflection/JsControlTreeModifier",
9
- "sap/ui/fl/Utils"
7
+ "sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
8
+ "sap/ui/fl/variants/VariantManager",
9
+ "sap/ui/rta/command/BaseCommand"
10
10
  ], function(
11
- BaseCommand,
12
- JsControlTreeModifier,
13
- flUtils
11
+ FlexRuntimeInfoAPI,
12
+ VariantManager,
13
+ BaseCommand
14
14
  ) {
15
15
  "use strict";
16
16
 
@@ -20,49 +20,40 @@ sap.ui.define([
20
20
  * @class
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  * @author SAP SE
23
- * @version 1.139.0
23
+ * @version 1.141.0
24
24
  * @constructor
25
25
  * @private
26
26
  * @since 1.86
27
27
  * @alias sap.ui.rta.command.ControlVariantSave
28
28
  */
29
- var ControlVariantSave = BaseCommand.extend("sap.ui.rta.command.ControlVariantSave", {
29
+ const ControlVariantSave = BaseCommand.extend("sap.ui.rta.command.ControlVariantSave", {
30
30
  metadata: {
31
31
  library: "sap.ui.rta",
32
- properties: {
33
- model: {
34
- type: "object"
35
- }
36
- },
37
32
  associations: {},
38
33
  events: {}
39
34
  }
40
35
  });
41
36
 
42
- /**
43
- * @override
44
- */
45
- ControlVariantSave.prototype.prepare = function() {
46
- this.oAppComponent = flUtils.getAppComponentForControl(this.getElement());
47
- this.sVariantManagementReference = JsControlTreeModifier.getSelector(this.getElement(), this.oAppComponent).id;
48
- return true;
49
- };
50
-
51
37
  /**
52
38
  * Triggers the Save of a variant.
53
39
  * @public
54
40
  * @returns {Promise} Promise that resolves after execution
55
41
  */
56
42
  ControlVariantSave.prototype.execute = function() {
57
- var sCurrentVariantReference = this.getModel().getCurrentVariantReference(this.sVariantManagementReference);
58
- this._aControlChanges = this.getModel().getVariant(sCurrentVariantReference, this.sVariantManagementReference).controlChanges;
59
- this._aDirtyChanges = this.getModel()._getDirtyChangesFromVariantChanges(this._aControlChanges);
60
- this._aDirtyChanges.forEach(function(oChange) {
43
+ const oVMControl = this.getElement();
44
+ this.sFlexReference = FlexRuntimeInfoAPI.getFlexReference({ element: oVMControl });
45
+ this._aControlChanges = VariantManager.getControlChangesForVariant(
46
+ this.sFlexReference,
47
+ oVMControl.getVariantManagementReference(),
48
+ oVMControl.getCurrentVariantKey()
49
+ );
50
+ this._aDirtyChanges = VariantManager.getDirtyChangesFromVariantChanges(this._aControlChanges, this.sFlexReference);
51
+ this._aDirtyChanges.forEach((oChange) => {
61
52
  if (oChange.getFileType() === "change") {
62
53
  oChange.setSavedToVariant(true);
63
54
  }
64
55
  });
65
- this.getModel().invalidateMap();
56
+ VariantManager.updateVariantManagementMap(this.sFlexReference);
66
57
  return Promise.resolve();
67
58
  };
68
59
 
@@ -77,7 +68,7 @@ sap.ui.define([
77
68
  oChange.setSavedToVariant(false);
78
69
  }
79
70
  });
80
- this.getModel().invalidateMap();
71
+ VariantManager.updateVariantManagementMap(this.sFlexReference);
81
72
  return Promise.resolve();
82
73
  };
83
74