@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.
- package/THIRDPARTY.txt +2 -2
- package/package.json +6 -6
- package/src/sap/ui/rta/.library +1 -1
- package/src/sap/ui/rta/Client.js +1 -1
- package/src/sap/ui/rta/RuntimeAuthoring.js +1 -1
- package/src/sap/ui/rta/Utils.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
- package/src/sap/ui/rta/command/AddIFrame.js +6 -8
- package/src/sap/ui/rta/command/AddProperty.js +2 -2
- package/src/sap/ui/rta/command/AddXML.js +3 -3
- package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +17 -19
- package/src/sap/ui/rta/command/AnnotationCommand.js +1 -1
- package/src/sap/ui/rta/command/BaseCommand.js +3 -4
- package/src/sap/ui/rta/command/BindProperty.js +4 -4
- package/src/sap/ui/rta/command/Combine.js +4 -4
- package/src/sap/ui/rta/command/CommandFactory.js +55 -77
- package/src/sap/ui/rta/command/CompositeCommand.js +19 -39
- package/src/sap/ui/rta/command/ControlVariantConfigure.js +16 -20
- package/src/sap/ui/rta/command/ControlVariantSave.js +19 -28
- package/src/sap/ui/rta/command/ControlVariantSaveAs.js +38 -43
- package/src/sap/ui/rta/command/ControlVariantSetTitle.js +15 -26
- package/src/sap/ui/rta/command/ControlVariantSwitch.js +29 -50
- package/src/sap/ui/rta/command/CreateContainer.js +3 -3
- package/src/sap/ui/rta/command/CustomAdd.js +2 -2
- package/src/sap/ui/rta/command/ExtendControllerCommand.js +2 -4
- package/src/sap/ui/rta/command/FlexCommand.js +34 -44
- package/src/sap/ui/rta/command/LREPSerializer.js +20 -23
- package/src/sap/ui/rta/command/LocalReset.js +3 -3
- package/src/sap/ui/rta/command/ManifestCommand.js +1 -1
- package/src/sap/ui/rta/command/Move.js +5 -5
- package/src/sap/ui/rta/command/Property.js +3 -3
- package/src/sap/ui/rta/command/Remove.js +4 -4
- package/src/sap/ui/rta/command/Rename.js +3 -3
- package/src/sap/ui/rta/command/Resize.js +2 -2
- package/src/sap/ui/rta/command/Reveal.js +3 -3
- package/src/sap/ui/rta/command/Settings.js +2 -2
- package/src/sap/ui/rta/command/Split.js +3 -3
- package/src/sap/ui/rta/command/Stack.js +51 -55
- package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +10 -10
- package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +4 -4
- package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +11 -11
- package/src/sap/ui/rta/command/manifest/AddLibrary.js +4 -8
- package/src/sap/ui/rta/enablement/elementActionTest.js +21 -9
- package/src/sap/ui/rta/library.js +2 -2
- package/src/sap/ui/rta/messagebundle_da.properties +1 -1
- package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +1 -1
- package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/rta/plugin/AddXMLPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
- package/src/sap/ui/rta/plugin/Combine.js +1 -1
- package/src/sap/ui/rta/plugin/ControlVariant.js +65 -87
- package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
- package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
- package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
- package/src/sap/ui/rta/plugin/ExtendControllerPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/LocalReset.js +26 -35
- package/src/sap/ui/rta/plugin/Plugin.js +1 -1
- package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
- package/src/sap/ui/rta/plugin/Remove.js +1 -1
- package/src/sap/ui/rta/plugin/Resize.js +1 -1
- package/src/sap/ui/rta/plugin/Selection.js +1 -1
- package/src/sap/ui/rta/plugin/Settings.js +1 -1
- package/src/sap/ui/rta/plugin/Split.js +1 -1
- package/src/sap/ui/rta/plugin/Stretch.js +7 -6
- package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +17 -5
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
- package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +1 -1
- package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +1 -1
- package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
- package/src/sap/ui/rta/plugin/rename/Rename.js +1 -1
- package/src/sap/ui/rta/plugin/rename/RenameDialog.js +2 -4
- package/src/sap/ui/rta/service/Action.js +1 -1
- package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
- package/src/sap/ui/rta/service/Outline.js +1 -1
- package/src/sap/ui/rta/service/Property.js +1 -1
- package/src/sap/ui/rta/service/Selection.js +1 -1
- package/src/sap/ui/rta/service/SupportTools.js +1 -1
- package/src/sap/ui/rta/toolbar/Adaptation.js +1 -1
- package/src/sap/ui/rta/toolbar/Base.js +1 -1
- package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
- package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
- package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
- package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
- package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +1 -1
- package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
- package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
- package/src/sap/ui/rta/util/PluginManager.js +1 -1
- package/src/sap/ui/rta/util/PopupManager.js +3 -3
- package/src/sap/ui/rta/util/ReloadManager.js +1 -1
- package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
- package/src/sap/ui/rta/util/ServiceManager.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/resolveBinding.js +1 -1
- package/src/sap/ui/rta/util/guidedTour/GuidedTour.js +1 -1
- package/src/sap/ui/rta/util/guidedTour/content/GeneralTour.js +1 -1
- package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +1 -1
|
@@ -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.
|
|
24
|
+
* @version 1.141.1
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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(
|
|
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
|
-
|
|
63
|
+
throw oError;
|
|
64
|
+
}
|
|
71
65
|
};
|
|
72
66
|
|
|
73
67
|
CompositeCommand.prototype.undo = function() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
31
|
+
* @version 1.141.1
|
|
34
32
|
* @constructor
|
|
35
33
|
* @private
|
|
36
34
|
* @since 1.52
|
|
37
35
|
* @alias sap.ui.rta.command.ControlVariantConfigure
|
|
38
36
|
*/
|
|
39
|
-
|
|
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
|
-
|
|
77
|
+
const oVariantManagementControl = this.getControl();
|
|
80
78
|
this.oAppComponent = FlUtils.getAppComponentForControl(oVariantManagementControl);
|
|
81
|
-
this.
|
|
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 ===
|
|
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
|
|
96
|
-
|
|
97
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
141
|
+
const oChange = this._aPreparedChanges[index];
|
|
145
142
|
VariantManager.deleteVariantChange(this.sVariantManagementReference, mPropertyBag, oChange);
|
|
146
|
-
}
|
|
143
|
+
});
|
|
147
144
|
|
|
148
145
|
this._aPreparedChanges = null;
|
|
149
146
|
if (this._sOldVReference) {
|
|
150
|
-
await
|
|
151
|
-
|
|
152
|
-
|
|
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/
|
|
8
|
-
"sap/ui/
|
|
9
|
-
"sap/ui/
|
|
7
|
+
"sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
|
|
8
|
+
"sap/ui/fl/variants/VariantManager",
|
|
9
|
+
"sap/ui/rta/command/BaseCommand"
|
|
10
10
|
], function(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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.
|
|
23
|
+
* @version 1.141.1
|
|
24
24
|
* @constructor
|
|
25
25
|
* @private
|
|
26
26
|
* @since 1.86
|
|
27
27
|
* @alias sap.ui.rta.command.ControlVariantSave
|
|
28
28
|
*/
|
|
29
|
-
|
|
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
|
-
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
60
|
-
|
|
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
|
-
|
|
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
|
-
|
|
71
|
+
VariantManager.updateVariantManagementMap(this.sFlexReference);
|
|
81
72
|
return Promise.resolve();
|
|
82
73
|
};
|
|
83
74
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
|
-
"sap/ui/
|
|
7
|
+
"sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
|
|
8
8
|
"sap/ui/fl/variants/VariantManager",
|
|
9
9
|
"sap/ui/fl/write/api/ContextSharingAPI",
|
|
10
10
|
"sap/ui/fl/write/api/PersistenceWriteAPI",
|
|
@@ -13,11 +13,11 @@ sap.ui.define([
|
|
|
13
13
|
"sap/ui/rta/library",
|
|
14
14
|
"sap/ui/rta/Utils"
|
|
15
15
|
], function(
|
|
16
|
-
|
|
16
|
+
FlexRuntimeInfoAPI,
|
|
17
17
|
VariantManager,
|
|
18
18
|
ContextSharingAPI,
|
|
19
19
|
PersistenceWriteAPI,
|
|
20
|
-
|
|
20
|
+
FlUtils,
|
|
21
21
|
BaseCommand,
|
|
22
22
|
rtaLibrary,
|
|
23
23
|
rtaUtils
|
|
@@ -30,13 +30,13 @@ sap.ui.define([
|
|
|
30
30
|
* @class
|
|
31
31
|
* @extends sap.ui.rta.command.BaseCommand
|
|
32
32
|
* @author SAP SE
|
|
33
|
-
* @version 1.
|
|
33
|
+
* @version 1.141.1
|
|
34
34
|
* @constructor
|
|
35
35
|
* @private
|
|
36
36
|
* @since 1.86
|
|
37
37
|
* @alias sap.ui.rta.command.ControlVariantSaveAs
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
const ControlVariantSaveAs = BaseCommand.extend("sap.ui.rta.command.ControlVariantSaveAs", {
|
|
40
40
|
metadata: {
|
|
41
41
|
library: "sap.ui.rta",
|
|
42
42
|
properties: {
|
|
@@ -46,9 +46,6 @@ sap.ui.define([
|
|
|
46
46
|
sourceDefaultVariant: {
|
|
47
47
|
type: "string"
|
|
48
48
|
},
|
|
49
|
-
model: {
|
|
50
|
-
type: "object"
|
|
51
|
-
},
|
|
52
49
|
newVariantParameters: {
|
|
53
50
|
type: "object"
|
|
54
51
|
}
|
|
@@ -61,18 +58,17 @@ sap.ui.define([
|
|
|
61
58
|
/**
|
|
62
59
|
* @override
|
|
63
60
|
*/
|
|
64
|
-
ControlVariantSaveAs.prototype.prepare = function(mFlexSettings) {
|
|
61
|
+
ControlVariantSaveAs.prototype.prepare = async function(mFlexSettings) {
|
|
65
62
|
this.oVariantManagementControl = this.getElement();
|
|
66
|
-
this.oAppComponent =
|
|
67
|
-
this.sVariantManagementReference =
|
|
68
|
-
this.
|
|
69
|
-
this.setSourceDefaultVariant(this.oModel.getData()[this.sVariantManagementReference].defaultVariant);
|
|
63
|
+
this.oAppComponent = FlUtils.getAppComponentForControl(this.oVariantManagementControl);
|
|
64
|
+
this.sVariantManagementReference = this.oVariantManagementControl.getVariantManagementReference();
|
|
65
|
+
this.setSourceDefaultVariant(this.oVariantManagementControl.getDefaultVariantKey());
|
|
70
66
|
this.sLayer = mFlexSettings.layer;
|
|
71
|
-
|
|
67
|
+
const mComponentPropertyBag = mFlexSettings;
|
|
72
68
|
mComponentPropertyBag.variantManagementControl = this.oVariantManagementControl;
|
|
73
69
|
|
|
74
70
|
function storeEventParameters(oEvent, oArgs) {
|
|
75
|
-
|
|
71
|
+
const mParameters = oEvent.getParameters();
|
|
76
72
|
this.setNewVariantParameters(mParameters);
|
|
77
73
|
this.oVariantManagementControl.detachSave(storeEventParameters, this);
|
|
78
74
|
this.oVariantManagementControl.detachCancel(handleCancel, this);
|
|
@@ -84,15 +80,15 @@ sap.ui.define([
|
|
|
84
80
|
oArgs.resolve(false);
|
|
85
81
|
}
|
|
86
82
|
|
|
87
|
-
|
|
83
|
+
const bState = await new Promise((resolve) => {
|
|
88
84
|
this.oVariantManagementControl.attachSave({resolve}, storeEventParameters, this);
|
|
89
85
|
this.oVariantManagementControl.attachCancel({resolve}, handleCancel, this);
|
|
90
|
-
this.oVariantManagementControl.openSaveAsDialogForKeyUser(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return bState;
|
|
86
|
+
this.oVariantManagementControl.openSaveAsDialogForKeyUser(
|
|
87
|
+
rtaUtils.getRtaStyleClassName(),
|
|
88
|
+
ContextSharingAPI.createComponent(mComponentPropertyBag)
|
|
89
|
+
);
|
|
95
90
|
});
|
|
91
|
+
return bState;
|
|
96
92
|
};
|
|
97
93
|
|
|
98
94
|
ControlVariantSaveAs.prototype.getPreparedChange = function() {
|
|
@@ -107,28 +103,27 @@ sap.ui.define([
|
|
|
107
103
|
* @public
|
|
108
104
|
* @returns {Promise} Promise that resolves after execution
|
|
109
105
|
*/
|
|
110
|
-
ControlVariantSaveAs.prototype.execute = function() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
ControlVariantSaveAs.prototype.execute = async function() {
|
|
107
|
+
const sFlexReference = FlexRuntimeInfoAPI.getFlexReference({ element: this.oVariantManagementControl });
|
|
108
|
+
this._aControlChangesWithoutVariant = VariantManager.getControlChangesForVariant(
|
|
109
|
+
sFlexReference,
|
|
110
|
+
this.sVariantManagementReference,
|
|
111
|
+
this.getSourceVariantReference()
|
|
112
|
+
).filter((oFlexObject) => !oFlexObject.getSavedToVariant());
|
|
113
|
+
const mParams = this.getNewVariantParameters();
|
|
117
114
|
mParams.layer = this.sLayer;
|
|
118
115
|
mParams.newVariantReference = this.sNewVariantReference;
|
|
119
116
|
mParams.generator = rtaLibrary.GENERATOR_NAME;
|
|
120
|
-
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.getModel().invalidateMap();
|
|
131
|
-
}.bind(this));
|
|
117
|
+
const aDirtyChanges = await VariantManager.handleSaveEvent(this.oVariantManagementControl, mParams);
|
|
118
|
+
this._aPreparedChanges = aDirtyChanges;
|
|
119
|
+
[this._oVariantChange] = aDirtyChanges;
|
|
120
|
+
this.sNewVariantReference = this._oVariantChange.getId();
|
|
121
|
+
this._aPreparedChanges.forEach(function(oChange) {
|
|
122
|
+
if (oChange.getFileType() === "change") {
|
|
123
|
+
oChange.setSavedToVariant(true);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
VariantManager.updateVariantManagementMap(sFlexReference);
|
|
132
127
|
};
|
|
133
128
|
|
|
134
129
|
/**
|
|
@@ -138,8 +133,8 @@ sap.ui.define([
|
|
|
138
133
|
*/
|
|
139
134
|
ControlVariantSaveAs.prototype.undo = async function() {
|
|
140
135
|
if (this._oVariantChange) {
|
|
141
|
-
|
|
142
|
-
this._aPreparedChanges.forEach(
|
|
136
|
+
const aChangesToBeDeleted = [];
|
|
137
|
+
this._aPreparedChanges.forEach((oChange) => {
|
|
143
138
|
if (oChange.getFileType() === "ctrl_variant_management_change") {
|
|
144
139
|
aChangesToBeDeleted.push(oChange);
|
|
145
140
|
}
|
|
@@ -149,7 +144,7 @@ sap.ui.define([
|
|
|
149
144
|
selector: this.oAppComponent
|
|
150
145
|
});
|
|
151
146
|
|
|
152
|
-
|
|
147
|
+
const mPropertyBag = {
|
|
153
148
|
variant: this._oVariantChange,
|
|
154
149
|
sourceVariantReference: this.getSourceVariantReference(),
|
|
155
150
|
variantManagementReference: this.sVariantManagementReference,
|
|
@@ -4,15 +4,11 @@
|
|
|
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
|
-
"sap/ui/fl/apply/api/ControlVariantApplyAPI",
|
|
9
7
|
"sap/ui/fl/variants/VariantManager",
|
|
10
8
|
"sap/ui/fl/Utils",
|
|
11
9
|
"sap/ui/rta/command/BaseCommand",
|
|
12
10
|
"sap/ui/rta/library"
|
|
13
11
|
], function(
|
|
14
|
-
JsControlTreeModifier,
|
|
15
|
-
ControlVariantApplyAPI,
|
|
16
12
|
VariantManager,
|
|
17
13
|
flUtils,
|
|
18
14
|
BaseCommand,
|
|
@@ -26,13 +22,13 @@ sap.ui.define([
|
|
|
26
22
|
* @class
|
|
27
23
|
* @extends sap.ui.rta.command.BaseCommand
|
|
28
24
|
* @author SAP SE
|
|
29
|
-
* @version 1.
|
|
25
|
+
* @version 1.141.1
|
|
30
26
|
* @constructor
|
|
31
27
|
* @private
|
|
32
28
|
* @since 1.50
|
|
33
29
|
* @alias sap.ui.rta.command.ControlVariantSetTitle
|
|
34
30
|
*/
|
|
35
|
-
|
|
31
|
+
const ControlVariantSetTitle = BaseCommand.extend("sap.ui.rta.command.ControlVariantSetTitle", {
|
|
36
32
|
metadata: {
|
|
37
33
|
library: "sap.ui.rta",
|
|
38
34
|
properties: {
|
|
@@ -69,30 +65,26 @@ sap.ui.define([
|
|
|
69
65
|
* @public
|
|
70
66
|
* @returns {Promise} Returns resolve after execution
|
|
71
67
|
*/
|
|
72
|
-
ControlVariantSetTitle.prototype.execute = function() {
|
|
73
|
-
|
|
68
|
+
ControlVariantSetTitle.prototype.execute = async function() {
|
|
69
|
+
const oVariantManagementControl = this.getElement();
|
|
74
70
|
|
|
75
71
|
this.oAppComponent = flUtils.getAppComponentForControl(oVariantManagementControl);
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
78
|
-
this.sCurrentVariant = this.oModel.getCurrentVariantReference(this.sVariantManagementReference);
|
|
72
|
+
this.sVariantManagementReference = oVariantManagementControl.getVariantManagementReference();
|
|
73
|
+
this.sCurrentVariantKey = oVariantManagementControl.getCurrentVariantKey();
|
|
79
74
|
|
|
80
|
-
|
|
75
|
+
const sCurrentTitle = oVariantManagementControl.getVariantByKey(this.sCurrentVariantKey).getTitle();
|
|
81
76
|
this.setOldText(sCurrentTitle);
|
|
82
77
|
|
|
83
|
-
|
|
78
|
+
const mPropertyBag = {
|
|
84
79
|
appComponent: this.oAppComponent,
|
|
85
|
-
variantReference: this.
|
|
80
|
+
variantReference: this.sCurrentVariantKey,
|
|
86
81
|
changeType: "setTitle",
|
|
87
82
|
title: this.getNewText(),
|
|
88
83
|
layer: this.sLayer,
|
|
89
84
|
generator: rtaLibrary.GENERATOR_NAME
|
|
90
85
|
};
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
.then(function(oChange) {
|
|
94
|
-
this._oVariantChange = oChange;
|
|
95
|
-
}.bind(this));
|
|
87
|
+
this._oVariantChange = await VariantManager.addVariantChange(this.sVariantManagementReference, mPropertyBag);
|
|
96
88
|
};
|
|
97
89
|
|
|
98
90
|
/**
|
|
@@ -100,19 +92,16 @@ sap.ui.define([
|
|
|
100
92
|
* @public
|
|
101
93
|
* @returns {Promise} Returns resolve after undo
|
|
102
94
|
*/
|
|
103
|
-
ControlVariantSetTitle.prototype.undo = function() {
|
|
104
|
-
|
|
105
|
-
variantReference: this.
|
|
95
|
+
ControlVariantSetTitle.prototype.undo = async function() {
|
|
96
|
+
const mPropertyBag = {
|
|
97
|
+
variantReference: this.sCurrentVariantKey,
|
|
106
98
|
changeType: "setTitle",
|
|
107
99
|
title: this.getOldText(),
|
|
108
100
|
appComponent: this.oAppComponent
|
|
109
101
|
};
|
|
110
|
-
var oChange = this._oVariantChange;
|
|
111
102
|
|
|
112
|
-
|
|
113
|
-
.
|
|
114
|
-
this._oVariantChange = null;
|
|
115
|
-
}.bind(this));
|
|
103
|
+
await VariantManager.deleteVariantChange(this.sVariantManagementReference, mPropertyBag, this._oVariantChange);
|
|
104
|
+
this._oVariantChange = null;
|
|
116
105
|
};
|
|
117
106
|
|
|
118
107
|
return ControlVariantSetTitle;
|