@openui5/sap.ui.fl 1.97.1 → 1.100.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 +25 -30
- package/THIRDPARTY.txt +15 -22
- 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/Change.js +38 -230
- package/src/sap/ui/fl/ChangePersistence.js +113 -163
- package/src/sap/ui/fl/ChangePersistenceFactory.js +5 -3
- package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +3 -4
- package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +3 -4
- package/src/sap/ui/fl/FakeLrepLocalStorage.js +4 -4
- package/src/sap/ui/fl/FlexController.js +57 -71
- package/src/sap/ui/fl/FlexControllerFactory.js +6 -4
- package/src/sap/ui/fl/LayerUtils.js +1 -1
- package/src/sap/ui/fl/Utils.js +39 -313
- package/src/sap/ui/fl/Variant.js +5 -119
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +2 -2
- package/src/sap/ui/fl/apply/_internal/changes/Applier.js +10 -8
- package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Reverter.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Utils.js +46 -2
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +3 -2
- 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/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/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 -4
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +15 -10
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariantRevertData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +452 -0
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +68 -0
- package/src/sap/ui/fl/apply/_internal/flexObjects/RevertData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +47 -23
- package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +9 -5
- package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +21 -22
- 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 +12 -10
- 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 -4
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +17 -45
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/prepareVariantsMap.js +6 -0
- package/src/sap/ui/fl/{PreprocessorImpl.js → apply/_internal/preprocessors/ControllerExtension.js} +43 -50
- package/src/sap/ui/fl/{EventHistory.js → apply/_internal/preprocessors/EventHistory.js} +7 -7
- package/src/sap/ui/fl/{RegistrationDelegator.js → apply/_internal/preprocessors/RegistrationDelegator.js} +40 -42
- package/src/sap/ui/fl/{XmlPreprocessorImpl.js → apply/_internal/preprocessors/XmlPreprocessor.js} +10 -8
- package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +1 -1
- package/src/sap/ui/fl/apply/api/DelegateMediatorAPI.js +1 -1
- package/src/sap/ui/fl/apply/api/FlexRuntimeInfoAPI.js +13 -0
- package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +13 -2
- 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/codeExt/CodeExtManager.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/variants/VariantManagement.designtime.js +9 -2
- package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeRegistryItem.js +9 -9
- package/src/sap/ui/fl/initial/_internal/connectors/BackendConnector.js +1 -1
- package/src/sap/ui/fl/initial/_internal/connectors/LrepConnector.js +16 -6
- package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +4 -3
- 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 +12 -12
- package/src/sap/ui/fl/messagebundle_ro.properties +1 -1
- package/src/sap/ui/fl/registry/Settings.js +52 -3
- package/src/sap/ui/fl/support/Flexibility.js +1 -1
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +59 -0
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +34 -0
- package/src/sap/ui/fl/support/api/SupportAPI.js +31 -0
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +2 -2
- 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 +4 -4
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +4 -4
- package/src/sap/ui/fl/support/apps/uiFlexibilityDiagnostics/helper/Extractor.js +3 -14
- package/src/sap/ui/fl/support/diagnostics/Flexibility.controller.js +1 -1
- package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/util/DescriptorChangeCheck.js +1 -1
- package/src/sap/ui/fl/util/IFrame.js +1 -1
- package/src/sap/ui/fl/util/IFrameRenderer.js +1 -1
- package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
- package/src/sap/ui/fl/util/changePropertyValueByPath.js +1 -1
- package/src/sap/ui/fl/util/resolveBinding.js +1 -1
- package/src/sap/ui/fl/variants/VariantManagement.js +7 -1
- package/src/sap/ui/fl/variants/VariantModel.js +32 -75
- package/src/sap/ui/fl/variants/context/Component.js +2 -6
- package/src/sap/ui/fl/variants/context/controller/ContextVisibility.controller.js +6 -41
- package/src/sap/ui/fl/variants/context/i18n/i18n.properties +3 -7
- package/src/sap/ui/fl/variants/context/i18n/i18n_ar.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_bg.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_ca.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_cs.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_cy.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_da.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_de.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_el.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_en.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_en_GB.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_en_US_sappsd.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_en_US_saprigi.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_en_US_saptrc.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_es.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_es_MX.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_et.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_fi.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_fr.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_fr_CA.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_hi.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_hr.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_hu.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_id.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_it.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_iw.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_ja.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_kk.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_ko.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_lt.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_lv.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_ms.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_nl.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_no.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_pl.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_pt.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_pt_PT.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_ro.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_ru.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_sh.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_sk.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_sl.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_sv.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_th.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_tr.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_uk.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_vi.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_zh_CN.properties +2 -4
- package/src/sap/ui/fl/variants/context/i18n/i18n_zh_TW.properties +2 -4
- package/src/sap/ui/fl/variants/context/view/ContextVisibility.view.xml +7 -6
- package/src/sap/ui/fl/write/_internal/Storage.js +47 -1
- package/src/sap/ui/fl/write/_internal/StorageFeaturesMerger.js +1 -1
- package/src/sap/ui/fl/write/_internal/Versions.js +18 -19
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +5 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +4 -2
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +24 -1
- package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +2 -2
- package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +3 -3
- package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +60 -6
- package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +59 -5
- 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 +4 -4
- 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 +5 -5
- 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 +19 -5
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +1 -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/AppVariantWriteAPI.js +13 -4
- package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +139 -39
- package/src/sap/ui/fl/write/api/FeaturesAPI.js +8 -2
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
- package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +87 -4
- package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +4 -4
- package/src/sap/ui/fl/write/api/TranslationAPI.js +123 -0
- package/src/sap/ui/fl/write/api/VersionsAPI.js +1 -1
- package/src/sap/ui/fl/write/api/connectors/ObjectStorageConnector.js +2 -1
- package/src/sap/ui/fl/write/connectors/BaseConnector.js +43 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"sap/base/Log",
|
|
8
|
+
"sap/base/util/deepClone",
|
|
9
|
+
"sap/base/util/isEmptyObject",
|
|
10
|
+
"sap/base/util/isPlainObject",
|
|
11
|
+
"sap/base/util/ObjectPath",
|
|
12
|
+
"sap/base/util/restricted/_omit",
|
|
13
|
+
"sap/ui/base/ManagedObject",
|
|
14
|
+
"sap/ui/fl/apply/_internal/flexObjects/States",
|
|
15
|
+
"sap/ui/fl/Layer",
|
|
16
|
+
"sap/ui/fl/registry/Settings",
|
|
17
|
+
"sap/ui/fl/Utils"
|
|
18
|
+
], function(
|
|
19
|
+
Log,
|
|
20
|
+
deepClone,
|
|
21
|
+
isEmptyObject,
|
|
22
|
+
isPlainObject,
|
|
23
|
+
ObjectPath,
|
|
24
|
+
_omit,
|
|
25
|
+
ManagedObject,
|
|
26
|
+
States,
|
|
27
|
+
Layer,
|
|
28
|
+
Settings,
|
|
29
|
+
Utils
|
|
30
|
+
) {
|
|
31
|
+
"use strict";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @type {sap.ui.fl.apply._internal.flexObjects.FlexObject.FlexObjectMetadata}
|
|
35
|
+
* @static
|
|
36
|
+
* @constant
|
|
37
|
+
* @typedef {object} sap.ui.fl.apply._internal.flexObjects.FlexObject.FlexObjectMetadata
|
|
38
|
+
* @property {string} reference - Application component name
|
|
39
|
+
* @property {string} namespace - Namespace of the flex object file
|
|
40
|
+
* @property {string} creation - Timestamp of creation date
|
|
41
|
+
* @property {string} projectId - Project ID of the flex object file
|
|
42
|
+
* @property {string} packageName - ABAP package name
|
|
43
|
+
* @property {string} moduleName - Name of the module which this flex object refers to (XML or JS)
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @type {sap.ui.fl.apply._internal.flexObjects.FlexObject.SupportInformation}
|
|
49
|
+
* @static
|
|
50
|
+
* @constant
|
|
51
|
+
* @typedef {object} sap.ui.fl.apply._internal.flexObjects.FlexObject.SupportInformation
|
|
52
|
+
* @property {string} generator - Tool that is used to generate the flex object file
|
|
53
|
+
* @property {string} service - Name of the OData service
|
|
54
|
+
* @property {string} sourceSystem - ABAP source system
|
|
55
|
+
* @property {string} sourceClient - ABAP source client
|
|
56
|
+
* @property {string} user - Username who created the flex object
|
|
57
|
+
* @property {string} sapui5Version - UI5 version in which the flex object was created
|
|
58
|
+
* @property {string} sourceChangeFileName - File name of the source flex object in case of a copied flex object
|
|
59
|
+
* @property {string} compositeCommand - Unique ID that defines which flex objects belong together in a composite command
|
|
60
|
+
* @property {string} command - Name of the command
|
|
61
|
+
* @property {string} oDataInformation - Object with information about the OData service
|
|
62
|
+
* @property {string} originalLanguage - Language in which the flex object was created
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Base class for any flex object.
|
|
68
|
+
*
|
|
69
|
+
* @class Base class for any flex object
|
|
70
|
+
* @extends sap.ui.base.ManagedObject
|
|
71
|
+
* @alias sap.ui.fl.apply._internal.flexObjects.FlexObject
|
|
72
|
+
* @since 1.100
|
|
73
|
+
* @version 1.100.0
|
|
74
|
+
* @private
|
|
75
|
+
* @ui5-restricted sap.ui.fl
|
|
76
|
+
*/
|
|
77
|
+
var FlexObject = ManagedObject.extend("sap.ui.fl.apply._internal.flexObjects.FlexObject", /* @lends sap.ui.fl.apply._internal.flexObjects.FlexObject.prototype */ {
|
|
78
|
+
metadata: {
|
|
79
|
+
properties: {
|
|
80
|
+
/**
|
|
81
|
+
* Current state of the flex object regarding the persistence.
|
|
82
|
+
* See {@link sap.ui.fl.apply._internal.flexObjects.States}.
|
|
83
|
+
*/
|
|
84
|
+
state: {
|
|
85
|
+
type: "string",
|
|
86
|
+
defaultValue: States.NEW
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* File type of the flex object.
|
|
90
|
+
* One of <code>change</code>, <code>variant</code>, <code>ctrl_variant</code>,
|
|
91
|
+
* <code>ctrl_variant_change</code> or <code>ctrl_variant_management_change</code>
|
|
92
|
+
*/
|
|
93
|
+
fileType: {
|
|
94
|
+
type: "string",
|
|
95
|
+
defaultValue: "change"
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Layer of the flex object.
|
|
99
|
+
* See {@link sap.ui.fl.Layer}.
|
|
100
|
+
*/
|
|
101
|
+
layer: {
|
|
102
|
+
type: "string"
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* Additional metadata of the flex object.
|
|
106
|
+
* See {@link sap.ui.fl.apply._internal.flexObjects.FlexObject.FlexObjectMetadata}.
|
|
107
|
+
*/
|
|
108
|
+
flexObjectMetadata: {
|
|
109
|
+
type: "object",
|
|
110
|
+
defaultValue: {}
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* Optional support information.
|
|
114
|
+
* See {@link sap.ui.fl.apply._internal.flexObjects.FlexObject.SupportInformation}.
|
|
115
|
+
*/
|
|
116
|
+
supportInformation: {
|
|
117
|
+
type: "object",
|
|
118
|
+
defaultValue: {}
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Content of the flex object that is used to apply the flex object.
|
|
122
|
+
*/
|
|
123
|
+
content: {
|
|
124
|
+
type: "any"
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* Map of texts that should be translated.
|
|
128
|
+
*/
|
|
129
|
+
texts: {
|
|
130
|
+
type: "object",
|
|
131
|
+
defaultValue: {}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
constructor: function() {
|
|
136
|
+
ManagedObject.apply(this, arguments);
|
|
137
|
+
var oFlexObjectMetadata = this.getFlexObjectMetadata();
|
|
138
|
+
if (oFlexObjectMetadata.reference) {
|
|
139
|
+
oFlexObjectMetadata.namespace = (
|
|
140
|
+
oFlexObjectMetadata.namespace
|
|
141
|
+
|| Utils.createNamespace(
|
|
142
|
+
{ reference: oFlexObjectMetadata.reference },
|
|
143
|
+
this.getFileType()
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
if (!oFlexObjectMetadata.projectId) {
|
|
148
|
+
oFlexObjectMetadata.projectId = oFlexObjectMetadata.reference.replace(".Component", "");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
this.setFlexObjectMetadata(oFlexObjectMetadata);
|
|
152
|
+
|
|
153
|
+
var oSupportInformation = this.getSupportInformation();
|
|
154
|
+
if (!oSupportInformation.originalLanguage) {
|
|
155
|
+
oSupportInformation.originalLanguage = Utils.getCurrentLanguage();
|
|
156
|
+
}
|
|
157
|
+
this.setSupportInformation(oSupportInformation);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Returns the mapping between flex object properties and file content properties in the back-end response.
|
|
163
|
+
* @returns {object} Mapping information
|
|
164
|
+
* @static
|
|
165
|
+
*/
|
|
166
|
+
FlexObject.getMappingInfo = function () {
|
|
167
|
+
return Object.assign({}, {
|
|
168
|
+
"flexObjectMetadata.reference": "reference",
|
|
169
|
+
"flexObjectMetadata.namespace": "namespace",
|
|
170
|
+
"flexObjectMetadata.creation": "creation",
|
|
171
|
+
"flexObjectMetadata.projectId": "projectId",
|
|
172
|
+
"flexObjectMetadata.packageName": "packageName",
|
|
173
|
+
"flexObjectMetadata.moduleName": "moduleName",
|
|
174
|
+
"supportInformation.generator": "support.generator",
|
|
175
|
+
"supportInformation.service": "support.service",
|
|
176
|
+
"supportInformation.sourceSystem": "sourceSystem",
|
|
177
|
+
"supportInformation.sourceClient": "sourceClient",
|
|
178
|
+
"supportInformation.user": "support.user",
|
|
179
|
+
"supportInformation.sapui5Version": "support.sapui5Version",
|
|
180
|
+
"supportInformation.sourceChangeFileName": "support.sourceChangeFileName",
|
|
181
|
+
"supportInformation.compositeCommand": "support.compositeCommand",
|
|
182
|
+
"supportInformation.command": "support.command",
|
|
183
|
+
"supportInformation.oDataInformation": "oDataInformation",
|
|
184
|
+
"supportInformation.originalLanguage": "originalLanguage",
|
|
185
|
+
layer: "layer",
|
|
186
|
+
fileType: "fileType",
|
|
187
|
+
content: "content",
|
|
188
|
+
id: "fileName",
|
|
189
|
+
texts: "texts"
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Returns the mapping between flex object properties and file content properties in the back-end response.
|
|
195
|
+
* Can be overridden to avoid access of static mapping within base methods.
|
|
196
|
+
* @returns {object} Mapping information
|
|
197
|
+
*/
|
|
198
|
+
FlexObject.prototype.getMappingInfo = function () {
|
|
199
|
+
return FlexObject.getMappingInfo();
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Sets the content of the flex object and marks the state as DIRTY.
|
|
204
|
+
* @param {any} oContent - Flex object content
|
|
205
|
+
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} <code>this</code> for chaining
|
|
206
|
+
*/
|
|
207
|
+
FlexObject.prototype.setContent = function (oContent) {
|
|
208
|
+
this.setProperty("content", oContent);
|
|
209
|
+
this.setState(States.DIRTY);
|
|
210
|
+
return this;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Getter for additional flex object metadata.
|
|
215
|
+
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject.FlexObjectMetadata} Additional metadata
|
|
216
|
+
*/
|
|
217
|
+
FlexObject.prototype.getFlexObjectMetadata = function () {
|
|
218
|
+
return Object.assign({}, this.getProperty("flexObjectMetadata"));
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Getter for flex object support information.
|
|
223
|
+
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject.SupportInformation} Support information
|
|
224
|
+
*/
|
|
225
|
+
FlexObject.prototype.getSupportInformation = function () {
|
|
226
|
+
return Object.assign({}, this.getProperty("supportInformation"));
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
function isValidStateChange(sNewState, sCurrentState) {
|
|
230
|
+
if (!Object.values(States).includes(sNewState)) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
// flex object state cannot move from NEW to DIRTY directly
|
|
234
|
+
if (
|
|
235
|
+
sCurrentState === States.NEW
|
|
236
|
+
&& sNewState === States.DIRTY
|
|
237
|
+
) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Validates and sets the state of the flex object.
|
|
245
|
+
* @param {sap.ui.fl.States} sState - New state
|
|
246
|
+
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} <code>this</code> for chaining
|
|
247
|
+
*/
|
|
248
|
+
FlexObject.prototype.setState = function (sState) {
|
|
249
|
+
var sCurrentState = this.getState();
|
|
250
|
+
if (sCurrentState !== sState && isValidStateChange(sState, sCurrentState)) {
|
|
251
|
+
this._sPreviousState = sCurrentState;
|
|
252
|
+
this.setProperty("state", sState);
|
|
253
|
+
}
|
|
254
|
+
return this;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Changes the state of the flex object to DELETED.
|
|
259
|
+
*/
|
|
260
|
+
FlexObject.prototype.markForDeletion = function () {
|
|
261
|
+
this.setState(States.DELETED);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Restores the state before the last state change.
|
|
266
|
+
* Cannot go back further than the previous state.
|
|
267
|
+
*/
|
|
268
|
+
FlexObject.prototype.restorePreviousState = function () {
|
|
269
|
+
if (this._sPreviousState) {
|
|
270
|
+
this.setState(this._sPreviousState);
|
|
271
|
+
delete this._sPreviousState;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Checks if flex object is read only because of its source system.
|
|
277
|
+
* @returns {boolean} <code>true</code> if the flex object is from another system
|
|
278
|
+
*/
|
|
279
|
+
FlexObject.prototype.isChangeFromOtherSystem = function () {
|
|
280
|
+
var sSourceSystem = this.getSupportInformation().sourceSystem;
|
|
281
|
+
var sSourceClient = this.getSupportInformation().sourceClient;
|
|
282
|
+
if (!sSourceSystem || !sSourceClient) {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
var oSettings = Settings.getInstanceOrUndef();
|
|
286
|
+
if (!oSettings) {
|
|
287
|
+
return true; // without settings the right to edit or delete a flex object cannot be determined
|
|
288
|
+
}
|
|
289
|
+
var sSystem = oSettings.getSystem();
|
|
290
|
+
var sClient = oSettings.getClient();
|
|
291
|
+
if (!sSystem || !sClient) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
return (sSourceSystem !== sSystem || sSourceClient !== sClient);
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Returns <code>true</code> if the flex object is user dependent.
|
|
299
|
+
* @returns {boolean} <code>true</code> if the flex object is only relevant for the current user
|
|
300
|
+
*/
|
|
301
|
+
FlexObject.prototype.isUserDependent = function () {
|
|
302
|
+
return this.getLayer() === Layer.USER;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Returns the text in the current language for a given ID.
|
|
307
|
+
* @param {string} sTextId - Text ID which was used as part of the <code>texts</code> property
|
|
308
|
+
* @returns {string} The text for the given text ID
|
|
309
|
+
*/
|
|
310
|
+
FlexObject.prototype.getText = function (sTextId) {
|
|
311
|
+
var oText = this.getTexts()[sTextId] || {};
|
|
312
|
+
return oText.value || "";
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Sets the new text for the given text ID.
|
|
317
|
+
* @param {string} sTextId - Text ID which was used as part of the <code>texts</code> property
|
|
318
|
+
* @param {string} sNewText - New text for the given text ID
|
|
319
|
+
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} <code>this</code> context for chaining
|
|
320
|
+
*/
|
|
321
|
+
FlexObject.prototype.setText = function (sTextId, sNewText) {
|
|
322
|
+
var oTexts = Object.assign({}, this.getTexts());
|
|
323
|
+
if (oTexts[sTextId]) {
|
|
324
|
+
oTexts[sTextId] = Object.assign({}, oTexts[sTextId], {
|
|
325
|
+
value: sNewText
|
|
326
|
+
});
|
|
327
|
+
this.setTexts(oTexts);
|
|
328
|
+
this.setState(States.DIRTY);
|
|
329
|
+
}
|
|
330
|
+
return this;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
function capitalize(sKey) {
|
|
334
|
+
return sKey.length ? sKey.charAt(0).toUpperCase() + sKey.slice(1) : sKey;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function getOriginalMutator(sFunctionName) {
|
|
338
|
+
return typeof this[sFunctionName] === "function"
|
|
339
|
+
? this[sFunctionName].bind(this)
|
|
340
|
+
: function () {
|
|
341
|
+
throw new Error(sFunctionName + " is not a valid mutator");
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function getMutators(sPropertyName) {
|
|
346
|
+
var aInstanceParts = sPropertyName.split(".");
|
|
347
|
+
aInstanceParts[0] = capitalize(aInstanceParts[0]);
|
|
348
|
+
var sFunctionName = aInstanceParts.shift();
|
|
349
|
+
var fnGetter = getOriginalMutator.call(this, "get" + sFunctionName);
|
|
350
|
+
var fnSetter = getOriginalMutator.call(this, "set" + sFunctionName);
|
|
351
|
+
return {
|
|
352
|
+
getValue: function () {
|
|
353
|
+
var vCurrentValue = deepClone(fnGetter());
|
|
354
|
+
if (aInstanceParts.length > 0) {
|
|
355
|
+
return ObjectPath.get(aInstanceParts, vCurrentValue);
|
|
356
|
+
}
|
|
357
|
+
return vCurrentValue;
|
|
358
|
+
},
|
|
359
|
+
setValue: function (vValue) {
|
|
360
|
+
var vPropertyValue = deepClone(fnGetter());
|
|
361
|
+
if (aInstanceParts.length > 0) {
|
|
362
|
+
ObjectPath.set(aInstanceParts, vValue, vPropertyValue);
|
|
363
|
+
} else {
|
|
364
|
+
vPropertyValue = vValue;
|
|
365
|
+
}
|
|
366
|
+
fnSetter(vPropertyValue);
|
|
367
|
+
return this;
|
|
368
|
+
}.bind(this)
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Converts properties of the flex object to the file content format according to the mapping info.
|
|
374
|
+
* @returns {object} File content of the flex object that can be persisted
|
|
375
|
+
*/
|
|
376
|
+
FlexObject.prototype.convertToFileContent = function() {
|
|
377
|
+
var oFileContent = {};
|
|
378
|
+
Object.entries(this.getMappingInfo()).forEach(function (aProperty) {
|
|
379
|
+
var oValueToSet = getMutators.call(this, aProperty[0]).getValue();
|
|
380
|
+
if (oValueToSet !== undefined) {
|
|
381
|
+
ObjectPath.set(aProperty[1], oValueToSet, oFileContent);
|
|
382
|
+
}
|
|
383
|
+
}.bind(this));
|
|
384
|
+
return oFileContent;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
function updateProperty(sPropertyName, vValue) {
|
|
388
|
+
var oMutators = getMutators.call(this, sPropertyName);
|
|
389
|
+
var vCurrentValue = oMutators.getValue();
|
|
390
|
+
if (vCurrentValue !== vValue) {
|
|
391
|
+
oMutators.setValue(vValue);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Converts the file content to the properties of the flex object according to the mapping info.
|
|
397
|
+
* @param {object} oFileContent - File content
|
|
398
|
+
* @param {object} oMappingInfo - Mapping info
|
|
399
|
+
* @returns {object} Properties map to create a new flex object
|
|
400
|
+
* @static
|
|
401
|
+
*/
|
|
402
|
+
FlexObject.mapFileContent = function (oFileContent, oMappingInfo) {
|
|
403
|
+
var aValidFileProperties = Object.values(oMappingInfo);
|
|
404
|
+
var mPropertyMap = {};
|
|
405
|
+
|
|
406
|
+
var fnMapProperty = function (sKey, vValue, sPath) {
|
|
407
|
+
var sNewPath = sPath ? sPath + "." + sKey : sKey;
|
|
408
|
+
var iIndex = aValidFileProperties.indexOf(sNewPath);
|
|
409
|
+
if (iIndex >= 0) {
|
|
410
|
+
var sPropertyName = Object.keys(oMappingInfo)[iIndex];
|
|
411
|
+
mPropertyMap[sPropertyName] = vValue;
|
|
412
|
+
} else if (isPlainObject(vValue)) {
|
|
413
|
+
Object.entries(vValue).forEach(function(aEntry) {
|
|
414
|
+
fnMapProperty(aEntry[0], aEntry[1], sNewPath);
|
|
415
|
+
});
|
|
416
|
+
} else {
|
|
417
|
+
Log.error("Missing mapping info for property " + sNewPath);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
Object.entries(deepClone(oFileContent)).forEach(function (aEntry) {
|
|
422
|
+
fnMapProperty(aEntry[0], aEntry[1]);
|
|
423
|
+
});
|
|
424
|
+
return mPropertyMap;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Updates the flex object with a file content delta.
|
|
429
|
+
* @param {object} oFileContent - File content of the flex object
|
|
430
|
+
*/
|
|
431
|
+
FlexObject.prototype.update = function (oFileContent) {
|
|
432
|
+
var oFilteredFileContent = _omit(oFileContent, ["fileName"]);
|
|
433
|
+
var mProperties = FlexObject.mapFileContent(oFilteredFileContent, this.getMappingInfo());
|
|
434
|
+
Object.entries(mProperties).forEach(function (aProperty) {
|
|
435
|
+
updateProperty.call(this, aProperty[0], aProperty[1]);
|
|
436
|
+
}.bind(this));
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Sets the response from the back end after the flex object is saved.
|
|
441
|
+
* @param {object} oResponse - File content
|
|
442
|
+
*/
|
|
443
|
+
FlexObject.prototype.setResponse = function (oResponse) {
|
|
444
|
+
if (!oResponse || isEmptyObject(oResponse)) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
this.update(oResponse);
|
|
448
|
+
this.setState(States.PERSISTED);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
return FlexObject;
|
|
452
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* !
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"sap/base/util/ObjectPath",
|
|
8
|
+
"sap/ui/fl/apply/_internal/flexObjects/FlexObject"
|
|
9
|
+
], function(
|
|
10
|
+
ObjectPath,
|
|
11
|
+
FlexObject
|
|
12
|
+
) {
|
|
13
|
+
"use strict";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @enum {string}
|
|
17
|
+
* Valid flex object types.
|
|
18
|
+
*
|
|
19
|
+
* @alias sap.ui.fl.apply._internal.flexObjects.FlexObjectFactory.FLEX_OBJECT_TYPES
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
var FLEX_OBJECT_TYPES = {
|
|
23
|
+
BASE_FLEX_OBJECT: FlexObject
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function getFlexObjectClass () {
|
|
27
|
+
return FLEX_OBJECT_TYPES.BASE_FLEX_OBJECT;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Helper class to create any flex object.
|
|
32
|
+
*
|
|
33
|
+
* @namespace sap.ui.fl.apply._internal.flexObjects.FlexObjectFactory
|
|
34
|
+
* @since 1.100
|
|
35
|
+
* @version 1.100.0
|
|
36
|
+
* @private
|
|
37
|
+
* @ui5-restricted sap.ui.fl
|
|
38
|
+
*/
|
|
39
|
+
var FlexObjectFactory = {};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new flex object.
|
|
43
|
+
*
|
|
44
|
+
* @param {object} oFileContent - File content
|
|
45
|
+
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} The created flex object
|
|
46
|
+
*/
|
|
47
|
+
FlexObjectFactory.createFromFileContent = function (oFileContent) {
|
|
48
|
+
var oNewFileContent = Object.assign({}, oFileContent);
|
|
49
|
+
var FlexObjectClass = getFlexObjectClass(oNewFileContent);
|
|
50
|
+
if (!FlexObjectClass) {
|
|
51
|
+
throw new Error("Unknown file type");
|
|
52
|
+
}
|
|
53
|
+
oNewFileContent.support = Object.assign(
|
|
54
|
+
{ generator: "FlexObjectFactory.createFromFileContent" },
|
|
55
|
+
oNewFileContent.support || {}
|
|
56
|
+
);
|
|
57
|
+
var oMappingInfo = FlexObjectClass.getMappingInfo();
|
|
58
|
+
var mCreationInfo = FlexObjectClass.mapFileContent(oNewFileContent, oMappingInfo);
|
|
59
|
+
var mProperties = Object.entries(mCreationInfo).reduce(function (mPropertyMap, aProperty) {
|
|
60
|
+
ObjectPath.set(aProperty[0].split('.'), aProperty[1], mPropertyMap);
|
|
61
|
+
return mPropertyMap;
|
|
62
|
+
}, {});
|
|
63
|
+
var oFlexObject = new FlexObjectClass(mProperties);
|
|
64
|
+
return oFlexObject;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return FlexObjectFactory;
|
|
68
|
+
});
|
|
@@ -44,10 +44,12 @@ sap.ui.define([
|
|
|
44
44
|
* The persistence happens inside an object mapped to the component reference, with the following properties:
|
|
45
45
|
*
|
|
46
46
|
* {
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* preparedMaps: {
|
|
48
|
+
* appDescriptorMap: {},
|
|
49
|
+
* changesMap: {},
|
|
50
|
+
* variantsMap: {},
|
|
51
|
+
* compVariantsMap: {},
|
|
52
|
+
* },
|
|
51
53
|
* storageResponse: {
|
|
52
54
|
* changes: {
|
|
53
55
|
* changes: [...],
|
|
@@ -65,14 +67,16 @@ sap.ui.define([
|
|
|
65
67
|
* },
|
|
66
68
|
* loadModules: <boolean>
|
|
67
69
|
* },
|
|
70
|
+
* unfilteredStorageResnonse: {...}, // same as above but without layer filtering
|
|
68
71
|
* partialFlexState: <boolean>,
|
|
69
|
-
* componentId: "<componentId>"
|
|
72
|
+
* componentId: "<componentId>",
|
|
73
|
+
* componentData: {...}
|
|
70
74
|
* }
|
|
71
75
|
*
|
|
72
76
|
* @namespace sap.ui.fl.apply._internal.flexState.FlexState
|
|
73
77
|
* @experimental
|
|
74
78
|
* @since 1.73
|
|
75
|
-
* @version 1.
|
|
79
|
+
* @version 1.100.0
|
|
76
80
|
* @private
|
|
77
81
|
* @ui5-restricted sap.ui.fl.apply._internal
|
|
78
82
|
*/
|
|
@@ -83,6 +87,7 @@ sap.ui.define([
|
|
|
83
87
|
var _mInitPromises = {};
|
|
84
88
|
var _oShellNavigationService;
|
|
85
89
|
var _oURLParsingService;
|
|
90
|
+
var _oChangePersistenceFactory;
|
|
86
91
|
var _mFlexObjectInfo = {
|
|
87
92
|
appDescriptorChanges: {
|
|
88
93
|
prepareFunction: prepareAppDescriptorMap,
|
|
@@ -102,6 +107,7 @@ sap.ui.define([
|
|
|
102
107
|
}
|
|
103
108
|
};
|
|
104
109
|
// some runtime data is only fetched once (e.g. during control init) and has to survive an invalidation of the FlexState
|
|
110
|
+
// TODO: move to maps as soon as they don't get cleared with cache invalidation
|
|
105
111
|
var _mExternalData = {
|
|
106
112
|
compVariants: {},
|
|
107
113
|
variants: {}
|
|
@@ -212,7 +218,7 @@ sap.ui.define([
|
|
|
212
218
|
|
|
213
219
|
function registerMaxLayerHandler(sReference) {
|
|
214
220
|
var oShellNavigationService = getUShellService("ShellNavigation");
|
|
215
|
-
if (oShellNavigationService) {
|
|
221
|
+
if (oShellNavigationService && !_mNavigationHandlers[sReference]) {
|
|
216
222
|
_mNavigationHandlers[sReference] = handleMaxLayerChange.bind(null, sReference);
|
|
217
223
|
oShellNavigationService.registerNavigationFilter(_mNavigationHandlers[sReference]);
|
|
218
224
|
}
|
|
@@ -246,10 +252,6 @@ sap.ui.define([
|
|
|
246
252
|
return undefined;
|
|
247
253
|
}
|
|
248
254
|
|
|
249
|
-
function clearPreparedMaps(sReference) {
|
|
250
|
-
_mInstances[sReference].preparedMaps = {};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
255
|
function checkPartialFlexState(mInitProperties) {
|
|
254
256
|
var oFlexInstance = _mInstances[mInitProperties.reference];
|
|
255
257
|
if (oFlexInstance.partialFlexState === true && mInitProperties.partialFlexState !== true) {
|
|
@@ -294,6 +296,20 @@ sap.ui.define([
|
|
|
294
296
|
return undefined;
|
|
295
297
|
}
|
|
296
298
|
|
|
299
|
+
// TODO: get rid of the following module dependencies as soon as the change state
|
|
300
|
+
// is migrated from changePersistenceFactory to the FlexState
|
|
301
|
+
function lazyLoadModules() {
|
|
302
|
+
return Promise.all([
|
|
303
|
+
Utils.requireAsync("sap/ui/fl/ChangePersistenceFactory")
|
|
304
|
+
])
|
|
305
|
+
.then(function(aModules) {
|
|
306
|
+
_oChangePersistenceFactory = aModules[0];
|
|
307
|
+
})
|
|
308
|
+
.catch(function(oError) {
|
|
309
|
+
Log.error("Error loading modules: " + oError.message);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
297
313
|
/**
|
|
298
314
|
* Initializes the FlexState for a given reference. A request for the flex data is sent to the Loader and the response is saved.
|
|
299
315
|
* The FlexState can only be initialized once, every subsequent init call will just resolve as soon as it is initialized.
|
|
@@ -305,12 +321,15 @@ sap.ui.define([
|
|
|
305
321
|
* @param {object} [mPropertyBag.rawManifest] - Raw JSON manifest that belongs to current component
|
|
306
322
|
* @param {string} [mPropertyBag.componentData] - Component data of the current component
|
|
307
323
|
* @param {object} [mPropertyBag.asyncHints] - Async hints passed from the app index to the component processing
|
|
308
|
-
* @param {
|
|
324
|
+
* @param {string} [mPropertyBag.version] - Number of the version in which the state should be initialized
|
|
309
325
|
* @param {boolean} [mPropertyBag.partialFlexState=false] - if true state is initialized partially and does not include flex bundles
|
|
310
|
-
* @returns {
|
|
326
|
+
* @returns {Promise<undefined>} Resolves a promise as soon as FlexState is initialized
|
|
311
327
|
*/
|
|
312
328
|
FlexState.initialize = function(mPropertyBag) {
|
|
313
|
-
return
|
|
329
|
+
return Promise.all([
|
|
330
|
+
loadUShellServices(),
|
|
331
|
+
lazyLoadModules()
|
|
332
|
+
])
|
|
314
333
|
.then(function() {
|
|
315
334
|
enhancePropertyBag(mPropertyBag);
|
|
316
335
|
var sFlexReference = mPropertyBag.reference;
|
|
@@ -345,8 +364,8 @@ sap.ui.define([
|
|
|
345
364
|
* @param {string} [mPropertyBag.reference] - Flex reference of the app
|
|
346
365
|
* @param {object} [mPropertyBag.manifest] - Manifest that belongs to actual component
|
|
347
366
|
* @param {string} [mPropertyBag.componentData] - Component data of the current component
|
|
348
|
-
* @param {
|
|
349
|
-
* @returns {
|
|
367
|
+
* @param {string} [mPropertyBag.version] - Number of the version in which the state should be initialized
|
|
368
|
+
* @returns {Promise<undefined>} Resolves a promise as soon as FlexState is initialized again
|
|
350
369
|
*/
|
|
351
370
|
FlexState.clearAndInitialize = function(mPropertyBag) {
|
|
352
371
|
enhancePropertyBag(mPropertyBag);
|
|
@@ -362,6 +381,14 @@ sap.ui.define([
|
|
|
362
381
|
deRegisterMaxLayerHandler(sReference);
|
|
363
382
|
delete _mInstances[sReference];
|
|
364
383
|
delete _mInitPromises[sReference];
|
|
384
|
+
// TODO: get rid of the following deletes as soon as the change state
|
|
385
|
+
// is migrated from changePersistenceFactory to the FlexState
|
|
386
|
+
if (
|
|
387
|
+
_oChangePersistenceFactory
|
|
388
|
+
&& (_oChangePersistenceFactory._instanceCache || {}).hasOwnProperty(sReference)
|
|
389
|
+
) {
|
|
390
|
+
_oChangePersistenceFactory._instanceCache[sReference].removeDirtyChanges();
|
|
391
|
+
}
|
|
365
392
|
} else {
|
|
366
393
|
Object.keys(_mInstances).forEach(function(sReference) {
|
|
367
394
|
deRegisterMaxLayerHandler(sReference);
|
|
@@ -404,14 +431,10 @@ sap.ui.define([
|
|
|
404
431
|
* The next initialize call will add it again.
|
|
405
432
|
*
|
|
406
433
|
* @param {string} sReference - Flex reference of the app
|
|
407
|
-
* @param {string} sComponentId - Component instance ID
|
|
408
434
|
*/
|
|
409
|
-
FlexState.clearFilteredResponse = function(sReference
|
|
410
|
-
if (
|
|
411
|
-
_mInstances[sReference]
|
|
412
|
-
&& (!sComponentId || sComponentId === _mInstances[sReference].componentId)
|
|
413
|
-
) {
|
|
414
|
-
clearPreparedMaps(sReference);
|
|
435
|
+
FlexState.clearFilteredResponse = function(sReference) {
|
|
436
|
+
if (_mInstances[sReference]) {
|
|
437
|
+
_mInstances[sReference].preparedMaps = {};
|
|
415
438
|
delete _mInstances[sReference].storageResponse;
|
|
416
439
|
}
|
|
417
440
|
};
|
|
@@ -461,6 +484,7 @@ sap.ui.define([
|
|
|
461
484
|
return _mInstances[sReference].unfilteredStorageResponse;
|
|
462
485
|
});
|
|
463
486
|
}
|
|
487
|
+
return undefined;
|
|
464
488
|
};
|
|
465
489
|
// temporary function until the maps are ready
|
|
466
490
|
FlexState.getFlexObjectsFromStorageResponse = function(sReference) {
|