@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
|
@@ -4,13 +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
7
|
"sap/ui/fl/apply/api/ControlVariantApplyAPI",
|
|
9
8
|
"sap/ui/fl/variants/VariantManager",
|
|
10
9
|
"sap/ui/fl/Utils",
|
|
11
10
|
"sap/ui/rta/command/BaseCommand"
|
|
12
11
|
], function(
|
|
13
|
-
JsControlTreeModifier,
|
|
14
12
|
ControlVariantApplyAPI,
|
|
15
13
|
VariantManager,
|
|
16
14
|
flUtils,
|
|
@@ -24,13 +22,13 @@ sap.ui.define([
|
|
|
24
22
|
* @class
|
|
25
23
|
* @extends sap.ui.rta.command.BaseCommand
|
|
26
24
|
* @author SAP SE
|
|
27
|
-
* @version 1.
|
|
25
|
+
* @version 1.141.1
|
|
28
26
|
* @constructor
|
|
29
27
|
* @private
|
|
30
28
|
* @since 1.50
|
|
31
29
|
* @alias sap.ui.rta.command.ControlVariantSwitch
|
|
32
30
|
*/
|
|
33
|
-
|
|
31
|
+
const ControlVariantSwitch = BaseCommand.extend("sap.ui.rta.command.ControlVariantSwitch", {
|
|
34
32
|
metadata: {
|
|
35
33
|
library: "sap.ui.rta",
|
|
36
34
|
properties: {
|
|
@@ -60,40 +58,30 @@ sap.ui.define([
|
|
|
60
58
|
}
|
|
61
59
|
});
|
|
62
60
|
|
|
63
|
-
function discardVariantContent(sVReference) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
async function discardVariantContent(sVReference) {
|
|
62
|
+
const aDirtyChanges = await VariantManager.eraseDirtyChangesOnVariant(
|
|
63
|
+
this.sVariantManagementReference,
|
|
64
|
+
sVReference,
|
|
65
|
+
this.getElement()
|
|
66
|
+
);
|
|
67
|
+
this.setDiscardedChanges(aDirtyChanges);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
ControlVariantSwitch.prototype._getAppComponent = function() {
|
|
71
|
-
var oElement = this.getElement();
|
|
72
|
-
return oElement ? flUtils.getAppComponentForControl(oElement) : this.getSelector().appComponent;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
70
|
/**
|
|
76
71
|
* Template Method to implement execute logic, with ensure precondition Element is available.
|
|
77
72
|
*
|
|
78
73
|
* @public
|
|
79
74
|
* @returns {Promise} Returns resolve after execution
|
|
80
75
|
*/
|
|
81
|
-
ControlVariantSwitch.prototype.execute = function() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.oModel = oAppComponent.getModel(ControlVariantApplyAPI.getVariantModelName());
|
|
87
|
-
this.sVariantManagementReference = JsControlTreeModifier.getSelector(oElement, oAppComponent).id;
|
|
76
|
+
ControlVariantSwitch.prototype.execute = async function() {
|
|
77
|
+
const oElement = this.getElement();
|
|
78
|
+
const sNewVariantReference = this.getTargetVariantReference();
|
|
79
|
+
this.sVariantManagementReference = oElement.getVariantManagementReference();
|
|
88
80
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
return undefined;
|
|
95
|
-
}.bind(this))
|
|
96
|
-
.then(this._updateModelVariant.bind(this, sNewVariantReference, oAppComponent));
|
|
81
|
+
if (this.getDiscardVariantContent()) {
|
|
82
|
+
await discardVariantContent.call(this, this.getSourceVariantReference());
|
|
83
|
+
}
|
|
84
|
+
this._updateVariant(sNewVariantReference);
|
|
97
85
|
};
|
|
98
86
|
|
|
99
87
|
/**
|
|
@@ -101,33 +89,24 @@ sap.ui.define([
|
|
|
101
89
|
* @public
|
|
102
90
|
* @returns {Promise} Returns resolve after undo
|
|
103
91
|
*/
|
|
104
|
-
ControlVariantSwitch.prototype.undo = function() {
|
|
105
|
-
|
|
106
|
-
var oAppComponent = this._getAppComponent();
|
|
92
|
+
ControlVariantSwitch.prototype.undo = async function() {
|
|
93
|
+
const sSourceVariantReference = this.getSourceVariantReference();
|
|
107
94
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.setDiscardedChanges([]);
|
|
115
|
-
this.oModel.checkUpdate(true);
|
|
116
|
-
}.bind(this));
|
|
117
|
-
}
|
|
118
|
-
return undefined;
|
|
119
|
-
}.bind(this));
|
|
95
|
+
await this._updateVariant(sSourceVariantReference);
|
|
96
|
+
// When discarding, dirty changes on source variant need to be applied AFTER the switch
|
|
97
|
+
if (this.getDiscardVariantContent()) {
|
|
98
|
+
await VariantManager.addAndApplyChangesOnVariant(this.getDiscardedChanges(), this.getElement());
|
|
99
|
+
this.setDiscardedChanges([]);
|
|
100
|
+
}
|
|
120
101
|
};
|
|
121
102
|
|
|
122
|
-
ControlVariantSwitch.prototype.
|
|
103
|
+
ControlVariantSwitch.prototype._updateVariant = async function(sVariantReference) {
|
|
123
104
|
if (this.getTargetVariantReference() !== this.getSourceVariantReference()) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
appComponent: oAppComponent
|
|
105
|
+
await ControlVariantApplyAPI.activateVariant({
|
|
106
|
+
element: this.getElement(),
|
|
107
|
+
variantReference: sVariantReference
|
|
128
108
|
});
|
|
129
109
|
}
|
|
130
|
-
return Promise.resolve();
|
|
131
110
|
};
|
|
132
111
|
|
|
133
112
|
return ControlVariantSwitch;
|
|
@@ -12,13 +12,13 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
12
12
|
* @class
|
|
13
13
|
* @extends sap.ui.rta.command.FlexCommand
|
|
14
14
|
* @author SAP SE
|
|
15
|
-
* @version 1.
|
|
15
|
+
* @version 1.141.1
|
|
16
16
|
* @constructor
|
|
17
17
|
* @private
|
|
18
18
|
* @since 1.34
|
|
19
19
|
* @alias sap.ui.rta.command.CreateContainer
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const CreateContainer = FlexCommand.extend("sap.ui.rta.command.CreateContainer", {
|
|
22
22
|
metadata: {
|
|
23
23
|
library: "sap.ui.rta",
|
|
24
24
|
properties: {
|
|
@@ -44,7 +44,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
CreateContainer.prototype._getChangeSpecificData = function() {
|
|
47
|
-
|
|
47
|
+
const mSpecificInfo = FlexCommand.prototype._getChangeSpecificData.apply(this);
|
|
48
48
|
|
|
49
49
|
mSpecificInfo.content.newLabel = this.getLabel();
|
|
50
50
|
|
|
@@ -12,13 +12,13 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
12
12
|
* @class
|
|
13
13
|
* @extends sap.ui.rta.command.FlexCommand
|
|
14
14
|
* @author SAP SE
|
|
15
|
-
* @version 1.
|
|
15
|
+
* @version 1.141.1
|
|
16
16
|
* @constructor
|
|
17
17
|
* @private
|
|
18
18
|
* @since 1.62
|
|
19
19
|
* @alias sap.ui.rta.command.CustomAdd
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const CustomAdd = FlexCommand.extend("sap.ui.rta.command.CustomAdd", {
|
|
22
22
|
metadata: {
|
|
23
23
|
library: "sap.ui.rta",
|
|
24
24
|
properties: {
|
|
@@ -22,7 +22,7 @@ sap.ui.define([
|
|
|
22
22
|
* @class
|
|
23
23
|
* @extends sap.ui.rta.command.FlexCommand
|
|
24
24
|
* @author SAP SE
|
|
25
|
-
* @version 1.
|
|
25
|
+
* @version 1.141.1
|
|
26
26
|
* @constructor
|
|
27
27
|
* @private
|
|
28
28
|
* @since 1.135
|
|
@@ -56,9 +56,7 @@ sap.ui.define([
|
|
|
56
56
|
const sControllerName = oView.getControllerModuleName() ? `module:${oView.getControllerModuleName()}` : oView.getController()?.getMetadata().getName();
|
|
57
57
|
// Calculate moduleName for code extension
|
|
58
58
|
const sReference = FlexRuntimeInfoAPI.getFlexReference({element: oAppComponent});
|
|
59
|
-
|
|
60
|
-
sModuleName += "/changes/";
|
|
61
|
-
sModuleName += sCodeRef.replace(/\.js/g, "");
|
|
59
|
+
const sModuleName = `${sReference.replace(/\.Component/g, "").replace(/\./g, "/")}/changes/${sCodeRef.replace(/\.js/g, "")}`;
|
|
62
60
|
|
|
63
61
|
const oChangeSpecificData = {
|
|
64
62
|
changeType: this.getChangeType(),
|
|
@@ -35,14 +35,14 @@ sap.ui.define([
|
|
|
35
35
|
* @extends sap.ui.rta.command.BaseCommand
|
|
36
36
|
*
|
|
37
37
|
* @author SAP SE
|
|
38
|
-
* @version 1.
|
|
38
|
+
* @version 1.141.1
|
|
39
39
|
*
|
|
40
40
|
* @constructor
|
|
41
41
|
* @private
|
|
42
42
|
* @since 1.34
|
|
43
43
|
* @alias sap.ui.rta.command.FlexCommand
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
const FlexCommand = BaseCommand.extend("sap.ui.rta.command.FlexCommand", {
|
|
46
46
|
metadata: {
|
|
47
47
|
library: "sap.ui.rta",
|
|
48
48
|
properties: {
|
|
@@ -69,31 +69,29 @@ sap.ui.define([
|
|
|
69
69
|
type: "boolean",
|
|
70
70
|
defaultValue: false
|
|
71
71
|
}
|
|
72
|
-
}
|
|
73
|
-
associations: {},
|
|
74
|
-
events: {}
|
|
72
|
+
}
|
|
75
73
|
}
|
|
76
74
|
});
|
|
77
75
|
|
|
78
76
|
/**
|
|
79
|
-
* Retrieves id of element or selector
|
|
77
|
+
* Retrieves the id of element or selector
|
|
80
78
|
*
|
|
81
|
-
* @returns {string}
|
|
79
|
+
* @returns {string} Id value
|
|
82
80
|
* @public
|
|
83
81
|
*/
|
|
84
82
|
FlexCommand.prototype.getElementId = function() {
|
|
85
|
-
|
|
83
|
+
const oElement = this.getElement();
|
|
86
84
|
return oElement ? oElement.getId() : this.getSelector().id;
|
|
87
85
|
};
|
|
88
86
|
|
|
89
87
|
/**
|
|
90
88
|
* Retrieves app component of element or selector
|
|
91
89
|
*
|
|
92
|
-
* @returns {sap.ui.core.UIComponent} component
|
|
90
|
+
* @returns {sap.ui.core.UIComponent} App component Instance
|
|
93
91
|
* @private
|
|
94
92
|
*/
|
|
95
93
|
FlexCommand.prototype.getAppComponent = function() {
|
|
96
|
-
|
|
94
|
+
const oElement = this.getElement();
|
|
97
95
|
return oElement ? FlUtils.getAppComponentForControl(oElement) : this.getSelector().appComponent;
|
|
98
96
|
};
|
|
99
97
|
|
|
@@ -131,7 +129,7 @@ sap.ui.define([
|
|
|
131
129
|
|
|
132
130
|
/**
|
|
133
131
|
* Returns a prepared change if exists in the command
|
|
134
|
-
* @returns {object} Prepared change
|
|
132
|
+
* @returns {object} Prepared change instance
|
|
135
133
|
* @public
|
|
136
134
|
*/
|
|
137
135
|
FlexCommand.prototype.getPreparedChange = function() {
|
|
@@ -140,10 +138,10 @@ sap.ui.define([
|
|
|
140
138
|
|
|
141
139
|
/**
|
|
142
140
|
* @override
|
|
143
|
-
* @returns {Promise}
|
|
141
|
+
* @returns {Promise<undefined>} Resolves with undefined after finishing execution
|
|
144
142
|
*/
|
|
145
143
|
FlexCommand.prototype.execute = function() {
|
|
146
|
-
|
|
144
|
+
const vChange = this.getPreparedChange();
|
|
147
145
|
return this._applyChange(vChange);
|
|
148
146
|
};
|
|
149
147
|
|
|
@@ -153,28 +151,26 @@ sap.ui.define([
|
|
|
153
151
|
* @protected
|
|
154
152
|
*/
|
|
155
153
|
FlexCommand.prototype._getChangeSpecificData = function() {
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
const mProperties = this.getMetadata().getProperties();
|
|
155
|
+
const mChangeSpecificData = {
|
|
158
156
|
changeType: this.getChangeType(),
|
|
159
157
|
content: mProperties.content?.get(this)
|
|
160
158
|
};
|
|
161
159
|
objectValues(mProperties)
|
|
162
|
-
.filter(
|
|
163
|
-
|
|
164
|
-
})
|
|
165
|
-
.forEach(function(oProperty) {
|
|
160
|
+
.filter((oProperty) => oProperty.group === "content")
|
|
161
|
+
.forEach((oProperty) => {
|
|
166
162
|
mChangeSpecificData.content ||= {};
|
|
167
163
|
mChangeSpecificData.content[oProperty.name] = oProperty.get(this);
|
|
168
|
-
}
|
|
164
|
+
});
|
|
169
165
|
return mChangeSpecificData;
|
|
170
166
|
};
|
|
171
167
|
|
|
172
168
|
/**
|
|
173
169
|
* Creates a change.
|
|
174
|
-
* @param {object} mFlexSettings Map containing the flexibility settings
|
|
175
|
-
* @param {string} sVariantManagementReference Reference to the variant management
|
|
176
|
-
* @param {string} sCommand Command name
|
|
177
|
-
* @returns {
|
|
170
|
+
* @param {object} mFlexSettings - Map containing the flexibility settings
|
|
171
|
+
* @param {string} sVariantManagementReference - Reference to the variant management
|
|
172
|
+
* @param {string} sCommand - Command name
|
|
173
|
+
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} Returns the change instance
|
|
178
174
|
* @private
|
|
179
175
|
*/
|
|
180
176
|
FlexCommand.prototype._createChange = function(mFlexSettings, sVariantManagementReference, sCommand) {
|
|
@@ -188,8 +184,8 @@ sap.ui.define([
|
|
|
188
184
|
* @param {object} mChangeSpecificData - Map containing change specific data
|
|
189
185
|
* @param {object} mFlexSettings - Map containing flex settings
|
|
190
186
|
* @param {string} sVariantManagementReference - Reference to the variant management
|
|
191
|
-
* @param {string} sCommand Command name
|
|
192
|
-
* @returns {Promise
|
|
187
|
+
* @param {string} sCommand - Command name
|
|
188
|
+
* @returns {Promise<object>} Resolves with the Change instance
|
|
193
189
|
* @private
|
|
194
190
|
*/
|
|
195
191
|
FlexCommand.prototype._createChangeFromData = async function(
|
|
@@ -246,39 +242,33 @@ sap.ui.define([
|
|
|
246
242
|
* @override
|
|
247
243
|
*/
|
|
248
244
|
FlexCommand.prototype.undo = function() {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var oChange = this.getPreparedChange();
|
|
245
|
+
const vControl = this.getElement() || JsControlTreeModifier.bySelector(this.getSelector());
|
|
246
|
+
const oChange = this.getPreparedChange();
|
|
252
247
|
|
|
253
248
|
return ChangesWriteAPI.revert({change: oChange, element: vControl});
|
|
254
249
|
};
|
|
255
250
|
|
|
256
251
|
/**
|
|
257
252
|
* @private
|
|
258
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.UIChange|Object}
|
|
259
|
-
* @returns {Promise} Returns an empty promise
|
|
253
|
+
* @param {sap.ui.fl.apply._internal.flexObjects.UIChange|Object} oChange Change object
|
|
260
254
|
*/
|
|
261
|
-
FlexCommand.prototype._applyChange = function(oChange) {
|
|
262
|
-
|
|
263
|
-
|
|
255
|
+
FlexCommand.prototype._applyChange = async function(oChange) {
|
|
256
|
+
const oAppComponent = this.getAppComponent();
|
|
257
|
+
const oSelectorElement = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
|
|
264
258
|
|
|
265
|
-
|
|
259
|
+
const mPropertyBag = {
|
|
266
260
|
modifier: JsControlTreeModifier,
|
|
267
261
|
appComponent: oAppComponent,
|
|
268
262
|
view: FlUtils.getViewForControl(oSelectorElement)
|
|
269
263
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return Promise.reject(oResult.error);
|
|
275
|
-
}
|
|
276
|
-
return undefined;
|
|
277
|
-
});
|
|
264
|
+
const oResult = await ChangesWriteAPI.apply({ change: oChange, element: oSelectorElement, ...mPropertyBag });
|
|
265
|
+
if (!oResult.success) {
|
|
266
|
+
throw new Error(oResult.error);
|
|
267
|
+
}
|
|
278
268
|
};
|
|
279
269
|
|
|
280
270
|
FlexCommand.prototype._validateControlForChange = function(mFlexSettings) {
|
|
281
|
-
if (mFlexSettings
|
|
271
|
+
if (mFlexSettings?.originalSelector && mFlexSettings?.content?.boundAggregation) {
|
|
282
272
|
return {
|
|
283
273
|
id: mFlexSettings.originalSelector,
|
|
284
274
|
appComponent: this.getAppComponent(),
|
|
@@ -23,7 +23,7 @@ sap.ui.define([
|
|
|
23
23
|
* @class
|
|
24
24
|
* @extends sap.ui.base.ManagedObject
|
|
25
25
|
* @author SAP SE
|
|
26
|
-
* @version 1.
|
|
26
|
+
* @version 1.141.1
|
|
27
27
|
* @constructor
|
|
28
28
|
* @private
|
|
29
29
|
* @since 1.42
|
|
@@ -52,7 +52,7 @@ sap.ui.define([
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* Promise to ensure that the event triggered methods are executed
|
|
55
|
+
* Promise to ensure that the event triggered methods are executed sequentially.
|
|
56
56
|
*/
|
|
57
57
|
LREPSerializer.prototype._lastPromise = Promise.resolve();
|
|
58
58
|
|
|
@@ -67,14 +67,14 @@ sap.ui.define([
|
|
|
67
67
|
* @public
|
|
68
68
|
*/
|
|
69
69
|
LREPSerializer.prototype.needsReload = function() {
|
|
70
|
-
this._lastPromise = this._lastPromise
|
|
70
|
+
this._lastPromise = this._lastPromise
|
|
71
|
+
.catch(() => {
|
|
71
72
|
// _lastPromise chain must not be interrupted
|
|
72
|
-
})
|
|
73
|
+
})
|
|
74
|
+
.then(() => {
|
|
73
75
|
const aCommands = this.getCommandStack().getAllExecutedCommands();
|
|
74
|
-
return aCommands.some(
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
}.bind(this));
|
|
76
|
+
return aCommands.some((oCommand) => !!oCommand.needsReload);
|
|
77
|
+
});
|
|
78
78
|
return this._lastPromise;
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
@@ -92,15 +92,17 @@ sap.ui.define([
|
|
|
92
92
|
* @public
|
|
93
93
|
*/
|
|
94
94
|
LREPSerializer.prototype.saveCommands = function(mPropertyBag) {
|
|
95
|
-
this._lastPromise = this._lastPromise
|
|
95
|
+
this._lastPromise = this._lastPromise
|
|
96
|
+
.catch((oError) => {
|
|
96
97
|
Log.error(oError);
|
|
97
98
|
// _lastPromise chain must not be interrupted
|
|
98
|
-
})
|
|
99
|
+
})
|
|
100
|
+
.then(async () => {
|
|
99
101
|
const oRootControl = getRootControlInstance(this.getRootControl());
|
|
100
102
|
if (!oRootControl) {
|
|
101
103
|
throw new Error("Can't save commands without root control instance!");
|
|
102
104
|
}
|
|
103
|
-
|
|
105
|
+
await PersistenceWriteAPI.save({
|
|
104
106
|
selector: oRootControl,
|
|
105
107
|
skipUpdateCache: false,
|
|
106
108
|
draft: !!mPropertyBag.saveAsDraft,
|
|
@@ -110,12 +112,10 @@ sap.ui.define([
|
|
|
110
112
|
adaptationId: mPropertyBag.adaptationId,
|
|
111
113
|
condenseAnyLayer: mPropertyBag.condenseAnyLayer
|
|
112
114
|
});
|
|
113
|
-
}.bind(this))
|
|
114
|
-
.then(function() {
|
|
115
115
|
Log.info("UI adaptation successfully wrote changes to the persistence");
|
|
116
116
|
this.getCommandStack().setSaved(true);
|
|
117
117
|
this.getCommandStack().removeAllCommands();
|
|
118
|
-
}
|
|
118
|
+
});
|
|
119
119
|
|
|
120
120
|
return this._lastPromise;
|
|
121
121
|
};
|
|
@@ -145,21 +145,18 @@ sap.ui.define([
|
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
|
-
* @description
|
|
149
148
|
* At this point command stack is not aware if the changes have been already booked for the new app variant.
|
|
150
149
|
* Therefore if there shall be some UI changes present in command stack, we undo all the changes till the beginning.
|
|
151
150
|
* In the last when user presses 'Save and Exit', there will be no change registered for the current app.
|
|
152
|
-
* @param {boolean} bRemoveChanges
|
|
153
|
-
* @returns {Promise}
|
|
151
|
+
* @param {boolean} bRemoveChanges - Whether LREPSerializer should clear the dirty changes in the persistence
|
|
152
|
+
* @returns {Promise} Resolves with true or false
|
|
154
153
|
*/
|
|
155
|
-
LREPSerializer.prototype.clearCommandStack = function(bRemoveChanges) {
|
|
154
|
+
LREPSerializer.prototype.clearCommandStack = async function(bRemoveChanges) {
|
|
156
155
|
const oCommandStack = this.getCommandStack();
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
.
|
|
160
|
-
|
|
161
|
-
return true;
|
|
162
|
-
});
|
|
157
|
+
await this._triggerUndoChanges(bRemoveChanges);
|
|
158
|
+
oCommandStack.removeAllCommands();
|
|
159
|
+
return true;
|
|
163
160
|
};
|
|
164
161
|
|
|
165
162
|
return LREPSerializer;
|
|
@@ -20,13 +20,13 @@ 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.90
|
|
27
27
|
* @alias sap.ui.rta.command.LocalReset
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
const LocalReset = BaseCommand.extend("sap.ui.rta.command.LocalReset", {
|
|
30
30
|
metadata: {
|
|
31
31
|
library: "sap.ui.rta",
|
|
32
32
|
properties: {
|
|
@@ -49,7 +49,7 @@ sap.ui.define([
|
|
|
49
49
|
* @override
|
|
50
50
|
*/
|
|
51
51
|
LocalReset.prototype.prepare = function(mFlexSettings) {
|
|
52
|
-
|
|
52
|
+
const oContainerControl = this.getElement();
|
|
53
53
|
this._oAppComponent = FlUtils.getAppComponentForControl(oContainerControl);
|
|
54
54
|
this._aAffectedChanges = LocalResetAPI.getNestedUIChangesForControl(
|
|
55
55
|
oContainerControl,
|
|
@@ -17,13 +17,13 @@ function(
|
|
|
17
17
|
* @class
|
|
18
18
|
* @extends sap.ui.rta.command.FlexCommand
|
|
19
19
|
* @author SAP SE
|
|
20
|
-
* @version 1.
|
|
20
|
+
* @version 1.141.1
|
|
21
21
|
* @constructor
|
|
22
22
|
* @private
|
|
23
23
|
* @since 1.34
|
|
24
24
|
* @alias sap.ui.rta.command.Move
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
const Move = FlexCommand.extend("sap.ui.rta.command.Move", {
|
|
27
27
|
metadata: {
|
|
28
28
|
library: "sap.ui.rta",
|
|
29
29
|
properties: {
|
|
@@ -49,8 +49,8 @@ function(
|
|
|
49
49
|
* @override
|
|
50
50
|
*/
|
|
51
51
|
Move.prototype._getChangeSpecificData = function() {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const mSource = this.getSource();
|
|
53
|
+
const mTarget = this.getTarget();
|
|
54
54
|
|
|
55
55
|
// replace elements by their id, unify format and help with serialization
|
|
56
56
|
if (mSource.parent) {
|
|
@@ -61,7 +61,7 @@ function(
|
|
|
61
61
|
mTarget.id = mTarget.parent.getId();
|
|
62
62
|
delete mTarget.parent;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
const mSpecificInfo = {
|
|
65
65
|
changeType: this.getChangeType(),
|
|
66
66
|
content: {
|
|
67
67
|
source: mSource,
|
|
@@ -16,13 +16,13 @@ sap.ui.define([
|
|
|
16
16
|
* @class
|
|
17
17
|
* @extends sap.ui.rta.command.FlexCommand
|
|
18
18
|
* @author SAP SE
|
|
19
|
-
* @version 1.
|
|
19
|
+
* @version 1.141.1
|
|
20
20
|
* @constructor
|
|
21
21
|
* @private
|
|
22
22
|
* @since 1.34
|
|
23
23
|
* @alias sap.ui.rta.command.Property
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
const Property = FlexCommand.extend("sap.ui.rta.command.Property", {
|
|
26
26
|
metadata: {
|
|
27
27
|
library: "sap.ui.rta",
|
|
28
28
|
properties: {
|
|
@@ -49,7 +49,7 @@ sap.ui.define([
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
Property.prototype._getChangeSpecificData = function() {
|
|
52
|
-
|
|
52
|
+
const oElement = this.getElement();
|
|
53
53
|
// general format
|
|
54
54
|
return {
|
|
55
55
|
changeType: this.getChangeType(),
|
|
@@ -12,13 +12,13 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
12
12
|
* @class
|
|
13
13
|
* @extends sap.ui.rta.command.FlexCommand
|
|
14
14
|
* @author SAP SE
|
|
15
|
-
* @version 1.
|
|
15
|
+
* @version 1.141.1
|
|
16
16
|
* @constructor
|
|
17
17
|
* @private
|
|
18
18
|
* @since 1.42
|
|
19
19
|
* @alias sap.ui.rta.command.Remove
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const Remove = FlexCommand.extend("sap.ui.rta.command.Remove", {
|
|
22
22
|
metadata: {
|
|
23
23
|
library: "sap.ui.rta",
|
|
24
24
|
properties: {
|
|
@@ -33,9 +33,9 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
Remove.prototype._getChangeSpecificData = function() {
|
|
36
|
-
|
|
36
|
+
const oElement = this.getRemovedElement() || this.getElement();
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const mSpecificInfo = {
|
|
39
39
|
changeType: this.getChangeType(),
|
|
40
40
|
removedElement: {
|
|
41
41
|
id: oElement.getId()
|
|
@@ -12,13 +12,13 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
12
12
|
* @class
|
|
13
13
|
* @extends sap.ui.rta.command.FlexCommand
|
|
14
14
|
* @author SAP SE
|
|
15
|
-
* @version 1.
|
|
15
|
+
* @version 1.141.1
|
|
16
16
|
* @constructor
|
|
17
17
|
* @private
|
|
18
18
|
* @since 1.34
|
|
19
19
|
* @alias sap.ui.rta.command.Rename
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const Rename = FlexCommand.extend("sap.ui.rta.command.Rename", {
|
|
22
22
|
metadata: {
|
|
23
23
|
library: "sap.ui.rta",
|
|
24
24
|
properties: {
|
|
@@ -38,7 +38,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
Rename.prototype._getChangeSpecificData = function() {
|
|
41
|
-
|
|
41
|
+
const mSpecificInfo = {
|
|
42
42
|
changeType: this.getChangeType(),
|
|
43
43
|
content: {
|
|
44
44
|
renamedElement: {
|
|
@@ -16,13 +16,13 @@ sap.ui.define([
|
|
|
16
16
|
* @class
|
|
17
17
|
* @extends sap.ui.rta.command.FlexCommand
|
|
18
18
|
* @author SAP SE
|
|
19
|
-
* @version 1.
|
|
19
|
+
* @version 1.141.1
|
|
20
20
|
* @constructor
|
|
21
21
|
* @private
|
|
22
22
|
* @since 1.101
|
|
23
23
|
* @alias sap.ui.rta.command.Resize
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
const Resize = FlexCommand.extend("sap.ui.rta.command.Resize", {
|
|
26
26
|
metadata: {
|
|
27
27
|
library: "sap.ui.rta",
|
|
28
28
|
properties: {
|
|
@@ -12,13 +12,13 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
12
12
|
* @class
|
|
13
13
|
* @extends sap.ui.rta.command.FlexCommand
|
|
14
14
|
* @author SAP SE
|
|
15
|
-
* @version 1.
|
|
15
|
+
* @version 1.141.1
|
|
16
16
|
* @constructor
|
|
17
17
|
* @private
|
|
18
18
|
* @since 1.44
|
|
19
19
|
* @alias sap.ui.rta.command.Reveal
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const Reveal = FlexCommand.extend("sap.ui.rta.command.Reveal", {
|
|
22
22
|
metadata: {
|
|
23
23
|
library: "sap.ui.rta",
|
|
24
24
|
properties: {
|
|
@@ -32,7 +32,7 @@ sap.ui.define(["sap/ui/rta/command/FlexCommand"], function(FlexCommand) {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
Reveal.prototype._getChangeSpecificData = function() {
|
|
35
|
-
|
|
35
|
+
const mSpecificChangeInfo = {
|
|
36
36
|
changeType: this.getChangeType(),
|
|
37
37
|
content: {}
|
|
38
38
|
};
|