@sapui5/sap.fe.core 1.96.4 → 1.99.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/package.json +6 -5
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AnnotationHelper.js +377 -405
- package/src/sap/fe/core/AnnotationHelper.ts +385 -0
- package/src/sap/fe/core/AppComponent.js +5 -3
- package/src/sap/fe/core/AppStateHandler.js +229 -195
- package/src/sap/fe/core/AppStateHandler.ts +171 -0
- package/src/sap/fe/core/BaseController.js +3 -2
- package/src/sap/fe/core/BusyLocker.js +105 -121
- package/src/sap/fe/core/BusyLocker.ts +98 -0
- package/src/sap/fe/core/CommonUtils.js +2073 -2606
- package/src/sap/fe/core/CommonUtils.ts +2078 -0
- package/src/sap/fe/core/ExtensionAPI.js +16 -7
- package/src/sap/fe/core/PageController.js +84 -119
- package/src/sap/fe/core/PageController.ts +101 -0
- package/src/sap/fe/core/RouterProxy.js +986 -809
- package/src/sap/fe/core/RouterProxy.ts +838 -0
- package/src/sap/fe/core/Synchronization.js +51 -35
- package/src/sap/fe/core/Synchronization.ts +29 -0
- package/src/sap/fe/core/TemplateComponent.js +173 -155
- package/src/sap/fe/core/TemplateComponent.ts +166 -0
- package/src/sap/fe/core/TemplateModel.js +97 -54
- package/src/sap/fe/core/TemplateModel.ts +63 -0
- package/src/sap/fe/core/TransactionHelper.js +1576 -1627
- package/src/sap/fe/core/TransactionHelper.ts +1706 -0
- package/src/sap/fe/core/actions/draft.js +559 -581
- package/src/sap/fe/core/actions/draft.ts +593 -0
- package/src/sap/fe/core/actions/messageHandling.js +545 -435
- package/src/sap/fe/core/actions/messageHandling.ts +532 -0
- package/src/sap/fe/core/actions/nonDraft.js +17 -19
- package/src/sap/fe/core/actions/nonDraft.ts +12 -0
- package/src/sap/fe/core/actions/operations.js +1074 -1192
- package/src/sap/fe/core/actions/operations.ts +1162 -0
- package/src/sap/fe/core/actions/sticky.js +102 -105
- package/src/sap/fe/core/actions/sticky.ts +102 -0
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +3 -2
- package/src/sap/fe/core/controllerextensions/EditFlow.js +235 -264
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +3 -2
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +288 -13
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +35 -25
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +79 -46
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +86 -10
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +109 -31
- package/src/sap/fe/core/controllerextensions/MassEdit.js +172 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +237 -104
- package/src/sap/fe/core/controllerextensions/PageReady.js +3 -3
- package/src/sap/fe/core/controllerextensions/PageReady.ts +12 -8
- package/src/sap/fe/core/controllerextensions/Paginator.js +37 -9
- package/src/sap/fe/core/controllerextensions/Placeholder.js +8 -4
- package/src/sap/fe/core/controllerextensions/Routing.js +25 -5
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +3 -2
- package/src/sap/fe/core/controllerextensions/Share.js +3 -2
- package/src/sap/fe/core/controllerextensions/SideEffects.js +9 -9
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +22 -21
- package/src/sap/fe/core/controllerextensions/ViewState.js +36 -8
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/CommandExecution.js +3 -2
- package/src/sap/fe/core/controls/ConditionalWrapper.js +3 -2
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +112 -113
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +9 -5
- package/src/sap/fe/core/controls/FieldWrapper.js +18 -23
- package/src/sap/fe/core/controls/FilterBar.js +3 -2
- package/src/sap/fe/core/controls/FormElementWrapper.js +3 -7
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +3 -2
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +3 -2
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +5 -4
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -2
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +3 -2
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
- package/src/sap/fe/core/converters/ConverterContext.js +14 -2
- package/src/sap/fe/core/converters/ConverterContext.ts +14 -3
- package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +8 -1
- package/src/sap/fe/core/converters/ManifestWrapper.js +56 -32
- package/src/sap/fe/core/converters/ManifestWrapper.ts +24 -6
- package/src/sap/fe/core/converters/MetaModelConverter.js +76 -6
- package/src/sap/fe/core/converters/MetaModelConverter.ts +79 -15
- package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
- package/src/sap/fe/core/converters/TemplateConverter.ts +2 -2
- package/src/sap/fe/core/converters/annotations/DataField.js +3 -3
- package/src/sap/fe/core/converters/annotations/DataField.ts +1 -1
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +85 -46
- package/src/sap/fe/core/converters/controls/Common/Action.js +16 -4
- package/src/sap/fe/core/converters/controls/Common/Action.ts +14 -5
- package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
- package/src/sap/fe/core/converters/controls/Common/Form.js +60 -19
- package/src/sap/fe/core/converters/controls/Common/Form.ts +66 -14
- package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +72 -0
- package/src/sap/fe/core/converters/controls/Common/Table.js +503 -399
- package/src/sap/fe/core/converters/controls/Common/Table.ts +615 -480
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +527 -0
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +655 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +489 -37
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +506 -58
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +6 -6
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +9 -15
- package/src/sap/fe/core/converters/helpers/Aggregation.js +18 -3
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
- package/src/sap/fe/core/converters/helpers/ID.js +9 -1
- package/src/sap/fe/core/converters/helpers/ID.ts +4 -0
- package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +4 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +3 -3
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +29 -11
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -20
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +13 -3
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
- package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
- package/src/sap/fe/core/formatters/TableFormatter.js +65 -31
- package/src/sap/fe/core/formatters/TableFormatter.ts +62 -30
- package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
- package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
- package/src/sap/fe/core/fpm/Component.js +3 -2
- package/src/sap/fe/core/helpers/AppStartupHelper.js +359 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +391 -0
- package/src/sap/fe/core/helpers/BindingExpression.js +479 -464
- package/src/sap/fe/core/helpers/BindingExpression.ts +477 -483
- package/src/sap/fe/core/helpers/ClassSupport.js +27 -15
- package/src/sap/fe/core/helpers/ClassSupport.ts +31 -20
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +63 -59
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +56 -0
- package/src/sap/fe/core/helpers/EditState.js +81 -84
- package/src/sap/fe/core/helpers/EditState.ts +81 -0
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
- package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
- package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
- package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +210 -0
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +202 -0
- package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.js +32 -0
- package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.ts +36 -0
- package/src/sap/fe/core/helpers/MassEditHelper.js +687 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +229 -174
- package/src/sap/fe/core/helpers/ModelHelper.ts +227 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
- package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +332 -313
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +330 -0
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
- package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
- package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
- package/src/sap/fe/core/library.js +30 -3
- package/src/sap/fe/core/library.support.js +12 -5
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +62 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +66 -0
- package/src/sap/fe/core/messagebundle.properties +72 -10
- package/src/sap/fe/core/messagebundle_ar.properties +41 -0
- package/src/sap/fe/core/messagebundle_bg.properties +41 -0
- package/src/sap/fe/core/messagebundle_ca.properties +41 -0
- package/src/sap/fe/core/messagebundle_cs.properties +42 -1
- package/src/sap/fe/core/messagebundle_cy.properties +41 -0
- package/src/sap/fe/core/messagebundle_da.properties +41 -0
- package/src/sap/fe/core/messagebundle_de.properties +41 -0
- package/src/sap/fe/core/messagebundle_el.properties +41 -0
- package/src/sap/fe/core/messagebundle_en.properties +41 -0
- package/src/sap/fe/core/messagebundle_en_GB.properties +41 -0
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +41 -0
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +35 -0
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +41 -0
- package/src/sap/fe/core/messagebundle_es.properties +41 -0
- package/src/sap/fe/core/messagebundle_es_MX.properties +41 -0
- package/src/sap/fe/core/messagebundle_et.properties +41 -0
- package/src/sap/fe/core/messagebundle_fi.properties +41 -0
- package/src/sap/fe/core/messagebundle_fr.properties +46 -5
- package/src/sap/fe/core/messagebundle_fr_CA.properties +41 -0
- package/src/sap/fe/core/messagebundle_hi.properties +41 -0
- package/src/sap/fe/core/messagebundle_hr.properties +41 -0
- package/src/sap/fe/core/messagebundle_hu.properties +42 -1
- package/src/sap/fe/core/messagebundle_id.properties +45 -4
- package/src/sap/fe/core/messagebundle_it.properties +41 -0
- package/src/sap/fe/core/messagebundle_iw.properties +41 -0
- package/src/sap/fe/core/messagebundle_ja.properties +50 -9
- package/src/sap/fe/core/messagebundle_kk.properties +41 -0
- package/src/sap/fe/core/messagebundle_ko.properties +41 -0
- package/src/sap/fe/core/messagebundle_lt.properties +41 -0
- package/src/sap/fe/core/messagebundle_lv.properties +41 -0
- package/src/sap/fe/core/messagebundle_ms.properties +41 -0
- package/src/sap/fe/core/messagebundle_nl.properties +41 -0
- package/src/sap/fe/core/messagebundle_no.properties +41 -0
- package/src/sap/fe/core/messagebundle_pl.properties +41 -0
- package/src/sap/fe/core/messagebundle_pt.properties +43 -2
- package/src/sap/fe/core/messagebundle_pt_PT.properties +41 -0
- package/src/sap/fe/core/messagebundle_ro.properties +41 -0
- package/src/sap/fe/core/messagebundle_ru.properties +41 -0
- package/src/sap/fe/core/messagebundle_sh.properties +41 -0
- package/src/sap/fe/core/messagebundle_sk.properties +41 -0
- package/src/sap/fe/core/messagebundle_sl.properties +41 -0
- package/src/sap/fe/core/messagebundle_sv.properties +42 -1
- package/src/sap/fe/core/messagebundle_th.properties +41 -0
- package/src/sap/fe/core/messagebundle_tr.properties +41 -0
- package/src/sap/fe/core/messagebundle_uk.properties +41 -0
- package/src/sap/fe/core/messagebundle_vi.properties +41 -0
- package/src/sap/fe/core/messagebundle_zh_CN.properties +41 -0
- package/src/sap/fe/core/messagebundle_zh_TW.properties +41 -0
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +269 -202
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +4 -3
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +9 -5
- package/src/sap/fe/core/services/NavigationServiceFactory.js +406 -300
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +316 -0
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +149 -81
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +80 -0
- package/src/sap/fe/core/services/RoutingServiceFactory.js +987 -1166
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
- package/src/sap/fe/core/services/ShellServicesFactory.js +31 -2
- package/src/sap/fe/core/services/ShellServicesFactory.ts +45 -11
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +41 -84
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +56 -99
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +461 -478
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +453 -0
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
- package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
- package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
- package/src/sap/fe/core/templating/DataModelPathHelper.js +6 -24
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +10 -23
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
- package/src/sap/fe/core/templating/EntitySetHelper.js +80 -7
- package/src/sap/fe/core/templating/EntitySetHelper.ts +42 -2
- package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
- package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
- package/src/sap/fe/core/templating/FilterHelper.js +139 -70
- package/src/sap/fe/core/templating/FilterHelper.ts +140 -70
- package/src/sap/fe/core/templating/PropertyHelper.js +2 -2
- package/src/sap/fe/core/templating/PropertyHelper.ts +1 -1
- package/src/sap/fe/core/templating/UIFormatters.js +45 -113
- package/src/sap/fe/core/templating/UIFormatters.ts +39 -76
- package/src/sap/fe/core/type/Email.js +1 -1
- package/src/sap/fe/core/type/Email.ts +4 -6
- package/ui5.yaml +0 -3
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import Service from "sap/ui/core/service/Service";
|
|
2
|
+
import ServiceFactory from "sap/ui/core/service/ServiceFactory";
|
|
3
|
+
import CacheManager from "sap/ui/core/cache/CacheManager";
|
|
4
|
+
import hash from "sap/base/strings/hash";
|
|
5
|
+
import { ServiceContext } from "sap/ui/core/service";
|
|
6
|
+
import jQuery from "sap/ui/thirdparty/jquery";
|
|
7
|
+
import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
|
|
8
|
+
import { AppComponent } from "sap/fe/core";
|
|
9
|
+
import UIComponent from "sap/ui/core/UIComponent";
|
|
10
|
+
|
|
11
|
+
function getMetadataETag(sUrl: any, sETag: any, mUpdatedMetaModelETags: any) {
|
|
12
|
+
return new Promise(function(resolve) {
|
|
13
|
+
// There is an Url in the FE cache, that's not in the MetaModel yet -> we need to check the ETag
|
|
14
|
+
(jQuery as any)
|
|
15
|
+
.ajax(sUrl, { method: "GET" })
|
|
16
|
+
.done(function(oResponse: any, sTextStatus: any, jqXHR: any) {
|
|
17
|
+
// ETag is not the same -> invalid
|
|
18
|
+
// ETag is the same -> valid
|
|
19
|
+
// If ETag is available use it, otherwise use Last-Modified
|
|
20
|
+
mUpdatedMetaModelETags[sUrl] = jqXHR.getResponseHeader("ETag") || jqXHR.getResponseHeader("Last-Modified");
|
|
21
|
+
resolve(sETag === mUpdatedMetaModelETags[sUrl]);
|
|
22
|
+
})
|
|
23
|
+
.fail(function() {
|
|
24
|
+
// Case 2z - Make sure we update the map so that we invalidate the cache
|
|
25
|
+
mUpdatedMetaModelETags[sUrl] = "";
|
|
26
|
+
resolve(false);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
type CacheHandlerServiceSettings = {
|
|
31
|
+
metaModel: ODataMetaModel;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export class CacheHandlerService extends Service<CacheHandlerServiceSettings> {
|
|
35
|
+
resolveFn: any;
|
|
36
|
+
rejectFn: any;
|
|
37
|
+
initPromise!: Promise<any>;
|
|
38
|
+
|
|
39
|
+
oFactory!: CacheHandlerServiceFactory;
|
|
40
|
+
oMetaModel!: ODataMetaModel;
|
|
41
|
+
oAppComponent: AppComponent;
|
|
42
|
+
oComponent!: UIComponent;
|
|
43
|
+
mCacheNeedsInvalidate: any;
|
|
44
|
+
|
|
45
|
+
init() {
|
|
46
|
+
const oContext = this.getContext();
|
|
47
|
+
this.oFactory = oContext.factory;
|
|
48
|
+
const mSettings = oContext.settings;
|
|
49
|
+
if (!mSettings.metaModel) {
|
|
50
|
+
throw new Error("a `metaModel` property is expected when instantiating the CacheHandlerService");
|
|
51
|
+
}
|
|
52
|
+
this.oMetaModel = mSettings.metaModel;
|
|
53
|
+
this.oAppComponent = mSettings.appComponent;
|
|
54
|
+
this.oComponent = mSettings.component;
|
|
55
|
+
this.initPromise = this.oMetaModel.fetchEntityContainer().then(() => {
|
|
56
|
+
return this;
|
|
57
|
+
});
|
|
58
|
+
this.mCacheNeedsInvalidate = {};
|
|
59
|
+
}
|
|
60
|
+
exit() {
|
|
61
|
+
// Deregister global instance
|
|
62
|
+
this.oFactory.removeGlobalInstance(this.oMetaModel);
|
|
63
|
+
}
|
|
64
|
+
validateCacheKey(sCacheIdentifier: any): Promise<string> {
|
|
65
|
+
// Keep track if the cache will anyway need to be updated
|
|
66
|
+
let bCacheNeedUpdate = true;
|
|
67
|
+
return CacheManager.get(sCacheIdentifier)
|
|
68
|
+
.then((mCacheOutput: any) => {
|
|
69
|
+
// We provide a default key so that an xml view cache is written
|
|
70
|
+
const mMetaModelETags = this.getETags();
|
|
71
|
+
let sUpdatedCacheKey: string | null = JSON.stringify(mMetaModelETags);
|
|
72
|
+
// Case #1a - No cache, so mCacheOuput is empty, cacheKey = current metamodel ETags
|
|
73
|
+
if (mCacheOutput) {
|
|
74
|
+
// Case #2 - Cache entry found, check if it's still valid
|
|
75
|
+
const mUpdatedMetaModelETags: any = {};
|
|
76
|
+
const mCachedETags = JSON.parse(mCacheOutput.cachedETags);
|
|
77
|
+
return Promise.all(
|
|
78
|
+
Object.keys(mCachedETags).map(function(sUrl: string) {
|
|
79
|
+
// Check validity of every single Url that's in the FE Cache object
|
|
80
|
+
if (mCachedETags[sUrl]) {
|
|
81
|
+
if (mMetaModelETags[sUrl]) {
|
|
82
|
+
// Case #2a - Same number of ETags in the cache and in the metadata
|
|
83
|
+
mUpdatedMetaModelETags[sUrl] = mMetaModelETags[sUrl];
|
|
84
|
+
return mCachedETags[sUrl] === mMetaModelETags[sUrl];
|
|
85
|
+
} else {
|
|
86
|
+
// Case #2b - No ETag in the cache for that URL, cachedETags was enhanced
|
|
87
|
+
return getMetadataETag(sUrl, mCachedETags[sUrl], mUpdatedMetaModelETags);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
// Case #2z - Last Templating added an URL without ETag
|
|
91
|
+
mUpdatedMetaModelETags[sUrl] = mMetaModelETags[sUrl];
|
|
92
|
+
return mCachedETags[sUrl] === mMetaModelETags[sUrl];
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
).then(function(aValidETags: any[]) {
|
|
96
|
+
bCacheNeedUpdate = aValidETags.indexOf(false) >= 0;
|
|
97
|
+
// Case #2a - Same number of ETags and all valid -> we return the viewCacheKey
|
|
98
|
+
// Case #2b - Different number of ETags and still all valid -> we return the viewCacheKey
|
|
99
|
+
// Case #2c - Same number of ETags but different values, main service Etag has changed, use that as cache key
|
|
100
|
+
// Case #2d - Different number of ETags but different value, main service Etag or linked service Etag has changed, new ETags should be used as cacheKey
|
|
101
|
+
// Case #2z - Cache has an invalid Etag - if there is an Etag provided from MetaModel use it as cacheKey
|
|
102
|
+
if (
|
|
103
|
+
Object.keys(mUpdatedMetaModelETags).some(function(sUrl: string) {
|
|
104
|
+
return !mUpdatedMetaModelETags[sUrl];
|
|
105
|
+
})
|
|
106
|
+
) {
|
|
107
|
+
// At least one of the MetaModel URLs doesn't provide an ETag, so no caching
|
|
108
|
+
return null;
|
|
109
|
+
} else {
|
|
110
|
+
return bCacheNeedUpdate ? JSON.stringify(mUpdatedMetaModelETags) : mCacheOutput.viewCacheKey;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
} else if (
|
|
114
|
+
Object.keys(mMetaModelETags).some(function(sUrl: string) {
|
|
115
|
+
return !mMetaModelETags[sUrl];
|
|
116
|
+
})
|
|
117
|
+
) {
|
|
118
|
+
// Check if cache can be used (all the metadata and annotations have to provide at least a ETag or a Last-Modified header)
|
|
119
|
+
// Case #1-b - No Cache, mCacheOuput is empty, but metamodel etags cannot be used, so no caching
|
|
120
|
+
bCacheNeedUpdate = true;
|
|
121
|
+
sUpdatedCacheKey = null;
|
|
122
|
+
}
|
|
123
|
+
return sUpdatedCacheKey;
|
|
124
|
+
})
|
|
125
|
+
.catch(() => {
|
|
126
|
+
// Don't use view cache in case of issues with the LRU cache
|
|
127
|
+
bCacheNeedUpdate = true;
|
|
128
|
+
return null;
|
|
129
|
+
})
|
|
130
|
+
.then((sCacheKey: any) => {
|
|
131
|
+
this.mCacheNeedsInvalidate[sCacheIdentifier] = bCacheNeedUpdate;
|
|
132
|
+
return sCacheKey;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
invalidateIfNeeded(sCacheKeys: string, sCacheIdentifier: string) {
|
|
136
|
+
// Check FE cache after XML view is processed completely
|
|
137
|
+
const sDataSourceETags = JSON.stringify(this.getETags());
|
|
138
|
+
if (this.mCacheNeedsInvalidate[sCacheIdentifier] || (sCacheKeys && sCacheKeys !== sDataSourceETags)) {
|
|
139
|
+
// Something in the sources and/or its ETags changed -> update the FE cache
|
|
140
|
+
const mCacheKeys: any = {};
|
|
141
|
+
// New ETags that need to be verified, may differ from the one used to generate the view
|
|
142
|
+
mCacheKeys.cachedETags = sDataSourceETags;
|
|
143
|
+
// Old ETags that are used for the xml view cache as key
|
|
144
|
+
mCacheKeys.viewCacheKey = sCacheKeys;
|
|
145
|
+
return CacheManager.set(sCacheIdentifier, mCacheKeys);
|
|
146
|
+
} else {
|
|
147
|
+
return Promise.resolve();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
getETags() {
|
|
151
|
+
const mMetaModelETags = (this.oMetaModel as any).getETags();
|
|
152
|
+
// ETags from UI5 are either a Date or a string, let's rationalize that
|
|
153
|
+
Object.keys(mMetaModelETags).forEach(function(sMetaModelKey: string) {
|
|
154
|
+
if (mMetaModelETags[sMetaModelKey] instanceof Date) {
|
|
155
|
+
// MetaModel contains a Last-Modified timestamp for the URL
|
|
156
|
+
mMetaModelETags[sMetaModelKey] = mMetaModelETags[sMetaModelKey].toISOString();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// add also the manifest hash as UI5 only considers the root component hash
|
|
161
|
+
const oManifestContent = this.oAppComponent.getManifest();
|
|
162
|
+
const sManifestHash = hash(
|
|
163
|
+
JSON.stringify({
|
|
164
|
+
sapApp: oManifestContent["sap.app"],
|
|
165
|
+
viewData: (this.oComponent as any).getViewData()
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
mMetaModelETags["manifest"] = sManifestHash;
|
|
169
|
+
return mMetaModelETags;
|
|
170
|
+
}
|
|
171
|
+
getInterface(): any {
|
|
172
|
+
return this;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
class CacheHandlerServiceFactory extends ServiceFactory<CacheHandlerServiceSettings> {
|
|
177
|
+
_oInstanceRegistry: Record<string, CacheHandlerService | null> = {};
|
|
178
|
+
createInstance(oServiceContext: ServiceContext<CacheHandlerServiceSettings>) {
|
|
179
|
+
const sMetaModelId = oServiceContext.settings.metaModel.getId();
|
|
180
|
+
let cacheHandlerInstance = this._oInstanceRegistry[sMetaModelId];
|
|
181
|
+
if (!cacheHandlerInstance) {
|
|
182
|
+
this._oInstanceRegistry[sMetaModelId] = cacheHandlerInstance = new CacheHandlerService(
|
|
183
|
+
Object.assign(
|
|
184
|
+
{
|
|
185
|
+
factory: this,
|
|
186
|
+
scopeObject: null,
|
|
187
|
+
scopeType: "service"
|
|
188
|
+
},
|
|
189
|
+
oServiceContext
|
|
190
|
+
)
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return cacheHandlerInstance.initPromise
|
|
195
|
+
.then(() => {
|
|
196
|
+
return this._oInstanceRegistry[sMetaModelId] as CacheHandlerService;
|
|
197
|
+
})
|
|
198
|
+
.catch((e: any) => {
|
|
199
|
+
// In case of error delete the global instance;
|
|
200
|
+
this._oInstanceRegistry[sMetaModelId] = null;
|
|
201
|
+
throw e;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
getInstance(oMetaModel: ODataMetaModel) {
|
|
205
|
+
return this._oInstanceRegistry[oMetaModel.getId()];
|
|
206
|
+
}
|
|
207
|
+
removeGlobalInstance(oMetaModel: ODataMetaModel) {
|
|
208
|
+
this._oInstanceRegistry[oMetaModel.getId()] = null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export default CacheHandlerServiceFactory;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
3
|
* (c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
4
|
*/
|
|
5
|
-
sap.ui.define(["sap/ui/core/service/ServiceFactory", "sap/ui/core/service/Service", "../converters/MetaModelConverter", "sap/ui/VersionInfo"], function (ServiceFactory, Service, MetaModelConverter, VersionInfo) {
|
|
5
|
+
sap.ui.define(["sap/ui/core/service/ServiceFactory", "sap/ui/core/service/Service", "../converters/MetaModelConverter", "sap/ui/VersionInfo", "sap/base/util/UriParameters"], function (ServiceFactory, Service, MetaModelConverter, VersionInfo, UriParameters) {
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
var DefaultEnvironmentCapabilities = MetaModelConverter.DefaultEnvironmentCapabilities;
|
|
@@ -19,7 +19,7 @@ sap.ui.define(["sap/ui/core/service/ServiceFactory", "sap/ui/core/service/Servic
|
|
|
19
19
|
|
|
20
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
21
21
|
|
|
22
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
22
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
23
23
|
|
|
24
24
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
25
25
|
|
|
@@ -59,6 +59,7 @@ sap.ui.define(["sap/ui/core/service/ServiceFactory", "sap/ui/core/service/Servic
|
|
|
59
59
|
});
|
|
60
60
|
_this.environmentCapabilities.UShell = !!(sap && sap.ushell && sap.ushell.Container);
|
|
61
61
|
_this.environmentCapabilities.IntentBasedNavigation = !!(sap && sap.ushell && sap.ushell.Container);
|
|
62
|
+
_this.environmentCapabilities.Situations = UriParameters.fromQuery(window.location.search).get("sap-fe-xx-situations") === "true";
|
|
62
63
|
_this.environmentCapabilities = Object.assign(_this.environmentCapabilities, oContext.settings);
|
|
63
64
|
|
|
64
65
|
_this.resolveFn(_this);
|
|
@@ -125,4 +126,4 @@ sap.ui.define(["sap/ui/core/service/ServiceFactory", "sap/ui/core/service/Servic
|
|
|
125
126
|
|
|
126
127
|
return EnvironmentServiceFactory;
|
|
127
128
|
}, false);
|
|
128
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
129
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkVudmlyb25tZW50U2VydmljZUZhY3RvcnkudHMiXSwibmFtZXMiOlsiRW52aXJvbm1lbnRDYXBhYmlsaXRpZXNTZXJ2aWNlIiwiaW5pdFByb21pc2UiLCJQcm9taXNlIiwicmVzb2x2ZSIsInJlamVjdCIsInJlc29sdmVGbiIsInJlamVjdEZuIiwib0NvbnRleHQiLCJnZXRDb250ZXh0IiwiZW52aXJvbm1lbnRDYXBhYmlsaXRpZXMiLCJPYmplY3QiLCJhc3NpZ24iLCJEZWZhdWx0RW52aXJvbm1lbnRDYXBhYmlsaXRpZXMiLCJWZXJzaW9uSW5mbyIsImxvYWQiLCJ1bmRlZmluZWQiLCJ0aGVuIiwidmVyc2lvbkluZm8iLCJDaGFydCIsImxpYnJhcmllcyIsImZpbmQiLCJsaWIiLCJuYW1lIiwiTWljcm9DaGFydCIsIlVTaGVsbCIsInNhcCIsInVzaGVsbCIsIkNvbnRhaW5lciIsIkludGVudEJhc2VkTmF2aWdhdGlvbiIsIlNpdHVhdGlvbnMiLCJVcmlQYXJhbWV0ZXJzIiwiZnJvbVF1ZXJ5Iiwid2luZG93IiwibG9jYXRpb24iLCJzZWFyY2giLCJnZXQiLCJzZXR0aW5ncyIsImNhdGNoIiwibGlicmFyeU5hbWUiLCJ1aSIsImdldENvcmUiLCJsb2FkTGlicmFyeSIsInJlcGxhY2UiLCJhc3luYyIsImUiLCJvQ2FwYWJpbGl0aWVzIiwiU2VydmljZSIsIkVudmlyb25tZW50U2VydmljZUZhY3RvcnkiLCJvU2VydmljZUNvbnRleHQiLCJlbnZpcm9ubWVudENhcGFiaWxpdGllc1NlcnZpY2UiLCJTZXJ2aWNlRmFjdG9yeSJdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTs7Ozs7Ozs7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PEVudmlyb25tZW50Q2FwYWJpbGl0aWVzPikge1xuXHRcdGNvbnN0IGVudmlyb25tZW50Q2FwYWJpbGl0aWVzU2VydmljZSA9IG5ldyBFbnZpcm9ubWVudENhcGFiaWxpdGllc1NlcnZpY2Uob1NlcnZpY2VDb250ZXh0KTtcblx0XHRyZXR1cm4gZW52aXJvbm1lbnRDYXBhYmlsaXRpZXNTZXJ2aWNlLmluaXRQcm9taXNlO1xuXHR9XG59XG5cbmV4cG9ydCBkZWZhdWx0IEVudmlyb25tZW50U2VydmljZUZhY3Rvcnk7XG4iXX0=
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ServiceFactory from "sap/ui/core/service/ServiceFactory";
|
|
2
|
+
import Service from "sap/ui/core/service/Service";
|
|
3
|
+
import { ServiceContext } from "sap/ui/core/service";
|
|
4
|
+
|
|
2
5
|
import { DefaultEnvironmentCapabilities, EnvironmentCapabilities } from "../converters/MetaModelConverter";
|
|
3
|
-
import
|
|
6
|
+
import VersionInfo from "sap/ui/VersionInfo";
|
|
7
|
+
import UriParameters from "sap/base/util/UriParameters";
|
|
4
8
|
|
|
5
9
|
class EnvironmentCapabilitiesService extends Service<EnvironmentCapabilities> {
|
|
6
10
|
resolveFn: any;
|
|
@@ -24,6 +28,8 @@ class EnvironmentCapabilitiesService extends Service<EnvironmentCapabilities> {
|
|
|
24
28
|
);
|
|
25
29
|
this.environmentCapabilities.UShell = !!(sap && sap.ushell && sap.ushell.Container);
|
|
26
30
|
this.environmentCapabilities.IntentBasedNavigation = !!(sap && sap.ushell && sap.ushell.Container);
|
|
31
|
+
this.environmentCapabilities.Situations =
|
|
32
|
+
UriParameters.fromQuery(window.location.search).get("sap-fe-xx-situations") === "true";
|
|
27
33
|
this.environmentCapabilities = Object.assign(this.environmentCapabilities, oContext.settings);
|
|
28
34
|
this.resolveFn(this);
|
|
29
35
|
})
|
|
@@ -33,9 +39,7 @@ class EnvironmentCapabilitiesService extends Service<EnvironmentCapabilities> {
|
|
|
33
39
|
resolveLibrary(libraryName: string): Promise<boolean> {
|
|
34
40
|
return new Promise(function(resolve) {
|
|
35
41
|
try {
|
|
36
|
-
sap.ui
|
|
37
|
-
.getCore()
|
|
38
|
-
.loadLibrary(`${libraryName.replace(/\./g, "/")}`, { async: true })
|
|
42
|
+
(sap.ui.getCore().loadLibrary(`${libraryName.replace(/\./g, "/")}`, { async: true }) as Promise<object>)
|
|
39
43
|
.then(function() {
|
|
40
44
|
resolve(true);
|
|
41
45
|
})
|