@sapui5/sap.fe.core 1.93.3 → 1.96.2
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 +2 -2
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AppComponent.js +9 -40
- package/src/sap/fe/core/BusyLocker.js +12 -0
- package/src/sap/fe/core/CommonUtils.js +430 -27
- package/src/sap/fe/core/ExtensionAPI.js +1 -1
- package/src/sap/fe/core/PageController.js +13 -2
- package/src/sap/fe/core/TemplateComponent.js +6 -0
- package/src/sap/fe/core/TransactionHelper.js +248 -170
- package/src/sap/fe/core/actions/draft.js +13 -1
- package/src/sap/fe/core/actions/operations.js +165 -45
- package/src/sap/fe/core/controllerextensions/EditFlow.js +56 -37
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +13 -6
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +127 -24
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +183 -164
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +834 -170
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +890 -189
- package/src/sap/fe/core/controllerextensions/PageReady.js +48 -33
- package/src/sap/fe/core/controllerextensions/PageReady.ts +49 -14
- package/src/sap/fe/core/controllerextensions/Paginator.js +150 -0
- package/src/sap/fe/core/controllerextensions/Placeholder.js +133 -270
- package/src/sap/fe/core/controllerextensions/Share.js +31 -13
- package/src/sap/fe/core/controllerextensions/SideEffects.js +5 -6
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +13 -12
- package/src/sap/fe/core/controllerextensions/ViewState.js +173 -6
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +39 -34
- package/src/sap/fe/core/controls/ActionParameterDialogValueHelp.fragment.xml +35 -0
- package/src/sap/fe/core/controls/ActionPartial.fragment.xml +1 -1
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +3 -0
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +45 -0
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +15 -4
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +250 -94
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +129 -135
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +325 -0
- package/src/sap/fe/core/converters/ConverterContext.js +19 -5
- package/src/sap/fe/core/converters/ConverterContext.ts +13 -3
- package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +9 -2
- package/src/sap/fe/core/converters/ManifestWrapper.js +9 -9
- package/src/sap/fe/core/converters/MetaModelConverter.js +858 -871
- package/src/sap/fe/core/converters/MetaModelConverter.ts +763 -826
- package/src/sap/fe/core/converters/TemplateConverter.js +4 -4
- package/src/sap/fe/core/converters/annotations/DataField.js +57 -7
- package/src/sap/fe/core/converters/annotations/DataField.ts +52 -2
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +80 -46
- package/src/sap/fe/core/converters/controls/Common/Action.js +56 -54
- package/src/sap/fe/core/converters/controls/Common/Action.ts +48 -36
- package/src/sap/fe/core/converters/controls/Common/Chart.js +101 -9
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +100 -5
- package/src/sap/fe/core/converters/controls/Common/Criticality.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +15 -16
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +16 -30
- package/src/sap/fe/core/converters/controls/Common/Form.js +21 -12
- package/src/sap/fe/core/converters/controls/Common/Form.ts +28 -8
- package/src/sap/fe/core/converters/controls/Common/KPI.js +287 -109
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +314 -139
- package/src/sap/fe/core/converters/controls/Common/Table.js +414 -171
- package/src/sap/fe/core/converters/controls/Common/Table.ts +412 -130
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +487 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +541 -0
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +364 -0
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +338 -0
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +74 -0
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +50 -0
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +11 -11
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +47 -35
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +45 -29
- package/src/sap/fe/core/converters/helpers/Aggregation.js +31 -32
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +26 -27
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +27 -2
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +22 -2
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +1 -1
- package/src/sap/fe/core/converters/helpers/ID.js +1 -3
- package/src/sap/fe/core/converters/helpers/ID.ts +2 -3
- package/src/sap/fe/core/converters/helpers/IssueManager.js +5 -4
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +4 -3
- package/src/sap/fe/core/converters/helpers/Key.js +3 -3
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +11 -6
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +9 -5
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +18 -5
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +14 -14
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +91 -20
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +77 -5
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +76 -714
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +75 -807
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +106 -17
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +121 -16
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
- 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/KPIFormatter.js +1 -1
- package/src/sap/fe/core/formatters/TableFormatter.js +1 -1
- package/src/sap/fe/core/formatters/TableFormatterTypes.js +1 -1
- package/src/sap/fe/core/formatters/ValueFormatter.js +1 -1
- package/src/sap/fe/core/fpm/Component.js +1 -1
- package/src/sap/fe/core/helpers/AnnotationEnum.js +3 -3
- package/src/sap/fe/core/helpers/BindingExpression.js +6 -6
- package/src/sap/fe/core/helpers/ClassSupport.js +4 -4
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +0 -2
- package/src/sap/fe/core/helpers/ModelHelper.js +27 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +6 -0
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +2 -2
- package/src/sap/fe/core/helpers/StableIdHelper.js +1 -1
- package/src/sap/fe/core/helpers/StableIdHelper.ts +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.js +2 -2
- package/src/sap/fe/core/jsx-runtime/jsxs.js +1 -1
- package/src/sap/fe/core/library.js +1 -1
- package/src/sap/fe/core/messagebundle.properties +30 -1
- package/src/sap/fe/core/messagebundle_ar.properties +43 -1
- package/src/sap/fe/core/messagebundle_bg.properties +42 -0
- package/src/sap/fe/core/messagebundle_ca.properties +44 -2
- package/src/sap/fe/core/messagebundle_cs.properties +42 -0
- package/src/sap/fe/core/messagebundle_cy.properties +42 -0
- package/src/sap/fe/core/messagebundle_da.properties +43 -1
- package/src/sap/fe/core/messagebundle_de.properties +45 -3
- package/src/sap/fe/core/messagebundle_el.properties +43 -1
- package/src/sap/fe/core/messagebundle_en.properties +42 -0
- package/src/sap/fe/core/messagebundle_en_GB.properties +43 -1
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +43 -1
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +48 -0
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +42 -0
- package/src/sap/fe/core/messagebundle_es.properties +50 -8
- package/src/sap/fe/core/messagebundle_es_MX.properties +45 -3
- package/src/sap/fe/core/messagebundle_et.properties +42 -0
- package/src/sap/fe/core/messagebundle_fi.properties +42 -0
- package/src/sap/fe/core/messagebundle_fr.properties +51 -9
- package/src/sap/fe/core/messagebundle_fr_CA.properties +42 -0
- package/src/sap/fe/core/messagebundle_hi.properties +43 -1
- package/src/sap/fe/core/messagebundle_hr.properties +43 -1
- package/src/sap/fe/core/messagebundle_hu.properties +42 -0
- package/src/sap/fe/core/messagebundle_id.properties +43 -1
- package/src/sap/fe/core/messagebundle_it.properties +43 -1
- package/src/sap/fe/core/messagebundle_iw.properties +44 -2
- package/src/sap/fe/core/messagebundle_ja.properties +43 -1
- package/src/sap/fe/core/messagebundle_kk.properties +43 -1
- package/src/sap/fe/core/messagebundle_ko.properties +43 -1
- package/src/sap/fe/core/messagebundle_lt.properties +43 -1
- package/src/sap/fe/core/messagebundle_lv.properties +43 -1
- package/src/sap/fe/core/messagebundle_ms.properties +43 -1
- package/src/sap/fe/core/messagebundle_nl.properties +47 -5
- package/src/sap/fe/core/messagebundle_no.properties +44 -2
- package/src/sap/fe/core/messagebundle_pl.properties +43 -1
- package/src/sap/fe/core/messagebundle_pt.properties +43 -1
- package/src/sap/fe/core/messagebundle_pt_PT.properties +43 -1
- package/src/sap/fe/core/messagebundle_ro.properties +43 -1
- package/src/sap/fe/core/messagebundle_ru.properties +43 -1
- package/src/sap/fe/core/messagebundle_sh.properties +43 -1
- package/src/sap/fe/core/messagebundle_sk.properties +42 -0
- package/src/sap/fe/core/messagebundle_sl.properties +43 -1
- package/src/sap/fe/core/messagebundle_sv.properties +43 -1
- package/src/sap/fe/core/messagebundle_th.properties +42 -0
- package/src/sap/fe/core/messagebundle_tr.properties +42 -0
- package/src/sap/fe/core/messagebundle_uk.properties +42 -0
- package/src/sap/fe/core/messagebundle_vi.properties +43 -1
- package/src/sap/fe/core/messagebundle_zh_CN.properties +43 -1
- package/src/sap/fe/core/messagebundle_zh_TW.properties +43 -1
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +5 -5
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +5 -5
- package/src/sap/fe/core/services/RoutingServiceFactory.js +155 -76
- package/src/sap/fe/core/services/ShellServicesFactory.js +9 -9
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +11 -12
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +11 -1
- package/src/sap/fe/core/support/AnnotationIssue.support.js +2 -4
- package/src/sap/fe/core/support/CollectionFacetMissingID.support.js +2 -4
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -4
- package/src/sap/fe/core/support/CommonHelper.js +2 -4
- package/src/sap/fe/core/support/Diagnostics.js +1 -1
- package/src/sap/fe/core/templating/CriticalityFormatters.js +4 -4
- package/src/sap/fe/core/templating/DataFieldFormatters.js +1 -1
- package/src/sap/fe/core/templating/DataModelPathHelper.js +54 -6
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +54 -4
- package/src/sap/fe/core/templating/EntitySetHelper.js +13 -3
- package/src/sap/fe/core/templating/EntitySetHelper.ts +4 -0
- package/src/sap/fe/core/templating/FieldControlHelper.js +1 -1
- package/src/sap/fe/core/templating/FilterHelper.js +23 -5
- package/src/sap/fe/core/templating/FilterHelper.ts +15 -1
- package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
- package/src/sap/fe/core/templating/PropertyFormatters.js +1 -1
- package/src/sap/fe/core/templating/PropertyHelper.js +8 -8
- package/src/sap/fe/core/templating/UIFormatters.js +72 -4
- package/src/sap/fe/core/templating/UIFormatters.ts +98 -3
- package/src/sap/fe/core/type/Email.js +1 -1
|
@@ -38,143 +38,6 @@ sap.ui.define(
|
|
|
38
38
|
ModelHelper
|
|
39
39
|
) {
|
|
40
40
|
"use strict";
|
|
41
|
-
|
|
42
|
-
//////////////////////////////////////////////
|
|
43
|
-
// Helper functions for semantic keys
|
|
44
|
-
//////////////////////////////////////////////
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Creates the filter to retrieve a context corresponding to a semantic path.
|
|
48
|
-
*
|
|
49
|
-
* @param {string} sSemanticPath The semantic path
|
|
50
|
-
* @param {Array} aSemanticKeys The semantic keys for the path
|
|
51
|
-
* @returns {sap.ui.model.Filter} The filter
|
|
52
|
-
*
|
|
53
|
-
* @ui5-restricted
|
|
54
|
-
*/
|
|
55
|
-
function createFilterFromSemanticPath(sSemanticPath, aSemanticKeys) {
|
|
56
|
-
var aKeyValues = sSemanticPath.substring(sSemanticPath.indexOf("(") + 1, sSemanticPath.length - 1).split(","),
|
|
57
|
-
aFilters;
|
|
58
|
-
|
|
59
|
-
if (aSemanticKeys.length != aKeyValues.length) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (aSemanticKeys.length === 1) {
|
|
64
|
-
// Take the first key value
|
|
65
|
-
var sKeyValue = aKeyValues[0];
|
|
66
|
-
if (sKeyValue.indexOf("'") === 0 && sKeyValue.lastIndexOf("'") === sKeyValue.length - 1) {
|
|
67
|
-
// Remove the quotes from the value and decode special chars
|
|
68
|
-
sKeyValue = decodeURIComponent(sKeyValue.substring(1, sKeyValue.length - 1));
|
|
69
|
-
}
|
|
70
|
-
aFilters = [new Filter(aSemanticKeys[0].$PropertyPath, FilterOperator.EQ, sKeyValue)];
|
|
71
|
-
} else {
|
|
72
|
-
var mKeyValues = {};
|
|
73
|
-
// Create a map of all key values
|
|
74
|
-
aKeyValues.forEach(function(sKeyAssignment) {
|
|
75
|
-
var aParts = sKeyAssignment.split("="),
|
|
76
|
-
sKeyValue = aParts[1];
|
|
77
|
-
|
|
78
|
-
if (sKeyValue.indexOf("'") === 0 && sKeyValue.lastIndexOf("'") === sKeyValue.length - 1) {
|
|
79
|
-
// Remove the quotes from the value and decode special chars
|
|
80
|
-
sKeyValue = decodeURIComponent(sKeyValue.substring(1, sKeyValue.length - 1));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
mKeyValues[aParts[0]] = sKeyValue;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
var bFailed = false;
|
|
87
|
-
aFilters = aSemanticKeys.map(function(oSemanticKey) {
|
|
88
|
-
var sKey = oSemanticKey.$PropertyPath,
|
|
89
|
-
sValue = mKeyValues[sKey];
|
|
90
|
-
|
|
91
|
-
if (sValue !== undefined) {
|
|
92
|
-
return new Filter(sKey, FilterOperator.EQ, sValue);
|
|
93
|
-
} else {
|
|
94
|
-
bFailed = true;
|
|
95
|
-
return "XX";
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
if (bFailed) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Add a draft filter to make sure we take the draft entity if there is one
|
|
105
|
-
// Or the active entity otherwise
|
|
106
|
-
var oDraftFilter = new Filter({
|
|
107
|
-
filters: [new Filter("IsActiveEntity", "EQ", false), new Filter("SiblingEntity/IsActiveEntity", "EQ", null)],
|
|
108
|
-
and: false
|
|
109
|
-
});
|
|
110
|
-
aFilters.push(oDraftFilter);
|
|
111
|
-
|
|
112
|
-
var oCombinedFilter = new Filter(aFilters, true);
|
|
113
|
-
return oCombinedFilter;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Converts a path with semantic keys to a path with technical keys.
|
|
118
|
-
*
|
|
119
|
-
* @param {string} sSemanticPath The path with semantic keys
|
|
120
|
-
* @param {sap.ui.model.odata.v4.ODataModel} oModel The model for the path
|
|
121
|
-
* @param {Array} aSemanticKeys The semantic keys for the path
|
|
122
|
-
* @returns {Promise} A Promise containing the path with technical keys if sSemanticPath could be interpreted as a semantic path, null otherwise
|
|
123
|
-
*
|
|
124
|
-
* @ui5-restricted
|
|
125
|
-
*/
|
|
126
|
-
function getTechnicalPathFromSemanticPath(sSemanticPath, oModel, aSemanticKeys) {
|
|
127
|
-
var oMetaModel = oModel.getMetaModel(),
|
|
128
|
-
sEntitySetName = oMetaModel.getMetaContext(sSemanticPath).getPath();
|
|
129
|
-
|
|
130
|
-
if (!aSemanticKeys || aSemanticKeys.length === 0) {
|
|
131
|
-
// No semantic keys
|
|
132
|
-
return Promise.resolve(null);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Create a set of filters corresponding to all keys
|
|
136
|
-
var oFilter = createFilterFromSemanticPath(sSemanticPath, aSemanticKeys);
|
|
137
|
-
if (oFilter === null) {
|
|
138
|
-
// Couldn't interpret the path as a semantic one
|
|
139
|
-
return Promise.resolve(null);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Load the corresponding object
|
|
143
|
-
var oListBinding = oModel.bindList("/" + sEntitySetName, undefined, undefined, oFilter, { "$$groupId": "$auto.Heroes" });
|
|
144
|
-
|
|
145
|
-
return oListBinding.requestContexts(0, 2).then(function(oContexts) {
|
|
146
|
-
if (oContexts && oContexts.length) {
|
|
147
|
-
return oContexts[0].getPath();
|
|
148
|
-
} else {
|
|
149
|
-
// No data could be loaded
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Checks if a path is eligible for semantic bookmarking.
|
|
157
|
-
*
|
|
158
|
-
* @param {string} sPath The path to test
|
|
159
|
-
* @param {sap.ui.model.odata.v4.ODataMetaModel} oMetaModel The associated metadata model
|
|
160
|
-
* @returns {boolean} `true` is the path is eligible
|
|
161
|
-
*
|
|
162
|
-
* @ui5-restricted
|
|
163
|
-
*/
|
|
164
|
-
function checkPathForSemanticBookmarking(sPath, oMetaModel) {
|
|
165
|
-
// Only path on root objects allow semantic bookmarking, i.e. sPath = xxx(yyy)
|
|
166
|
-
var aMatches = /^[\/]?(\w+)\([^\/]+\)$/.exec(sPath);
|
|
167
|
-
if (!aMatches) {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
// Get the entitySet name
|
|
171
|
-
var sEntitySetPath = "/" + aMatches[1];
|
|
172
|
-
// Check the entity set supports draft (otherwise we don't support semantic bookmarking)
|
|
173
|
-
var oDraftRoot = oMetaModel.getObject(sEntitySetPath + "@com.sap.vocabularies.Common.v1.DraftRoot");
|
|
174
|
-
var oDraftNode = oMetaModel.getObject(sEntitySetPath + "@com.sap.vocabularies.Common.v1.DraftNode");
|
|
175
|
-
return oDraftRoot || oDraftNode ? true : false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
41
|
/**
|
|
179
42
|
* {@link sap.ui.core.mvc.ControllerExtension Controller extension}
|
|
180
43
|
*
|
|
@@ -241,12 +104,14 @@ sap.ui.define(
|
|
|
241
104
|
|
|
242
105
|
/**
|
|
243
106
|
* Navigates to the specified navigation target.
|
|
107
|
+
*
|
|
244
108
|
* @param {sap.ui.model.odata.v4.Context} oContext Context instance
|
|
245
109
|
* @param {string} sNavigationTargetName Navigation target name
|
|
246
|
-
* @param oSemanticObject
|
|
110
|
+
* @param {object} oSemanticObject Semantic object
|
|
111
|
+
* @param {boolean} bPreserveHistory True to force the new URL to be added at the end of the browser history (no replace)
|
|
247
112
|
* @ui5-restricted
|
|
248
113
|
*/
|
|
249
|
-
navigateToTarget: function(oContext, sNavigationTargetName, oSemanticObject) {
|
|
114
|
+
navigateToTarget: function(oContext, sNavigationTargetName, oSemanticObject, bPreserveHistory) {
|
|
250
115
|
var oNavigationConfiguration =
|
|
251
116
|
this._oPageComponent &&
|
|
252
117
|
this._oPageComponent.getNavigationConfiguration &&
|
|
@@ -255,9 +120,9 @@ sap.ui.define(
|
|
|
255
120
|
var oDetailRoute = oNavigationConfiguration.detail;
|
|
256
121
|
var sRouteName = oDetailRoute.route;
|
|
257
122
|
var mParameterMapping = oDetailRoute.parameters;
|
|
258
|
-
this._oRoutingService.navigateTo(oContext, sRouteName, mParameterMapping,
|
|
123
|
+
this._oRoutingService.navigateTo(oContext, sRouteName, mParameterMapping, bPreserveHistory, oSemanticObject);
|
|
259
124
|
} else {
|
|
260
|
-
this._oRoutingService.navigateTo(oContext, null, null,
|
|
125
|
+
this._oRoutingService.navigateTo(oContext, null, null, bPreserveHistory);
|
|
261
126
|
}
|
|
262
127
|
this._oView.getViewData();
|
|
263
128
|
},
|
|
@@ -455,11 +320,12 @@ sap.ui.define(
|
|
|
455
320
|
|
|
456
321
|
this.onRouteMatched();
|
|
457
322
|
|
|
458
|
-
var
|
|
323
|
+
var oModel = this._oView.getModel(),
|
|
324
|
+
oOut;
|
|
459
325
|
if (bDeferred) {
|
|
460
326
|
oOut = this._bindDeferred(sTarget, oNavigationParameters);
|
|
461
327
|
} else {
|
|
462
|
-
oOut = this._bindPage(sTarget, oNavigationParameters);
|
|
328
|
+
oOut = this._bindPage(sTarget, oModel, oNavigationParameters);
|
|
463
329
|
}
|
|
464
330
|
var that = this;
|
|
465
331
|
// eslint-disable-next-line promise/catch-or-return
|
|
@@ -510,19 +376,20 @@ sap.ui.define(
|
|
|
510
376
|
* Sets the binding context of the page from a path.
|
|
511
377
|
*
|
|
512
378
|
* @param {string} sTargetPath The path to the context
|
|
379
|
+
* @param {sap.ui.model.odata.v4.ODataModel} oModel The OData model
|
|
513
380
|
* @param {object} oNavigationParameters Navigation parameters
|
|
514
381
|
* @returns {Promise}
|
|
515
382
|
* @ui5-restricted
|
|
516
383
|
*/
|
|
517
|
-
_bindPage: function(sTargetPath, oNavigationParameters) {
|
|
384
|
+
_bindPage: function(sTargetPath, oModel, oNavigationParameters) {
|
|
518
385
|
var that = this;
|
|
519
386
|
|
|
520
387
|
if (sTargetPath === "") {
|
|
521
|
-
return Promise.resolve(this._bindPageToContext(null, oNavigationParameters));
|
|
388
|
+
return Promise.resolve(this._bindPageToContext(null, oModel, oNavigationParameters));
|
|
522
389
|
} else {
|
|
523
|
-
return this._resolveSemanticPath(sTargetPath)
|
|
390
|
+
return this._resolveSemanticPath(sTargetPath, oModel)
|
|
524
391
|
.then(function(sTechnicalPath) {
|
|
525
|
-
that._bindPageToPath(sTechnicalPath, oNavigationParameters);
|
|
392
|
+
that._bindPageToPath(sTechnicalPath, oModel, oNavigationParameters);
|
|
526
393
|
})
|
|
527
394
|
.catch(function(oError) {
|
|
528
395
|
// Error handling for erroneous metadata request
|
|
@@ -537,16 +404,163 @@ sap.ui.define(
|
|
|
537
404
|
},
|
|
538
405
|
|
|
539
406
|
/**
|
|
540
|
-
*
|
|
407
|
+
* Creates the filter to retrieve a context corresponding to a semantic path.
|
|
408
|
+
*
|
|
409
|
+
* @param {string} sSemanticPath The semantic path
|
|
410
|
+
* @param {Array} aSemanticKeys The semantic keys for the path
|
|
411
|
+
* @param {object} oMetaModel The instance of the meta model
|
|
412
|
+
* @returns {sap.ui.model.Filter} The filter
|
|
541
413
|
*
|
|
414
|
+
* @ui5-restricted
|
|
415
|
+
*/
|
|
416
|
+
_createFilterFromSemanticPath: function(sSemanticPath, aSemanticKeys, oMetaModel) {
|
|
417
|
+
var aKeyValues = sSemanticPath.substring(sSemanticPath.indexOf("(") + 1, sSemanticPath.length - 1).split(","),
|
|
418
|
+
aFilters;
|
|
419
|
+
|
|
420
|
+
if (aSemanticKeys.length != aKeyValues.length) {
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
var bFilteringCaseSensitive = ModelHelper.isFilteringCaseSensitive(oMetaModel);
|
|
425
|
+
|
|
426
|
+
if (aSemanticKeys.length === 1) {
|
|
427
|
+
// Take the first key value
|
|
428
|
+
var sKeyValue = aKeyValues[0];
|
|
429
|
+
if (sKeyValue.indexOf("'") === 0 && sKeyValue.lastIndexOf("'") === sKeyValue.length - 1) {
|
|
430
|
+
// Remove the quotes from the value and decode special chars
|
|
431
|
+
sKeyValue = decodeURIComponent(sKeyValue.substring(1, sKeyValue.length - 1));
|
|
432
|
+
}
|
|
433
|
+
aFilters = [
|
|
434
|
+
new Filter({
|
|
435
|
+
path: aSemanticKeys[0].$PropertyPath,
|
|
436
|
+
operator: FilterOperator.EQ,
|
|
437
|
+
value1: sKeyValue,
|
|
438
|
+
caseSensitive: bFilteringCaseSensitive
|
|
439
|
+
})
|
|
440
|
+
];
|
|
441
|
+
} else {
|
|
442
|
+
var mKeyValues = {};
|
|
443
|
+
// Create a map of all key values
|
|
444
|
+
aKeyValues.forEach(function(sKeyAssignment) {
|
|
445
|
+
var aParts = sKeyAssignment.split("="),
|
|
446
|
+
sKeyValue = aParts[1];
|
|
447
|
+
|
|
448
|
+
if (sKeyValue.indexOf("'") === 0 && sKeyValue.lastIndexOf("'") === sKeyValue.length - 1) {
|
|
449
|
+
// Remove the quotes from the value and decode special chars
|
|
450
|
+
sKeyValue = decodeURIComponent(sKeyValue.substring(1, sKeyValue.length - 1));
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
mKeyValues[aParts[0]] = sKeyValue;
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
var bFailed = false;
|
|
457
|
+
aFilters = aSemanticKeys.map(function(oSemanticKey) {
|
|
458
|
+
var sKey = oSemanticKey.$PropertyPath,
|
|
459
|
+
sValue = mKeyValues[sKey];
|
|
460
|
+
|
|
461
|
+
if (sValue !== undefined) {
|
|
462
|
+
return new Filter({
|
|
463
|
+
path: sKey,
|
|
464
|
+
operator: FilterOperator.EQ,
|
|
465
|
+
value1: sValue,
|
|
466
|
+
caseSensitive: bFilteringCaseSensitive
|
|
467
|
+
});
|
|
468
|
+
} else {
|
|
469
|
+
bFailed = true;
|
|
470
|
+
return "XX";
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
if (bFailed) {
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// Add a draft filter to make sure we take the draft entity if there is one
|
|
480
|
+
// Or the active entity otherwise
|
|
481
|
+
var oDraftFilter = new Filter({
|
|
482
|
+
filters: [new Filter("IsActiveEntity", "EQ", false), new Filter("SiblingEntity/IsActiveEntity", "EQ", null)],
|
|
483
|
+
and: false
|
|
484
|
+
});
|
|
485
|
+
aFilters.push(oDraftFilter);
|
|
486
|
+
|
|
487
|
+
var oCombinedFilter = new Filter(aFilters, true);
|
|
488
|
+
return oCombinedFilter;
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Converts a path with semantic keys to a path with technical keys.
|
|
493
|
+
*
|
|
494
|
+
* @param {string} sSemanticPath The path with semantic keys
|
|
495
|
+
* @param {sap.ui.model.odata.v4.ODataModel} oModel The model for the path
|
|
496
|
+
* @param {Array} aSemanticKeys The semantic keys for the path
|
|
497
|
+
* @returns {Promise} A Promise containing the path with technical keys if sSemanticPath could be interpreted as a semantic path, null otherwise
|
|
498
|
+
*
|
|
499
|
+
* @ui5-restricted
|
|
500
|
+
*/
|
|
501
|
+
_getTechnicalPathFromSemanticPath: function(sSemanticPath, oModel, aSemanticKeys) {
|
|
502
|
+
var oMetaModel = oModel.getMetaModel(),
|
|
503
|
+
sEntitySetName = oMetaModel.getMetaContext(sSemanticPath).getPath();
|
|
504
|
+
|
|
505
|
+
if (!aSemanticKeys || aSemanticKeys.length === 0) {
|
|
506
|
+
// No semantic keys
|
|
507
|
+
return Promise.resolve(null);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// Create a set of filters corresponding to all keys
|
|
511
|
+
var oFilter = this._createFilterFromSemanticPath(sSemanticPath, aSemanticKeys, oMetaModel);
|
|
512
|
+
if (oFilter === null) {
|
|
513
|
+
// Couldn't interpret the path as a semantic one
|
|
514
|
+
return Promise.resolve(null);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// Load the corresponding object
|
|
518
|
+
var oListBinding = oModel.bindList("/" + sEntitySetName, undefined, undefined, oFilter, {
|
|
519
|
+
"$$groupId": "$auto.Heroes"
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
return oListBinding.requestContexts(0, 2).then(function(oContexts) {
|
|
523
|
+
if (oContexts && oContexts.length) {
|
|
524
|
+
return oContexts[0].getPath();
|
|
525
|
+
} else {
|
|
526
|
+
// No data could be loaded
|
|
527
|
+
return null;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
},
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Checks if a path is eligible for semantic bookmarking.
|
|
534
|
+
*
|
|
535
|
+
* @param {string} sPath The path to test
|
|
536
|
+
* @param {sap.ui.model.odata.v4.ODataMetaModel} oMetaModel The associated metadata model
|
|
537
|
+
* @returns {boolean} `true` if the path is eligible
|
|
538
|
+
*
|
|
539
|
+
* @ui5-restricted
|
|
540
|
+
*/
|
|
541
|
+
_checkPathForSemanticBookmarking: function(sPath, oMetaModel) {
|
|
542
|
+
// Only path on root objects allow semantic bookmarking, i.e. sPath = xxx(yyy)
|
|
543
|
+
var aMatches = /^[\/]?(\w+)\([^\/]+\)$/.exec(sPath);
|
|
544
|
+
if (!aMatches) {
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
// Get the entitySet name
|
|
548
|
+
var sEntitySetPath = "/" + aMatches[1];
|
|
549
|
+
// Check the entity set supports draft (otherwise we don't support semantic bookmarking)
|
|
550
|
+
var oDraftRoot = oMetaModel.getObject(sEntitySetPath + "@com.sap.vocabularies.Common.v1.DraftRoot");
|
|
551
|
+
var oDraftNode = oMetaModel.getObject(sEntitySetPath + "@com.sap.vocabularies.Common.v1.DraftNode");
|
|
552
|
+
return oDraftRoot || oDraftNode ? true : false;
|
|
553
|
+
},
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Builds a path with semantic keys from a path with technical keys.
|
|
542
557
|
* @param {string} sPathToResolve The path to be transformed
|
|
558
|
+
* @param oModel
|
|
543
559
|
* @returns {Promise} String promise for the new path. If sPathToResolved couldn't be interpreted as a semantic path, it is returned as is.
|
|
544
|
-
*
|
|
545
560
|
* @ui5-restricted
|
|
546
561
|
*/
|
|
547
|
-
_resolveSemanticPath: function(sPathToResolve) {
|
|
548
|
-
var
|
|
549
|
-
oMetaModel = oModel.getMetaModel(),
|
|
562
|
+
_resolveSemanticPath: function(sPathToResolve, oModel) {
|
|
563
|
+
var oMetaModel = oModel.getMetaModel(),
|
|
550
564
|
oLastSemanticMapping = this._oRoutingService.getLastSemanticMapping(),
|
|
551
565
|
sCurrentHashNoParams = this._oRouter
|
|
552
566
|
.getHashChanger()
|
|
@@ -563,7 +577,7 @@ sap.ui.define(
|
|
|
563
577
|
if (sRootEntityName.indexOf("/") === 0) {
|
|
564
578
|
sRootEntityName = sRootEntityName.substring(1);
|
|
565
579
|
}
|
|
566
|
-
var bAllowSemanticBookmark =
|
|
580
|
+
var bAllowSemanticBookmark = this._checkPathForSemanticBookmarking(sCurrentHashNoParams, oMetaModel),
|
|
567
581
|
aSemanticKeys = bAllowSemanticBookmark && SemanticKeyHelper.getSemanticKeys(oMetaModel, sRootEntityName);
|
|
568
582
|
if (!aSemanticKeys) {
|
|
569
583
|
// No semantic keys available --> use the path as is
|
|
@@ -573,7 +587,9 @@ sap.ui.define(
|
|
|
573
587
|
return Promise.resolve(oLastSemanticMapping.technicalPath);
|
|
574
588
|
} else {
|
|
575
589
|
// We need resolve the semantic path to get the technical keys
|
|
576
|
-
return
|
|
590
|
+
return this._getTechnicalPathFromSemanticPath(sCurrentHashNoParams, oModel, aSemanticKeys).then(function(
|
|
591
|
+
sTechnicalPath
|
|
592
|
+
) {
|
|
577
593
|
if (sTechnicalPath && sTechnicalPath !== sPathToResolve) {
|
|
578
594
|
// The semantic path was resolved (otherwise keep the original value for target)
|
|
579
595
|
that._oRoutingService.setLastSemanticMapping({
|
|
@@ -592,11 +608,12 @@ sap.ui.define(
|
|
|
592
608
|
* Sets the binding context of the page from a path.
|
|
593
609
|
*
|
|
594
610
|
* @param {string} sTargetPath The path to build the context. Needs to contain technical keys only.
|
|
611
|
+
* @param {sap.ui.model.odata.v4.ODataModel} oModel The OData model
|
|
595
612
|
* @param {object} oNavigationParameters Navigation parameters
|
|
596
613
|
*
|
|
597
614
|
* @ui5-restricted
|
|
598
615
|
*/
|
|
599
|
-
_bindPageToPath: function(sTargetPath, oNavigationParameters) {
|
|
616
|
+
_bindPageToPath: function(sTargetPath, oModel, oNavigationParameters) {
|
|
600
617
|
var oCurrentContext = this._getBindingContext(),
|
|
601
618
|
sCurrentPath = oCurrentContext && oCurrentContext.getPath(),
|
|
602
619
|
oUseContext = oNavigationParameters.useContext;
|
|
@@ -610,10 +627,10 @@ sap.ui.define(
|
|
|
610
627
|
oTargetContext = oUseContext;
|
|
611
628
|
} else {
|
|
612
629
|
// Otherwise we need to create it from sTargetPath
|
|
613
|
-
oTargetContext = this._createBindingContext(sTargetPath);
|
|
630
|
+
oTargetContext = this._createBindingContext(sTargetPath, oModel);
|
|
614
631
|
}
|
|
615
632
|
if (oTargetContext !== oCurrentContext) {
|
|
616
|
-
this._bindPageToContext(oTargetContext, oNavigationParameters);
|
|
633
|
+
this._bindPageToContext(oTargetContext, oModel, oNavigationParameters);
|
|
617
634
|
}
|
|
618
635
|
} else if (!oNavigationParameters.bReasonIsIappState && EditState.isEditStateDirty()) {
|
|
619
636
|
this._refreshBindingContext(oCurrentContext);
|
|
@@ -624,11 +641,12 @@ sap.ui.define(
|
|
|
624
641
|
* Binds the page to a context.
|
|
625
642
|
*
|
|
626
643
|
* @param {sap.ui.model.odata.v4.Context} oContext Context to be bound
|
|
644
|
+
* @param {sap.ui.model.odata.v4.ODataModel} oModel The OData model
|
|
627
645
|
* @param {object} oNavigationParameters Navigation parameters
|
|
628
646
|
*
|
|
629
647
|
* @ui5-restricted
|
|
630
648
|
*/
|
|
631
|
-
_bindPageToContext: function(oContext, oNavigationParameters) {
|
|
649
|
+
_bindPageToContext: function(oContext, oModel, oNavigationParameters) {
|
|
632
650
|
var that = this;
|
|
633
651
|
if (!oContext) {
|
|
634
652
|
this.onBeforeBinding(null);
|
|
@@ -638,7 +656,7 @@ sap.ui.define(
|
|
|
638
656
|
|
|
639
657
|
if (!oContext.getBinding() || oContext.getBinding().isA("sap.ui.model.odata.v4.ODataListBinding")) {
|
|
640
658
|
// We need to recreate the context otherwise we get errors
|
|
641
|
-
oContext = this._createBindingContext(oContext.getPath());
|
|
659
|
+
oContext = this._createBindingContext(oContext.getPath(), oModel);
|
|
642
660
|
if (EditState.isEditStateDirty()) {
|
|
643
661
|
// TODO: as a workaround we invalidate the model cache while the app is dirty
|
|
644
662
|
// as the manage model sets the parent in an async task and the request side effects
|
|
@@ -654,7 +672,8 @@ sap.ui.define(
|
|
|
654
672
|
editable: oNavigationParameters.bTargetEditable,
|
|
655
673
|
listBinding: oParentListBinding,
|
|
656
674
|
bPersistOPScroll: oNavigationParameters.bPersistOPScroll,
|
|
657
|
-
bDraftNavigation: oNavigationParameters.bDraftNavigation
|
|
675
|
+
bDraftNavigation: oNavigationParameters.bDraftNavigation,
|
|
676
|
+
showPlaceholder: oNavigationParameters.bShowPlaceholder
|
|
658
677
|
});
|
|
659
678
|
|
|
660
679
|
this._setBindingContext(oContext);
|
|
@@ -666,17 +685,17 @@ sap.ui.define(
|
|
|
666
685
|
* Creates a binding context from a path.
|
|
667
686
|
*
|
|
668
687
|
* @param {string} sPath The path
|
|
688
|
+
* @param {sap.ui.model.odata.v4.ODataModel} oModel The OData model
|
|
669
689
|
* @returns {sap.ui.model.odata.v4.Context} Created context
|
|
670
690
|
*
|
|
671
691
|
* @ui5-restricted
|
|
672
692
|
*/
|
|
673
|
-
_createBindingContext: function(sPath) {
|
|
693
|
+
_createBindingContext: function(sPath, oModel) {
|
|
674
694
|
var oPageComponent = this._oPageComponent,
|
|
675
695
|
sEntitySet = oPageComponent && oPageComponent.getEntitySet && oPageComponent.getEntitySet(),
|
|
676
696
|
sContextPath =
|
|
677
697
|
(oPageComponent && oPageComponent.getContextPath && oPageComponent.getContextPath()) ||
|
|
678
698
|
(sEntitySet && "/" + sEntitySet),
|
|
679
|
-
oModel = this._oView.getModel(),
|
|
680
699
|
oMetaModel = oModel.getMetaModel(),
|
|
681
700
|
that = this,
|
|
682
701
|
mParameters = {
|
|
@@ -686,7 +705,7 @@ sap.ui.define(
|
|
|
686
705
|
};
|
|
687
706
|
|
|
688
707
|
if (sEntitySet) {
|
|
689
|
-
var sMessagesPath = oMetaModel.
|
|
708
|
+
var sMessagesPath = oMetaModel.getObject(sContextPath + "/@com.sap.vocabularies.Common.v1.Messages/$Path");
|
|
690
709
|
if (sMessagesPath) {
|
|
691
710
|
mParameters.$select = sMessagesPath;
|
|
692
711
|
}
|
|
@@ -795,7 +814,7 @@ sap.ui.define(
|
|
|
795
814
|
}
|
|
796
815
|
|
|
797
816
|
if (sContextPath) {
|
|
798
|
-
sMessagesPath = oMetaModel.
|
|
817
|
+
sMessagesPath = oMetaModel.getObject(sContextPath + "/@com.sap.vocabularies.Common.v1.Messages/$Path");
|
|
799
818
|
}
|
|
800
819
|
|
|
801
820
|
// binding of the context must have $$PatchWithoutSideEffects true, this bound context may be needed to be fetched from the dependent binding
|