@openui5/sap.ui.rta 1.114.0 → 1.115.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 (146) hide show
  1. package/.reuse/dep5 +0 -5
  2. package/THIRDPARTY.txt +0 -6
  3. package/package.json +6 -6
  4. package/src/sap/ui/rta/.library +1 -1
  5. package/src/sap/ui/rta/Client.js +1 -1
  6. package/src/sap/ui/rta/RuntimeAuthoring.js +67 -43
  7. package/src/sap/ui/rta/Utils.js +36 -2
  8. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  9. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  10. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  11. package/src/sap/ui/rta/command/AddXML.js +1 -1
  12. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  13. package/src/sap/ui/rta/command/AppDescriptorCommand.js +1 -1
  14. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  15. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  16. package/src/sap/ui/rta/command/Combine.js +1 -1
  17. package/src/sap/ui/rta/command/CommandFactory.js +1 -1
  18. package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
  19. package/src/sap/ui/rta/command/ControlVariantConfigure.js +4 -8
  20. package/src/sap/ui/rta/command/ControlVariantSave.js +5 -6
  21. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +7 -10
  22. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -5
  23. package/src/sap/ui/rta/command/ControlVariantSwitch.js +11 -12
  24. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  25. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  26. package/src/sap/ui/rta/command/FlexCommand.js +1 -1
  27. package/src/sap/ui/rta/command/LREPSerializer.js +4 -2
  28. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  29. package/src/sap/ui/rta/command/Move.js +1 -1
  30. package/src/sap/ui/rta/command/Property.js +1 -1
  31. package/src/sap/ui/rta/command/Remove.js +1 -1
  32. package/src/sap/ui/rta/command/Rename.js +1 -1
  33. package/src/sap/ui/rta/command/Resize.js +1 -1
  34. package/src/sap/ui/rta/command/Reveal.js +1 -1
  35. package/src/sap/ui/rta/command/Settings.js +1 -1
  36. package/src/sap/ui/rta/command/Split.js +1 -1
  37. package/src/sap/ui/rta/command/Stack.js +1 -1
  38. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  39. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  40. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
  41. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  42. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
  43. package/src/sap/ui/rta/enablement/elementActionTest.js +1 -1
  44. package/src/sap/ui/rta/library.js +2 -2
  45. package/src/sap/ui/rta/messagebundle.properties +8 -0
  46. package/src/sap/ui/rta/messagebundle_ar.properties +7 -3
  47. package/src/sap/ui/rta/messagebundle_bg.properties +7 -3
  48. package/src/sap/ui/rta/messagebundle_ca.properties +7 -3
  49. package/src/sap/ui/rta/messagebundle_cs.properties +7 -3
  50. package/src/sap/ui/rta/messagebundle_cy.properties +7 -3
  51. package/src/sap/ui/rta/messagebundle_da.properties +6 -2
  52. package/src/sap/ui/rta/messagebundle_de.properties +6 -2
  53. package/src/sap/ui/rta/messagebundle_el.properties +7 -3
  54. package/src/sap/ui/rta/messagebundle_en.properties +4 -0
  55. package/src/sap/ui/rta/messagebundle_en_GB.properties +4 -0
  56. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +7 -0
  57. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +7 -0
  58. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +4 -0
  59. package/src/sap/ui/rta/messagebundle_es.properties +6 -2
  60. package/src/sap/ui/rta/messagebundle_es_MX.properties +7 -3
  61. package/src/sap/ui/rta/messagebundle_et.properties +7 -3
  62. package/src/sap/ui/rta/messagebundle_fi.properties +7 -3
  63. package/src/sap/ui/rta/messagebundle_fr.properties +6 -2
  64. package/src/sap/ui/rta/messagebundle_fr_CA.properties +7 -3
  65. package/src/sap/ui/rta/messagebundle_hi.properties +7 -3
  66. package/src/sap/ui/rta/messagebundle_hr.properties +7 -3
  67. package/src/sap/ui/rta/messagebundle_hu.properties +7 -3
  68. package/src/sap/ui/rta/messagebundle_id.properties +7 -3
  69. package/src/sap/ui/rta/messagebundle_it.properties +6 -2
  70. package/src/sap/ui/rta/messagebundle_iw.properties +7 -3
  71. package/src/sap/ui/rta/messagebundle_ja.properties +20 -16
  72. package/src/sap/ui/rta/messagebundle_kk.properties +7 -3
  73. package/src/sap/ui/rta/messagebundle_ko.properties +7 -3
  74. package/src/sap/ui/rta/messagebundle_lt.properties +7 -3
  75. package/src/sap/ui/rta/messagebundle_lv.properties +7 -3
  76. package/src/sap/ui/rta/messagebundle_ms.properties +7 -3
  77. package/src/sap/ui/rta/messagebundle_nl.properties +6 -2
  78. package/src/sap/ui/rta/messagebundle_no.properties +7 -3
  79. package/src/sap/ui/rta/messagebundle_pl.properties +7 -3
  80. package/src/sap/ui/rta/messagebundle_pt.properties +6 -2
  81. package/src/sap/ui/rta/messagebundle_pt_PT.properties +6 -2
  82. package/src/sap/ui/rta/messagebundle_ro.properties +6 -2
  83. package/src/sap/ui/rta/messagebundle_ru.properties +7 -3
  84. package/src/sap/ui/rta/messagebundle_sh.properties +7 -3
  85. package/src/sap/ui/rta/messagebundle_sk.properties +7 -3
  86. package/src/sap/ui/rta/messagebundle_sl.properties +7 -3
  87. package/src/sap/ui/rta/messagebundle_sv.properties +6 -2
  88. package/src/sap/ui/rta/messagebundle_th.properties +8 -4
  89. package/src/sap/ui/rta/messagebundle_tr.properties +7 -3
  90. package/src/sap/ui/rta/messagebundle_uk.properties +7 -3
  91. package/src/sap/ui/rta/messagebundle_vi.properties +7 -3
  92. package/src/sap/ui/rta/messagebundle_zh_CN.properties +7 -3
  93. package/src/sap/ui/rta/messagebundle_zh_TW.properties +7 -3
  94. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +1 -1
  95. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  96. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  97. package/src/sap/ui/rta/plugin/CompVariant.js +6 -2
  98. package/src/sap/ui/rta/plugin/ControlVariant.js +4 -2
  99. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  100. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  101. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  102. package/src/sap/ui/rta/plugin/EasyAdd.js +1 -1
  103. package/src/sap/ui/rta/plugin/EasyRemove.js +1 -1
  104. package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
  105. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  106. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  107. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  108. package/src/sap/ui/rta/plugin/Rename.js +1 -1
  109. package/src/sap/ui/rta/plugin/RenameHandler.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 +1 -1
  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/AdditionalElementsPlugin.js +1 -1
  118. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  119. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
  120. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
  121. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  122. package/src/sap/ui/rta/service/Action.js +1 -1
  123. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  124. package/src/sap/ui/rta/service/Outline.js +1 -1
  125. package/src/sap/ui/rta/service/Property.js +1 -1
  126. package/src/sap/ui/rta/service/Selection.js +1 -1
  127. package/src/sap/ui/rta/service/SupportTools.js +11 -1
  128. package/src/sap/ui/rta/toolbar/Adaptation.js +23 -4
  129. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  130. package/src/sap/ui/rta/toolbar/Fiori.js +2 -2
  131. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  132. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  133. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  134. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  135. package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptations.js +52 -22
  136. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +3 -2
  137. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  138. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +2 -2
  139. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  140. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  141. package/src/sap/ui/rta/util/ReloadManager.js +30 -22
  142. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  143. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +42 -24
  144. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +5 -7
  145. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +52 -1
  146. package/src/sap/ui/rta/view/RemoveElementDialog.fragment.xml +1 -1
