@openui5/sap.ui.rta 1.109.0 → 1.111.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 +16 -16
- package/THIRDPARTY.txt +2 -2
- package/package.json +6 -6
- package/src/sap/ui/rta/.library +2 -2
- package/src/sap/ui/rta/Client.js +2 -2
- package/src/sap/ui/rta/RuntimeAuthoring.js +251 -151
- package/src/sap/ui/rta/Utils.js +40 -19
- package/src/sap/ui/rta/api/startAdaptation.js +1 -1
- package/src/sap/ui/rta/api/startKeyUserAdaptation.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantDialog.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantManager.js +2 -2
- package/src/sap/ui/rta/appVariant/AppVariantOverviewDialog.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantUtils.js +1 -1
- package/src/sap/ui/rta/appVariant/Feature.js +2 -8
- package/src/sap/ui/rta/appVariant/S4HanaCloudBackend.js +1 -1
- package/src/sap/ui/rta/appVariant/Utils.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/Component.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/index.js +1 -1
- package/src/sap/ui/rta/appVariant/manageApps/webapp/model/models.js +1 -1
- package/src/sap/ui/rta/command/AddIFrame.js +2 -2
- package/src/sap/ui/rta/command/AddProperty.js +2 -2
- package/src/sap/ui/rta/command/AddXML.js +2 -2
- package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +2 -2
- package/src/sap/ui/rta/command/AppDescriptorCommand.js +2 -2
- package/src/sap/ui/rta/command/BaseCommand.js +2 -2
- package/src/sap/ui/rta/command/BindProperty.js +2 -2
- package/src/sap/ui/rta/command/Combine.js +2 -2
- package/src/sap/ui/rta/command/CommandFactory.js +2 -2
- package/src/sap/ui/rta/command/CompositeCommand.js +2 -2
- package/src/sap/ui/rta/command/ControlVariantConfigure.js +2 -2
- package/src/sap/ui/rta/command/ControlVariantSave.js +2 -2
- package/src/sap/ui/rta/command/ControlVariantSaveAs.js +2 -2
- package/src/sap/ui/rta/command/ControlVariantSetTitle.js +2 -2
- package/src/sap/ui/rta/command/ControlVariantSwitch.js +15 -13
- package/src/sap/ui/rta/command/CreateContainer.js +2 -2
- package/src/sap/ui/rta/command/CustomAdd.js +2 -2
- package/src/sap/ui/rta/command/FlexCommand.js +2 -2
- package/src/sap/ui/rta/command/LREPSerializer.js +27 -12
- package/src/sap/ui/rta/command/LocalReset.js +2 -2
- package/src/sap/ui/rta/command/Move.js +2 -2
- package/src/sap/ui/rta/command/Property.js +2 -2
- package/src/sap/ui/rta/command/Remove.js +2 -2
- package/src/sap/ui/rta/command/Rename.js +2 -2
- package/src/sap/ui/rta/command/Resize.js +2 -2
- package/src/sap/ui/rta/command/Reveal.js +2 -2
- package/src/sap/ui/rta/command/Settings.js +2 -2
- package/src/sap/ui/rta/command/Split.js +2 -2
- package/src/sap/ui/rta/command/Stack.js +11 -3
- package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +2 -2
- package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +2 -2
- package/src/sap/ui/rta/enablement/TestDelegate.js +1 -1
- package/src/sap/ui/rta/enablement/elementActionTest.js +2 -2
- package/src/sap/ui/rta/library.js +3 -3
- package/src/sap/ui/rta/messagebundle.properties +65 -13
- package/src/sap/ui/rta/messagebundle_ar.properties +35 -11
- package/src/sap/ui/rta/messagebundle_bg.properties +35 -11
- package/src/sap/ui/rta/messagebundle_ca.properties +35 -11
- package/src/sap/ui/rta/messagebundle_cs.properties +35 -11
- package/src/sap/ui/rta/messagebundle_cy.properties +34 -10
- package/src/sap/ui/rta/messagebundle_da.properties +34 -10
- package/src/sap/ui/rta/messagebundle_de.properties +37 -13
- package/src/sap/ui/rta/messagebundle_el.properties +34 -10
- package/src/sap/ui/rta/messagebundle_en.properties +33 -9
- package/src/sap/ui/rta/messagebundle_en_GB.properties +33 -9
- package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +31 -5
- package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +37 -5
- package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +31 -7
- package/src/sap/ui/rta/messagebundle_es.properties +34 -10
- package/src/sap/ui/rta/messagebundle_es_MX.properties +34 -10
- package/src/sap/ui/rta/messagebundle_et.properties +34 -10
- package/src/sap/ui/rta/messagebundle_fi.properties +34 -10
- package/src/sap/ui/rta/messagebundle_fr.properties +34 -10
- package/src/sap/ui/rta/messagebundle_fr_CA.properties +35 -11
- package/src/sap/ui/rta/messagebundle_hi.properties +35 -11
- package/src/sap/ui/rta/messagebundle_hr.properties +35 -11
- package/src/sap/ui/rta/messagebundle_hu.properties +34 -10
- package/src/sap/ui/rta/messagebundle_id.properties +35 -11
- package/src/sap/ui/rta/messagebundle_it.properties +35 -11
- package/src/sap/ui/rta/messagebundle_iw.properties +34 -10
- package/src/sap/ui/rta/messagebundle_ja.properties +35 -11
- package/src/sap/ui/rta/messagebundle_kk.properties +34 -10
- package/src/sap/ui/rta/messagebundle_ko.properties +34 -10
- package/src/sap/ui/rta/messagebundle_lt.properties +34 -10
- package/src/sap/ui/rta/messagebundle_lv.properties +35 -11
- package/src/sap/ui/rta/messagebundle_ms.properties +35 -11
- package/src/sap/ui/rta/messagebundle_nl.properties +34 -10
- package/src/sap/ui/rta/messagebundle_no.properties +35 -11
- package/src/sap/ui/rta/messagebundle_pl.properties +35 -11
- package/src/sap/ui/rta/messagebundle_pt.properties +35 -11
- package/src/sap/ui/rta/messagebundle_pt_PT.properties +34 -10
- package/src/sap/ui/rta/messagebundle_ro.properties +35 -11
- package/src/sap/ui/rta/messagebundle_ru.properties +35 -11
- package/src/sap/ui/rta/messagebundle_sh.properties +34 -10
- package/src/sap/ui/rta/messagebundle_sk.properties +34 -10
- package/src/sap/ui/rta/messagebundle_sl.properties +34 -10
- package/src/sap/ui/rta/messagebundle_sv.properties +35 -11
- package/src/sap/ui/rta/messagebundle_th.properties +36 -12
- package/src/sap/ui/rta/messagebundle_tr.properties +34 -10
- package/src/sap/ui/rta/messagebundle_uk.properties +34 -10
- package/src/sap/ui/rta/messagebundle_vi.properties +35 -11
- package/src/sap/ui/rta/messagebundle_zh_CN.properties +35 -11
- package/src/sap/ui/rta/messagebundle_zh_TW.properties +35 -11
- package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +2 -2
- package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
- package/src/sap/ui/rta/plugin/Combine.js +2 -2
- package/src/sap/ui/rta/plugin/CompVariant.js +4 -6
- package/src/sap/ui/rta/plugin/ControlVariant.js +2 -2
- package/src/sap/ui/rta/plugin/CreateContainer.js +3 -3
- package/src/sap/ui/rta/plugin/CutPaste.js +2 -2
- package/src/sap/ui/rta/plugin/DragDrop.js +4 -4
- package/src/sap/ui/rta/plugin/EasyAdd.js +30 -21
- package/src/sap/ui/rta/plugin/EasyRemove.js +13 -11
- package/src/sap/ui/rta/plugin/LocalReset.js +2 -2
- package/src/sap/ui/rta/plugin/Plugin.js +57 -13
- package/src/sap/ui/rta/plugin/RTAElementMover.js +2 -2
- package/src/sap/ui/rta/plugin/Remove.js +3 -3
- package/src/sap/ui/rta/plugin/Rename.js +2 -2
- package/src/sap/ui/rta/plugin/RenameHandler.js +30 -19
- package/src/sap/ui/rta/plugin/Resize.js +2 -2
- package/src/sap/ui/rta/plugin/Selection.js +8 -15
- package/src/sap/ui/rta/plugin/Settings.js +2 -2
- package/src/sap/ui/rta/plugin/Split.js +2 -2
- package/src/sap/ui/rta/plugin/Stretch.js +17 -16
- package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +28 -7
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.fragment.xml +1 -0
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +2 -2
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +4 -2
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +5 -5
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +2 -2
- package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +2 -2
- package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +2 -2
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.fragment.xml +7 -2
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +2 -2
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialogController.js +4 -4
- package/src/sap/ui/rta/plugin/iframe/urlCleaner.js +1 -1
- package/src/sap/ui/rta/service/Action.js +2 -2
- package/src/sap/ui/rta/service/ControllerExtension.js +2 -2
- package/src/sap/ui/rta/service/Outline.js +2 -2
- package/src/sap/ui/rta/service/Property.js +2 -2
- package/src/sap/ui/rta/service/Receiver.js +1 -1
- package/src/sap/ui/rta/service/Selection.js +2 -2
- package/src/sap/ui/rta/service/SupportTools.js +2 -2
- package/src/sap/ui/rta/service/index.js +1 -1
- package/src/sap/ui/rta/themes/base/AddIFrame.less +1 -1
- package/src/sap/ui/rta/themes/base/Dialogs.less +1 -1
- package/src/sap/ui/rta/themes/base/FieldRepository.less +1 -1
- package/src/sap/ui/rta/themes/base/library.source.less +1 -1
- package/src/sap/ui/rta/themes/sap_hcb/library.source.less +1 -1
- package/src/sap/ui/rta/toolbar/ActionsMenu.fragment.xml +82 -0
- package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +35 -79
- package/src/sap/ui/rta/toolbar/Adaptation.js +83 -25
- package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +1 -1
- package/src/sap/ui/rta/toolbar/Base.js +4 -4
- package/src/sap/ui/rta/toolbar/BaseRenderer.js +1 -1
- package/src/sap/ui/rta/toolbar/Fiori.js +15 -11
- package/src/sap/ui/rta/toolbar/FioriLike.js +2 -2
- package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +2 -2
- package/src/sap/ui/rta/toolbar/Personalization.js +2 -2
- package/src/sap/ui/rta/toolbar/Standalone.js +2 -2
- package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptations.js +340 -0
- package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptationsDialog.fragment.xml +152 -0
- package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +225 -0
- package/src/sap/ui/rta/toolbar/contextBased/{SaveAsContextBasedAdaptationDialog.fragment.xml → SaveAsAdaptationDialog.fragment.xml} +19 -15
- package/src/sap/ui/rta/toolbar/translation/Translation.js +2 -2
- package/src/sap/ui/rta/toolbar/versioning/Versioning.js +4 -4
- package/src/sap/ui/rta/util/Animation.js +5 -9
- package/src/sap/ui/rta/util/BindingsExtractor.js +1 -1
- package/src/sap/ui/rta/util/PluginManager.js +2 -2
- package/src/sap/ui/rta/util/PopupManager.js +2 -2
- package/src/sap/ui/rta/util/ReloadManager.js +2 -2
- package/src/sap/ui/rta/util/ServiceEventBus.js +2 -2
- package/src/sap/ui/rta/util/StylesLoader.js +1 -1
- package/src/sap/ui/rta/util/UrlParser.js +1 -1
- package/src/sap/ui/rta/util/adaptationStarter.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +4 -6
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorCategorySelection.fragment.xml +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +27 -3
- package/src/sap/ui/rta/util/changeVisualization/ChangeStates.js +2 -2
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +127 -71
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/CombineVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/CreateContainerVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/MoveVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/RenameVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/SplitVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +1 -1
- package/src/sap/ui/rta/util/hasStableId.js +1 -1
- package/src/sap/ui/rta/util/showMessageBox.js +1 -1
- package/src/sap/ui/rta/util/validateFlexEnabled.js +1 -1
- package/src/sap/ui/rta/util/validateStableIds.js +1 -1
- package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation.js +0 -124
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* OpenUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -23,7 +23,6 @@ sap.ui.define([
|
|
|
23
23
|
"sap/ui/dt/Util",
|
|
24
24
|
"sap/ui/events/KeyCodes",
|
|
25
25
|
"sap/ui/fl/write/api/Version",
|
|
26
|
-
"sap/ui/fl/apply/api/SmartVariantManagementApplyAPI",
|
|
27
26
|
"sap/ui/fl/write/api/ContextBasedAdaptationsAPI",
|
|
28
27
|
"sap/ui/fl/write/api/ControlPersonalizationWriteAPI",
|
|
29
28
|
"sap/ui/fl/write/api/FeaturesAPI",
|
|
@@ -71,7 +70,6 @@ sap.ui.define([
|
|
|
71
70
|
DtUtil,
|
|
72
71
|
KeyCodes,
|
|
73
72
|
Version,
|
|
74
|
-
SmartVariantManagementApplyAPI,
|
|
75
73
|
ContextBasedAdaptationsAPI,
|
|
76
74
|
ControlPersonalizationWriteAPI,
|
|
77
75
|
FeaturesAPI,
|
|
@@ -118,7 +116,7 @@ sap.ui.define([
|
|
|
118
116
|
* @class The runtime authoring allows to adapt the fields of a running application.
|
|
119
117
|
* @extends sap.ui.base.ManagedObject
|
|
120
118
|
* @author SAP SE
|
|
121
|
-
* @version 1.
|
|
119
|
+
* @version 1.111.0
|
|
122
120
|
* @constructor
|
|
123
121
|
* @private
|
|
124
122
|
* @since 1.30
|
|
@@ -395,7 +393,7 @@ sap.ui.define([
|
|
|
395
393
|
var oUriParams = UriParameters.fromQuery(window.location.search);
|
|
396
394
|
var sUriLayer = oUriParams.get("sap-ui-layer");
|
|
397
395
|
|
|
398
|
-
mFlexSettings =
|
|
396
|
+
mFlexSettings = Object.assign({}, this.getFlexSettings(), mFlexSettings);
|
|
399
397
|
if (sUriLayer) {
|
|
400
398
|
mFlexSettings.layer = sUriLayer.toUpperCase();
|
|
401
399
|
}
|
|
@@ -472,7 +470,6 @@ sap.ui.define([
|
|
|
472
470
|
}
|
|
473
471
|
var oFlexInfoSession = PersistenceWriteAPI.getResetAndPublishInfoFromSession(this.getRootControlInstance());
|
|
474
472
|
this.bInitialResetEnabled = !!oFlexInfoSession.isResetEnabled;
|
|
475
|
-
this.bInitialPublishEnabled = !!oFlexInfoSession.isPublishEnabled;
|
|
476
473
|
|
|
477
474
|
this._oSerializer = new LREPSerializer({commandStack: this.getCommandStack(), rootControl: this.getRootControl()});
|
|
478
475
|
|
|
@@ -496,12 +493,13 @@ sap.ui.define([
|
|
|
496
493
|
//add root control is triggering overlay creation, so we need to wait for the scope to be set.
|
|
497
494
|
this._oDesignTime.addRootElement(this._oRootControl);
|
|
498
495
|
|
|
499
|
-
|
|
496
|
+
//TODO: remove when Overlay.getOverlayContainer() does not return jQuery any more
|
|
497
|
+
Overlay.getOverlayContainer().get(0).classList.add("sapUiRta");
|
|
500
498
|
if (this.getLayer() === Layer.USER) {
|
|
501
|
-
|
|
499
|
+
Overlay.getOverlayContainer().get(0).classList.add("sapUiRtaPersonalize");
|
|
502
500
|
} else {
|
|
503
501
|
// RTA Visual Improvements
|
|
504
|
-
|
|
502
|
+
document.body.classList.add("sapUiRtaMode");
|
|
505
503
|
}
|
|
506
504
|
this._oDesignTime.getSelectionManager().attachChange(function(oEvent) {
|
|
507
505
|
this.fireSelectionChange({selection: oEvent.getParameter("selection")});
|
|
@@ -590,6 +588,18 @@ sap.ui.define([
|
|
|
590
588
|
return Promise.reject("RuntimeAuthoring is already started");
|
|
591
589
|
};
|
|
592
590
|
|
|
591
|
+
function showSaveConfirmation() {
|
|
592
|
+
return Utils.showMessageBox("warning", "MSG_UNSAVED_CHANGES_ON_CLOSE", {
|
|
593
|
+
titleKey: "TIT_UNSAVED_CHANGES_ON_CLOSE",
|
|
594
|
+
actionKeys: [
|
|
595
|
+
"BTN_UNSAVED_CHANGES_ON_CLOSE_SAVE",
|
|
596
|
+
"BTN_UNSAVED_CHANGES_ON_CLOSE_DONT_SAVE"
|
|
597
|
+
],
|
|
598
|
+
emphasizedActionKey: "BTN_UNSAVED_CHANGES_ON_CLOSE_SAVE",
|
|
599
|
+
showCancel: true
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
|
|
593
603
|
/**
|
|
594
604
|
* Stops Runtime Authoring
|
|
595
605
|
*
|
|
@@ -599,13 +609,33 @@ sap.ui.define([
|
|
|
599
609
|
* @returns {Promise} Resolves with undefined
|
|
600
610
|
*/
|
|
601
611
|
RuntimeAuthoring.prototype.stop = function(bSkipSave, bSkipRestart) {
|
|
602
|
-
|
|
612
|
+
var bUserCancelled;
|
|
603
613
|
var oReloadInfo;
|
|
614
|
+
checkToolbarAndExecuteFunction.call(this, "setBusy", true);
|
|
604
615
|
return waitForPendingActions.call(this)
|
|
616
|
+
.then(function() {
|
|
617
|
+
var oCommandStack = this.getCommandStack();
|
|
618
|
+
var sLayer = this.getLayer();
|
|
619
|
+
if (sLayer !== Layer.USER && !bSkipSave && oCommandStack.canUndo()) {
|
|
620
|
+
return showSaveConfirmation()
|
|
621
|
+
.then(function (sAction) {
|
|
622
|
+
if (sAction === MessageBox.Action.CANCEL) {
|
|
623
|
+
bUserCancelled = true;
|
|
624
|
+
return Promise.reject();
|
|
625
|
+
}
|
|
626
|
+
if (sAction === this._getTextResources().getText("BTN_UNSAVED_CHANGES_ON_CLOSE_DONT_SAVE")) {
|
|
627
|
+
return this._oSerializer.clearCommandStack(/*bRemoveChanges = */true);
|
|
628
|
+
}
|
|
629
|
+
return undefined;
|
|
630
|
+
}.bind(this));
|
|
631
|
+
}
|
|
632
|
+
return undefined;
|
|
633
|
+
}.bind(this))
|
|
605
634
|
.then(function() {
|
|
606
635
|
if (bSkipRestart) {
|
|
607
636
|
return {};
|
|
608
637
|
}
|
|
638
|
+
//Reload check must happen before _serializeToLrep is called
|
|
609
639
|
return ReloadManager.checkReloadOnExit({
|
|
610
640
|
layer: this.getLayer(),
|
|
611
641
|
selector: this.getRootControlInstance(),
|
|
@@ -617,20 +647,31 @@ sap.ui.define([
|
|
|
617
647
|
}.bind(this))
|
|
618
648
|
.then(function(oReturn) {
|
|
619
649
|
oReloadInfo = oReturn;
|
|
620
|
-
|
|
650
|
+
if (!bSkipSave) {
|
|
651
|
+
// serializeToLrep has to be called on exit even when no changes were made -> to invalidate cache
|
|
652
|
+
return this._serializeToLrep(/*bCondenseAnyLayer=*/false, /*bIsExit=*/true);
|
|
653
|
+
}
|
|
654
|
+
return undefined;
|
|
621
655
|
}.bind(this))
|
|
622
|
-
.then(checkToolbarAndExecuteFunction.bind(this, "hide", bSkipSave))
|
|
623
656
|
.then(function() {
|
|
657
|
+
checkToolbarAndExecuteFunction.call(this, "hide", bSkipSave);
|
|
624
658
|
this.fireStop();
|
|
625
659
|
if (!bSkipRestart) {
|
|
626
660
|
ReloadManager.handleUrlParametersOnExit(oReloadInfo);
|
|
627
661
|
}
|
|
628
662
|
}.bind(this))
|
|
629
|
-
.catch(
|
|
663
|
+
.catch(function(vError) {
|
|
664
|
+
if (!bUserCancelled) {
|
|
665
|
+
return showTechnicalError(vError);
|
|
666
|
+
}
|
|
667
|
+
return undefined;
|
|
668
|
+
})
|
|
630
669
|
.then(function() {
|
|
631
670
|
checkToolbarAndExecuteFunction.call(this, "setBusy", false);
|
|
632
|
-
|
|
633
|
-
|
|
671
|
+
if (!bUserCancelled) {
|
|
672
|
+
this._sStatus = STOPPED;
|
|
673
|
+
document.body.classList.remove("sapUiRtaMode");
|
|
674
|
+
}
|
|
634
675
|
}.bind(this));
|
|
635
676
|
};
|
|
636
677
|
|
|
@@ -707,9 +748,13 @@ sap.ui.define([
|
|
|
707
748
|
|
|
708
749
|
Overlay.getOverlayContainer().toggleClass("sapUiRtaVisualizationMode", (sNewMode === "visualization"));
|
|
709
750
|
if (sNewMode === "visualization") {
|
|
710
|
-
|
|
751
|
+
document.querySelectorAll(".sapUiDtOverlayMovable").forEach(function(oNode) {
|
|
752
|
+
oNode.style.cursor = "default";
|
|
753
|
+
});
|
|
711
754
|
} else {
|
|
712
|
-
|
|
755
|
+
document.querySelectorAll(".sapUiDtOverlayMovable").forEach(function(oNode) {
|
|
756
|
+
oNode.style.cursor = "move";
|
|
757
|
+
});
|
|
713
758
|
}
|
|
714
759
|
|
|
715
760
|
this._oToolbarControlsModel.setProperty("/modeSwitcher", sNewMode);
|
|
@@ -853,16 +898,30 @@ sap.ui.define([
|
|
|
853
898
|
// ---- API ----
|
|
854
899
|
|
|
855
900
|
// this function is used to save in the Visual Editor
|
|
856
|
-
RuntimeAuthoring.prototype._serializeToLrep = function(bCondenseAnyLayer) {
|
|
901
|
+
RuntimeAuthoring.prototype._serializeToLrep = function(bCondenseAnyLayer, bIsExit) {
|
|
857
902
|
// when saving a change that requires a reload, the information has to be cached
|
|
858
903
|
// to do the reload when exiting UI Adaptation as then the change will not be available anymore
|
|
859
904
|
if (!this._bSavedChangesNeedReload) {
|
|
860
905
|
return this._oSerializer.needsReload().then(function(bReloadNeeded) {
|
|
861
906
|
this._bSavedChangesNeedReload = bReloadNeeded;
|
|
862
|
-
return serializeAndSave.call(this, undefined, bCondenseAnyLayer);
|
|
907
|
+
return serializeAndSave.call(this, undefined, bCondenseAnyLayer, bIsExit);
|
|
863
908
|
}.bind(this));
|
|
864
909
|
}
|
|
865
|
-
return serializeAndSave.call(this, undefined, bCondenseAnyLayer);
|
|
910
|
+
return serializeAndSave.call(this, undefined, bCondenseAnyLayer, bIsExit);
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Condenses the given changes and saves the result.
|
|
915
|
+
* For the function to do anything at least two changes have to be passed.
|
|
916
|
+
*
|
|
917
|
+
* @param {object[]} aChanges - Array of flex object instances
|
|
918
|
+
* @returns {Promise} Resolves when the save and condense is done
|
|
919
|
+
* @private
|
|
920
|
+
* @ui5-restricted Visual Editor
|
|
921
|
+
*/
|
|
922
|
+
RuntimeAuthoring.prototype.condenseAndSaveChanges = function(/* aChanges */) {
|
|
923
|
+
// for now there is no functionality to only consider passed changes during condensing, so the standard save functionality is triggered
|
|
924
|
+
return this._serializeToLrep.apply(this, arguments);
|
|
866
925
|
};
|
|
867
926
|
|
|
868
927
|
/**
|
|
@@ -874,8 +933,7 @@ sap.ui.define([
|
|
|
874
933
|
RuntimeAuthoring.prototype._onUnload = function() {
|
|
875
934
|
// this function is still in the prototype scope for easier testing
|
|
876
935
|
var oCommandStack = this.getCommandStack();
|
|
877
|
-
|
|
878
|
-
if (bUnsaved && this.getShowWindowUnloadDialog()) {
|
|
936
|
+
if (oCommandStack.canUndo() && this.getShowWindowUnloadDialog()) {
|
|
879
937
|
return this._getTextResources().getText("MSG_UNSAVED_CHANGES");
|
|
880
938
|
}
|
|
881
939
|
window.onbeforeunload = this._oldUnloadHandler;
|
|
@@ -1025,16 +1083,17 @@ sap.ui.define([
|
|
|
1025
1083
|
var oCommandStack = this.getCommandStack();
|
|
1026
1084
|
var bCanUndo = oCommandStack.canUndo();
|
|
1027
1085
|
var bCanRedo = oCommandStack.canRedo();
|
|
1028
|
-
var
|
|
1086
|
+
var bWasSaved = oCommandStack.getSaved();
|
|
1087
|
+
var bTranslationRelevantDirtyChange = this._oToolbarControlsModel.getProperty("/translation/visible") &&
|
|
1029
1088
|
TranslationAPI.hasTranslationRelevantDirtyChanges({layer: Layer.CUSTOMER, selector: this.getRootControlInstance()});
|
|
1030
1089
|
|
|
1031
1090
|
// TODO: move to the setter to the ChangesState
|
|
1032
1091
|
this._oVersionsModel.setDirtyChanges(PersistenceWriteAPI.hasDirtyChanges({selector: this.getRootControlInstance()}));
|
|
1033
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1034
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1035
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1036
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1037
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1092
|
+
this._oToolbarControlsModel.setProperty("/undo/enabled", bCanUndo);
|
|
1093
|
+
this._oToolbarControlsModel.setProperty("/redo/enabled", bCanRedo);
|
|
1094
|
+
this._oToolbarControlsModel.setProperty("/save/enabled", bCanUndo);
|
|
1095
|
+
this._oToolbarControlsModel.setProperty("/restore/enabled", this.bInitialResetEnabled || bCanUndo || bWasSaved);
|
|
1096
|
+
this._oToolbarControlsModel.setProperty("/translation/enabled", this.bPersistedDataTranslatable || bTranslationRelevantDirtyChange);
|
|
1038
1097
|
}
|
|
1039
1098
|
this.fireUndoRedoStackModified();
|
|
1040
1099
|
}
|
|
@@ -1060,13 +1119,13 @@ sap.ui.define([
|
|
|
1060
1119
|
var bFocusInsideRtaToolbar = this.getShowToolbars() && this.getToolbar().getDomRef().contains(document.activeElement);
|
|
1061
1120
|
var bFocusOnContextMenu = false;
|
|
1062
1121
|
// there might be two divs with that style-class (compact and expanded context menu)
|
|
1063
|
-
|
|
1064
|
-
if (
|
|
1122
|
+
document.querySelectorAll(".sapUiDtContextMenu").forEach(function(oNode) {
|
|
1123
|
+
if (oNode.contains(document.activeElement)) {
|
|
1065
1124
|
bFocusOnContextMenu = true;
|
|
1066
1125
|
}
|
|
1067
1126
|
});
|
|
1068
1127
|
var bFocusOnBody = document.body === document.activeElement;
|
|
1069
|
-
var bFocusInsideRenameField =
|
|
1128
|
+
var bFocusInsideRenameField = DOMUtil.getParents(document.activeElement, ".sapUiRtaEditableField").length > 0;
|
|
1070
1129
|
|
|
1071
1130
|
if ((bFocusInsideOverlayContainer || bFocusInsideRtaToolbar || bFocusOnContextMenu || bFocusOnBody) && !bFocusInsideRenameField) {
|
|
1072
1131
|
// OSX: replace CTRL with CMD
|
|
@@ -1096,35 +1155,45 @@ sap.ui.define([
|
|
|
1096
1155
|
}
|
|
1097
1156
|
}
|
|
1098
1157
|
|
|
1099
|
-
function onSaveAsContextBasedAdaptation(oEvent) {
|
|
1100
|
-
var mPropertyBag = {
|
|
1101
|
-
parameters: oEvent.mParameters,
|
|
1102
|
-
control: this.getRootControlInstance(),
|
|
1103
|
-
layer: this.getLayer()
|
|
1104
|
-
};
|
|
1105
|
-
return ContextBasedAdaptationsAPI.create(mPropertyBag);
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
1158
|
function saveOnly(oEvent) {
|
|
1109
1159
|
var fnCallback = oEvent.getParameter("callback") || function() {};
|
|
1110
1160
|
return this.save()
|
|
1111
1161
|
.then(fnCallback);
|
|
1112
1162
|
}
|
|
1113
1163
|
|
|
1114
|
-
function serializeAndSave(bActivateVersion, bCondenseAnyLayer) {
|
|
1164
|
+
function serializeAndSave(bActivateVersion, bCondenseAnyLayer, bIsExit) {
|
|
1115
1165
|
if (this.getShowToolbars()) {
|
|
1116
|
-
this.bPersistedDataTranslatable = this._oToolbarControlsModel.getProperty("/
|
|
1166
|
+
this.bPersistedDataTranslatable = this._oToolbarControlsModel.getProperty("/translation/enabled");
|
|
1117
1167
|
}
|
|
1168
|
+
|
|
1118
1169
|
var mPropertyBag = {
|
|
1119
|
-
// Save changes on the current layer and discard dirty changes on other layers
|
|
1120
|
-
saveAsDraft: this._oVersionsModel.getProperty("/versioningEnabled") && this.getLayer() === Layer.CUSTOMER,
|
|
1121
1170
|
layer: this.getLayer(),
|
|
1122
1171
|
removeOtherLayerChanges: true,
|
|
1123
|
-
version: bActivateVersion ? this._oVersionsModel.getProperty("/displayedVersion") : undefined,
|
|
1124
1172
|
condenseAnyLayer: bCondenseAnyLayer
|
|
1125
1173
|
};
|
|
1126
1174
|
|
|
1127
|
-
|
|
1175
|
+
if (this._oVersionsModel.getProperty("/versioningEnabled")) {
|
|
1176
|
+
var sVersion = bActivateVersion ? this._oVersionsModel.getProperty("/displayedVersion") : undefined;
|
|
1177
|
+
|
|
1178
|
+
// If a draft is being processed, saving without exiting must retrieve the updated state of the draft version
|
|
1179
|
+
if (!sVersion) {
|
|
1180
|
+
sVersion = bIsExit ? undefined : Version.Number.Draft;
|
|
1181
|
+
}
|
|
1182
|
+
mPropertyBag.version = sVersion;
|
|
1183
|
+
|
|
1184
|
+
// Save changes on the current layer and discard dirty changes on other layers
|
|
1185
|
+
mPropertyBag.saveAsDraft = this.getLayer() === Layer.CUSTOMER;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
return this._oSerializer.saveCommands(mPropertyBag)
|
|
1189
|
+
.then(function() {
|
|
1190
|
+
if (!bIsExit) {
|
|
1191
|
+
//clean CViz after Save
|
|
1192
|
+
var oToolbar = this.getToolbar();
|
|
1193
|
+
var oChangeVisualization = this.getChangeVisualization();
|
|
1194
|
+
oChangeVisualization.updateAfterSave(oToolbar);
|
|
1195
|
+
}
|
|
1196
|
+
}.bind(this));
|
|
1128
1197
|
}
|
|
1129
1198
|
|
|
1130
1199
|
function onActivate(oEvent) {
|
|
@@ -1139,6 +1208,7 @@ sap.ui.define([
|
|
|
1139
1208
|
if (sAction === MessageBox.Action.OK) {
|
|
1140
1209
|
return activate.call(this, sVersionTitle);
|
|
1141
1210
|
}
|
|
1211
|
+
return undefined;
|
|
1142
1212
|
}.bind(this));
|
|
1143
1213
|
}
|
|
1144
1214
|
return activate.call(this, sVersionTitle);
|
|
@@ -1159,7 +1229,7 @@ sap.ui.define([
|
|
|
1159
1229
|
}).then(function() {
|
|
1160
1230
|
showMessageToast.call(this, "MSG_DRAFT_ACTIVATION_SUCCESS");
|
|
1161
1231
|
this.bInitialResetEnabled = true;
|
|
1162
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1232
|
+
this._oToolbarControlsModel.setProperty("/restore/enabled", true);
|
|
1163
1233
|
this.getCommandStack().removeAllCommands();
|
|
1164
1234
|
}.bind(this))
|
|
1165
1235
|
.catch(function(oError) {
|
|
@@ -1287,7 +1357,7 @@ sap.ui.define([
|
|
|
1287
1357
|
}.bind(this));
|
|
1288
1358
|
}
|
|
1289
1359
|
|
|
1290
|
-
function createToolsMenu(
|
|
1360
|
+
function createToolsMenu(mButtonsAvailability) {
|
|
1291
1361
|
if (!this.getDependent("toolbar")) {
|
|
1292
1362
|
var bUserLayer = this.getLayer() === Layer.USER;
|
|
1293
1363
|
var oProperties = {
|
|
@@ -1309,7 +1379,6 @@ sap.ui.define([
|
|
|
1309
1379
|
oProperties.activate = onActivate.bind(this);
|
|
1310
1380
|
oProperties.discardDraft = onDiscardDraft.bind(this);
|
|
1311
1381
|
oProperties.switchVersion = onSwitchVersion.bind(this);
|
|
1312
|
-
oProperties.saveAsContextBasedAdaptation = onSaveAsContextBasedAdaptation.bind(this);
|
|
1313
1382
|
oProperties.openChangeCategorySelectionPopover = this.getChangeVisualization
|
|
1314
1383
|
? this.getChangeVisualization().openChangeCategorySelectionPopover.bind(this.getChangeVisualization())
|
|
1315
1384
|
: function() {};
|
|
@@ -1331,8 +1400,8 @@ sap.ui.define([
|
|
|
1331
1400
|
return Promise.all([oToolbar.onFragmentLoaded(), FeaturesAPI.isKeyUserTranslationEnabled(this.getLayer())])
|
|
1332
1401
|
.then(function(aArguments) {
|
|
1333
1402
|
var bTranslationAvailable = aArguments[1];
|
|
1334
|
-
var
|
|
1335
|
-
var bExtendedOverview =
|
|
1403
|
+
var bAppVariantsAvailable = mButtonsAvailability.saveAsAvailable;
|
|
1404
|
+
var bExtendedOverview = bAppVariantsAvailable && RtaAppVariantFeature.isOverviewExtended();
|
|
1336
1405
|
var oUriParameters = UriParameters.fromURL(window.location.href);
|
|
1337
1406
|
// the "Visualization" tab should not be visible if the "fiori-tools-rta-mode" URL-parameter is set to any value but "false"
|
|
1338
1407
|
var bVisualizationButtonVisible;
|
|
@@ -1340,24 +1409,55 @@ sap.ui.define([
|
|
|
1340
1409
|
this.bPersistedDataTranslatable = false;
|
|
1341
1410
|
|
|
1342
1411
|
this._oToolbarControlsModel = new JSONModel({
|
|
1343
|
-
undoEnabled: false,
|
|
1344
|
-
redoEnabled: false,
|
|
1345
|
-
translationVisible: bTranslationAvailable,
|
|
1346
|
-
translationEnabled: this.bPersistedDataTranslatable,
|
|
1347
|
-
publishVisible: aButtonsVisibility.publishAvailable,
|
|
1348
|
-
publishEnabled: this.bInitialPublishEnabled,
|
|
1349
|
-
restoreEnabled: this.bInitialResetEnabled,
|
|
1350
|
-
appVariantsOverviewVisible: bSaveAsAvailable && bExtendedOverview,
|
|
1351
|
-
appVariantsOverviewEnabled: bSaveAsAvailable && bExtendedOverview,
|
|
1352
|
-
saveAsVisible: bSaveAsAvailable,
|
|
1353
|
-
contextBasedAdaptationVisible: aButtonsVisibility.contextBasedAdaptationAvailable,
|
|
1354
|
-
saveAsEnabled: false,
|
|
1355
|
-
manageAppsVisible: bSaveAsAvailable && !bExtendedOverview,
|
|
1356
|
-
manageAppsEnabled: bSaveAsAvailable && !bExtendedOverview,
|
|
1357
1412
|
modeSwitcher: this.getMode(),
|
|
1358
|
-
|
|
1413
|
+
undo: {
|
|
1414
|
+
enabled: false
|
|
1415
|
+
},
|
|
1416
|
+
redo: {
|
|
1417
|
+
enabled: false
|
|
1418
|
+
},
|
|
1419
|
+
save: {
|
|
1420
|
+
enabled: false
|
|
1421
|
+
},
|
|
1422
|
+
translation: {
|
|
1423
|
+
visible: bTranslationAvailable,
|
|
1424
|
+
enabled: this.bPersistedDataTranslatable
|
|
1425
|
+
},
|
|
1426
|
+
appVariantMenu: {
|
|
1427
|
+
visible: bAppVariantsAvailable,
|
|
1428
|
+
enabled: bAppVariantsAvailable,
|
|
1429
|
+
overview: {
|
|
1430
|
+
visible: bAppVariantsAvailable && bExtendedOverview,
|
|
1431
|
+
enabled: bAppVariantsAvailable && bExtendedOverview
|
|
1432
|
+
},
|
|
1433
|
+
manageApps: {
|
|
1434
|
+
visible: bAppVariantsAvailable && !bExtendedOverview,
|
|
1435
|
+
enabled: bAppVariantsAvailable && !bExtendedOverview
|
|
1436
|
+
},
|
|
1437
|
+
saveAs: {
|
|
1438
|
+
visible: bAppVariantsAvailable,
|
|
1439
|
+
enabled: bAppVariantsAvailable
|
|
1440
|
+
}
|
|
1441
|
+
},
|
|
1442
|
+
restore: {
|
|
1443
|
+
visible: !this._oVersionsModel.getProperty("/versioningEnabled"),
|
|
1444
|
+
enabled: this.bInitialResetEnabled
|
|
1445
|
+
},
|
|
1446
|
+
contextBasedAdaptation: {
|
|
1447
|
+
visible: mButtonsAvailability.contextBasedAdaptationAvailable,
|
|
1448
|
+
enabled: mButtonsAvailability.contextBasedAdaptationAvailable
|
|
1449
|
+
},
|
|
1450
|
+
actionsMenuButton: {
|
|
1451
|
+
enabled: true
|
|
1452
|
+
},
|
|
1453
|
+
visualizationButton: {
|
|
1454
|
+
visible: bVisualizationButtonVisible,
|
|
1455
|
+
enabled: bVisualizationButtonVisible
|
|
1456
|
+
}
|
|
1359
1457
|
});
|
|
1360
1458
|
|
|
1459
|
+
this._oVersionsModel.setProperty("/publishVersionVisible", mButtonsAvailability.publishAvailable);
|
|
1460
|
+
|
|
1361
1461
|
var oTranslationPromise = new Promise(function(resolve) {
|
|
1362
1462
|
if (!bTranslationAvailable) {
|
|
1363
1463
|
resolve();
|
|
@@ -1367,20 +1467,20 @@ sap.ui.define([
|
|
|
1367
1467
|
TranslationAPI.getSourceLanguages({selector: this.getRootControlInstance(), layer: this.getLayer()})
|
|
1368
1468
|
.then(function(aSourceLanguages) {
|
|
1369
1469
|
this.bPersistedDataTranslatable = aSourceLanguages.length > 0;
|
|
1370
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1470
|
+
this._oToolbarControlsModel.setProperty("/translation/enabled", this.bPersistedDataTranslatable);
|
|
1371
1471
|
}.bind(this)).finally(resolve);
|
|
1372
1472
|
}.bind(this));
|
|
1373
1473
|
|
|
1374
1474
|
var oSaveAsPromise = new Promise(function(resolve) {
|
|
1375
|
-
if (!
|
|
1475
|
+
if (!bAppVariantsAvailable) {
|
|
1376
1476
|
resolve();
|
|
1377
1477
|
return;
|
|
1378
1478
|
}
|
|
1379
1479
|
|
|
1380
1480
|
RtaAppVariantFeature.isManifestSupported().then(function(bResult) {
|
|
1381
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1382
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1383
|
-
this._oToolbarControlsModel.setProperty("/
|
|
1481
|
+
this._oToolbarControlsModel.setProperty("/appVariantMenu/saveAs/enabled", bResult);
|
|
1482
|
+
this._oToolbarControlsModel.setProperty("/appVariantMenu/overview/enabled", bResult);
|
|
1483
|
+
this._oToolbarControlsModel.setProperty("/appVariantMenu/manageApps/enabled", bResult);
|
|
1384
1484
|
}.bind(this)).finally(resolve);
|
|
1385
1485
|
}.bind(this));
|
|
1386
1486
|
|
|
@@ -1540,6 +1640,7 @@ sap.ui.define([
|
|
|
1540
1640
|
Log.error("sap.ui.rta: " + oError.message);
|
|
1541
1641
|
});
|
|
1542
1642
|
}
|
|
1643
|
+
return undefined;
|
|
1543
1644
|
}.bind(this));
|
|
1544
1645
|
return this._pElementModified;
|
|
1545
1646
|
}
|
|
@@ -1618,94 +1719,93 @@ sap.ui.define([
|
|
|
1618
1719
|
}
|
|
1619
1720
|
}
|
|
1620
1721
|
} else {
|
|
1621
|
-
this._mServices[sName] = mService = {
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1722
|
+
this._mServices[sName] = mService = {};
|
|
1723
|
+
mService.status = SERVICE_STARTING;
|
|
1724
|
+
mService.location = sServiceLocation;
|
|
1725
|
+
mService.initPromise = new Promise(function(fnResolve, fnReject) {
|
|
1726
|
+
sap.ui.require(
|
|
1727
|
+
[sServiceLocation],
|
|
1728
|
+
function(fnServiceFactory) {
|
|
1729
|
+
mService.factory = fnServiceFactory;
|
|
1730
|
+
|
|
1731
|
+
if (!this._oServiceEventBus) {
|
|
1732
|
+
this._oServiceEventBus = new ServiceEventBus();
|
|
1733
|
+
}
|
|
1633
1734
|
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
);
|
|
1645
|
-
}
|
|
1646
|
-
if (!isPlainObject(oService)) {
|
|
1647
|
-
throw DtUtil.createError(
|
|
1648
|
-
"RuntimeAuthoring#startService",
|
|
1649
|
-
DtUtil.printf("Invalid service format. Service should return simple javascript object after initialization. Service name = '{0}'", sName),
|
|
1650
|
-
"sap.ui.rta"
|
|
1651
|
-
);
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
mService.service = oService;
|
|
1655
|
-
mService.exports = {};
|
|
1656
|
-
|
|
1657
|
-
// Expose events API if there is at least one event
|
|
1658
|
-
if (Array.isArray(oService.events) && oService.events.length > 0) {
|
|
1659
|
-
jQuery.extend(mService.exports, {
|
|
1660
|
-
attachEvent: this._oServiceEventBus.subscribe.bind(this._oServiceEventBus, sName),
|
|
1661
|
-
detachEvent: this._oServiceEventBus.unsubscribe.bind(this._oServiceEventBus, sName),
|
|
1662
|
-
attachEventOnce: this._oServiceEventBus.subscribeOnce.bind(this._oServiceEventBus, sName)
|
|
1663
|
-
});
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
// Expose methods/properties from exports object if any
|
|
1667
|
-
var mExports = oService.exports || {};
|
|
1668
|
-
jQuery.extend(
|
|
1669
|
-
mService.exports,
|
|
1670
|
-
Object.keys(mExports).reduce(function(mResult, sKey) {
|
|
1671
|
-
var vValue = mExports[sKey];
|
|
1672
|
-
mResult[sKey] = typeof vValue === "function"
|
|
1673
|
-
? DtUtil.waitForSynced(this._oDesignTime, vValue)
|
|
1674
|
-
: vValue;
|
|
1675
|
-
return mResult;
|
|
1676
|
-
}.bind(this), {})
|
|
1735
|
+
DtUtil.wrapIntoPromise(fnServiceFactory)(
|
|
1736
|
+
this,
|
|
1737
|
+
this._oServiceEventBus.publish.bind(this._oServiceEventBus, sName)
|
|
1738
|
+
)
|
|
1739
|
+
.then(function(oService) {
|
|
1740
|
+
if (this.bIsDestroyed) {
|
|
1741
|
+
throw DtUtil.createError(
|
|
1742
|
+
"RuntimeAuthoring#startService",
|
|
1743
|
+
DtUtil.printf("RuntimeAuthoring instance is destroyed while initializing the service '{0}'", sName),
|
|
1744
|
+
"sap.ui.rta"
|
|
1677
1745
|
);
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1746
|
+
}
|
|
1747
|
+
if (!isPlainObject(oService)) {
|
|
1748
|
+
throw DtUtil.createError(
|
|
1749
|
+
"RuntimeAuthoring#startService",
|
|
1750
|
+
DtUtil.printf("Invalid service format. Service should return simple javascript object after initialization. Service name = '{0}'", sName),
|
|
1751
|
+
"sap.ui.rta"
|
|
1752
|
+
);
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
mService.service = oService;
|
|
1756
|
+
mService.exports = {};
|
|
1757
|
+
|
|
1758
|
+
// Expose events API if there is at least one event
|
|
1759
|
+
if (Array.isArray(oService.events) && oService.events.length > 0) {
|
|
1760
|
+
Object.assign(mService.exports, {
|
|
1761
|
+
attachEvent: this._oServiceEventBus.subscribe.bind(this._oServiceEventBus, sName),
|
|
1762
|
+
detachEvent: this._oServiceEventBus.unsubscribe.bind(this._oServiceEventBus, sName),
|
|
1763
|
+
attachEventOnce: this._oServiceEventBus.subscribeOnce.bind(this._oServiceEventBus, sName)
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
// Expose methods/properties from exports object if any
|
|
1768
|
+
var mExports = oService.exports || {};
|
|
1769
|
+
Object.assign(
|
|
1770
|
+
mService.exports,
|
|
1771
|
+
Object.keys(mExports).reduce(function(mResult, sKey) {
|
|
1772
|
+
var vValue = mExports[sKey];
|
|
1773
|
+
mResult[sKey] = typeof vValue === "function"
|
|
1774
|
+
? DtUtil.waitForSynced(this._oDesignTime, vValue)
|
|
1775
|
+
: vValue;
|
|
1776
|
+
return mResult;
|
|
1777
|
+
}.bind(this), {})
|
|
1778
|
+
);
|
|
1779
|
+
|
|
1780
|
+
mService.status = SERVICE_STARTED;
|
|
1781
|
+
fnResolve(Object.freeze(mService.exports));
|
|
1782
|
+
}.bind(this))
|
|
1783
|
+
.catch(fnReject);
|
|
1784
|
+
}.bind(this),
|
|
1785
|
+
function(vError) {
|
|
1698
1786
|
mService.status = SERVICE_FAILED;
|
|
1699
|
-
|
|
1787
|
+
fnReject(
|
|
1700
1788
|
DtUtil.propagateError(
|
|
1701
1789
|
vError,
|
|
1702
1790
|
"RuntimeAuthoring#startService",
|
|
1703
|
-
DtUtil.printf("
|
|
1791
|
+
DtUtil.printf("Can't load service '{0}' by its name: {1}", sName, sServiceLocation),
|
|
1704
1792
|
"sap.ui.rta"
|
|
1705
1793
|
)
|
|
1706
1794
|
);
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1795
|
+
}
|
|
1796
|
+
);
|
|
1797
|
+
}.bind(this))
|
|
1798
|
+
.catch(function(vError) {
|
|
1799
|
+
mService.status = SERVICE_FAILED;
|
|
1800
|
+
return Promise.reject(
|
|
1801
|
+
DtUtil.propagateError(
|
|
1802
|
+
vError,
|
|
1803
|
+
"RuntimeAuthoring#startService",
|
|
1804
|
+
DtUtil.printf("Error during service '{0}' initialization.", sName),
|
|
1805
|
+
"sap.ui.rta"
|
|
1806
|
+
)
|
|
1807
|
+
);
|
|
1808
|
+
});
|
|
1709
1809
|
|
|
1710
1810
|
return mService.initPromise;
|
|
1711
1811
|
}
|
|
@@ -1744,4 +1844,4 @@ sap.ui.define([
|
|
|
1744
1844
|
};
|
|
1745
1845
|
|
|
1746
1846
|
return RuntimeAuthoring;
|
|
1747
|
-
});
|
|
1847
|
+
});
|