@openui5/sap.ui.rta 1.103.0 → 1.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.reuse/dep5 +18 -1
- package/LICENSES/LicenseRef-tzdata-PublicDomain.txt +5 -0
- package/THIRDPARTY.txt +36 -3
- 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 +83 -406
- package/src/sap/ui/rta/Utils.js +2 -2
- package/src/sap/ui/rta/api/startAdaptation.js +2 -2
- package/src/sap/ui/rta/api/startKeyUserAdaptation.js +2 -2
- package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantUtils.js +6 -22
- package/src/sap/ui/rta/appVariant/Feature.js +4 -12
- package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +5 -3
- package/src/sap/ui/rta/command/AddIFrame.js +1 -1
- package/src/sap/ui/rta/command/AddProperty.js +1 -1
- package/src/sap/ui/rta/command/AddXML.js +1 -1
- package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/rta/command/AppDescriptorCommand.js +8 -3
- package/src/sap/ui/rta/command/BaseCommand.js +1 -1
- package/src/sap/ui/rta/command/BindProperty.js +1 -1
- package/src/sap/ui/rta/command/Combine.js +1 -1
- package/src/sap/ui/rta/command/CommandFactory.js +1 -1
- package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantConfigure.js +4 -2
- package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSaveAs.js +5 -3
- package/src/sap/ui/rta/command/ControlVariantSetTitle.js +5 -4
- package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/CreateContainer.js +1 -1
- package/src/sap/ui/rta/command/CustomAdd.js +1 -1
- package/src/sap/ui/rta/command/FlexCommand.js +4 -2
- package/src/sap/ui/rta/command/LREPSerializer.js +11 -8
- package/src/sap/ui/rta/command/LocalReset.js +1 -1
- package/src/sap/ui/rta/command/Move.js +1 -1
- package/src/sap/ui/rta/command/Property.js +1 -1
- package/src/sap/ui/rta/command/Remove.js +1 -1
- package/src/sap/ui/rta/command/Rename.js +1 -1
- package/src/sap/ui/rta/command/Resize.js +1 -1
- package/src/sap/ui/rta/command/Reveal.js +1 -1
- package/src/sap/ui/rta/command/Settings.js +1 -1
- package/src/sap/ui/rta/command/Split.js +1 -1
- package/src/sap/ui/rta/command/Stack.js +3 -3
- package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +6 -4
- package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +6 -4
- package/src/sap/ui/rta/enablement/elementActionTest.js +1 -1
- package/src/sap/ui/rta/library.js +2 -2
- package/src/sap/ui/rta/messagebundle.properties +15 -11
- package/src/sap/ui/rta/messagebundle_ar.properties +23 -9
- package/src/sap/ui/rta/messagebundle_bg.properties +24 -10
- package/src/sap/ui/rta/messagebundle_ca.properties +24 -10
- package/src/sap/ui/rta/messagebundle_cs.properties +23 -9
- package/src/sap/ui/rta/messagebundle_cy.properties +21 -7
- package/src/sap/ui/rta/messagebundle_da.properties +25 -11
- package/src/sap/ui/rta/messagebundle_de.properties +25 -11
- package/src/sap/ui/rta/messagebundle_el.properties +24 -10
- package/src/sap/ui/rta/messagebundle_en.properties +25 -11
- package/src/sap/ui/rta/messagebundle_en_GB.properties +25 -11
- package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +18 -11
- package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +14 -2
- package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +26 -12
- package/src/sap/ui/rta/messagebundle_es.properties +21 -7
- package/src/sap/ui/rta/messagebundle_es_MX.properties +19 -5
- package/src/sap/ui/rta/messagebundle_et.properties +21 -7
- package/src/sap/ui/rta/messagebundle_fi.properties +25 -11
- package/src/sap/ui/rta/messagebundle_fr.properties +22 -8
- package/src/sap/ui/rta/messagebundle_fr_CA.properties +24 -10
- package/src/sap/ui/rta/messagebundle_hi.properties +24 -10
- package/src/sap/ui/rta/messagebundle_hr.properties +23 -9
- package/src/sap/ui/rta/messagebundle_hu.properties +17 -3
- package/src/sap/ui/rta/messagebundle_id.properties +23 -9
- package/src/sap/ui/rta/messagebundle_it.properties +24 -10
- package/src/sap/ui/rta/messagebundle_iw.properties +24 -10
- package/src/sap/ui/rta/messagebundle_ja.properties +24 -10
- package/src/sap/ui/rta/messagebundle_kk.properties +24 -10
- package/src/sap/ui/rta/messagebundle_ko.properties +24 -10
- package/src/sap/ui/rta/messagebundle_lt.properties +23 -9
- package/src/sap/ui/rta/messagebundle_lv.properties +21 -7
- package/src/sap/ui/rta/messagebundle_ms.properties +25 -11
- package/src/sap/ui/rta/messagebundle_nl.properties +25 -11
- package/src/sap/ui/rta/messagebundle_no.properties +24 -10
- package/src/sap/ui/rta/messagebundle_pl.properties +23 -9
- package/src/sap/ui/rta/messagebundle_pt.properties +24 -10
- package/src/sap/ui/rta/messagebundle_pt_PT.properties +23 -9
- package/src/sap/ui/rta/messagebundle_ro.properties +23 -9
- package/src/sap/ui/rta/messagebundle_ru.properties +24 -10
- package/src/sap/ui/rta/messagebundle_sh.properties +25 -11
- package/src/sap/ui/rta/messagebundle_sk.properties +23 -9
- package/src/sap/ui/rta/messagebundle_sl.properties +21 -7
- package/src/sap/ui/rta/messagebundle_sv.properties +25 -11
- package/src/sap/ui/rta/messagebundle_th.properties +27 -13
- package/src/sap/ui/rta/messagebundle_tr.properties +24 -10
- package/src/sap/ui/rta/messagebundle_uk.properties +25 -11
- package/src/sap/ui/rta/messagebundle_vi.properties +24 -10
- package/src/sap/ui/rta/messagebundle_zh_CN.properties +24 -10
- package/src/sap/ui/rta/messagebundle_zh_TW.properties +23 -9
- package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.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/CompVariant.js +2 -2
- package/src/sap/ui/rta/plugin/ControlVariant.js +21 -15
- 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/EasyAdd.js +1 -1
- package/src/sap/ui/rta/plugin/EasyRemove.js +1 -1
- package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
- 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/Rename.js +1 -1
- package/src/sap/ui/rta/plugin/RenameHandler.js +23 -5
- package/src/sap/ui/rta/plugin/Resize.js +1 -1
- package/src/sap/ui/rta/plugin/Selection.js +12 -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 +5 -3
- 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 +5 -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/iframe/AddIFrame.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
- package/src/sap/ui/rta/service/Action.js +1 -1
- package/src/sap/ui/rta/service/ControllerExtension.js +8 -9
- 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/themes/base/Toolbar.adaptation.less +19 -4
- package/src/sap/ui/rta/toolbar/Adaptation.js +6 -4
- package/src/sap/ui/rta/toolbar/Base.js +8 -4
- 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/Personalization.js +1 -1
- package/src/sap/ui/rta/toolbar/Standalone.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 +1 -1
- package/src/sap/ui/rta/util/ReloadManager.js +331 -0
- package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
- package/src/sap/ui/rta/util/adaptationStarter.js +14 -8
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +100 -51
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +100 -55
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +41 -106
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +2 -2
- package/src/sap/ui/rta/util/changeVisualization/categories/CombineVisualization.js +87 -0
- package/src/sap/ui/rta/util/changeVisualization/categories/MoveVisualization.js +4 -4
- package/src/sap/ui/rta/util/changeVisualization/categories/RenameVisualization.js +2 -2
- package/src/sap/ui/rta/util/changeVisualization/categories/SplitVisualization.js +6 -4
- package/src/sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory.js +11 -3
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
3
|
* (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
|
+
"sap/base/util/UriParameters",
|
|
7
8
|
"sap/base/Log",
|
|
8
9
|
"sap/ui/core/Control",
|
|
9
10
|
"sap/ui/core/UIComponent",
|
|
@@ -14,6 +15,7 @@ sap.ui.define([
|
|
|
14
15
|
"sap/ui/rta/util/showMessageBox",
|
|
15
16
|
"sap/ui/rta/RuntimeAuthoring"
|
|
16
17
|
], function(
|
|
18
|
+
UriParameters,
|
|
17
19
|
Log,
|
|
18
20
|
Control,
|
|
19
21
|
UIComponent,
|
|
@@ -41,13 +43,17 @@ sap.ui.define([
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
function checkFlexEnabled(oAppComponent) {
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
+
// fiori tools is always a developer scenario where the flexEnabled flag should not be evaluated
|
|
47
|
+
var sFioriToolsMode = UriParameters.fromQuery(window.location.search).get("fiori-tools-rta-mode");
|
|
48
|
+
if (!sFioriToolsMode || sFioriToolsMode === "false") {
|
|
49
|
+
var oManifest = oAppComponent.getManifest() || {};
|
|
50
|
+
var vFlexEnabled = oManifest["sap.ui5"] && oManifest["sap.ui5"].flexEnabled;
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
if (vFlexEnabled === false) {
|
|
53
|
+
var oError = Error("This app is not enabled for key user adaptation");
|
|
54
|
+
oError.reason = "flexEnabled";
|
|
55
|
+
throw oError;
|
|
56
|
+
}
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
|
|
@@ -8,7 +8,6 @@ sap.ui.define([
|
|
|
8
8
|
"sap/ui/core/Fragment",
|
|
9
9
|
"sap/ui/model/json/JSONModel",
|
|
10
10
|
"sap/ui/core/Control",
|
|
11
|
-
"sap/m/Text",
|
|
12
11
|
"sap/ui/core/format/DateFormat",
|
|
13
12
|
"sap/ui/events/KeyCodes",
|
|
14
13
|
"sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory",
|
|
@@ -20,7 +19,6 @@ sap.ui.define([
|
|
|
20
19
|
Fragment,
|
|
21
20
|
JSONModel,
|
|
22
21
|
Control,
|
|
23
|
-
Text,
|
|
24
22
|
DateFormat,
|
|
25
23
|
KeyCodes,
|
|
26
24
|
getVisualizationCategory,
|
|
@@ -48,7 +46,7 @@ sap.ui.define([
|
|
|
48
46
|
* @alias sap.ui.rta.util.changeVisualization.ChangeIndicator
|
|
49
47
|
* @author SAP SE
|
|
50
48
|
* @since 1.84.0
|
|
51
|
-
* @version 1.
|
|
49
|
+
* @version 1.105.0
|
|
52
50
|
* @private
|
|
53
51
|
*/
|
|
54
52
|
var ChangeIndicator = Control.extend("sap.ui.rta.util.changeVisualization.ChangeIndicator", {
|
|
@@ -160,7 +158,7 @@ sap.ui.define([
|
|
|
160
158
|
|
|
161
159
|
function centerVertically(oIndicator) {
|
|
162
160
|
var oIndicatorDomRef = oIndicator.getDomRef();
|
|
163
|
-
var iOverlayHeight =
|
|
161
|
+
var iOverlayHeight = Core.byId(oIndicator.getOverlayId()).getDomRef().offsetHeight;
|
|
164
162
|
var iIndicatorHeight = oIndicatorDomRef.offsetHeight;
|
|
165
163
|
// the indicator should be centered only if the element has a small enough height to improve the design and visibility
|
|
166
164
|
if (iOverlayHeight < iIndicatorHeight * 5) {
|
|
@@ -168,6 +166,84 @@ sap.ui.define([
|
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
168
|
|
|
169
|
+
function getTexts(mChangeInformation, oRtaResourceBundle, sOverlayId) {
|
|
170
|
+
var oAffectedElement = Core.byId(mChangeInformation.affectedElementId);
|
|
171
|
+
var mPayload = Object.keys(mChangeInformation.payload || {}).reduce(function(mPayload, sKey) {
|
|
172
|
+
var vOriginalValue = mChangeInformation.payload[sKey];
|
|
173
|
+
var bIsBinding = FlUtils.isBinding(vOriginalValue);
|
|
174
|
+
var vValue = bIsBinding
|
|
175
|
+
? resolveBinding(vOriginalValue, oAffectedElement)
|
|
176
|
+
: vOriginalValue;
|
|
177
|
+
mPayload[sKey] = vValue;
|
|
178
|
+
return mPayload;
|
|
179
|
+
}, {});
|
|
180
|
+
|
|
181
|
+
var mPropertyBag = { appComponent: FlUtils.getAppComponentForControl(oAffectedElement) };
|
|
182
|
+
var oOverlay = Core.byId(sOverlayId);
|
|
183
|
+
var oVisualizationUtil = getVisualizationCategory(mChangeInformation);
|
|
184
|
+
var sElementLabel = oOverlay.getDesignTimeMetadata().getLabel(oAffectedElement);
|
|
185
|
+
var oDescription = oVisualizationUtil && oVisualizationUtil.getDescription(mPayload, sElementLabel, mPropertyBag);
|
|
186
|
+
sElementLabel = sElementLabel && "'" + sElementLabel + "'";
|
|
187
|
+
var sShortenedElementLabel = ChangeVisualizationUtils.shortenString(sElementLabel);
|
|
188
|
+
var sChangeTextKey = (
|
|
189
|
+
"TXT_CHANGEVISUALIZATION_CHANGE_"
|
|
190
|
+
+ mChangeInformation.commandName.toUpperCase()
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
var sDescriptionText;
|
|
194
|
+
var sDescriptionTooltip;
|
|
195
|
+
// for settings commands if available description and tooltip should be taken as is from the change handler
|
|
196
|
+
if (mPayload.description && mChangeInformation.commandName === "settings") {
|
|
197
|
+
sDescriptionText = mPayload.description;
|
|
198
|
+
sDescriptionTooltip = mPayload.descriptionTooltip || "";
|
|
199
|
+
} else {
|
|
200
|
+
if (oDescription) {
|
|
201
|
+
sDescriptionText = oDescription.descriptionText;
|
|
202
|
+
sDescriptionTooltip = oDescription.descriptionTooltip;
|
|
203
|
+
} else {
|
|
204
|
+
sDescriptionText = oRtaResourceBundle.getText(sChangeTextKey, sShortenedElementLabel);
|
|
205
|
+
sDescriptionTooltip = oRtaResourceBundle.getText(sChangeTextKey, sElementLabel);
|
|
206
|
+
}
|
|
207
|
+
sDescriptionTooltip = sDescriptionText.length < sDescriptionTooltip.length ? sDescriptionTooltip : null;
|
|
208
|
+
}
|
|
209
|
+
var sDetailButtonText = oDescription && oDescription.buttonText;
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
description: sDescriptionText,
|
|
213
|
+
tooltip: sDescriptionTooltip,
|
|
214
|
+
buttonText: sDetailButtonText
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function getDates(mChangeInformation, oRtaResourceBundle) {
|
|
219
|
+
var sCreationDate = mChangeInformation.change.getCreation();
|
|
220
|
+
var oDate = new Date(sCreationDate);
|
|
221
|
+
var sFallbackDate = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CREATED_IN_SESSION_DATE");
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
fullDate: sCreationDate ? DateFormat.getDateTimeInstance().format(oDate) : sFallbackDate,
|
|
225
|
+
relativeDate: sCreationDate ? DateFormat.getDateTimeInstance({ relative: "true" }).format(oDate) : sFallbackDate
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function formatChangesModelItem(sOverlayId, mChangeInformation) {
|
|
230
|
+
var oRtaResourceBundle = Core.getLibraryResourceBundle("sap.ui.rta");
|
|
231
|
+
var oTexts = getTexts(mChangeInformation, oRtaResourceBundle, sOverlayId);
|
|
232
|
+
var oDates = getDates(mChangeInformation, oRtaResourceBundle);
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
id: mChangeInformation.id,
|
|
237
|
+
change: mChangeInformation,
|
|
238
|
+
description: oTexts.description,
|
|
239
|
+
descriptionTooltip: oTexts.tooltip,
|
|
240
|
+
fullDate: oDates.fullDate,
|
|
241
|
+
relativeDate: oDates.relativeDate,
|
|
242
|
+
detailButtonText: oTexts.buttonText,
|
|
243
|
+
icon: CATEGORY_ICONS[mChangeInformation.commandCategory]
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
171
247
|
ChangeIndicator.prototype.init = function() {
|
|
172
248
|
this._iOldTabIndex = 0;
|
|
173
249
|
handleBrowserEventsOnElement.call(this, this, "attachBrowserEvent");
|
|
@@ -203,11 +279,28 @@ sap.ui.define([
|
|
|
203
279
|
this._bScheduledForFocus = true;
|
|
204
280
|
};
|
|
205
281
|
|
|
282
|
+
ChangeIndicator.prototype.setOverlayId = function(sOverlayId) {
|
|
283
|
+
// Overlays don't have aggregations, thus the indicator dom ref must be placed as
|
|
284
|
+
// a child of the overlay dom ref manually
|
|
285
|
+
// If the overlay that the indicator should be attached to changes, it is possible that the
|
|
286
|
+
// indicator is not rendered yet or that the old overlay and thus the nested indicator were destroyed
|
|
287
|
+
// To properly render it, the indicator must temporarily be placed in the static area
|
|
288
|
+
// Once it is rendered, it can move itself to the actual overlay dom ref (see onAfterRendering)
|
|
289
|
+
var oDomRef = this.getDomRef();
|
|
290
|
+
if (oDomRef) {
|
|
291
|
+
oDomRef.parentNode.removeChild(oDomRef);
|
|
292
|
+
}
|
|
293
|
+
this.placeAt(Core.getStaticAreaRef());
|
|
294
|
+
|
|
295
|
+
this.setProperty("overlayId", sOverlayId);
|
|
296
|
+
return this;
|
|
297
|
+
};
|
|
298
|
+
|
|
206
299
|
ChangeIndicator.prototype.onAfterRendering = function() {
|
|
207
|
-
var oOverlay =
|
|
300
|
+
var oOverlay = Core.getElementById(this.getOverlayId());
|
|
208
301
|
if (oOverlay) {
|
|
209
302
|
// Attach to the overlay
|
|
210
|
-
oOverlay.appendChild(this.getDomRef());
|
|
303
|
+
oOverlay.getDomRef().appendChild(this.getDomRef());
|
|
211
304
|
centerVertically(this);
|
|
212
305
|
}
|
|
213
306
|
// Restore the Tabindex if stored before; set to 0 as default
|
|
@@ -237,7 +330,7 @@ sap.ui.define([
|
|
|
237
330
|
|
|
238
331
|
ChangeIndicator.prototype.setChanges = function(aChanges) {
|
|
239
332
|
this.setProperty("changes", aChanges);
|
|
240
|
-
this._oDetailModel.setData((aChanges || []).reverse().map(
|
|
333
|
+
this._oDetailModel.setData((aChanges || []).reverse().map(formatChangesModelItem.bind(this, this.getOverlayId())));
|
|
241
334
|
};
|
|
242
335
|
|
|
243
336
|
ChangeIndicator.prototype._onSelect = function(oEvent) {
|
|
@@ -270,50 +363,6 @@ sap.ui.define([
|
|
|
270
363
|
this[sFunctionName]("sapUiRtaHover");
|
|
271
364
|
};
|
|
272
365
|
|
|
273
|
-
ChangeIndicator.prototype._formatChangesModelItem = function(mChangeInformation) {
|
|
274
|
-
var oAffectedElement = Core.byId(mChangeInformation.affectedElementId);
|
|
275
|
-
var mPayload = Object.keys(mChangeInformation.payload || {}).reduce(function(mPayload, sKey) {
|
|
276
|
-
var vOriginalValue = mChangeInformation.payload[sKey];
|
|
277
|
-
var bIsBinding = FlUtils.isBinding(vOriginalValue);
|
|
278
|
-
var vValue = bIsBinding
|
|
279
|
-
? resolveBinding(vOriginalValue, oAffectedElement)
|
|
280
|
-
: vOriginalValue;
|
|
281
|
-
mPayload[sKey] = vValue;
|
|
282
|
-
return mPayload;
|
|
283
|
-
}, {});
|
|
284
|
-
|
|
285
|
-
var mPropertyBag = { appComponent: FlUtils.getAppComponentForControl(oAffectedElement) };
|
|
286
|
-
var oOverlay = Core.byId(this.getOverlayId());
|
|
287
|
-
var sElementLabel = oOverlay.getDesignTimeMetadata().getLabel(oAffectedElement);
|
|
288
|
-
var oVisualizationUtil = getVisualizationCategory(mChangeInformation.commandName);
|
|
289
|
-
var oDescription = oVisualizationUtil && oVisualizationUtil.getDescription(mPayload, sElementLabel, mPropertyBag);
|
|
290
|
-
var oRtaResourceBundle = Core.getLibraryResourceBundle("sap.ui.rta");
|
|
291
|
-
sElementLabel = sElementLabel && "'" + sElementLabel + "'";
|
|
292
|
-
var sShortenedElementLabel = ChangeVisualizationUtils.shortenString(sElementLabel);
|
|
293
|
-
var sChangeTextKey = (
|
|
294
|
-
"TXT_CHANGEVISUALIZATION_CHANGE_"
|
|
295
|
-
+ mChangeInformation.commandName.toUpperCase()
|
|
296
|
-
);
|
|
297
|
-
var sDescriptionText = oDescription ? oDescription.descriptionText : oRtaResourceBundle.getText(sChangeTextKey, sShortenedElementLabel);
|
|
298
|
-
var sDescriptionTooltip = oDescription ? oDescription.descriptionTooltip : oRtaResourceBundle.getText(sChangeTextKey, sElementLabel);
|
|
299
|
-
var sCreationDate = mChangeInformation.change.getCreation();
|
|
300
|
-
var oDate = new Date(sCreationDate);
|
|
301
|
-
var sFallbackDate = oRtaResourceBundle.getText("TXT_CHANGEVISUALIZATION_CREATED_IN_SESSION_DATE");
|
|
302
|
-
var sFullDate = sCreationDate ? DateFormat.getDateTimeInstance().format(oDate) : sFallbackDate;
|
|
303
|
-
var sRelativeDate = sCreationDate ? DateFormat.getDateTimeInstance({ relative: "true" }).format(oDate) : sFallbackDate;
|
|
304
|
-
var sDetailButtonText = oDescription && oDescription.buttonText;
|
|
305
|
-
return {
|
|
306
|
-
id: mChangeInformation.id,
|
|
307
|
-
change: mChangeInformation,
|
|
308
|
-
description: sDescriptionText,
|
|
309
|
-
descriptionTooltip: sDescriptionTooltip && sDescriptionText.length < sDescriptionTooltip.length ? sDescriptionTooltip : null,
|
|
310
|
-
fullDate: sFullDate,
|
|
311
|
-
relativeDate: sRelativeDate,
|
|
312
|
-
detailButtonText: sDetailButtonText,
|
|
313
|
-
icon: CATEGORY_ICONS[mChangeInformation.commandCategory]
|
|
314
|
-
};
|
|
315
|
-
};
|
|
316
|
-
|
|
317
366
|
ChangeIndicator.prototype._openDetailPopover = function() {
|
|
318
367
|
if (!this.getAggregation("_popover")) {
|
|
319
368
|
//store the tabindex (tabindex will be removed on opening the popover)
|
|
@@ -5,15 +5,25 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"sap/ui/base/ManagedObject",
|
|
9
8
|
"sap/base/util/includes",
|
|
10
9
|
"sap/base/util/values",
|
|
11
|
-
"sap/base/util/restricted/_omit"
|
|
10
|
+
"sap/base/util/restricted/_omit",
|
|
11
|
+
"sap/base/Log",
|
|
12
|
+
"sap/ui/base/ManagedObject",
|
|
13
|
+
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
14
|
+
"sap/ui/dt/ElementUtil",
|
|
15
|
+
"sap/ui/fl/write/api/ChangesWriteAPI",
|
|
16
|
+
"sap/ui/fl/Utils"
|
|
12
17
|
], function(
|
|
13
|
-
ManagedObject,
|
|
14
18
|
includes,
|
|
15
19
|
values,
|
|
16
|
-
_omit
|
|
20
|
+
_omit,
|
|
21
|
+
Log,
|
|
22
|
+
ManagedObject,
|
|
23
|
+
JsControlTreeModifier,
|
|
24
|
+
ElementUtil,
|
|
25
|
+
ChangesWriteAPI,
|
|
26
|
+
FlUtils
|
|
17
27
|
) {
|
|
18
28
|
"use strict";
|
|
19
29
|
|
|
@@ -25,7 +35,7 @@ sap.ui.define([
|
|
|
25
35
|
* @alias sap.ui.rta.util.changeVisualization.ChangeIndicatorRegistry
|
|
26
36
|
* @author SAP SE
|
|
27
37
|
* @since 1.86.0
|
|
28
|
-
* @version 1.
|
|
38
|
+
* @version 1.105.0
|
|
29
39
|
* @private
|
|
30
40
|
*/
|
|
31
41
|
var ChangeIndicatorRegistry = ManagedObject.extend("sap.ui.rta.util.changeVisualization.ChangeIndicatorRegistry", {
|
|
@@ -37,12 +47,18 @@ sap.ui.define([
|
|
|
37
47
|
commandCategories: {
|
|
38
48
|
type: "object",
|
|
39
49
|
defaultValue: []
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Id of the component or control to visualize the changes for
|
|
53
|
+
*/
|
|
54
|
+
rootControlId: {
|
|
55
|
+
type: "string"
|
|
40
56
|
}
|
|
41
57
|
}
|
|
42
58
|
},
|
|
43
59
|
constructor: function () {
|
|
44
60
|
ManagedObject.prototype.constructor.apply(this, arguments);
|
|
45
|
-
this.
|
|
61
|
+
this._oChangeIndicatorData = {};
|
|
46
62
|
this._oChangeIndicators = {};
|
|
47
63
|
}
|
|
48
64
|
});
|
|
@@ -57,7 +73,7 @@ sap.ui.define([
|
|
|
57
73
|
* @returns {object[]} Registered changes
|
|
58
74
|
*/
|
|
59
75
|
ChangeIndicatorRegistry.prototype.getChanges = function () {
|
|
60
|
-
return values(this.
|
|
76
|
+
return values(this._oChangeIndicatorData || {}).map(function (oChange) {
|
|
61
77
|
return Object.assign({}, oChange);
|
|
62
78
|
});
|
|
63
79
|
};
|
|
@@ -68,7 +84,7 @@ sap.ui.define([
|
|
|
68
84
|
* @returns {string[]} Promise with both design time and runtime change
|
|
69
85
|
*/
|
|
70
86
|
ChangeIndicatorRegistry.prototype.getChangeIds = function () {
|
|
71
|
-
return Object.keys(this.
|
|
87
|
+
return Object.keys(this._oChangeIndicatorData || {});
|
|
72
88
|
};
|
|
73
89
|
|
|
74
90
|
/**
|
|
@@ -78,7 +94,7 @@ sap.ui.define([
|
|
|
78
94
|
* @returns {object} Registered change
|
|
79
95
|
*/
|
|
80
96
|
ChangeIndicatorRegistry.prototype.getChange = function (sChangeId) {
|
|
81
|
-
return this.
|
|
97
|
+
return this._oChangeIndicatorData[sChangeId] && Object.assign({}, this._oChangeIndicatorData[sChangeId]);
|
|
82
98
|
};
|
|
83
99
|
|
|
84
100
|
/**
|
|
@@ -105,7 +121,7 @@ sap.ui.define([
|
|
|
105
121
|
));
|
|
106
122
|
}
|
|
107
123
|
|
|
108
|
-
values(this.
|
|
124
|
+
values(this._oChangeIndicatorData).forEach(function (oChange) {
|
|
109
125
|
oChange.visualizationInfo.displayElementIds.forEach(function (sSelectorId, iIndex) {
|
|
110
126
|
addSelector(sSelectorId, oChange.visualizationInfo.affectedElementIds[iIndex], oChange, false);
|
|
111
127
|
});
|
|
@@ -118,16 +134,6 @@ sap.ui.define([
|
|
|
118
134
|
return oChangeIndicators;
|
|
119
135
|
};
|
|
120
136
|
|
|
121
|
-
/**
|
|
122
|
-
* Checks if the given element ID was registered as a change indicator.
|
|
123
|
-
*
|
|
124
|
-
* @param {string} sSelectorId - ID of the element to check
|
|
125
|
-
* @returns {boolean} Whether the element was registered as an indicator
|
|
126
|
-
*/
|
|
127
|
-
ChangeIndicatorRegistry.prototype.hasChangeIndicator = function (sSelectorId) {
|
|
128
|
-
return !!this._oChangeIndicators[sSelectorId];
|
|
129
|
-
};
|
|
130
|
-
|
|
131
137
|
/**
|
|
132
138
|
* Returns the registered change indicator for the given element ID.
|
|
133
139
|
*
|
|
@@ -152,25 +158,83 @@ sap.ui.define([
|
|
|
152
158
|
*
|
|
153
159
|
* @param {object} oChange - The change to register
|
|
154
160
|
* @param {string} sCommandName - Command name of the change
|
|
161
|
+
* @returns {Promise<undefined>} Resolves as soon as the change is registered
|
|
155
162
|
*/
|
|
156
|
-
ChangeIndicatorRegistry.prototype.registerChange = function
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
dependentElementIds: []
|
|
163
|
+
ChangeIndicatorRegistry.prototype.registerChange = function(oChange, sCommandName) {
|
|
164
|
+
var oAppComponent = FlUtils.getAppComponentForControl(ElementUtil.getElementInstance(this.getRootControlId()));
|
|
165
|
+
return getVisualizationInfo(oChange, oAppComponent).then(function(mChangeVisualizationInfo) {
|
|
166
|
+
var aCategories = this.getCommandCategories();
|
|
167
|
+
var sCommandCategory;
|
|
168
|
+
if (sCommandName === "settings" && includes(Object.keys(aCategories), mChangeVisualizationInfo.payload.category)) {
|
|
169
|
+
sCommandCategory = mChangeVisualizationInfo.payload.category;
|
|
170
|
+
} else {
|
|
171
|
+
sCommandCategory = Object.keys(aCategories).find(function (sCommandCategoryName) {
|
|
172
|
+
return includes(aCategories[sCommandCategoryName], sCommandName);
|
|
173
|
+
});
|
|
168
174
|
}
|
|
169
|
-
};
|
|
170
175
|
|
|
171
|
-
|
|
176
|
+
this._oChangeIndicatorData[oChange.getId()] = {
|
|
177
|
+
change: oChange,
|
|
178
|
+
commandName: sCommandName,
|
|
179
|
+
commandCategory: sCommandCategory,
|
|
180
|
+
visualizationInfo: mChangeVisualizationInfo
|
|
181
|
+
};
|
|
182
|
+
}.bind(this));
|
|
172
183
|
};
|
|
173
184
|
|
|
185
|
+
function getVisualizationInfo(oChange, oAppComponent) {
|
|
186
|
+
function getSelectorIds(aSelectorList) {
|
|
187
|
+
if (!aSelectorList) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
return aSelectorList
|
|
191
|
+
.map(function(vSelector) {
|
|
192
|
+
var oElement = typeof vSelector.getId === "function"
|
|
193
|
+
? vSelector
|
|
194
|
+
: JsControlTreeModifier.bySelector(vSelector, oAppComponent);
|
|
195
|
+
return oElement && oElement.getId();
|
|
196
|
+
})
|
|
197
|
+
.filter(Boolean);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return getInfoFromChangeHandler(oAppComponent, oChange)
|
|
201
|
+
.then(function(oInfoFromChangeHandler) {
|
|
202
|
+
var mVisualizationInfo = oInfoFromChangeHandler || {};
|
|
203
|
+
var aAffectedElementIds = getSelectorIds(mVisualizationInfo.affectedControls || [oChange.getSelector()]);
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
affectedElementIds: aAffectedElementIds,
|
|
207
|
+
dependentElementIds: getSelectorIds(mVisualizationInfo.dependentControls) || [],
|
|
208
|
+
displayElementIds: getSelectorIds(mVisualizationInfo.displayControls) || aAffectedElementIds,
|
|
209
|
+
payload: mVisualizationInfo.payload || {}
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function getInfoFromChangeHandler(oAppComponent, oChange) {
|
|
215
|
+
var oControl = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
|
|
216
|
+
if (oControl) {
|
|
217
|
+
return ChangesWriteAPI.getChangeHandler({
|
|
218
|
+
changeType: oChange.getChangeType(),
|
|
219
|
+
element: oControl,
|
|
220
|
+
modifier: JsControlTreeModifier,
|
|
221
|
+
layer: oChange.getLayer()
|
|
222
|
+
})
|
|
223
|
+
.then(function(oChangeHandler) {
|
|
224
|
+
if (oChangeHandler && typeof oChangeHandler.getChangeVisualizationInfo === "function") {
|
|
225
|
+
return oChangeHandler.getChangeVisualizationInfo(oChange, oAppComponent);
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
})
|
|
229
|
+
.catch(function(vErr) {
|
|
230
|
+
Log.error(vErr);
|
|
231
|
+
return undefined;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return Promise.resolve();
|
|
236
|
+
}
|
|
237
|
+
|
|
174
238
|
/**
|
|
175
239
|
* Adds a change indicator to the registry.
|
|
176
240
|
*
|
|
@@ -181,30 +245,11 @@ sap.ui.define([
|
|
|
181
245
|
this._oChangeIndicators[sSelectorId] = oChangeIndicator;
|
|
182
246
|
};
|
|
183
247
|
|
|
184
|
-
/**
|
|
185
|
-
* Adds selectors for a registered change.
|
|
186
|
-
*
|
|
187
|
-
* @param {string} sChangeId - ID of the registered change
|
|
188
|
-
* @param {object} mVisualizationInfo - Map of selector IDs to register
|
|
189
|
-
* @param {string[]} [mVisualizationInfo.affectedElementIds] - Array of affected element IDs
|
|
190
|
-
* @param {string[]} [mVisualizationInfo.displayElementIds] - Array of element IDs that the indicators are attached to
|
|
191
|
-
* @param {string[]} [mVisualizationInfo.dependentElementIds] - Array of element IDs that the dependent indicators are attached to
|
|
192
|
-
* @param {object} [mVisualizationInfo.payload] - Command category specific visualization information
|
|
193
|
-
*/
|
|
194
|
-
ChangeIndicatorRegistry.prototype.addVisualizationInfo = function (sChangeId, mVisualizationInfo) {
|
|
195
|
-
var oChange = this._oChanges[sChangeId];
|
|
196
|
-
if (oChange === undefined) {
|
|
197
|
-
throw new Error("Change id is not registered");
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
oChange.visualizationInfo = Object.assign({}, oChange.visualizationInfo, mVisualizationInfo);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
248
|
/**
|
|
204
249
|
* Resets the change and change indicator registries.
|
|
205
250
|
*/
|
|
206
251
|
ChangeIndicatorRegistry.prototype.reset = function () {
|
|
207
|
-
Object.keys(this.
|
|
252
|
+
Object.keys(this._oChangeIndicatorData).forEach(function (sKeyToRemove) {
|
|
208
253
|
this.removeChange(sKeyToRemove);
|
|
209
254
|
}.bind(this));
|
|
210
255
|
|
|
@@ -220,7 +265,7 @@ sap.ui.define([
|
|
|
220
265
|
* @param {string} sChangeId - ID of the registered change
|
|
221
266
|
*/
|
|
222
267
|
ChangeIndicatorRegistry.prototype.removeChange = function (sChangeId) {
|
|
223
|
-
delete this.
|
|
268
|
+
delete this._oChangeIndicatorData[sChangeId];
|
|
224
269
|
};
|
|
225
270
|
|
|
226
271
|
return ChangeIndicatorRegistry;
|