package/.reuse/dep5 CHANGED
@@ -192,11 +192,6 @@ Copyright: 2012 Matteo Spinelli
192
192
  License: MIT
193
193
  Comment: these files belong to: cubiq.org - swipeview
194
194
 
195
- Files: src/sap.ui.core/src/sap/ui/thirdparty/mobify-carousel.js
196
- Copyright: Mobify R&D Inc.
197
- License: MIT
198
- Comment: these files belong to: Mobify.js
199
-
200
195
  Files: src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js
201
196
  Copyright: 2011 Zynga Inc.
202
197
  License: MIT
package/THIRDPARTY.txt CHANGED
@@ -143,12 +143,6 @@ License: MIT
143
143
  License Text: https://github.com/SAP/openui5/blob/master/LICENSES/MIT.txt
144
144
  Contained in: src/sap.ui.core/src/sap/ui/thirdparty/swipe-view.js
145
145
 
146
- Component: Mobify.js, version: 1.1
147
- Copyright: Mobify R&D Inc.
148
- License: MIT
149
- License Text: https://github.com/SAP/openui5/blob/master/LICENSES/MIT.txt
150
- Contained in: src/sap.ui.core/src/sap/ui/thirdparty/mobify-carousel.js
151
-
152
146
  Component: Zynga Scroller, version: 1.2.1-0-g5d43806
