@sapui5/sap.fe.core 1.95.0 → 1.98.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 +5 -5
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AnnotationHelper.js +3 -3
- package/src/sap/fe/core/AppComponent.js +9 -44
- package/src/sap/fe/core/AppStateHandler.js +2 -2
- package/src/sap/fe/core/BaseController.js +1 -1
- package/src/sap/fe/core/BusyLocker.js +13 -1
- package/src/sap/fe/core/CommonUtils.js +129 -219
- package/src/sap/fe/core/ExtensionAPI.js +14 -6
- package/src/sap/fe/core/PageController.js +9 -35
- package/src/sap/fe/core/RouterProxy.js +79 -75
- package/src/sap/fe/core/Synchronization.js +1 -1
- package/src/sap/fe/core/TemplateComponent.js +16 -7
- package/src/sap/fe/core/TemplateModel.js +1 -1
- package/src/sap/fe/core/TransactionHelper.js +183 -65
- package/src/sap/fe/core/actions/draft.js +50 -23
- package/src/sap/fe/core/actions/messageHandling.js +86 -7
- package/src/sap/fe/core/actions/nonDraft.js +1 -1
- package/src/sap/fe/core/actions/operations.js +75 -33
- package/src/sap/fe/core/actions/sticky.js +1 -1
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +1 -1
- package/src/sap/fe/core/controllerextensions/EditFlow.js +276 -122
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +1 -1
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +14 -6
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +90 -46
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +234 -232
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +539 -209
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +550 -213
- package/src/sap/fe/core/controllerextensions/MassEdit.js +79 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +227 -103
- package/src/sap/fe/core/controllerextensions/PageReady.js +2 -2
- package/src/sap/fe/core/controllerextensions/PageReady.ts +3 -7
- package/src/sap/fe/core/controllerextensions/Paginator.js +38 -12
- package/src/sap/fe/core/controllerextensions/Placeholder.js +16 -19
- package/src/sap/fe/core/controllerextensions/Routing.js +17 -2
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +1 -1
- package/src/sap/fe/core/controllerextensions/Share.js +20 -7
- package/src/sap/fe/core/controllerextensions/SideEffects.js +8 -9
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +19 -17
- package/src/sap/fe/core/controllerextensions/ViewState.js +54 -9
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +40 -34
- package/src/sap/fe/core/controls/ActionParameterDialogValueHelp.fragment.xml +35 -0
- package/src/sap/fe/core/controls/CommandExecution.js +1 -1
- package/src/sap/fe/core/controls/ConditionalWrapper.js +1 -1
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +110 -109
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +7 -4
- package/src/sap/fe/core/controls/FieldWrapper.js +10 -4
- package/src/sap/fe/core/controls/FilterBar.js +1 -1
- package/src/sap/fe/core/controls/FormElementWrapper.js +1 -6
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +45 -0
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +1 -1
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +1 -1
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +1 -1
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +1 -1
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +1 -1
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +78 -0
- package/src/sap/fe/core/converters/ConverterContext.js +13 -1
- package/src/sap/fe/core/converters/ConverterContext.ts +10 -0
- package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +7 -1
- package/src/sap/fe/core/converters/ManifestWrapper.js +18 -7
- package/src/sap/fe/core/converters/ManifestWrapper.ts +15 -6
- package/src/sap/fe/core/converters/MetaModelConverter.js +920 -882
- package/src/sap/fe/core/converters/MetaModelConverter.ts +829 -853
- package/src/sap/fe/core/converters/annotations/DataField.js +54 -4
- package/src/sap/fe/core/converters/annotations/DataField.ts +53 -3
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +83 -48
- package/src/sap/fe/core/converters/controls/Common/Action.js +15 -3
- package/src/sap/fe/core/converters/controls/Common/Action.ts +12 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.js +1 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +0 -2
- package/src/sap/fe/core/converters/controls/Common/Form.js +68 -21
- package/src/sap/fe/core/converters/controls/Common/Form.ts +60 -16
- package/src/sap/fe/core/converters/controls/Common/KPI.js +331 -248
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +355 -287
- package/src/sap/fe/core/converters/controls/Common/Table.js +426 -332
- package/src/sap/fe/core/converters/controls/Common/Table.ts +516 -383
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +468 -0
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +609 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +30 -13
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +31 -12
- 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 +15 -7
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +27 -6
- package/src/sap/fe/core/converters/helpers/Aggregation.js +8 -1
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +9 -1
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +3 -2
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +2 -2
- package/src/sap/fe/core/converters/helpers/ID.js +9 -1
- package/src/sap/fe/core/converters/helpers/ID.ts +6 -2
- package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -5
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +2 -2
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +1 -1
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +34 -4
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -7
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +2 -5
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +1 -2
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +11 -2
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.ts +8 -3
- package/src/sap/fe/core/formatters/TableFormatter.js +27 -4
- package/src/sap/fe/core/formatters/TableFormatter.ts +20 -3
- package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
- package/src/sap/fe/core/formatters/ValueFormatter.ts +25 -3
- package/src/sap/fe/core/fpm/Component.js +2 -2
- package/src/sap/fe/core/helpers/AppStartupHelper.js +359 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +388 -0
- package/src/sap/fe/core/helpers/BindingExpression.js +199 -111
- package/src/sap/fe/core/helpers/BindingExpression.ts +193 -102
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +1 -1
- package/src/sap/fe/core/helpers/EditState.js +1 -1
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +1 -3
- package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +211 -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 +678 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +64 -1
- package/src/sap/fe/core/helpers/PasteHelper.js +7 -1
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
- package/src/sap/fe/core/helpers/StableIdHelper.js +2 -2
- package/src/sap/fe/core/helpers/StableIdHelper.ts +1 -1
- package/src/sap/fe/core/library.js +28 -2
- package/src/sap/fe/core/library.support.js +10 -4
- 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 +67 -3
- package/src/sap/fe/core/messagebundle_ar.properties +40 -3
- package/src/sap/fe/core/messagebundle_bg.properties +40 -3
- package/src/sap/fe/core/messagebundle_ca.properties +41 -4
- package/src/sap/fe/core/messagebundle_cs.properties +41 -4
- package/src/sap/fe/core/messagebundle_cy.properties +40 -3
- package/src/sap/fe/core/messagebundle_da.properties +40 -3
- package/src/sap/fe/core/messagebundle_de.properties +40 -3
- package/src/sap/fe/core/messagebundle_el.properties +40 -3
- package/src/sap/fe/core/messagebundle_en.properties +37 -0
- package/src/sap/fe/core/messagebundle_en_GB.properties +37 -0
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +37 -0
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +46 -2
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +44 -0
- package/src/sap/fe/core/messagebundle_es.properties +40 -3
- package/src/sap/fe/core/messagebundle_es_MX.properties +41 -4
- package/src/sap/fe/core/messagebundle_et.properties +40 -3
- package/src/sap/fe/core/messagebundle_fi.properties +40 -3
- package/src/sap/fe/core/messagebundle_fr.properties +41 -4
- package/src/sap/fe/core/messagebundle_fr_CA.properties +40 -3
- package/src/sap/fe/core/messagebundle_hi.properties +40 -3
- package/src/sap/fe/core/messagebundle_hr.properties +40 -3
- package/src/sap/fe/core/messagebundle_hu.properties +41 -4
- package/src/sap/fe/core/messagebundle_id.properties +42 -5
- package/src/sap/fe/core/messagebundle_it.properties +40 -3
- package/src/sap/fe/core/messagebundle_iw.properties +40 -3
- package/src/sap/fe/core/messagebundle_ja.properties +49 -12
- package/src/sap/fe/core/messagebundle_kk.properties +40 -3
- package/src/sap/fe/core/messagebundle_ko.properties +40 -3
- package/src/sap/fe/core/messagebundle_lt.properties +40 -3
- package/src/sap/fe/core/messagebundle_lv.properties +40 -3
- package/src/sap/fe/core/messagebundle_ms.properties +40 -3
- package/src/sap/fe/core/messagebundle_nl.properties +40 -3
- package/src/sap/fe/core/messagebundle_no.properties +40 -3
- package/src/sap/fe/core/messagebundle_pl.properties +40 -3
- package/src/sap/fe/core/messagebundle_pt.properties +42 -5
- package/src/sap/fe/core/messagebundle_pt_PT.properties +40 -3
- package/src/sap/fe/core/messagebundle_ro.properties +40 -3
- package/src/sap/fe/core/messagebundle_ru.properties +40 -3
- package/src/sap/fe/core/messagebundle_sh.properties +40 -3
- package/src/sap/fe/core/messagebundle_sk.properties +40 -3
- package/src/sap/fe/core/messagebundle_sl.properties +40 -3
- package/src/sap/fe/core/messagebundle_sv.properties +41 -4
- package/src/sap/fe/core/messagebundle_th.properties +40 -3
- package/src/sap/fe/core/messagebundle_tr.properties +40 -3
- package/src/sap/fe/core/messagebundle_uk.properties +40 -3
- package/src/sap/fe/core/messagebundle_vi.properties +40 -3
- package/src/sap/fe/core/messagebundle_zh_CN.properties +40 -3
- package/src/sap/fe/core/messagebundle_zh_TW.properties +40 -3
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +1 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +1 -1
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +4 -3
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -0
- package/src/sap/fe/core/services/NavigationServiceFactory.js +1 -1
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +1 -1
- package/src/sap/fe/core/services/RoutingServiceFactory.js +98 -328
- package/src/sap/fe/core/services/ShellServicesFactory.js +31 -2
- package/src/sap/fe/core/services/ShellServicesFactory.ts +30 -1
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +8 -5
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +11 -6
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +14 -5
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +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 +8 -37
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +13 -33
- 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 +86 -3
- package/src/sap/fe/core/templating/EntitySetHelper.ts +44 -0
- package/src/sap/fe/core/templating/FilterHelper.js +10 -7
- package/src/sap/fe/core/templating/FilterHelper.ts +8 -6
- 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 +47 -107
- package/src/sap/fe/core/templating/UIFormatters.ts +76 -72
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Control } from "sap/ui/core";
|
|
2
|
+
import { View } from "sap/ui/core/mvc";
|
|
3
|
+
import { Log } from "sap/base";
|
|
4
|
+
import { ODataMetaModel } from "sap/ui/model/odata/v4";
|
|
5
|
+
import { getEntitySetPath } from "sap/fe/core/helpers/ModelHelper";
|
|
6
|
+
import { BaseManifestSettings } from "sap/fe/core/converters/ManifestSettings";
|
|
7
|
+
import { JSONModel } from "sap/ui/model/json";
|
|
8
|
+
import {
|
|
9
|
+
RefreshStrategyType,
|
|
10
|
+
SORefreshStrategy,
|
|
11
|
+
RefreshStrategies,
|
|
12
|
+
PATH_TO_STORE,
|
|
13
|
+
SOAction
|
|
14
|
+
} from "sap/fe/core/helpers/KeepAliveRefreshTypes";
|
|
15
|
+
|
|
16
|
+
// Private functions - start
|
|
17
|
+
const _fnSimplifyEntitySetPath = function(metaModel: ODataMetaModel, entitySetPathToUse: string): string {
|
|
18
|
+
const entitySetPath = getEntitySetPath(entitySetPathToUse);
|
|
19
|
+
const entitySet = entitySetPath.indexOf("$NavigationPropertyBinding") > -1 && metaModel.getObject(entitySetPath);
|
|
20
|
+
return entitySet ? "/" + entitySet : entitySetPathToUse;
|
|
21
|
+
};
|
|
22
|
+
const _fnIsApplicable = function(primaryPath: string, key: string, strategy: RefreshStrategyType): boolean {
|
|
23
|
+
return primaryPath === key || (strategy === RefreshStrategyType.IncludingDependents && primaryPath.startsWith(key));
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Check if given path resides in the context path provided.
|
|
27
|
+
*
|
|
28
|
+
* @param {ODataMetaModel} metaModel MetaModel to be used
|
|
29
|
+
* @param {string} contextPath Context path to be used
|
|
30
|
+
* @param {string} path Path to be used
|
|
31
|
+
* @param {RefreshStrategyType} strategy Strategy, it could be 'self' | 'includingDependents'
|
|
32
|
+
* @returns {boolean} Returns true if the context path is applicable.
|
|
33
|
+
*/
|
|
34
|
+
const _isPathApplicableToContextPath = function(
|
|
35
|
+
metaModel: ODataMetaModel,
|
|
36
|
+
contextPath: string,
|
|
37
|
+
path: string,
|
|
38
|
+
strategy: RefreshStrategyType
|
|
39
|
+
): boolean {
|
|
40
|
+
let contextPathToCheck = contextPath.startsWith("/") ? contextPath : "/" + contextPath,
|
|
41
|
+
pathToCheck = path.startsWith("/") ? path : "/" + path;
|
|
42
|
+
if (!_fnIsApplicable(contextPathToCheck, pathToCheck, strategy)) {
|
|
43
|
+
contextPathToCheck = _fnSimplifyEntitySetPath(metaModel, contextPathToCheck);
|
|
44
|
+
if (!_fnIsApplicable(contextPathToCheck, pathToCheck, strategy)) {
|
|
45
|
+
pathToCheck = _fnSimplifyEntitySetPath(metaModel, pathToCheck);
|
|
46
|
+
} else {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return _fnIsApplicable(contextPathToCheck, pathToCheck, strategy);
|
|
51
|
+
};
|
|
52
|
+
// Private functions - end
|
|
53
|
+
/**
|
|
54
|
+
* Get controls to refresh in a view.
|
|
55
|
+
*
|
|
56
|
+
* @param {View} view View of the controls
|
|
57
|
+
* @param {Control[]} controls Context path to be used
|
|
58
|
+
* @returns {Control[]} Returns controls that need to be refreshed.
|
|
59
|
+
*/
|
|
60
|
+
const getControlsForRefresh = function(view: View, controls: Control[]): Control[] {
|
|
61
|
+
const controlsForRefresh: Control[] = [];
|
|
62
|
+
const metaModel = view.getModel().getMetaModel() as ODataMetaModel;
|
|
63
|
+
const internalModel = view.getModel("internal");
|
|
64
|
+
const refreshStrategy = internalModel.getProperty(PATH_TO_STORE) || {};
|
|
65
|
+
if (controls) {
|
|
66
|
+
controls.forEach(function(control) {
|
|
67
|
+
const contextPath = control.data("targetCollectionPath");
|
|
68
|
+
for (const key in refreshStrategy) {
|
|
69
|
+
const strategy = refreshStrategy[key];
|
|
70
|
+
if (controlsForRefresh.indexOf(control) === -1 && _isPathApplicableToContextPath(metaModel, contextPath, key, strategy)) {
|
|
71
|
+
controlsForRefresh.push(control);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return controlsForRefresh;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Get refresh strategy for the control for a context path.
|
|
80
|
+
*
|
|
81
|
+
* @param {Control} control Control from which refresh info is needed
|
|
82
|
+
* @param {string} contextPath ContextPath for properities
|
|
83
|
+
* @returns {RefreshStrategyType} Returns strategy for control refresh.
|
|
84
|
+
*/
|
|
85
|
+
const getControlRefreshStrategyForContextPath = function(control: Control, contextPath: string): RefreshStrategyType | undefined {
|
|
86
|
+
const metaModel = control.getModel().getMetaModel() as ODataMetaModel;
|
|
87
|
+
const internalModel = control.getModel("internal");
|
|
88
|
+
const refreshStrategy = internalModel.getProperty(PATH_TO_STORE) || {};
|
|
89
|
+
let strategy;
|
|
90
|
+
if (contextPath) {
|
|
91
|
+
for (const key in refreshStrategy) {
|
|
92
|
+
const strategyToCheck = refreshStrategy[key];
|
|
93
|
+
if (_isPathApplicableToContextPath(metaModel, contextPath, key, strategyToCheck)) {
|
|
94
|
+
strategy = strategyToCheck;
|
|
95
|
+
if (strategy === "includingDependents") {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return strategy;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Get refresh info from view.
|
|
105
|
+
*
|
|
106
|
+
* @param {View} view View from which refresh info is needed
|
|
107
|
+
* @returns {RefreshStrategyType | undefined} Returns strategy for view refresh.
|
|
108
|
+
*/
|
|
109
|
+
const getViewRefreshInfo = function(view: View): RefreshStrategyType | undefined {
|
|
110
|
+
const viewData = view.getViewData() as BaseManifestSettings,
|
|
111
|
+
contextPath = viewData && (viewData?.contextPath || "/" + viewData?.entitySet);
|
|
112
|
+
return KeepAliveHelper.getControlRefreshStrategyForContextPath(view, contextPath);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get refresh strategy for an intent.
|
|
117
|
+
*
|
|
118
|
+
* @param {RefreshStrategies} refreshStrategies RefreshStrategies to consider
|
|
119
|
+
* @param {string} semanticObject Outbound Semantic Object
|
|
120
|
+
* @param {string} action Outbound Action
|
|
121
|
+
* @returns {SORefreshStrategy | undefined} Returns refresh strategies to use for the intent.
|
|
122
|
+
*/
|
|
123
|
+
const getRefreshStrategyForIntent = function(
|
|
124
|
+
refreshStrategies: RefreshStrategies,
|
|
125
|
+
semanticObject?: string,
|
|
126
|
+
action?: string
|
|
127
|
+
): SORefreshStrategy | undefined {
|
|
128
|
+
const soAction = semanticObject && action && semanticObject + "-" + action;
|
|
129
|
+
const intents = refreshStrategies.intents;
|
|
130
|
+
const soActionIntentMatch = intents && soAction && intents[soAction];
|
|
131
|
+
const soIntentMatch = !soActionIntentMatch && intents && semanticObject && intents[semanticObject];
|
|
132
|
+
|
|
133
|
+
return soActionIntentMatch || soIntentMatch || refreshStrategies?.defaultBehavior || refreshStrategies?._feDefault;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Store control refresh strategy for hash in the internal model.
|
|
137
|
+
*
|
|
138
|
+
* @param {Control} control Control for the refresh strategy
|
|
139
|
+
* @param {SOAction} hash Shell hash object
|
|
140
|
+
*/
|
|
141
|
+
const storeControlRefreshStrategyForHash = function(control: Control, hash: SOAction): void {
|
|
142
|
+
if (control && control.getModel("viewData") && control.getModel("internal")) {
|
|
143
|
+
const viewData = control.getModel("viewData");
|
|
144
|
+
const refreshStrategies: RefreshStrategies = viewData.getProperty(PATH_TO_STORE);
|
|
145
|
+
if (refreshStrategies) {
|
|
146
|
+
const internalModel = control.getModel("internal");
|
|
147
|
+
const refreshStrategy: SORefreshStrategy | undefined = KeepAliveHelper.getRefreshStrategyForIntent(
|
|
148
|
+
refreshStrategies,
|
|
149
|
+
hash?.semanticObject,
|
|
150
|
+
hash?.action
|
|
151
|
+
);
|
|
152
|
+
(internalModel as JSONModel<{}>).setProperty(PATH_TO_STORE, refreshStrategy);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Method to refresh and restore the view if neccessary.
|
|
159
|
+
*
|
|
160
|
+
* @param {object} view Control for the refresh strategy
|
|
161
|
+
* @returns {object} A promise after view refresh and restore are triggered
|
|
162
|
+
*/
|
|
163
|
+
const restoreView = function(view: View): Promise<any> {
|
|
164
|
+
const internalModelContext = view.getBindingContext("internal");
|
|
165
|
+
const controller = view.getController();
|
|
166
|
+
const viewState = (controller as any)?.viewState;
|
|
167
|
+
let refreshBindings = Promise.resolve();
|
|
168
|
+
if (internalModelContext && internalModelContext.getProperty("restoreStatus") === "pending") {
|
|
169
|
+
if (viewState.refreshViewBindings) {
|
|
170
|
+
refreshBindings = viewState.refreshViewBindings();
|
|
171
|
+
refreshBindings
|
|
172
|
+
.then(function() {
|
|
173
|
+
Log.info("FE V4: Refresh was triggered successfull: " + view.getId());
|
|
174
|
+
})
|
|
175
|
+
.catch(function(err) {
|
|
176
|
+
Log.warning("FE V4: Refresh was unsuccessfull: " + view.getId(), err);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
refreshBindings = refreshBindings
|
|
180
|
+
.then(function() {
|
|
181
|
+
viewState.onRestore();
|
|
182
|
+
internalModelContext.setProperty("restoreStatus", "done");
|
|
183
|
+
})
|
|
184
|
+
.catch(function(error) {
|
|
185
|
+
Log.warning("FE V4: Restore was unsuccessfull: " + view.getId(), error);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return refreshBindings;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* helper class for KeepAlive feature in sap.fe.
|
|
193
|
+
*/
|
|
194
|
+
const KeepAliveHelper = {
|
|
195
|
+
getControlsForRefresh,
|
|
196
|
+
getControlRefreshStrategyForContextPath,
|
|
197
|
+
getViewRefreshInfo,
|
|
198
|
+
getRefreshStrategyForIntent,
|
|
199
|
+
storeControlRefreshStrategyForHash,
|
|
200
|
+
restoreView
|
|
201
|
+
};
|
|
202
|
+
export default KeepAliveHelper;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
sap.ui.define([], function () {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var _exports = {};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Enumeration for supported refresh strategy type
|
|
12
|
+
*/
|
|
13
|
+
var RefreshStrategyType;
|
|
14
|
+
/**
|
|
15
|
+
* Configuration of a RefreshStrategy
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
(function (RefreshStrategyType) {
|
|
19
|
+
RefreshStrategyType["Self"] = "self";
|
|
20
|
+
RefreshStrategyType["IncludingDependents"] = "includingDependents";
|
|
21
|
+
})(RefreshStrategyType || (RefreshStrategyType = {}));
|
|
22
|
+
|
|
23
|
+
_exports.RefreshStrategyType = RefreshStrategyType;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Path used to store information
|
|
27
|
+
*/
|
|
28
|
+
var PATH_TO_STORE = "/refreshStrategyOnAppRestore";
|
|
29
|
+
_exports.PATH_TO_STORE = PATH_TO_STORE;
|
|
30
|
+
return _exports;
|
|
31
|
+
}, false);
|
|
32
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIktlZXBBbGl2ZVJlZnJlc2hUeXBlcy50cyJdLCJuYW1lcyI6WyJSZWZyZXNoU3RyYXRlZ3lUeXBlIiwiUEFUSF9UT19TVE9SRSJdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTs7Ozs7O0FBRkE7QUFDQTtBQUNBO01BQ1lBLG1CO0FBSVo7QUFDQTtBQUNBOzthQU5ZQSxtQjtBQUFBQSxJQUFBQSxtQjtBQUFBQSxJQUFBQSxtQjtLQUFBQSxtQixLQUFBQSxtQjs7OztBQTZCWjtBQUNBO0FBQ0E7QUFDTyxNQUFNQyxhQUFxQixHQUFHLDhCQUE5QiIsInNvdXJjZVJvb3QiOiIuIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFbnVtZXJhdGlvbiBmb3Igc3VwcG9ydGVkIHJlZnJlc2ggc3RyYXRlZ3kgdHlwZVxuICovXG5leHBvcnQgZW51bSBSZWZyZXNoU3RyYXRlZ3lUeXBlIHtcblx0U2VsZiA9IFwic2VsZlwiLFxuXHRJbmNsdWRpbmdEZXBlbmRlbnRzID0gXCJpbmNsdWRpbmdEZXBlbmRlbnRzXCJcbn1cbi8qKlxuICogQ29uZmlndXJhdGlvbiBvZiBhIFJlZnJlc2hTdHJhdGVneVxuICovXG5leHBvcnQgdHlwZSBTT1JlZnJlc2hTdHJhdGVneSA9IHtcblx0W2VudGl0eVNldE5hbWVPckNvbnRleHRQYXRoOiBzdHJpbmddOiBSZWZyZXNoU3RyYXRlZ3lUeXBlO1xufTtcbi8qKlxuICogQ29uZmlndXJhdGlvbiBvZiBhIFJlZnJlc2hTdHJhdGVnaWVzXG4gKi9cbmV4cG9ydCB0eXBlIFJlZnJlc2hTdHJhdGVnaWVzID0ge1xuXHRpbnRlbnRzPzoge1xuXHRcdFtzb0FjdGlvbjogc3RyaW5nXTogU09SZWZyZXNoU3RyYXRlZ3k7IC8vICdzb0FjdGlvbicgZm9ybWF0IGlzIFwiPFNlbWFudGljT2JqZWN0Pi08QWN0aW9uPlwiXG5cdH07XG5cdGRlZmF1bHRCZWhhdmlvcj86IFNPUmVmcmVzaFN0cmF0ZWd5O1xuXHRfZmVEZWZhdWx0PzogU09SZWZyZXNoU3RyYXRlZ3k7XG59O1xuXG4vKipcbiAqIENvbmZpZ3VyYXRpb24gZm9yIGhhc2ggd2l0aCBzZW1hbnRpY09iamVjdCBhbmQgYWN0aW9uXG4gKi9cbmV4cG9ydCB0eXBlIFNPQWN0aW9uID0ge1xuXHRzZW1hbnRpY09iamVjdD86IHN0cmluZztcblx0YWN0aW9uPzogc3RyaW5nO1xufTtcblxuLyoqXG4gKiBQYXRoIHVzZWQgdG8gc3RvcmUgaW5mb3JtYXRpb25cbiAqL1xuZXhwb3J0IGNvbnN0IFBBVEhfVE9fU1RPUkU6IHN0cmluZyA9IFwiL3JlZnJlc2hTdHJhdGVneU9uQXBwUmVzdG9yZVwiO1xuIl19
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumeration for supported refresh strategy type
|
|
3
|
+
*/
|
|
4
|
+
export enum RefreshStrategyType {
|
|
5
|
+
Self = "self",
|
|
6
|
+
IncludingDependents = "includingDependents"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Configuration of a RefreshStrategy
|
|
10
|
+
*/
|
|
11
|
+
export type SORefreshStrategy = {
|
|
12
|
+
[entitySetNameOrContextPath: string]: RefreshStrategyType;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Configuration of a RefreshStrategies
|
|
16
|
+
*/
|
|
17
|
+
export type RefreshStrategies = {
|
|
18
|
+
intents?: {
|
|
19
|
+
[soAction: string]: SORefreshStrategy; // 'soAction' format is "<SemanticObject>-<Action>"
|
|
20
|
+
};
|
|
21
|
+
defaultBehavior?: SORefreshStrategy;
|
|
22
|
+
_feDefault?: SORefreshStrategy;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for hash with semanticObject and action
|
|
27
|
+
*/
|
|
28
|
+
export type SOAction = {
|
|
29
|
+
semanticObject?: string;
|
|
30
|
+
action?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Path used to store information
|
|
35
|
+
*/
|
|
36
|
+
export const PATH_TO_STORE: string = "/refreshStrategyOnAppRestore";
|