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