153
147
  Copyright: 2011 Zynga Inc.
154
148
  License: MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openui5/sap.ui.rta",
3
- "version": "1.114.0",
3
+ "version": "1.115.1",
4
4
  "description": "OpenUI5 UI Library sap.ui.rta",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -14,10 +14,10 @@
14
14
  "url": "https://github.com/SAP/openui5.git"
15
15
  },
16
16
  "dependencies": {
17
- "@openui5/sap.m": "1.114.0",
18
- "@openui5/sap.ui.core": "1.114.0",
19
- "@openui5/sap.ui.dt": "1.114.0",
20
- "@openui5/sap.ui.fl": "1.114.0",
21
- "@openui5/sap.ui.layout": "1.114.0"
17
+ "@openui5/sap.m": "1.115.1",
18
+ "@openui5/sap.ui.core": "1.115.1",
19
+ "@openui5/sap.ui.dt": "1.115.1",
20
+ "@openui5/sap.ui.fl": "1.115.1",
21
+ "@openui5/sap.ui.layout": "1.115.1"
22
22
  }
23
23
  }
@@ -6,7 +6,7 @@
6
6
  <copyright>OpenUI5
7
7
  * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
8
8
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
9
- <version>1.114.0</version>
9
+ <version>1.115.1</version>
10
10
 
11
11
  <documentation>SAPUI5 library with RTA controls.</documentation>
12
12
 
