@openui5/sap.ui.fl 1.112.2 → 1.113.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/THIRDPARTY.txt +1 -1
- package/package.json +3 -3
- package/src/sap/ui/fl/.library +1 -1
- package/src/sap/ui/fl/Cache.js +1 -1
- package/src/sap/ui/fl/ChangePersistence.js +42 -32
- package/src/sap/ui/fl/ChangePersistenceFactory.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
- package/src/sap/ui/fl/FlexController.js +1 -1
- package/src/sap/ui/fl/FlexControllerFactory.js +22 -18
- package/src/sap/ui/fl/LayerUtils.js +1 -1
- package/src/sap/ui/fl/Utils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
- package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/controlVariants/URLHandler.js +6 -6
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +2 -2
- package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +5 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/EventHistory.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
- package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/fl/changeHandler/Base.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseAddXml.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
- package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +4 -4
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/internal/Utils.js +3 -3
- package/src/sap/ui/fl/designtime/util/IFrame.designtime.js +36 -31
- package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +2 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeRegistryItem.js +1 -1
- package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
- package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
- package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
- package/src/sap/ui/fl/library.js +43 -43
- package/src/sap/ui/fl/messagebundle_sl.properties +2 -2
- package/src/sap/ui/fl/registry/Settings.js +1 -2
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
- package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +11 -13
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
- package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/util/IFrame.js +2 -2
- package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
- package/src/sap/ui/fl/util/resolveBinding.js +1 -1
- package/src/sap/ui/fl/variants/VariantModel.js +7 -2
- package/src/sap/ui/fl/write/_internal/Storage.js +2 -2
- package/src/sap/ui/fl/write/_internal/StorageFeaturesMerger.js +1 -1
- package/src/sap/ui/fl/write/_internal/Versions.js +7 -2
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +24 -9
- package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +36 -27
- package/src/sap/ui/fl/write/_internal/condenser/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/condenser/classifications/Update.js +10 -1
- package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/write/_internal/extensionPoint/Registry.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/FlexObjectState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +18 -1
- package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
- package/src/sap/ui/fl/write/api/ChangesWriteAPI.js +25 -5
- package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +118 -4
- package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +34 -14
- package/src/sap/ui/fl/write/api/FeaturesAPI.js +19 -9
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
- package/src/sap/ui/fl/write/api/VersionsAPI.js +5 -3
- package/src/sap/ui/fl/write/api/connectors/ObjectStorageConnector.js +2 -1
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
+
"sap/ui/fl/registry/Settings",
|
|
8
9
|
"sap/ui/fl/apply/_internal/flexState/ManifestUtils",
|
|
9
10
|
"sap/ui/fl/Utils",
|
|
10
11
|
"sap/ui/fl/write/_internal/Storage",
|
|
11
12
|
"sap/ui/fl/write/_internal/Versions",
|
|
12
13
|
"sap/ui/model/json/JSONModel"
|
|
13
14
|
], function (
|
|
15
|
+
Settings,
|
|
14
16
|
ManifestUtils,
|
|
15
17
|
FlexUtils,
|
|
16
18
|
Storage,
|
|
@@ -19,6 +21,8 @@ sap.ui.define([
|
|
|
19
21
|
) {
|
|
20
22
|
"use strict";
|
|
21
23
|
|
|
24
|
+
var _mInstances = {};
|
|
25
|
+
|
|
22
26
|
/**
|
|
23
27
|
* Provides an API for creating and managing context-based adaptation.
|
|
24
28
|
*
|
|
@@ -59,14 +63,122 @@ sap.ui.define([
|
|
|
59
63
|
return oResponse;
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Initializes the context-based adaptations for a given control and layer
|
|
68
|
+
* @param {object} mPropertyBag - Object with parameters as properties
|
|
69
|
+
* @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
|
|
70
|
+
* @param {string} mPropertyBag.layer - Layer
|
|
71
|
+
* @returns {sap.ui.model.json.JSONModel} - Model of adaptations enhanced with additional properties
|
|
72
|
+
*/
|
|
73
|
+
ContextBasedAdaptationsAPI.initialize = function (mPropertyBag) {
|
|
74
|
+
if (!mPropertyBag.layer) {
|
|
75
|
+
return Promise.reject("No layer was provided");
|
|
76
|
+
}
|
|
77
|
+
if (!mPropertyBag.control) {
|
|
78
|
+
return Promise.reject("No control was provided");
|
|
79
|
+
}
|
|
80
|
+
var sReference = getFlexReferenceForControl(mPropertyBag.control);
|
|
81
|
+
mPropertyBag.reference = sReference;
|
|
82
|
+
var sLayer = mPropertyBag.layer;
|
|
83
|
+
return Settings.getInstance()
|
|
84
|
+
.then(function(oSettings) {
|
|
85
|
+
var bContextBasedAdaptationsEnabled = oSettings.isContextBasedAdaptationEnabled();
|
|
86
|
+
var oAdaptationsPromise = bContextBasedAdaptationsEnabled ? ContextBasedAdaptationsAPI.load(mPropertyBag) : Promise.resolve({adaptations: []});
|
|
87
|
+
return oAdaptationsPromise;
|
|
88
|
+
})
|
|
89
|
+
.then(function(oAdaptations) {
|
|
90
|
+
return ContextBasedAdaptationsAPI.createModel(oAdaptations.adaptations);
|
|
91
|
+
})
|
|
92
|
+
.then(function(oModel) {
|
|
93
|
+
_mInstances[sReference] = _mInstances[sReference] || {};
|
|
94
|
+
_mInstances[sReference][sLayer] = _mInstances[sReference][sLayer] || {};
|
|
95
|
+
_mInstances[sReference][sLayer] = oModel;
|
|
96
|
+
return _mInstances[sReference][sLayer];
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Initializes and creates an new adaptation Model
|
|
102
|
+
* @param {string[]} aAdaptations - List of adaptations from backend
|
|
103
|
+
* @returns {sap.ui.model.json.JSONModel} - Model of adaptations enhanced with additional properties
|
|
104
|
+
*/
|
|
105
|
+
ContextBasedAdaptationsAPI.createModel = function(aAdaptations) {
|
|
106
|
+
if (!Array.isArray(aAdaptations)) {
|
|
107
|
+
throw Error("Adaptations model can only be initialized with an array of adaptations");
|
|
108
|
+
}
|
|
109
|
+
var oModel = new JSONModel({
|
|
110
|
+
adaptations: aAdaptations,
|
|
111
|
+
count: aAdaptations.length,
|
|
112
|
+
displayedAdaptation: aAdaptations.length > 0 ? aAdaptations[0] : {}
|
|
113
|
+
});
|
|
114
|
+
oModel.updateAdaptations = function(aAdaptations) {
|
|
115
|
+
oModel.setProperty("/adaptations", aAdaptations);
|
|
116
|
+
oModel.setProperty("/count", aAdaptations.length);
|
|
117
|
+
if (aAdaptations.length > 0) {
|
|
118
|
+
var oDisplayedAdaptation = oModel.getProperty("/adaptations/0/"); //TODO: might be changed in future
|
|
119
|
+
oModel.setProperty("/displayedAdaptation", oDisplayedAdaptation);
|
|
120
|
+
}
|
|
121
|
+
oModel.updateBindings(true);
|
|
122
|
+
};
|
|
123
|
+
oModel.insertAdaptation = function(oNewAdaptation) {
|
|
124
|
+
aAdaptations = oModel.getProperty("/adaptations");
|
|
125
|
+
aAdaptations.splice(oNewAdaptation.priority, 0, oNewAdaptation);
|
|
126
|
+
delete oNewAdaptation.priority;
|
|
127
|
+
oModel.updateAdaptations(aAdaptations);
|
|
128
|
+
};
|
|
129
|
+
return oModel;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Returns adaptations model given reference id and layer.
|
|
134
|
+
* @param {object} mPropertyBag - Object with parameters as properties
|
|
135
|
+
* @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
|
|
136
|
+
* @param {string} mPropertyBag.layer - Layer
|
|
137
|
+
* @returns {sap.ui.model.json.JSONModel} - Model of adaptations enhanced with additional properties
|
|
138
|
+
*/
|
|
139
|
+
ContextBasedAdaptationsAPI.getAdaptationsModel = function(mPropertyBag) {
|
|
140
|
+
if (!mPropertyBag.layer) {
|
|
141
|
+
throw Error("No layer was provided");
|
|
142
|
+
}
|
|
143
|
+
if (!mPropertyBag.control) {
|
|
144
|
+
throw Error("No control was provided");
|
|
145
|
+
}
|
|
146
|
+
mPropertyBag.reference = getFlexReferenceForControl(mPropertyBag.control);
|
|
147
|
+
var sReference = mPropertyBag.reference;
|
|
148
|
+
var sLayer = mPropertyBag.layer;
|
|
149
|
+
if (!ContextBasedAdaptationsAPI.hasAdaptationsModel(mPropertyBag)) {
|
|
150
|
+
throw Error("Adaptations model for reference '" + sReference + "' and layer '" + sLayer + "' were not initialized.");
|
|
151
|
+
}
|
|
152
|
+
return _mInstances[sReference][sLayer];
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Checks if adaptations model for a given reference and layer exists.
|
|
157
|
+
* @param {object} mPropertyBag - Object with parameters as properties
|
|
158
|
+
* @param {string} mPropertyBag.reference - ID of the application for which the versions are requested
|
|
159
|
+
* @param {string} mPropertyBag.layer - Layer
|
|
160
|
+
* @returns {boolean} checks if an adaptation model exists for this reference and layer
|
|
161
|
+
*/
|
|
162
|
+
ContextBasedAdaptationsAPI.hasAdaptationsModel = function(mPropertyBag) {
|
|
163
|
+
var sReference = mPropertyBag.reference;
|
|
164
|
+
var sLayer = mPropertyBag.layer;
|
|
165
|
+
return _mInstances[sReference] && _mInstances[sReference][sLayer];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
ContextBasedAdaptationsAPI.clearInstances = function() {
|
|
169
|
+
_mInstances = {};
|
|
170
|
+
};
|
|
171
|
+
|
|
62
172
|
/**
|
|
63
173
|
* Create new context-based adaptation and saves it in the backend
|
|
64
174
|
* @param {object} mPropertyBag - Object with parameters as properties
|
|
65
175
|
* @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
|
|
66
176
|
* @param {string} mPropertyBag.layer - Layer
|
|
67
|
-
* @param {object} mPropertyBag.contextBasedAdaptation - Parameters
|
|
177
|
+
* @param {object} mPropertyBag.contextBasedAdaptation - Parameters for new adaptation
|
|
68
178
|
* @param {string} mPropertyBag.contextBasedAdaptation.title - Title of the new adaptation
|
|
69
179
|
* @param {object} mPropertyBag.contextBasedAdaptation.contexts - Contexts of the new adaptation, for example roles for which the adaptation is created
|
|
180
|
+
* @param {object} mPropertyBag.contextBasedAdaptation.priority - Priority of the new adaptation
|
|
181
|
+
* @param {object} mPropertyBag.contextBasedAdaptation.priority - ID of the new adaptation
|
|
70
182
|
* @returns {Promise} Promise that resolves with the context-based adaptation
|
|
71
183
|
*/
|
|
72
184
|
ContextBasedAdaptationsAPI.create = function (mPropertyBag) {
|
|
@@ -87,8 +199,10 @@ sap.ui.define([
|
|
|
87
199
|
reference: mPropertyBag.reference,
|
|
88
200
|
parentVersion: Versions.getVersionsModel({ layer: mPropertyBag.layer, reference: mPropertyBag.reference }).getProperty("/displayedVersion")
|
|
89
201
|
}).then(function (oResponse) {
|
|
202
|
+
var oModel = this.getAdaptationsModel(mPropertyBag);
|
|
203
|
+
oModel.insertAdaptation(mPropertyBag.contextBasedAdaptation);
|
|
90
204
|
return handleResponseForVersioning(oResponse, 201, mPropertyBag);
|
|
91
|
-
});
|
|
205
|
+
}.bind(this));
|
|
92
206
|
};
|
|
93
207
|
|
|
94
208
|
/**
|
|
@@ -126,7 +240,7 @@ sap.ui.define([
|
|
|
126
240
|
* @param {object} mPropertyBag - Object with parameters as properties
|
|
127
241
|
* @param {sap.ui.core.Control} mPropertyBag.control - Control for which the request is done
|
|
128
242
|
* @param {string} mPropertyBag.layer - Layer
|
|
129
|
-
* @returns {Promise} Promise that resolves with the list of context-based adaptations
|
|
243
|
+
* @returns {Promise<object>} Promise that resolves with the list of context-based adaptations
|
|
130
244
|
*/
|
|
131
245
|
ContextBasedAdaptationsAPI.load = function (mPropertyBag) {
|
|
132
246
|
if (!mPropertyBag.layer) {
|
|
@@ -145,7 +259,7 @@ sap.ui.define([
|
|
|
145
259
|
if (!oAdaptations) {
|
|
146
260
|
oAdaptations = { adaptations: [] };
|
|
147
261
|
}
|
|
148
|
-
return
|
|
262
|
+
return oAdaptations;
|
|
149
263
|
});
|
|
150
264
|
};
|
|
151
265
|
return ContextBasedAdaptationsAPI;
|
|
@@ -15,6 +15,7 @@ sap.ui.define([
|
|
|
15
15
|
"sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
|
|
16
16
|
"sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage",
|
|
17
17
|
"sap/ui/fl/registry/Settings",
|
|
18
|
+
"sap/ui/fl/write/api/ChangesWriteAPI",
|
|
18
19
|
"sap/ui/fl/FlexControllerFactory",
|
|
19
20
|
"sap/ui/fl/Layer",
|
|
20
21
|
"sap/ui/fl/Utils"
|
|
@@ -29,6 +30,7 @@ sap.ui.define([
|
|
|
29
30
|
FlexRuntimeInfoAPI,
|
|
30
31
|
ChangeHandlerStorage,
|
|
31
32
|
Settings,
|
|
33
|
+
ChangesWriteAPI,
|
|
32
34
|
FlexControllerFactory,
|
|
33
35
|
Layer,
|
|
34
36
|
Utils
|
|
@@ -99,6 +101,7 @@ sap.ui.define([
|
|
|
99
101
|
* @property {object} changeSpecificData - Map of change-specific data to perform a flex change
|
|
100
102
|
* @property {string} changeSpecificData.changeType - Change type for which a change handler is registered
|
|
101
103
|
* @property {object} changeSpecificData.content - Content for the change
|
|
104
|
+
* @property {boolean} [transient=false] - Transient changes are not persisted
|
|
102
105
|
* @since 1.69
|
|
103
106
|
* @private
|
|
104
107
|
* @ui5-restricted UI5 controls that allow personalization
|
|
@@ -113,7 +116,7 @@ sap.ui.define([
|
|
|
113
116
|
* @param {boolean} [mPropertyBag.ignoreVariantManagement=false] - If flag is set to <code>true</code>, the changes will not belong to any variant, otherwise it will be detected if the changes are done in the context of variant mangement
|
|
114
117
|
* @param {boolean} [mPropertyBag.useStaticArea=false] - If flag is set to true then the static area is used to determine the variant management control
|
|
115
118
|
*
|
|
116
|
-
* @returns {Promise} Promise resolving to an array of successfully applied changes, after the changes have been written to the map of dirty changes and applied to the control
|
|
119
|
+
* @returns {Promise} Promise resolving to an array of successfully applied changes, after the changes have been written to the map of dirty changes (except transient changes) and applied to the control
|
|
117
120
|
* @private
|
|
118
121
|
* @ui5-restricted
|
|
119
122
|
*/
|
|
@@ -133,7 +136,7 @@ sap.ui.define([
|
|
|
133
136
|
var aSuccessfulChanges = [];
|
|
134
137
|
|
|
135
138
|
function createChanges() {
|
|
136
|
-
var
|
|
139
|
+
var aChanges = [];
|
|
137
140
|
return mPropertyBag.changes.reduce(function(pPromise, oPersonalizationChange) {
|
|
138
141
|
return pPromise
|
|
139
142
|
.then(function() {
|
|
@@ -141,7 +144,8 @@ sap.ui.define([
|
|
|
141
144
|
return checkChangeSpecificData(oPersonalizationChange, sLayer);
|
|
142
145
|
})
|
|
143
146
|
.then(function() {
|
|
144
|
-
|
|
147
|
+
// Transient changes are always VM-independent
|
|
148
|
+
if (!oPersonalizationChange.transient && !mPropertyBag.ignoreVariantManagement) {
|
|
145
149
|
// check for preset variantReference
|
|
146
150
|
if (!oPersonalizationChange.changeSpecificData.variantReference) {
|
|
147
151
|
var sVariantManagementReference = getRelevantVariantManagementReference(oAppComponent, oPersonalizationChange.selectorControl, mPropertyBag.useStaticArea);
|
|
@@ -156,11 +160,18 @@ sap.ui.define([
|
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
oPersonalizationChange.changeSpecificData = Object.assign(oPersonalizationChange.changeSpecificData, {developerMode: false, layer: sLayer});
|
|
159
|
-
return
|
|
163
|
+
return ChangesWriteAPI.create({
|
|
164
|
+
changeSpecificData: oPersonalizationChange.changeSpecificData,
|
|
165
|
+
selector: oPersonalizationChange.selectorControl
|
|
166
|
+
});
|
|
160
167
|
})
|
|
161
|
-
.then(function(
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
.then(function(oCreatedChange) {
|
|
169
|
+
if (!oPersonalizationChange.transient) {
|
|
170
|
+
oCreatedChange = oFlexController.addPreparedChange(oCreatedChange, oAppComponent);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
aChanges.push({
|
|
174
|
+
changeInstance: oCreatedChange,
|
|
164
175
|
selectorControl: oPersonalizationChange.selectorControl
|
|
165
176
|
});
|
|
166
177
|
})
|
|
@@ -169,21 +180,30 @@ sap.ui.define([
|
|
|
169
180
|
});
|
|
170
181
|
}, Promise.resolve())
|
|
171
182
|
.then(function() {
|
|
172
|
-
return
|
|
183
|
+
return aChanges;
|
|
173
184
|
});
|
|
174
185
|
}
|
|
175
186
|
|
|
176
|
-
function applyChanges(
|
|
177
|
-
return
|
|
187
|
+
function applyChanges(aChanges) {
|
|
188
|
+
return aChanges.reduce(function(pPromise, oChange) {
|
|
178
189
|
return pPromise
|
|
179
190
|
.then(function() {
|
|
180
|
-
|
|
191
|
+
oChange.changeInstance.setQueuedForApply();
|
|
192
|
+
return ChangesWriteAPI.apply({
|
|
193
|
+
change: oChange.changeInstance,
|
|
194
|
+
element: oChange.selectorControl
|
|
195
|
+
});
|
|
181
196
|
})
|
|
182
|
-
.then(function(
|
|
183
|
-
|
|
197
|
+
.then(function(oResult) {
|
|
198
|
+
if (oResult.success) {
|
|
199
|
+
aSuccessfulChanges.push(oChange.changeInstance);
|
|
200
|
+
} else {
|
|
201
|
+
throw oResult.error || new Error("ChangesWriteAPI.apply failed with unspecified error");
|
|
202
|
+
}
|
|
184
203
|
})
|
|
185
204
|
.catch(function(oError) {
|
|
186
|
-
|
|
205
|
+
oFlexController.deleteChange(oChange.changeInstance, oAppComponent);
|
|
206
|
+
Log.error("A Change was not applied successfully. Reason: ", oError.message);
|
|
187
207
|
});
|
|
188
208
|
}, Promise.resolve());
|
|
189
209
|
}
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/ui/fl/registry/Settings",
|
|
9
|
-
"sap/ui/fl/Layer"
|
|
9
|
+
"sap/ui/fl/Layer",
|
|
10
|
+
"sap/ui/fl/Utils"
|
|
10
11
|
], function(
|
|
11
12
|
Settings,
|
|
12
|
-
Layer
|
|
13
|
+
Layer,
|
|
14
|
+
Utils
|
|
13
15
|
) {
|
|
14
16
|
"use strict";
|
|
15
17
|
|
|
@@ -50,24 +52,32 @@ sap.ui.define([
|
|
|
50
52
|
* @description App variant functionality is only supported in S/4HANA Cloud Platform & S/4HANA on Premise.
|
|
51
53
|
* App variant functionality should be available if the following conditions are met:
|
|
52
54
|
* When the current layer is 'CUSTOMER'.
|
|
53
|
-
* When it is not a standalone app
|
|
55
|
+
* When it is not a standalone app.
|
|
54
56
|
* When the backend supports this feature.
|
|
55
57
|
* @private
|
|
56
58
|
* @ui5-restricted
|
|
57
59
|
*/
|
|
58
60
|
isSaveAsAvailable: function (sLayer) {
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
+
return Promise.all([
|
|
62
|
+
Settings.getInstance(),
|
|
63
|
+
Utils.getUShellService("CrossApplicationNavigation")
|
|
64
|
+
])
|
|
65
|
+
.then(function (aPromises) {
|
|
66
|
+
var oSettings = aPromises[0];
|
|
67
|
+
var oCrossAppNav = aPromises[1];
|
|
68
|
+
return (
|
|
61
69
|
oSettings.isAppVariantSaveAsEnabled()
|
|
62
70
|
&& sLayer === Layer.CUSTOMER
|
|
63
|
-
&&
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
&& oCrossAppNav !== undefined // Not a standalone app
|
|
72
|
+
);
|
|
73
|
+
})
|
|
74
|
+
.catch(function () {
|
|
75
|
+
//either Settings or CrossApplicationNavigation service from Unified Shell failed -> disable save as app variant
|
|
67
76
|
return false;
|
|
68
77
|
});
|
|
69
78
|
},
|
|
70
79
|
|
|
80
|
+
|
|
71
81
|
/**
|
|
72
82
|
* Determine if the context-based adaptation feature is available in the connected backend
|
|
73
83
|
*
|
|
@@ -157,11 +157,13 @@ sap.ui.define([
|
|
|
157
157
|
if (!mPropertyBag.layer) {
|
|
158
158
|
return Promise.reject("No layer was provided");
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (
|
|
160
|
+
var oModel = getVersionsModel(mPropertyBag);
|
|
161
|
+
if (oModel) {
|
|
162
|
+
if (mPropertyBag.version === undefined) {
|
|
163
163
|
mPropertyBag.version = oModel.getProperty("/activeVersion");
|
|
164
164
|
}
|
|
165
|
+
oModel.setProperty("/displayedVersion", mPropertyBag.version);
|
|
166
|
+
oModel.setProperty("/persistedVersion", mPropertyBag.version);
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
var oAppComponent = Utils.getAppComponentForControl(mPropertyBag.control);
|