@openui5/sap.ui.fl 1.120.6 → 1.121.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 +23 -21
- package/THIRDPARTY.txt +6 -43
- package/package.json +3 -3
- package/src/sap/ui/fl/.library +1 -1
- package/src/sap/ui/fl/ChangePersistence.js +38 -133
- 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 +28 -15
- package/src/sap/ui/fl/FlexControllerFactory.js +1 -1
- package/src/sap/ui/fl/LayerUtils.js +5 -5
- package/src/sap/ui/fl/Utils.js +15 -18
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Applier.js +19 -20
- 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 +6 -2
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +9 -3
- 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 +2 -2
- 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 +17 -11
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +7 -19
- package/src/sap/ui/fl/{write → apply}/_internal/extensionPoint/Registry.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 -3
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +13 -7
- package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +3 -2
- package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +8 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +47 -0
- package/src/sap/ui/fl/apply/_internal/flexState/DataSelector.js +124 -34
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +118 -45
- package/src/sap/ui/fl/apply/_internal/flexState/InitialPrepareFunctions.js +25 -9
- package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +17 -3
- package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +21 -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 +108 -104
- package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +93 -34
- package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +195 -0
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +7 -6
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/Utils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap.js +6 -6
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +2 -2
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +89 -11
- package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +20 -28
- 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/{write → apply}/api/ExtensionPointRegistryAPI.js +3 -3
- package/src/sap/ui/fl/apply/api/FlexRuntimeInfoAPI.js +49 -8
- package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.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 +7 -6
- 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 +2 -2
- package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnstashControl.js +4 -4
- 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/designtime/util/IFrame.designtime.js +3 -91
- package/src/sap/ui/fl/designtime/util/editIFrame.js +94 -0
- package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/FlexInfoSession.js +2 -23
- package/src/sap/ui/fl/initial/_internal/Storage.js +106 -39
- package/src/sap/ui/fl/{write → initial}/_internal/StorageFeaturesMerger.js +10 -7
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +14 -8
- 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/connectors/BackendConnector.js +26 -4
- package/src/sap/ui/fl/initial/_internal/connectors/BtpServiceConnector.js +44 -0
- package/src/sap/ui/fl/initial/_internal/connectors/KeyUserConnector.js +8 -1
- package/src/sap/ui/fl/initial/_internal/connectors/LrepConnector.js +48 -2
- package/src/sap/ui/fl/initial/_internal/connectors/NeoLrepConnector.js +25 -4
- package/src/sap/ui/fl/initial/_internal/connectors/PersonalizationConnector.js +12 -1
- package/src/sap/ui/fl/initial/_internal/connectors/StaticFileConnector.js +14 -4
- 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/initial/api/Version.js +0 -1
- package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +22 -1
- package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
- package/src/sap/ui/fl/library.js +48 -43
- package/src/sap/ui/fl/messagebundle.properties +3 -0
- package/src/sap/ui/fl/messagebundle_bg.properties +1 -1
- package/src/sap/ui/fl/messagebundle_en_US_saprigi.properties +39 -39
- package/src/sap/ui/fl/messagebundle_hu.properties +1 -1
- package/src/sap/ui/fl/messagebundle_it.properties +1 -1
- package/src/sap/ui/fl/messagebundle_lv.properties +1 -1
- package/src/sap/ui/fl/messagebundle_mk.properties +2 -2
- package/src/sap/ui/fl/messagebundle_no.properties +1 -1
- package/src/sap/ui/fl/registry/Settings.js +12 -1
- package/src/sap/ui/fl/support/_internal/extractChangeDependencies.js +40 -20
- package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +93 -0
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +4 -4
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
- package/src/sap/ui/fl/support/api/SupportAPI.js +5 -2
- 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 +1 -1
- 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/DescriptorChangeCheck.js +34 -19
- package/src/sap/ui/fl/util/IFrame.js +67 -20
- 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/VariantManagement.js +88 -49
- package/src/sap/ui/fl/variants/VariantModel.js +19 -6
- package/src/sap/ui/fl/write/_internal/Storage.js +5 -34
- package/src/sap/ui/fl/write/_internal/Versions.js +62 -63
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +2 -2
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +2 -2
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +2 -2
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +2 -2
- package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +1 -1
- package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -16
- package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +55 -0
- package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +3 -9
- package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +1 -26
- package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +3 -20
- package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +5 -1
- package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -15
- package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +11 -4
- 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 +7 -7
- 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 +22 -3
- package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +36 -4
- 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 +1 -3
- package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +1 -1
- package/src/sap/ui/fl/write/api/FeaturesAPI.js +2 -2
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +2 -2
- package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +36 -7
- package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +88 -105
- package/src/sap/ui/fl/write/api/SmartBusinessWriteAPI.js +25 -2
- package/src/sap/ui/fl/write/api/SmartVariantManagementWriteAPI.js +1 -0
- package/src/sap/ui/fl/write/api/VersionsAPI.js +0 -1
- package/src/sap/ui/fl/write/api/connectors/ObjectStorageConnector.js +241 -28
- package/src/sap/ui/fl/write/connectors/BaseConnector.js +2 -10
- package/ui5.yaml +37 -76
- package/LICENSES/BSD-2-Clause.txt +0 -22
- package/src/sap/ui/fl/apply/_internal/flexState/changes/prepareChangesMap.js +0 -26
- /package/src/sap/ui/fl/descriptorRelated/{internal/Utils.js → Utils.js} +0 -0
|
@@ -13,7 +13,6 @@ sap.ui.define([
|
|
|
13
13
|
"sap/base/util/isEmptyObject",
|
|
14
14
|
"sap/ui/base/ManagedObjectObserver",
|
|
15
15
|
"sap/ui/thirdparty/hasher",
|
|
16
|
-
"sap/base/util/includes",
|
|
17
16
|
"sap/ui/fl/apply/_internal/controlVariants/Utils"
|
|
18
17
|
], function(
|
|
19
18
|
Component,
|
|
@@ -24,7 +23,6 @@ sap.ui.define([
|
|
|
24
23
|
isEmptyObject,
|
|
25
24
|
ManagedObjectObserver,
|
|
26
25
|
hasher,
|
|
27
|
-
includes,
|
|
28
26
|
VariantUtil
|
|
29
27
|
) {
|
|
30
28
|
"use strict";
|
|
@@ -59,7 +57,7 @@ sap.ui.define([
|
|
|
59
57
|
|
|
60
58
|
if (sVariantManagementReference) {
|
|
61
59
|
// check if a URL parameter for this variant management reference was already added
|
|
62
|
-
if (includes(
|
|
60
|
+
if (aAddedVMReferences.includes(sVariantManagementReference)) {
|
|
63
61
|
oResultantParameters.updateRequired = true;
|
|
64
62
|
return oResultantParameters;
|
|
65
63
|
}
|
|
@@ -170,7 +168,7 @@ sap.ui.define([
|
|
|
170
168
|
function setTechnicalURLParameterValues(mPropertyBag) {
|
|
171
169
|
var oModel = mPropertyBag.model;
|
|
172
170
|
var oURLParsingService = oModel.getUShellService("URLParsing");
|
|
173
|
-
var
|
|
171
|
+
var oUshellNavigationService = oModel.getUShellService("Navigation");
|
|
174
172
|
var oParsedHash = oURLParsingService && oURLParsingService.parseShellHash(hasher.getHash());
|
|
175
173
|
|
|
176
174
|
if (oParsedHash && oParsedHash.params) {
|
|
@@ -181,14 +179,18 @@ sap.ui.define([
|
|
|
181
179
|
&& oModel.oAppComponent.getComponentData().technicalParameters;
|
|
182
180
|
// if mTechnicalParameters are not available we write a warning and continue updating the hash
|
|
183
181
|
if (!mTechnicalParameters) {
|
|
184
|
-
Log.warning(
|
|
182
|
+
Log.warning(
|
|
183
|
+
"Component instance not provided, so technical parameters in component data and browser history remain unchanged"
|
|
184
|
+
);
|
|
185
185
|
}
|
|
186
186
|
if (mPropertyBag.parameters.length === 0) {
|
|
187
187
|
delete oParsedHash.params[VariantUtil.VARIANT_TECHNICAL_PARAMETER];
|
|
188
|
-
|
|
188
|
+
// Case when ControlVariantsAPI.clearVariantParameterInURL is called with a parameter
|
|
189
|
+
mTechnicalParameters && delete mTechnicalParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER];
|
|
189
190
|
} else {
|
|
190
191
|
oParsedHash.params[VariantUtil.VARIANT_TECHNICAL_PARAMETER] = mPropertyBag.parameters;
|
|
191
|
-
|
|
192
|
+
// Technical parameters need to be in sync with the URL hash
|
|
193
|
+
mTechnicalParameters && (mTechnicalParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER] = mPropertyBag.parameters);
|
|
192
194
|
}
|
|
193
195
|
|
|
194
196
|
if (mPropertyBag.silent) {
|
|
@@ -196,7 +198,7 @@ sap.ui.define([
|
|
|
196
198
|
hasher.replaceHash(oURLParsingService.constructShellHash(oParsedHash));
|
|
197
199
|
hasher.changed.active = true; // re-enable changed signal
|
|
198
200
|
} else if (!deepEqual(mOldHashParams, oParsedHash.params)) {
|
|
199
|
-
|
|
201
|
+
oUshellNavigationService.navigate({
|
|
200
202
|
target: {
|
|
201
203
|
semanticObject: oParsedHash.semanticObject,
|
|
202
204
|
action: oParsedHash.action,
|
|
@@ -240,7 +242,8 @@ sap.ui.define([
|
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
if (Array.isArray(mURLParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER])) {
|
|
243
|
-
mURLParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER] =
|
|
245
|
+
mURLParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER] =
|
|
246
|
+
mURLParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER].map(decodeURIComponent);
|
|
244
247
|
mURLParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER].some(function(sParamDecoded, iIndex) {
|
|
245
248
|
if (!isEmptyObject(oModel.getVariant(sParamDecoded, mPropertyBag.vmReference))) {
|
|
246
249
|
mReturnObject.index = iIndex;
|
|
@@ -252,7 +255,9 @@ sap.ui.define([
|
|
|
252
255
|
}
|
|
253
256
|
return merge(
|
|
254
257
|
mReturnObject,
|
|
255
|
-
mURLParameters
|
|
258
|
+
mURLParameters
|
|
259
|
+
&& mURLParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER]
|
|
260
|
+
&& {parameters: mURLParameters[VariantUtil.VARIANT_TECHNICAL_PARAMETER]}
|
|
256
261
|
);
|
|
257
262
|
}
|
|
258
263
|
|
|
@@ -341,7 +346,8 @@ sap.ui.define([
|
|
|
341
346
|
};
|
|
342
347
|
|
|
343
348
|
/**
|
|
344
|
-
* Removes the variant URL parameter for the passed variant management
|
|
349
|
+
* Removes the variant URL parameter for the passed variant management
|
|
350
|
+
* and returns the index at which the passed variant management is present.
|
|
345
351
|
*
|
|
346
352
|
* @param {object} mPropertyBag - Property bag
|
|
347
353
|
* @param {string} mPropertyBag.vmReference - Variant management reference
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// Provides object sap.ui.fl.apply._internal.extensionPoint.Processor
|
|
8
8
|
sap.ui.define([
|
|
9
9
|
"sap/ui/fl/apply/_internal/changes/Applier",
|
|
10
|
+
"sap/ui/fl/apply/_internal/extensionPoint/Registry",
|
|
10
11
|
"sap/ui/fl/apply/_internal/flexState/FlexState",
|
|
11
12
|
"sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState",
|
|
12
13
|
"sap/ui/fl/Utils",
|
|
@@ -17,6 +18,7 @@ sap.ui.define([
|
|
|
17
18
|
],
|
|
18
19
|
function(
|
|
19
20
|
Applier,
|
|
21
|
+
ExtensionPointRegistry,
|
|
20
22
|
FlexState,
|
|
21
23
|
ExtensionPointState,
|
|
22
24
|
Utils,
|
|
@@ -28,13 +30,14 @@ function(
|
|
|
28
30
|
"use strict";
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
* Implements the <code>Extension Points</code> provider by SAPUI5 flexibility that can be hooked
|
|
33
|
+
* Implements the <code>Extension Points</code> provider by SAPUI5 flexibility that can be hooked
|
|
34
|
+
* in the <code>sap.ui.core.ExtensionPoint</code> life cycle.
|
|
32
35
|
*
|
|
33
36
|
* @name sap.ui.fl.apply._internal.extensionPoint.Processor
|
|
34
37
|
* @class
|
|
35
38
|
* @constructor
|
|
36
39
|
* @author SAP SE
|
|
37
|
-
* @version 1.
|
|
40
|
+
* @version 1.121.0
|
|
38
41
|
*/
|
|
39
42
|
var Processor;
|
|
40
43
|
|
|
@@ -77,6 +80,7 @@ function(
|
|
|
77
80
|
iControlIndex,
|
|
78
81
|
iNestedEPAdditionalContentCounter,
|
|
79
82
|
fnNestedCallback
|
|
83
|
+
// eslint-disable-next-line max-nested-callbacks
|
|
80
84
|
).then(function(iNestedCounter) {
|
|
81
85
|
iNestedEPAdditionalContentCounter += iNestedCounter;
|
|
82
86
|
});
|
|
@@ -120,23 +124,7 @@ function(
|
|
|
120
124
|
|
|
121
125
|
registerExtensionPoint(mExtensionPointInfo) {
|
|
122
126
|
if (DesignTime.isDesignModeEnabled()) {
|
|
123
|
-
|
|
124
|
-
Processor.oExtensionPointRegistry.registerExtensionPoint(mExtensionPointInfo);
|
|
125
|
-
return SyncPromise.resolve();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
Processor.oRegistryPromise = Processor.oRegistryPromise.then(function() {
|
|
129
|
-
return new Promise(function(resolve, reject) {
|
|
130
|
-
sap.ui.require(["sap/ui/fl/write/_internal/extensionPoint/Registry"], function(ExtensionPointRegistry) {
|
|
131
|
-
Processor.oExtensionPointRegistry = ExtensionPointRegistry;
|
|
132
|
-
ExtensionPointRegistry.registerExtensionPoint(mExtensionPointInfo);
|
|
133
|
-
resolve();
|
|
134
|
-
}, function(oError) {
|
|
135
|
-
reject(oError);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
return Processor.oRegistryPromise;
|
|
127
|
+
ExtensionPointRegistry.registerExtensionPoint(mExtensionPointInfo);
|
|
140
128
|
}
|
|
141
129
|
return SyncPromise.resolve();
|
|
142
130
|
},
|
|
@@ -15,10 +15,10 @@ sap.ui.define([
|
|
|
15
15
|
/**
|
|
16
16
|
* Object to register extension points to track their locations.
|
|
17
17
|
* @constructor
|
|
18
|
-
* @alias sap.ui.fl.
|
|
18
|
+
* @alias sap.ui.fl.apply._internal.extensionPoint.Registry
|
|
19
19
|
*
|
|
20
20
|
* @author SAP SE
|
|
21
|
-
* @version 1.
|
|
21
|
+
* @version 1.121.0
|
|
22
22
|
*
|
|
23
23
|
* @private
|
|
24
24
|
* @ui5-restricted sap.ui.fl
|
|
@@ -32,7 +32,7 @@ sap.ui.define([
|
|
|
32
32
|
* @extends sap.ui.fl.apply._internal.flexObjects.Variant
|
|
33
33
|
* @alias sap.ui.fl.apply._internal.flexObjects.CompVariant
|
|
34
34
|
* @since 1.103
|
|
35
|
-
* @version 1.
|
|
35
|
+
* @version 1.121.0
|
|
36
36
|
* @private
|
|
37
37
|
* @ui5-restricted sap.ui.fl, sap.ui.comp
|
|
38
38
|
*/
|
|
@@ -20,7 +20,7 @@ sap.ui.define([
|
|
|
20
20
|
* @extends sap.ui.fl.apply._internal.flexObjects.FlexObject
|
|
21
21
|
* @alias sap.ui.fl.apply._internal.flexObjects.ControllerExtensionChange
|
|
22
22
|
* @since 1.105
|
|
23
|
-
* @version 1.
|
|
23
|
+
* @version 1.121.0
|
|
24
24
|
* @private
|
|
25
25
|
* @ui5-restricted sap.ui.fl
|
|
26
26
|
*/
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"sap/ui/core/Core",
|
|
9
8
|
"sap/ui/fl/apply/_internal/controlVariants/Utils",
|
|
10
9
|
"sap/ui/fl/apply/_internal/flexObjects/Variant"
|
|
11
10
|
], function(
|
|
12
|
-
Core,
|
|
13
11
|
ControlVariantUtils,
|
|
14
12
|
Variant
|
|
15
13
|
) {
|
|
@@ -24,7 +22,7 @@ sap.ui.define([
|
|
|
24
22
|
* @extends sap.ui.fl.apply._internal.flexObjects.Variant
|
|
25
23
|
* @alias sap.ui.fl.apply._internal.flexObjects.FlVariant
|
|
26
24
|
* @since 1.104
|
|
27
|
-
* @version 1.
|
|
25
|
+
* @version 1.121.0
|
|
28
26
|
* @private
|
|
29
27
|
* @ui5-restricted sap.ui.fl
|
|
30
28
|
*/
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
"sap/base/util/restricted/_pick",
|
|
8
8
|
"sap/base/util/ObjectPath",
|
|
9
|
-
"sap/ui/core/Core",
|
|
10
9
|
"sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange",
|
|
11
10
|
"sap/ui/fl/apply/_internal/flexObjects/CompVariant",
|
|
12
11
|
"sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange",
|
|
@@ -14,6 +13,7 @@ sap.ui.define([
|
|
|
14
13
|
"sap/ui/fl/apply/_internal/flexObjects/FlVariant",
|
|
15
14
|
"sap/ui/fl/apply/_internal/flexObjects/States",
|
|
16
15
|
"sap/ui/fl/apply/_internal/flexObjects/UIChange",
|
|
16
|
+
"sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor",
|
|
17
17
|
"sap/ui/fl/registry/Settings",
|
|
18
18
|
"sap/ui/fl/Layer",
|
|
19
19
|
"sap/ui/fl/LayerUtils",
|
|
@@ -21,7 +21,6 @@ sap.ui.define([
|
|
|
21
21
|
], function(
|
|
22
22
|
_pick,
|
|
23
23
|
ObjectPath,
|
|
24
|
-
Core,
|
|
25
24
|
AppDescriptorChange,
|
|
26
25
|
CompVariant,
|
|
27
26
|
ControllerExtensionChange,
|
|
@@ -29,6 +28,7 @@ sap.ui.define([
|
|
|
29
28
|
FlVariant,
|
|
30
29
|
States,
|
|
31
30
|
UIChange,
|
|
31
|
+
getVariantAuthor,
|
|
32
32
|
Settings,
|
|
33
33
|
Layer,
|
|
34
34
|
LayerUtils,
|
|
@@ -97,7 +97,7 @@ sap.ui.define([
|
|
|
97
97
|
*
|
|
98
98
|
* @namespace sap.ui.fl.apply._internal.flexObjects.FlexObjectFactory
|
|
99
99
|
* @since 1.100
|
|
100
|
-
* @version 1.
|
|
100
|
+
* @version 1.121.0
|
|
101
101
|
* @private
|
|
102
102
|
* @ui5-restricted sap.ui.fl
|
|
103
103
|
*/
|
|
@@ -193,6 +193,7 @@ sap.ui.define([
|
|
|
193
193
|
* @param {object} [mPropertyBag.layer] - See {@link sap.ui.fl.apply._internal.flexObjects.FlexObject}
|
|
194
194
|
* @param {string} [mPropertyBag.reference] - See {@link sap.ui.fl.apply._internal.flexObjects.FlexObject.FlexObjectMetadata}
|
|
195
195
|
* @param {string} [mPropertyBag.generator] - See {@link sap.ui.fl.apply._internal.flexObjects.FlexObject.SupportInformation}
|
|
196
|
+
* @param {object} [mPropertyBag.authors] - Map of user IDs to full names
|
|
196
197
|
* @returns {sap.ui.fl.apply._internal.flexObjects.FlVariant} Variant instance
|
|
197
198
|
*/
|
|
198
199
|
FlexObjectFactory.createFlVariant = function(mPropertyBag) {
|
|
@@ -207,7 +208,10 @@ sap.ui.define([
|
|
|
207
208
|
type: "XFLD"
|
|
208
209
|
}
|
|
209
210
|
};
|
|
210
|
-
|
|
211
|
+
|
|
212
|
+
const oFlVariant = new FlVariant(mProperties);
|
|
213
|
+
oFlVariant.setAuthor(getVariantAuthor(oFlVariant, mPropertyBag.authors));
|
|
214
|
+
return oFlVariant;
|
|
211
215
|
};
|
|
212
216
|
|
|
213
217
|
/**
|
|
@@ -238,10 +242,10 @@ sap.ui.define([
|
|
|
238
242
|
* @param {object} [oFileContent.executeOnSelection] - see above
|
|
239
243
|
*
|
|
240
244
|
* @param {string} [oFileContent.persistencyKey] - see <code>sap.ui.fl.apply._internal.flexObjects.CompVariant</code>
|
|
241
|
-
*
|
|
245
|
+
* @param {object} [mAuthors] - Map of user IDs and users' names which is used to determine author of the variant
|
|
242
246
|
* @returns {sap.ui.fl.apply._internal.flexObjects.CompVariant} Created comp variant object
|
|
243
247
|
*/
|
|
244
|
-
FlexObjectFactory.createCompVariant = function(oFileContent) {
|
|
248
|
+
FlexObjectFactory.createCompVariant = function(oFileContent, mAuthors) {
|
|
245
249
|
oFileContent.generator ||= "FlexObjectFactory.createCompVariant";
|
|
246
250
|
oFileContent.user = ObjectPath.get("support.user", oFileContent);
|
|
247
251
|
var mCompVariantContent = createBasePropertyBag(oFileContent);
|
|
@@ -265,7 +269,9 @@ sap.ui.define([
|
|
|
265
269
|
);
|
|
266
270
|
}
|
|
267
271
|
|
|
268
|
-
|
|
272
|
+
const oCompVariant = new CompVariant(mCompVariantContent);
|
|
273
|
+
oCompVariant.setAuthor(getVariantAuthor(oCompVariant, mAuthors));
|
|
274
|
+
return oCompVariant;
|
|
269
275
|
};
|
|
270
276
|
|
|
271
277
|
return FlexObjectFactory;
|
|
@@ -26,7 +26,7 @@ sap.ui.define([
|
|
|
26
26
|
* @extends sap.ui.fl.apply._internal.flexObjects.FlexObject
|
|
27
27
|
* @alias sap.ui.fl.apply._internal.flexObjects.UIChange
|
|
28
28
|
* @since 1.109
|
|
29
|
-
* @version 1.
|
|
29
|
+
* @version 1.121.0
|
|
30
30
|
* @private
|
|
31
31
|
* @ui5-restricted
|
|
32
32
|
*/
|
|
@@ -239,7 +239,8 @@ sap.ui.define([
|
|
|
239
239
|
* Adds and returns a promise that resolves as soon as
|
|
240
240
|
* <code>resolveChangeProcessingPromise</code> or <code>resolveChangeProcessingPromiseWithError</code> is called.
|
|
241
241
|
* The promise will always resolve, either without a parameter or with an object and an <code>error</code> parameter inside.
|
|
242
|
-
* At any time, there is only one object for 'apply' or 'revert'. If this function is called multiple times for the same key,
|
|
242
|
+
* At any time, there is only one object for 'apply' or 'revert'. If this function is called multiple times for the same key,
|
|
243
|
+
* only the current promise will be returned.
|
|
243
244
|
*
|
|
244
245
|
* _oChangeProcessingPromises: {
|
|
245
246
|
* States.Operations.APPLY: {
|
|
@@ -17,7 +17,7 @@ sap.ui.define([
|
|
|
17
17
|
* @extends sap.ui.fl.apply._internal.flexObjects.FlexObject
|
|
18
18
|
* @alias sap.ui.fl.apply._internal.flexObjects.Variant
|
|
19
19
|
* @since 1.103
|
|
20
|
-
* @version 1.
|
|
20
|
+
* @version 1.121.0
|
|
21
21
|
* @private
|
|
22
22
|
* @ui5-restricted sap.ui.fl
|
|
23
23
|
*/
|
|
@@ -64,6 +64,12 @@ sap.ui.define([
|
|
|
64
64
|
*/
|
|
65
65
|
variantId: {
|
|
66
66
|
type: "string"
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Variant author
|
|
70
|
+
*/
|
|
71
|
+
author: {
|
|
72
|
+
type: "string"
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
},
|
|
@@ -74,6 +80,7 @@ sap.ui.define([
|
|
|
74
80
|
if (!this.getVariantId()) {
|
|
75
81
|
this.setVariantId(this.getId());
|
|
76
82
|
}
|
|
83
|
+
this.setAuthor(this.getSupportInformation().user || "");
|
|
77
84
|
}
|
|
78
85
|
});
|
|
79
86
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/ui/core/Lib",
|
|
9
|
+
"sap/ui/fl/Layer",
|
|
10
|
+
"sap/ui/fl/registry/Settings"
|
|
11
|
+
], function(
|
|
12
|
+
Lib,
|
|
13
|
+
Layer,
|
|
14
|
+
Settings
|
|
15
|
+
) {
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the full username by the ID of a variant author.
|
|
20
|
+
* In case the user herself is the author, a translated 'You' will be displayed or in case of developers, no exchange takes place.
|
|
21
|
+
*
|
|
22
|
+
* @function
|
|
23
|
+
* @since 1.121
|
|
24
|
+
* @version 1.121.0
|
|
25
|
+
* @private
|
|
26
|
+
* @ui5-restricted sap.ui.fl
|
|
27
|
+
* @alias module:sap/ui/fl/apply/_internal/flexState/compVariants/getVariantAuthor
|
|
28
|
+
*
|
|
29
|
+
* @param {sap.ui.fl.apply.flexObjects.Variant} oVariant - A variant object for which the Author should be retrieved
|
|
30
|
+
* @param {object} mMapIdsNames - Map of user IDs and users' names
|
|
31
|
+
* @returns {string} The resolved author of variant
|
|
32
|
+
*/
|
|
33
|
+
return (oVariant, mMapIdsNames) => {
|
|
34
|
+
const sAuthor = oVariant.getSupportInformation().user || "";
|
|
35
|
+
const oSettings = Settings.getInstanceOrUndef();
|
|
36
|
+
|
|
37
|
+
if (oVariant.getLayer() === Layer.USER || sAuthor === oSettings?.getUserId()) {
|
|
38
|
+
return Lib.getResourceBundleFor("sap.ui.fl").getText("VARIANT_SELF_OWNER_NAME");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (![Layer.PUBLIC, Layer.CUSTOMER].includes(oVariant.getLayer())) {
|
|
42
|
+
return sAuthor;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return mMapIdsNames?.[sAuthor] || sAuthor;
|
|
46
|
+
};
|
|
47
|
+
});
|
|
@@ -24,6 +24,7 @@ sap.ui.define([
|
|
|
24
24
|
* @private
|
|
25
25
|
* @ui5-restricted
|
|
26
26
|
*/
|
|
27
|
+
// eslint-disable-next-line max-len
|
|
27
28
|
var DataSelector = ManagedObject.extend("sap.ui.fl.apply._internal.flexState.DataSelector", /* @lends sap.ui.fl.apply._internal.flexState.DataSelector.prototype */ {
|
|
28
29
|
metadata: {
|
|
29
30
|
properties: {
|
|
@@ -39,8 +40,8 @@ sap.ui.define([
|
|
|
39
40
|
type: "object"
|
|
40
41
|
},
|
|
41
42
|
/**
|
|
42
|
-
* Temporary cache to store calculated values or
|
|
43
|
-
*
|
|
43
|
+
* Temporary cache to store calculated values or, in case of parameterized selectors,
|
|
44
|
+
* key value pairs like <code>parentSelectorParameterValue: { parameterValue: { someKey: someValue } }</code>
|
|
44
45
|
*/
|
|
45
46
|
cachedResult: {
|
|
46
47
|
type: "any"
|
|
@@ -103,14 +104,34 @@ sap.ui.define([
|
|
|
103
104
|
|
|
104
105
|
const sNoParameter = "DataSelector_no_parameter";
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
// Returns a list of parameter values for all selectors in the chain
|
|
108
|
+
// This list can be used to access nested caches in child selectors
|
|
109
|
+
function getParameterChain(oLowestDataSelector, mParameters) {
|
|
110
|
+
const aParameterList = [];
|
|
111
|
+
|
|
112
|
+
function getParameterValue(oCurrentDataSelector) {
|
|
113
|
+
const sParameterKey = oCurrentDataSelector.getParameterKey();
|
|
114
|
+
if (!sParameterKey) {
|
|
115
|
+
return sNoParameter;
|
|
116
|
+
}
|
|
117
|
+
return mParameters?.[sParameterKey];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let oCurrentDataSelector = oLowestDataSelector;
|
|
109
121
|
do {
|
|
110
|
-
|
|
122
|
+
const sParameterValue = getParameterValue(oCurrentDataSelector);
|
|
123
|
+
// If no parameter value is provided for the last child selector in the chain
|
|
124
|
+
// skip it, start with its parent and thus return the whole cache entry
|
|
125
|
+
if (sParameterValue || oCurrentDataSelector !== oLowestDataSelector) {
|
|
126
|
+
if (sParameterValue === undefined) {
|
|
127
|
+
throw new Error(`Parameter '${oCurrentDataSelector.getParameterKey()}' is missing`);
|
|
128
|
+
}
|
|
129
|
+
aParameterList.unshift(sParameterValue);
|
|
130
|
+
}
|
|
131
|
+
|
|
111
132
|
oCurrentDataSelector = oCurrentDataSelector.getParentDataSelector();
|
|
112
133
|
} while (oCurrentDataSelector);
|
|
113
|
-
return
|
|
134
|
+
return aParameterList;
|
|
114
135
|
}
|
|
115
136
|
|
|
116
137
|
/**
|
|
@@ -143,14 +164,21 @@ sap.ui.define([
|
|
|
143
164
|
};
|
|
144
165
|
|
|
145
166
|
DataSelector.prototype._getParameterizedCachedResult = function(mParameters) {
|
|
146
|
-
const aParameterValues =
|
|
167
|
+
const aParameterValues = getParameterChain(this, mParameters);
|
|
168
|
+
if (aParameterValues.length === 0) {
|
|
169
|
+
return this.getCachedResult();
|
|
170
|
+
}
|
|
147
171
|
return ObjectPath.get(aParameterValues, this.getCachedResult());
|
|
148
172
|
};
|
|
149
173
|
|
|
150
174
|
DataSelector.prototype._setParameterizedCachedResult = function(mParameters, vValue) {
|
|
151
|
-
const aParameterValues =
|
|
175
|
+
const aParameterValues = getParameterChain(this, mParameters);
|
|
152
176
|
const mNewData = {};
|
|
153
|
-
|
|
177
|
+
if (aParameterValues.length === 0) {
|
|
178
|
+
Object.assign(mNewData, vValue);
|
|
179
|
+
} else {
|
|
180
|
+
ObjectPath.set(aParameterValues, vValue, mNewData);
|
|
181
|
+
}
|
|
154
182
|
return this.setCachedResult(merge(
|
|
155
183
|
{},
|
|
156
184
|
this.getCachedResult(),
|
|
@@ -158,14 +186,43 @@ sap.ui.define([
|
|
|
158
186
|
));
|
|
159
187
|
};
|
|
160
188
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
189
|
+
// Clears the affected cache section and updates
|
|
190
|
+
// dependent selectors accordingly
|
|
191
|
+
// It might be required to fully clear all dependent selectors
|
|
192
|
+
// as well in the future
|
|
193
|
+
DataSelector.prototype._clearCache = function(mParameters, aUpdateInfo) {
|
|
194
|
+
const aUpdatedParameterMaps = [];
|
|
195
|
+
|
|
196
|
+
const sParameterKey = this.getParameterKey();
|
|
197
|
+
if (!sParameterKey) {
|
|
198
|
+
// Cache is not parameterized, clear it completly
|
|
199
|
+
this.setCachedResult(null);
|
|
200
|
+
aUpdatedParameterMaps.push(mParameters);
|
|
201
|
+
} else if (Object.keys(mParameters || {}).includes(sParameterKey)) {
|
|
202
|
+
// Clear cache for a specific parameter
|
|
203
|
+
if (this._getParameterizedCachedResult(mParameters) !== undefined) {
|
|
204
|
+
this._setParameterizedCachedResult(mParameters, null);
|
|
205
|
+
aUpdatedParameterMaps.push(mParameters);
|
|
206
|
+
}
|
|
164
207
|
} else {
|
|
165
|
-
//
|
|
166
|
-
|
|
167
|
-
|
|
208
|
+
// Fully clear all parameters
|
|
209
|
+
// Since its own parameter is missing, cached result is the map of all
|
|
210
|
+
// parameter keys and their cache values
|
|
211
|
+
const mCurrentCache = this._getParameterizedCachedResult(mParameters);
|
|
212
|
+
Object.keys(mCurrentCache || {}).forEach((sCacheKey) => {
|
|
213
|
+
aUpdatedParameterMaps.push({
|
|
214
|
+
...mParameters,
|
|
215
|
+
[sParameterKey]: sCacheKey
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
this.setCachedResult({});
|
|
168
219
|
}
|
|
220
|
+
|
|
221
|
+
this.getUpdateListeners().forEach(function(fnUpdateFunction) {
|
|
222
|
+
aUpdatedParameterMaps.forEach((mUpdatedParameters) => {
|
|
223
|
+
fnUpdateFunction(mUpdatedParameters, aUpdateInfo);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
169
226
|
};
|
|
170
227
|
|
|
171
228
|
/**
|
|
@@ -176,12 +233,6 @@ sap.ui.define([
|
|
|
176
233
|
*/
|
|
177
234
|
DataSelector.prototype.clearCachedResult = function(mParameters) {
|
|
178
235
|
this._clearCache(mParameters);
|
|
179
|
-
// TODO: For now recalculate the dependent selectors,
|
|
180
|
-
// it might be required to fully clear all dependent selectors
|
|
181
|
-
// as well in the future
|
|
182
|
-
this.getUpdateListeners().forEach(function(fnUpdateFunction) {
|
|
183
|
-
fnUpdateFunction();
|
|
184
|
-
});
|
|
185
236
|
};
|
|
186
237
|
|
|
187
238
|
/**
|
|
@@ -214,26 +265,65 @@ sap.ui.define([
|
|
|
214
265
|
|
|
215
266
|
var vNewResult = this.getExecuteFunction()(
|
|
216
267
|
oParentData,
|
|
217
|
-
|
|
268
|
+
mParameters
|
|
218
269
|
);
|
|
219
270
|
this._setParameterizedCachedResult(mParameters, vNewResult);
|
|
220
|
-
// FIXME: Might lead to infinite loop if update always invalidates
|
|
221
|
-
// this.getUpdateListeners().forEach(function(fnUpdateFunction) {
|
|
222
|
-
// fnUpdateFunction();
|
|
223
|
-
// });
|
|
224
271
|
return vNewResult;
|
|
225
272
|
};
|
|
226
273
|
|
|
274
|
+
function checkInvalidation(fnCheckInvalidation, mParameters, aUpdateInfo) {
|
|
275
|
+
if (aUpdateInfo) {
|
|
276
|
+
return aUpdateInfo.some((oUpdateInfo) => fnCheckInvalidation(mParameters, oUpdateInfo));
|
|
277
|
+
}
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
|
|
227
281
|
/**
|
|
228
|
-
*
|
|
229
|
-
* @
|
|
282
|
+
* Update Info Object containing information for the checkInvalidation function.
|
|
283
|
+
* @typedef {object} sap.ui.fl.apply._internal.flexState.dataSelector.UpdateInfo
|
|
284
|
+
* @property {string} [aUpdateInfo.type] - Type of the update done before
|
|
285
|
+
* @property {sap.ui.fl.apply._internal.flexObjects.FlexObject} [aUpdateInfo.updatedObject] - Update relevant object
|
|
230
286
|
*/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Invokes the cache invalidation check and resets the cache if necessary.
|
|
290
|
+
* For chained selectors, this function must always be called as low in the chain as possible,
|
|
291
|
+
* i.e. on the first selector where the updated data might show side effects.
|
|
292
|
+
*
|
|
293
|
+
* @param {object} [mParameters] - Map of selector specific parameters
|
|
294
|
+
* @param {sap.ui.fl.apply._internal.flexState.dataSelector.UpdateInfo[]} [aUpdateInfo] - List with update info objects
|
|
295
|
+
*/
|
|
296
|
+
DataSelector.prototype.checkUpdate = function(mParameters, aUpdateInfo) {
|
|
297
|
+
const sParameterKey = this.getParameterKey();
|
|
298
|
+
|
|
299
|
+
if (
|
|
300
|
+
// If data selector is parameterized
|
|
301
|
+
sParameterKey !== undefined
|
|
302
|
+
// and no valid value for the parameter of the data selector was provided
|
|
303
|
+
&& !Object.keys(mParameters || {}).includes(sParameterKey)
|
|
304
|
+
) {
|
|
305
|
+
const vCachedResult = this._getParameterizedCachedResult(mParameters);
|
|
306
|
+
const aCacheKeys = Object.keys(vCachedResult && typeof vCachedResult === "object" ? vCachedResult : {});
|
|
307
|
+
// Check invalidation of children for each possible parameter value
|
|
308
|
+
aCacheKeys.forEach((sCacheKey) => {
|
|
309
|
+
// Append the possible cache key part to pass down the selector chain
|
|
310
|
+
const mInvalidationCheckParameters = {
|
|
311
|
+
...mParameters,
|
|
312
|
+
[sParameterKey]: sCacheKey
|
|
313
|
+
};
|
|
314
|
+
const bRequiresInvalidation = checkInvalidation(this.getCheckInvalidation(), mInvalidationCheckParameters, aUpdateInfo);
|
|
315
|
+
if (bRequiresInvalidation) {
|
|
316
|
+
// Clear the affected cache entry and continue checks in the child selectors
|
|
317
|
+
this._clearCache(mInvalidationCheckParameters, aUpdateInfo);
|
|
318
|
+
}
|
|
319
|
+
return !bRequiresInvalidation;
|
|
236
320
|
});
|
|
321
|
+
} else {
|
|
322
|
+
// Data selector is not parameterized or specific cache entry was selected
|
|
323
|
+
const bRequiresInvalidation = checkInvalidation(this.getCheckInvalidation(), mParameters, aUpdateInfo);
|
|
324
|
+
if (bRequiresInvalidation) {
|
|
325
|
+
this._clearCache(mParameters, aUpdateInfo);
|
|
326
|
+
}
|
|
237
327
|
}
|
|
238
328
|
};
|
|
239
329
|
|