@@ -57,7 +57,7 @@ sap.ui.define([
57
57
  * @alias sap.ui.rta.Client
58
58
  * @author SAP SE
59
59
  * @since 1.56.0
60
- * @version 1.114.0
60
+ * @version 1.115.1
61
61
  * @private
62
62
  * @ui5-restricted
63
63
  */
@@ -120,7 +120,7 @@ sap.ui.define([
120
120
  * @class The runtime authoring allows to adapt the fields of a running application.
121
121
  * @extends sap.ui.base.ManagedObject
122
122
  * @author SAP SE
123
- * @version 1.114.0
123
+ * @version 1.115.1
124
124
  * @constructor
125
125
  * @private
126
126
  * @since 1.30
@@ -441,6 +441,7 @@ sap.ui.define([
441
441
  * @public
442
442
  */
443
443
  RuntimeAuthoring.prototype.start = function() {
444
+ var bIsAutomaticRestart = RuntimeAuthoring.needsRestart(this.getLayer());
444
445
  var oDesignTimePromise;
445
446
  var vError;
446
447
  // Create DesignTime
@@ -454,8 +455,8 @@ sap.ui.define([
454
455
  }
455
456
 
456
457
  return this._loadUShellServicesPromise
457
- .then(initVersioning.bind(this))
458
- .then(initContextBasedAdaptations.bind(this))
458
+ .then(initVersioning.bind(this, bIsAutomaticRestart))
459
+ .then(initContextBasedAdaptations.bind(this, bIsAutomaticRestart))
459
460
  /*
460
461
  Check if the application has personalized changes and reload without them;
461
462
  Also Check if the application has an available draft and if yes, reload with those changes.
@@ -575,7 +576,7 @@ sap.ui.define([
575
576
  validateFlexEnabled(this);
576
577
  }
577
578
  this._sStatus = STARTED;
578
- RuntimeAuthoring.disableRestart(Layer.CUSTOMER);
579
+ RuntimeAuthoring.disableRestart(this.getLayer());
579
580
  this.fireStart({
580
581
  editablePluginsCount: this.getPluginManager().getEditableOverlaysCount()
581
582
  });
@@ -1063,33 +1064,30 @@ sap.ui.define([
1063
1064
  * @returns {Promise} Resolves as soon as the MessageBox is closed
1064
1065
  */
1065
1066
  function onStackModified() {
1066
- var bBackEndDraftExists = this._oVersionsModel.getProperty("/backendDraft");
1067
- var bDraftDisplayed = this._oVersionsModel.getProperty("/displayedVersion") === Version.Number.Draft;
1068
1067
  var oCommandStack = this.getCommandStack();
1069
1068
  var bCanUndo = oCommandStack.canUndo();
1070
1069
 
1070
+ // FIXME Missing check whether action is saveable e.g. switching a view should not trigger this
1071
+ // bCanUndo and _bUserDiscardedDraft seem to be redundant logic,
1072
+ // because displayedVersion would be draft already
1071
1073
  if (
1072
1074
  !this.getShowToolbars() ||
1073
1075
  !bCanUndo ||
1074
- this._bUserDiscardedDraft ||
1075
- bDraftDisplayed ||
1076
- !bBackEndDraftExists
1076
+ this._bUserDiscardedDraft
1077
1077
  ) {
1078
- return modifyStack.call(this);
1078
+ modifyStack.call(this);
1079
+ return;
1079
1080
  }
1080
1081
 
1081
1082
  // warn the user: the existing draft would be discarded in case the user saves
1082
- return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_AND_CREATE_NEW_DIALOG", {
1083
- titleKey: "TIT_DRAFT_DISCARD_DIALOG",
1084
- actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
1085
- emphasizedAction: MessageBox.Action.OK
1086
- })
1087
- .then(function(sAction) {
1088
- if (sAction === MessageBox.Action.OK) {
1089
- discardDraftConfirmed.call(this);
1090
- } else {
1091
- this.undo();
1083
+ Utils.checkDraftOverwrite(this._oVersionsModel)
1084
+ .then(function(bDialogShown) {
1085
+ if (bDialogShown) {
1086
+ this._bUserDiscardedDraft = true;
1092
1087
  }
1088
+ modifyStack.call(this);
1089
+ }.bind(this), function() {
1090
+ this.undo();
1093
1091
  }.bind(this));
1094
1092
  }
1095
1093
 
@@ -1211,6 +1209,10 @@ sap.ui.define([
1211
1209
  // Save changes on the current layer and discard dirty changes on other layers
1212
1210
  mPropertyBag.saveAsDraft = this.getLayer() === Layer.CUSTOMER;
1213
1211
  }
1212
+ if (this._oContextBasedAdaptationsModel.getProperty("/contextBasedAdaptationsEnabled")) {
1213
+ // If an adaptation is being processed, saving without exiting must retrieve the updated state of the adaptation
1214
+ mPropertyBag.adaptationId = bIsExit ? undefined : this._oContextBasedAdaptationsModel.getProperty("/displayedAdaptation/id");
1215
+ }
1214
1216
 
1215
1217
  return this._oSerializer.saveCommands(mPropertyBag)
1216
1218
  .then(function() {
@@ -1344,18 +1346,18 @@ sap.ui.define([
1344
1346
  emphasizedAction: MessageBox.Action.YES
1345
1347
  }).then(function(sAction) {
1346
1348
  if (sAction === MessageBox.Action.YES) {
1347
- this._serializeToLrep()
1349
+ return this._serializeToLrep()
1348
1350
  .then(callbackFn);
1349
1351
  } else if (sAction === MessageBox.Action.NO) {
1350
1352
  // avoids the data loss popup; a reload is triggered later and will destroy RTA & the command stack
1351
1353
  this.getCommandStack().removeAllCommands(true);
1352
- callbackFn();
1354
+ return callbackFn();
1353
1355
  }
1354
- return undefined;
1356
+ return Promise.resolve();
1355
1357
  }.bind(this));
1356
- return;
1358
+ return Promise.resolve();
1357
1359
  }
1358
- callbackFn();
1360
+ return callbackFn();
1359
1361
  }
1360
1362
 
1361
1363
  function onSwitchAdaptation(oEvent) {
@@ -1366,15 +1368,20 @@ sap.ui.define([
1366
1368
  var sAdaptationId = oEvent.getParameter("adaptationId");
1367
1369
  this._sSwitchToAdaptationId = sAdaptationId;
1368
1370
  return handleDataLoss.call(this, "MSG_SWITCH_VERSION_DIALOG", "BTN_SWITCH_ADAPTATIONS",
1369
- switchAdaptation.bind(this, this._sSwitchToAdaptationId));
1371
+ switchAdaptation.bind(this, this._sSwitchToAdaptationId))
1372
+ .catch(function(oError) {
1373
+ Utils.showMessageBox("error", "MSG_SWITCH_ADAPTATION_FAILED", {error: oError});
1374
+ Log.error("sap.ui.rta: " + oError.stack || oError.message || oError);
1375
+ });
1370
1376
  }
1371
1377
 
1372
1378
  function switchAdaptation(sAdaptationId) {
1373
1379
  var sVersion = this._oVersionsModel.getProperty("/displayedVersion");
1374
- switchVersion.call(this, sVersion, sAdaptationId);
1380
+ return switchVersion.call(this, sVersion, sAdaptationId);
1375
1381
  }
1376
1382
 
1377
1383
  function onSwitchVersion(oEvent) {
1384
+ var fnCallback = oEvent.getParameter("callback") || function() {};
1378
1385
  var sVersion = oEvent.getParameter("version");
1379
1386
  var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
1380
1387
 
@@ -1384,24 +1391,30 @@ sap.ui.define([
1384
1391
  }
1385
1392
 
1386
1393
  this._sSwitchToVersion = sVersion;
1387
- return handleDataLoss.call(this, "MSG_SWITCH_VERSION_DIALOG", "TIT_SWITCH_VERSION_DIALOG",
1388
- switchVersion.bind(this, this._sSwitchToVersion));
1394
+ handleDataLoss.call(this, "MSG_SWITCH_VERSION_DIALOG", "TIT_SWITCH_VERSION_DIALOG",
1395
+ switchVersion.bind(this, this._sSwitchToVersion))
1396
+ .then(fnCallback)
1397
+ .catch(function(oError) {
1398
+ Utils.showMessageBox("error", "MSG_SWITCH_VERSION_FAILED", {error: oError});
1399
+ Log.error("sap.ui.rta: " + oError.stack || oError.message || oError);
1400
+ });
1389
1401
  }
1390
1402
 
1391
1403
  function switchVersion(sVersion, sAdaptationId) {
1392
1404
  RuntimeAuthoring.enableRestart(this.getLayer(), this.getRootControlInstance());
1393
1405
 
1394
- VersionsAPI.loadVersionForApplication({
1406
+ return VersionsAPI.loadVersionForApplication({
1395
1407
  control: this.getRootControlInstance(),
1396
1408
  layer: this.getLayer(),
1397
1409
  version: sVersion,
1398
1410
  adaptationId: sAdaptationId
1411
+ }).then(function() {
1412
+ var oReloadInfo = {
1413
+ versionSwitch: true,
1414
+ version: sVersion
1415
+ };
1416
+ ReloadManager.triggerReload(oReloadInfo);
1399
1417
  });
1400
- var oReloadInfo = {
1401
- versionSwitch: true,
1402
- version: sVersion
1403
- };
1404
- ReloadManager.triggerReload(oReloadInfo);
1405
1418
  }
1406
1419
 
1407
1420
  function onPublishVersion() {
@@ -1420,11 +1433,6 @@ sap.ui.define([
1420
1433
  });
1421
1434
  }
1422
1435
 
1423
- function discardDraftConfirmed() {
1424
- this._bUserDiscardedDraft = true;
1425
- modifyStack.call(this);
1426
- }
1427
-
1428
1436
  function isOldVersionDisplayed() {
1429
1437
  return VersionsAPI.isOldVersionDisplayed({
1430
1438
  control: this.getRootControlInstance(),
@@ -1439,7 +1447,15 @@ sap.ui.define([
1439
1447
  });
1440
1448
  }
1441
1449
 
1442
- function initVersioning() {
1450
+ /**
1451
+ * Inits version models. Clears old state if RTA is starting from end user mode (no switch)
1452
+ * @param {boolean} bIsAutomaticRestart - If true this is not an RTA start but a reload due to version/adaptation switch
1453
+ * @returns {Promise<void>} - Promise
1454
+ */
1455
+ function initVersioning(bIsAutomaticRestart) {
1456
+ if (!bIsAutomaticRestart) {
1457
+ VersionsAPI.clearInstances();
1458
+ }
1443
1459
  return VersionsAPI.initialize({
1444
1460
  control: this.getRootControlInstance(),
1445
1461
  layer: this.getLayer()
@@ -1448,7 +1464,15 @@ sap.ui.define([
1448
1464
  }.bind(this));
1449
1465
  }
1450
1466
 
1451
- function initContextBasedAdaptations() {
1467
+ /**
1468
+ * Inits CBA models. Clears old state if RTA is starting from end user mode (no switch)
1469
+ * @param {boolean} bIsAutomaticRestart - If true this is not an RTA start but a reload due to version/adaptation switch
1470
+ * @returns {Promise<void>} - Promise
1471
+ */
1472
+ function initContextBasedAdaptations(bIsAutomaticRestart) {
1473
+ if (!bIsAutomaticRestart) {
1474
+ ContextBasedAdaptationsAPI.clearInstances();
1475
+ }
1452
1476
  return ContextBasedAdaptationsAPI.initialize({
1453
1477
  control: this.getRootControlInstance(),
1454
1478
  layer: this.getLayer()
@@ -1754,7 +1778,7 @@ sap.ui.define([
1754
1778
  if (oError && oError.message && oError.message.indexOf("The following Change cannot be applied because of a dependency") > -1) {
1755
1779
  Utils.showMessageBox("error", "MSG_DEPENDENCY_ERROR", {error: oError});
1756
1780
  }
1757
- Log.error("sap.ui.rta: " + oError.message);
1781
+ Log.error("sap.ui.rta:", oError.message, oError.stack);
1758
1782
  });
1759
1783
  }
1760
1784
  return undefined;
@@ -9,6 +9,7 @@ sap.ui.define([
9
9
  "sap/ui/fl/Utils",
10
10
  "sap/ui/fl/Layer",
11
11
  "sap/ui/fl/LayerUtils",
12
+ "sap/ui/fl/write/api/Version",
12
13
  "sap/ui/dt/OverlayUtil",
13
14
  "sap/ui/dt/DOMUtil",
14
15
  "sap/ui/dt/ElementUtil",
@@ -26,6 +27,7 @@ function(
26
27
  FlexUtils,
27
28
  Layer,
28
29
  FlexLayerUtils,
30
+ Version,
29
31
  OverlayUtil,
30
32
  DOMUtil,
31
33
  ElementUtil,
@@ -45,7 +47,7 @@ function(
45
47
  *
46
48
  * @namespace
47
49
  * @author SAP SE
48
- * @version 1.114.0
50
+ * @version 1.115.1
49
51
  *
50
52
  * @private
51
53
  * @since 1.30
@@ -407,7 +409,7 @@ function(
407
409
  var oRenderer = Utils.getFiori2Renderer();
408
410
  return oRenderer
409
411
  && oRenderer.getRootControl
410
- && oRenderer.getRootControl().getOUnifiedShell().getHeader();
412
+ && oRenderer.getRootControl().getShellHeader();
411
413
  };
412
414
 
413
415
  /**
@@ -644,5 +646,37 @@ function(
644
646
  });
645
647
  };
646
648
 
649
+ /**
650
+ * Check if an existing draft would be overwritten if a change is done on the currently shown version
651
+ * If so it opens a confirmation dialog.
652
+ * @param {object} oVersionsModel The versions model
653
+ * @return {Promise.<boolean>} It either resolves with an indicator whether a confirmation
654
+ * was shown or rejects with "cancel" if cancel was pressed
655
+ */
656
+ Utils.checkDraftOverwrite = function(oVersionsModel) {
657
+ var bBackEndDraftExists = oVersionsModel.getProperty("/backendDraft");
658
+ var bDraftDisplayed = oVersionsModel.getProperty("/displayedVersion") === Version.Number.Draft;
659
+
660
+ if (
661
+ bDraftDisplayed ||
662
+ !bBackEndDraftExists
663
+ ) {
664
+ return Promise.resolve(false);
665
+ }
666
+
667
+ // warn the user: the existing draft would be discarded in case the user saves
668
+ return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_AND_CREATE_NEW_DIALOG", {
669
+ titleKey: "TIT_DRAFT_DISCARD_DIALOG",
670
+ actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
671
+ emphasizedAction: MessageBox.Action.OK
672
+ })
673
+ .then(function(sAction) {
674
+ if (sAction !== MessageBox.Action.OK) {
675
+ throw "cancel";
676
+ }
677
+ return true;
678
+ });
679
+ };
680
+
647
681
  return Utils;
648
682
  }, /* bExport= */true);
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @extends sap.ui.base.ManagedObject
26
26
  * @author SAP SE
27
- * @version 1.114.0
27
+ * @version 1.115.1
28
28
  * @constructor
29
29
  * @private
30
30
  * @since 1.53
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.114.0
19
+ * @version 1.115.1
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.75
@@ -14,7 +14,7 @@ sap.ui.define([
14
14
  * @class
15
15
  * @extends sap.ui.rta.command.FlexCommand
16
16
  * @author SAP SE
17
- * @version 1.114.0
17
+ * @version 1.115.1
18
18
  * @constructor
19
19
  * @private
20
20
  * @since 1.78
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.114.0
19
+ * @version 1.115.1
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.54
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @extends sap.ui.rta.command.FlexCommand
26
26
  * @author SAP SE
27
- * @version 1.114.0
27
+ * @version 1.115.1
28
28
  * @constructor
29
29
  * @private
30
30
  * @since 1.76
@@ -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.114.0
24
+ * @version 1.115.1
25
25
  *
26
26
  * @constructor
27
27
  * @private
@@ -13,7 +13,7 @@ sap.ui.define(["sap/ui/base/ManagedObject"], function(ManagedObject) {
13
13
  * @extends sap.ui.base.ManagedObject
14
14
  *
15
15
  * @author SAP SE
16
- * @version 1.114.0
16
+ * @version 1.115.1
17
17
  *
18
18
  * @constructor
19
19
  * @private
@@ -26,7 +26,7 @@ sap.ui.define([
26
26
  * @class
27
27
  * @extends sap.ui.rta.command.FlexCommand
28
28
  * @author SAP SE
29
- * @version 1.114.0
29
+ * @version 1.115.1
30
30
  * @constructor
31
31
  * @private
32
32
  * @since 1.38
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.114.0
19
+ * @version 1.115.1
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.46
@@ -485,7 +485,7 @@ sap.ui.define([
485
485
  * @extends sap.ui.base.ManagedObject
486
486
  *
487
487
  * @author SAP SE
488
- * @version 1.114.0
488
+ * @version 1.115.1
489
489
  *
490
490
  * @constructor
491
491
  * @private
@@ -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.114.0
24
+ * @version 1.115.1
25
25
  *
26
26
  * @constructor
27
27
  * @private
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @extends sap.ui.rta.command.BaseCommand
26
26
  * @author SAP SE
27
- * @version 1.114.0
27
+ * @version 1.115.1
28
28
  * @constructor
29
29
  * @private
30
30
  * @since 1.52
@@ -79,9 +79,7 @@ sap.ui.define([
79
79
  this._aPreparedChanges.push(this.oModel.addVariantChange(this.sVariantManagementReference, mChangeProperties));
80
80
  }.bind(this));
81
81
 
82
- return Promise.resolve().then(function() {
83
- this.oModel.checkUpdate(true);
84
- }.bind(this));
82
+ return Promise.resolve();
85
83
  };
86
84
 
87
85
  /**
@@ -108,10 +106,8 @@ sap.ui.define([
108
106
  this.oModel.deleteVariantChange(this.sVariantManagementReference, mPropertyBag, oChange);
109
107
  }.bind(this));
110
108
 
111
- return Promise.resolve().then(function() {
112
- this.oModel.checkUpdate(true);
113
- this._aPreparedChanges = null;
114
- }.bind(this));
109
+ this._aPreparedChanges = null;
110
+ return Promise.resolve();
115
111
  };
116
112
 
117
113
  return ControlVariantConfigure;
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  * @class
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  * @author SAP SE
23
- * @version 1.114.0
23
+ * @version 1.115.1
24
24
  * @constructor
25
25
  * @private
26
26
  * @since 1.86
@@ -59,11 +59,10 @@ sap.ui.define([
59
59
  this._aDirtyChanges = this.getModel()._getDirtyChangesFromVariantChanges(this._aControlChanges);
60
60
  this._aDirtyChanges.forEach(function(oChange) {
61
61
  if (oChange.getFileType() === "change") {
62
- oChange.assignedToVariant = true;
62
+ oChange.setSavedToVariant(true);
63
63
  }
64
64
  });
65
- this.getModel().oData[this.sVariantManagementReference].modified = false;
66
- this.getModel().checkUpdate(true);
65
+ this.getModel().invalidateMap();
67
66
  return Promise.resolve();
68
67
  };
69
68
 
@@ -75,10 +74,10 @@ sap.ui.define([
75
74
  ControlVariantSave.prototype.undo = function() {
76
75
  this._aDirtyChanges.forEach(function(oChange) {
77
76
  if (oChange.getFileType() === "change") {
78
- oChange.assignedToVariant = false;
77
+ oChange.setSavedToVariant(false);
79
78
  }
80
79
  });
81
- this.getModel().checkDirtyStateForControlModels([this.sVariantManagementReference]);
80
+ this.getModel().invalidateMap();
82
81
  return Promise.resolve();
83
82
  };
84
83
 
@@ -28,7 +28,7 @@ sap.ui.define([
28
28
  * @class
29
29
  * @extends sap.ui.rta.command.BaseCommand
30
30
  * @author SAP SE
31
- * @version 1.114.0
31
+ * @version 1.115.1
32
32
  * @constructor
33
33
  * @private
34
34
  * @since 1.86
@@ -66,6 +66,8 @@ sap.ui.define([
66
66
  this.oModel = this.getModel();
67
67
  this.setSourceDefaultVariant(this.oModel.getData()[this.sVariantManagementReference].defaultVariant);
68
68
  this.sLayer = mFlexSettings.layer;
69
+ var mComponentPropertyBag = mFlexSettings;
70
+ mComponentPropertyBag.variantManagementControl = this.oVariantManagementControl;
69
71
 
70
72
  function storeEventParameters(oEvent, oArgs) {
71
73
  var mParameters = oEvent.getParameters();
@@ -84,7 +86,7 @@ sap.ui.define([
84
86
  this.oVariantManagementControl.attachSave({resolve: resolve}, storeEventParameters, this);
85
87
  this.oVariantManagementControl.attachCancel({resolve: resolve}, handleCancel, this);
86
88
  this.oVariantManagementControl.openSaveAsDialogForKeyUser(rtaUtils.getRtaStyleClassName(),
87
- ContextSharingAPI.createComponent(mFlexSettings));
89
+ ContextSharingAPI.createComponent(mComponentPropertyBag));
88
90
  }.bind(this))
89
91
  .then(function(bState) {
90
92
  return bState;
@@ -117,12 +119,10 @@ sap.ui.define([
117
119
  this.sNewVariantReference = this._oVariantChange.getId();
118
120
  this._aPreparedChanges.forEach(function(oChange) {
119
121
  if (oChange.getFileType() === "change") {
120
- oChange.assignedToVariant = true;
122
+ oChange.setSavedToVariant(true);
121
123
  }
122
124
  });
123
- // Assigning changes to the variant might have an impact on the modified state
124
- // Call the check again to make sure it is up to date
125
- this.getModel().checkDirtyStateForControlModels([this.sVariantManagementReference]);
125
+ this.getModel().invalidateMap();
126
126
  }.bind(this));
127
127
  };
128
128
 
@@ -135,7 +135,7 @@ sap.ui.define([
135
135
  if (this._oVariantChange) {
136
136
  this._aPreparedChanges.forEach(function(oChange) {
137
137
  if (oChange.getFileType() === "ctrl_variant_management_change") {
138
- this.oModel.oFlexController.deleteChange(oChange, this.oAppComponent);
138
+ this.oModel.oFlexController.deleteChange(oChange);
139
139
  }
140
140
  }.bind(this));
141
141
 
@@ -151,11 +151,8 @@ sap.ui.define([
151
151
  return this.oModel.addAndApplyChangesOnVariant(this._aControlChanges);
152
152
  }.bind(this))
153
153
  .then(function() {
154
- this.oModel.getData()[this.sVariantManagementReference].defaultVariant = this.getSourceDefaultVariant();
155
- this.oModel.getData()[this.sVariantManagementReference].originalDefaultVariant = this.getSourceDefaultVariant();
156
154
  this._aPreparedChanges = null;
157
155
  this._oVariantChange = null;
158
- this.getModel().checkUpdate(true);
159
156
  }.bind(this));
160
157
  }
161
158
  return Promise.resolve();
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @extends sap.ui.rta.command.BaseCommand
26
26
  * @author SAP SE
27
- * @version 1.114.0
27
+ * @version 1.115.1
28
28
  * @constructor
29
29
  * @private
30
30
  * @since 1.50
@@ -69,7 +69,6 @@ sap.ui.define([
69
69
  */
70
70
  ControlVariantSetTitle.prototype.execute = function() {
71
71
  var oVariantManagementControl = this.getElement();
72
- var oVariantManagementControlBinding = oVariantManagementControl.getTitle().getBinding("text");
73
72
 
74
73
  this.oAppComponent = flUtils.getAppComponentForControl(oVariantManagementControl);
75
74
  this.oModel = this.oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
@@ -91,7 +90,6 @@ sap.ui.define([
91
90
  return Promise.resolve(this.oModel.addVariantChange(this.sVariantManagementReference, mPropertyBag))
92
91
  .then(function(oChange) {
93
92
  this._oVariantChange = oChange;
94
- oVariantManagementControlBinding.checkUpdate(true); /*Force Update as binding key stays same*/
95
93
  }.bind(this));
96
94
  };
97
95
 
@@ -101,7 +99,6 @@ sap.ui.define([
101
99
  * @returns {Promise} Returns resolve after undo
102
100
  */
103
101
  ControlVariantSetTitle.prototype.undo = function() {
104
- var oVariantManagementControlBinding = this.getElement().getTitle().getBinding("text");
105
102
  var mPropertyBag = {
106
103
  variantReference: this.sCurrentVariant,
107
104
  changeType: "setTitle",
@@ -112,7 +109,6 @@ sap.ui.define([
112
109
  return Promise.resolve(this.oModel.deleteVariantChange(this.sVariantManagementReference, mPropertyBag, oChange))
113
110
  .then(function() {
114
111
  this._oVariantChange = null;
115
- oVariantManagementControlBinding.checkUpdate(true); /*Force Update as binding key stays same*/
116
112
  }.bind(this));
117
113
  };
118
114