@sapui5/sap.suite.ui.generic.template 1.120.8 → 1.120.9
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 +1 -1
- package/src/sap/suite/ui/generic/template/.library +1 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/controller/ControllerImplementation.js +19 -24
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +22 -21
- package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/genericUtilities/filterHelper.js +47 -28
- package/src/sap/suite/ui/generic/template/genericUtilities/metadataAnalyser.js +20 -0
- package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +1 -11
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +5 -5
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
- package/src/sap/suite/ui/generic/template/library.js +1 -1
package/package.json
CHANGED
package/src/sap/suite/ui/generic/template/AnalyticalListPage/controller/ControllerImplementation.js
CHANGED
|
@@ -255,37 +255,34 @@ sap.ui.define(["sap/fe/navigation/SelectionVariant",
|
|
|
255
255
|
|
|
256
256
|
var getFilterInfoForTilePromise = function () {
|
|
257
257
|
var oPresentationControlHandler = oTemplateUtils.oServices.oPresentationControlHandlerFactory.getPresentationControlHandler(oState.oSmartChart);
|
|
258
|
-
var
|
|
259
|
-
var
|
|
258
|
+
var oMetaModel = oPresentationControlHandler.getModel().getMetaModel();
|
|
259
|
+
var sEntityTypeName = oMetaModel.getODataEntitySet(oPresentationControlHandler.getEntitySet()).entityType;
|
|
260
|
+
var oTable = oState.oSmartTable.getTable();
|
|
261
|
+
var oBinding = oTable.getBinding("rows") || oTable.getBinding("items");
|
|
262
|
+
var sServiceUrl = oBinding && oBinding.getDownloadUrl();
|
|
260
263
|
// - For Analytical Binding.
|
|
261
264
|
// we recv. aApplicationFilter and aApplicationFilters binding both but aApplicationFilter have actual filters operator value.
|
|
262
265
|
// - For List Binding.
|
|
263
266
|
// we recv. only aApplicationFilters contains filter operator.
|
|
264
|
-
var aFilters =
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
var aFilters = oBinding.aApplicationFilter || oBinding.aApplicationFilters;
|
|
268
|
+
// non-draft case when no filter is applied
|
|
269
|
+
if (!aFilters.length) {
|
|
267
270
|
return Promise.resolve({
|
|
268
|
-
|
|
269
|
-
sServiceUrl: ""
|
|
271
|
+
sServiceUrl: sServiceUrl
|
|
270
272
|
});
|
|
271
273
|
}
|
|
272
274
|
var oFilterData = oState.oSmartFilterbar.getFilterData();
|
|
273
|
-
var
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
var sFilterParams = filterHelper.getFilterParams(oMetaModel, sEntityTypeName, aFilters, oFilterData);
|
|
276
|
+
if (sFilterParams) {
|
|
277
|
+
sServiceUrl = oTemplateUtils.oCommonUtils.fnReplaceFiltersWithGetDownloadUrl(sServiceUrl, sFilterParams);
|
|
278
|
+
return Promise.resolve({
|
|
279
|
+
sServiceUrl: sServiceUrl
|
|
280
|
+
});
|
|
281
|
+
} else {
|
|
279
282
|
return Promise.resolve({
|
|
280
|
-
bIsStatic: true,
|
|
281
283
|
sServiceUrl: ""
|
|
282
284
|
});
|
|
283
285
|
}
|
|
284
|
-
sServiceUrl = oTemplateUtils.oCommonUtils.fnReplaceFiltersWithGetDownloadUrl(sServiceUrl, oFilterParams);
|
|
285
|
-
return Promise.resolve({
|
|
286
|
-
bIsStatic: oFilterParams.bIsStatic,
|
|
287
|
-
sServiceUrl: sServiceUrl
|
|
288
|
-
});
|
|
289
286
|
};
|
|
290
287
|
|
|
291
288
|
var oFragmentController = {
|
|
@@ -317,14 +314,12 @@ sap.ui.define(["sap/fe/navigation/SelectionVariant",
|
|
|
317
314
|
},
|
|
318
315
|
|
|
319
316
|
getServiceUrl: function () {
|
|
320
|
-
// only create static tile, if filter for any semanticDateRangeProperty (including custom filter field) exists
|
|
321
317
|
return getFilterInfoForTilePromise().then(function (oFilterInfo) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
sServiceUrl = oFilterInfo.sServiceUrl + "&$top=0&$inlinecount=allpages";
|
|
318
|
+
if (oFilterInfo.sServiceUrl) {
|
|
319
|
+
oFilterInfo.sServiceUrl = oFilterInfo.sServiceUrl ? (oFilterInfo.sServiceUrl + "&$top=0&$inlinecount=allpages") : "";
|
|
325
320
|
}
|
|
326
321
|
var oShareInfo = {
|
|
327
|
-
serviceUrl: sServiceUrl
|
|
322
|
+
serviceUrl: oFilterInfo.sServiceUrl
|
|
328
323
|
};
|
|
329
324
|
oController.onSaveAsTileExtension(oShareInfo);
|
|
330
325
|
return oShareInfo.serviceUrl;
|
|
@@ -301,32 +301,35 @@ sap.ui.define([
|
|
|
301
301
|
var bAreDataShownInTable = oState.oIappStateHandler.areDataShownInTable();
|
|
302
302
|
if (bAreDataShownInTable) {
|
|
303
303
|
var oPresentationControlHandler = oState.oPresentationControlHandler;
|
|
304
|
-
var
|
|
305
|
-
var
|
|
304
|
+
var oMetaModel = oPresentationControlHandler.getModel().getMetaModel();
|
|
305
|
+
var sEntityTypeName = oMetaModel.getODataEntitySet(oPresentationControlHandler.getEntitySet()).entityType;
|
|
306
|
+
var oBinding = oPresentationControlHandler.getBinding(oState);
|
|
307
|
+
var sServiceUrl = oBinding.getDownloadUrl();
|
|
306
308
|
// - For Analytical Binding.
|
|
307
309
|
// we recv. aApplicationFilter and aApplicationFilters binding both but aApplicationFilter have actual filters operator value.
|
|
308
310
|
// - For List Binding.
|
|
309
311
|
// we recv. only aApplicationFilters contains filter operator.
|
|
310
|
-
var aFilters =
|
|
311
|
-
|
|
312
|
-
|
|
312
|
+
var aFilters = oBinding.aApplicationFilter || oBinding.aApplicationFilters;
|
|
313
|
+
// non-draft case when no filter is applied
|
|
314
|
+
if (!aFilters.length) {
|
|
313
315
|
return Promise.resolve({
|
|
314
|
-
|
|
315
|
-
sServiceUrl: ""
|
|
316
|
+
sServiceUrl: sServiceUrl
|
|
316
317
|
});
|
|
317
318
|
}
|
|
318
319
|
var oFilterData = oState.oSmartFilterbar.getFilterData();
|
|
319
|
-
var
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
320
|
+
var sFilterParams = filterHelper.getFilterParams(oMetaModel, sEntityTypeName, aFilters, oFilterData);
|
|
321
|
+
if (sFilterParams) {
|
|
322
|
+
sServiceUrl = oTemplateUtils.oCommonUtils.fnReplaceFiltersWithGetDownloadUrl(sServiceUrl, sFilterParams);
|
|
323
|
+
return Promise.resolve({
|
|
324
|
+
sServiceUrl: sServiceUrl
|
|
325
|
+
});
|
|
326
|
+
} else {
|
|
327
|
+
return Promise.resolve({
|
|
328
|
+
sServiceUrl: ""
|
|
329
|
+
});
|
|
330
|
+
}
|
|
327
331
|
}
|
|
328
332
|
return Promise.resolve({
|
|
329
|
-
bIsStatic: true,
|
|
330
333
|
sServiceUrl: ""
|
|
331
334
|
});
|
|
332
335
|
};
|
|
@@ -360,14 +363,12 @@ sap.ui.define([
|
|
|
360
363
|
},
|
|
361
364
|
|
|
362
365
|
getServiceUrl: function () {
|
|
363
|
-
// only create static tile, if filter for any semanticDateRangeProperty (including custom filter field) exists
|
|
364
366
|
return getFilterInfoForTilePromise().then(function (oFilterInfo) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
sServiceUrl = oFilterInfo.sServiceUrl + "&$top=0&$inlinecount=allpages";
|
|
367
|
+
if (oFilterInfo.sServiceUrl) {
|
|
368
|
+
oFilterInfo.sServiceUrl = oFilterInfo.sServiceUrl ? (oFilterInfo.sServiceUrl + "&$top=0&$inlinecount=allpages") : "";
|
|
368
369
|
}
|
|
369
370
|
var oShareInfo = {
|
|
370
|
-
serviceUrl: sServiceUrl
|
|
371
|
+
serviceUrl: oFilterInfo.sServiceUrl
|
|
371
372
|
};
|
|
372
373
|
oController.onSaveAsTileExtension(oShareInfo);
|
|
373
374
|
return oShareInfo.serviceUrl;
|
|
@@ -3,8 +3,10 @@ sap.ui.define([
|
|
|
3
3
|
"sap/ui/core/format/DateFormat",
|
|
4
4
|
"sap/base/security/encodeURL",
|
|
5
5
|
"sap/m/DynamicDateUtil",
|
|
6
|
-
"sap/ui/
|
|
7
|
-
|
|
6
|
+
"sap/suite/ui/generic/template/genericUtilities/metadataAnalyser",
|
|
7
|
+
"sap/base/i18n/date/CalendarType",
|
|
8
|
+
"sap/suite/ui/generic/template/genericUtilities/testableHelper"
|
|
9
|
+
], function (FilterOperator, DateFormat, encodeURL, DynamicDateUtil, metadataAnalyser, CalendarType, testableHelper) {
|
|
8
10
|
"use strict";
|
|
9
11
|
|
|
10
12
|
function getInfoForFilters(aFilters, getFilterInfoForPropertyFilters, bAnd){
|
|
@@ -95,7 +97,7 @@ sap.ui.define([
|
|
|
95
97
|
* Formats a JavaScript value according to the given
|
|
96
98
|
* <a href="http://www.odata.org/documentation/odata-version-2-0/overview#AbstractTypeSystem">
|
|
97
99
|
* EDM type</a>.
|
|
98
|
-
*
|
|
100
|
+
* We are temperary using the method from UI5 model.
|
|
99
101
|
* @param {any} vValue The value to format
|
|
100
102
|
* @param {string} sType The EDM type (e.g. Edm.Decimal)
|
|
101
103
|
* @param {boolean} bCaseSensitive Whether strings gets compared case sensitive or not
|
|
@@ -105,9 +107,7 @@ sap.ui.define([
|
|
|
105
107
|
function formatValue(vValue, sType, bCaseSensitive) {
|
|
106
108
|
var oDate, sValue;
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
bCaseSensitive = true;
|
|
110
|
-
}
|
|
110
|
+
bCaseSensitive = bCaseSensitive === undefined || bCaseSensitive;
|
|
111
111
|
|
|
112
112
|
// null values should return the null literal
|
|
113
113
|
if (vValue === null || vValue === undefined) {
|
|
@@ -180,25 +180,39 @@ sap.ui.define([
|
|
|
180
180
|
}
|
|
181
181
|
return sValue;
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Callback function used to concatenate basic or complex filters for each filter value
|
|
186
|
+
* @param {object} oParams - It contains information like (Model/EntityType/FilterData/bIsStatic),
|
|
187
|
+
* Here bIsStatic is subject to change from false to true whenever application uses custom sematic date
|
|
188
|
+
* @param {String} sProperty - property name of the filter field from SFB
|
|
189
|
+
* @param {Array} aFiltersForProperty - filter operator of field from SFB
|
|
190
|
+
* @param {String} sLogicalOperator - logical operator (and/or) betweem each filter item.
|
|
191
|
+
* @returns {string} - return combination of filters as a string.
|
|
192
|
+
*/
|
|
193
|
+
function getFilterInfoForPropertyFilters(oParams, sProperty, aFiltersForProperty, sLogicalOperator) {
|
|
194
|
+
var oValue1, oValue2, sOperator, oProperty = metadataAnalyser.getPropertyMetadata(oParams.oMetaModel, oParams.sEntityTypeName, sProperty);
|
|
195
|
+
// for navigation properties
|
|
196
|
+
sProperty = sProperty.replaceAll("/", ".");
|
|
197
|
+
// If Custom filter is implemented date field for smart filter bar then we make static tile
|
|
198
|
+
if ((oProperty.type === "Edm.DateTime" || oProperty.type === "Edm.DateTimeOffset") && !oParams.oFilterData[sProperty]) {
|
|
199
|
+
oParams.bIsStatic = true;
|
|
200
|
+
return {
|
|
201
|
+
stringRep: "",
|
|
202
|
+
logicalOperator: sLogicalOperator
|
|
203
|
+
};
|
|
204
|
+
}
|
|
187
205
|
var sRet = aFiltersForProperty.map(function (oFilter) {
|
|
188
206
|
var bCaseSensitive = true;
|
|
189
207
|
if (oFilter.bCaseSensitive === undefined) {
|
|
190
208
|
bCaseSensitive = true;
|
|
191
209
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
if (oProperty && (oProperty.type === "Edm.DateTime" || oProperty.type === "Edm.DateTimeOffset") && oFilterData[sNavProperty || sProperty].conditionTypeInfo && oFilterData[sNavProperty || sProperty].conditionTypeInfo.data.operation !== "DATE") {
|
|
198
|
-
if (!DynamicDateUtil.getAllOptionKeys().includes(oFilterData[sNavProperty || sProperty].conditionTypeInfo.data.operation)) {
|
|
199
|
-
bIsStatic = true;
|
|
210
|
+
if ((oProperty.type === "Edm.DateTime" || oProperty.type === "Edm.DateTimeOffset") && oParams.oFilterData[sProperty].conditionTypeInfo && oParams.oFilterData[sProperty].conditionTypeInfo.data.operation !== "DATE") {
|
|
211
|
+
if (!DynamicDateUtil.getAllOptionKeys().includes(oParams.oFilterData[sProperty].conditionTypeInfo.data.operation)) {
|
|
212
|
+
oParams.bIsStatic = true;
|
|
213
|
+
return;
|
|
200
214
|
}
|
|
201
|
-
var oValue = getSematicDateFormat(oFilterData[
|
|
215
|
+
var oValue = getSematicDateFormat(oParams.oFilterData[sProperty], oProperty.type);
|
|
202
216
|
oValue1 = oValue.oValue1;
|
|
203
217
|
oValue2 = oValue.oValue2;
|
|
204
218
|
sOperator = oValue.operator;
|
|
@@ -237,6 +251,8 @@ sap.ui.define([
|
|
|
237
251
|
return "endswith(" + sProperty + "," + oValue1 + ")";
|
|
238
252
|
case "NotEndsWith":
|
|
239
253
|
return "not%20endswith(" + sProperty + "," + oValue1 + ")";
|
|
254
|
+
default:
|
|
255
|
+
return "";
|
|
240
256
|
}
|
|
241
257
|
}).join("%20" + sLogicalOperator + "%20");
|
|
242
258
|
return {
|
|
@@ -247,22 +263,25 @@ sap.ui.define([
|
|
|
247
263
|
|
|
248
264
|
/**
|
|
249
265
|
* Function returns filter params for service url
|
|
250
|
-
* @param {object}
|
|
266
|
+
* @param {object} sEntityTypeName
|
|
251
267
|
* @param {Array} aApplicationFilters - Smartfilterbar filters operators
|
|
252
268
|
* @param {Object} oFilterData - smartfilterbar filter object with values
|
|
253
269
|
* @returns {string} return filter param of service url
|
|
254
270
|
*/
|
|
255
|
-
function getFilterParams(
|
|
256
|
-
var
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
bIsStatic:
|
|
271
|
+
function getFilterParams(oMetaModel, sEntityTypeName, aApplicationFilters, oFilterData) {
|
|
272
|
+
var oParams = {
|
|
273
|
+
oMetaModel: oMetaModel,
|
|
274
|
+
sEntityTypeName: sEntityTypeName,
|
|
275
|
+
oFilterData: oFilterData,
|
|
276
|
+
bIsStatic: false
|
|
261
277
|
};
|
|
278
|
+
// Here oParams.bIsStrict will change if SFB have custom semantic-date filter.
|
|
279
|
+
var sFilterParams = "$filter=" + getFilterString(aApplicationFilters, getFilterInfoForPropertyFilters.bind(null, oParams));
|
|
280
|
+
sFilterParams = oParams.bIsStatic ? "" : sFilterParams;
|
|
281
|
+
return sFilterParams;
|
|
262
282
|
}
|
|
263
|
-
|
|
283
|
+
testableHelper.testableStatic(getFilterString, "filterHelper_getFilterString");
|
|
264
284
|
return {
|
|
265
|
-
getFilterString: getFilterString,
|
|
266
285
|
getFilterParams: getFilterParams
|
|
267
286
|
};
|
|
268
287
|
});
|
|
@@ -251,6 +251,26 @@ sap.ui.define([
|
|
|
251
251
|
return null;
|
|
252
252
|
},
|
|
253
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Function return metadata ODataProperty.
|
|
256
|
+
*
|
|
257
|
+
* @param {object} oMetaModel
|
|
258
|
+
* @param {object} oEntityType
|
|
259
|
+
* @param {object} sProperty
|
|
260
|
+
* @returns {object} returns metadata oDataProperty
|
|
261
|
+
*/
|
|
262
|
+
getPropertyMetadata: function (oMetaModel, sEntityTypeName, sProperty) {
|
|
263
|
+
var oEntityType = oMetaModel.getODataEntityType(sEntityTypeName);
|
|
264
|
+
var aPathParts = sProperty.split("/");
|
|
265
|
+
for (var j = 0; j < aPathParts.length - 1; j++) { // go through the parts finding the last entity type;
|
|
266
|
+
var oAssociationEnd = oMetaModel.getODataAssociationEnd(oEntityType, aPathParts[j]);
|
|
267
|
+
oEntityType = oMetaModel.getODataEntityType(oAssociationEnd.type);
|
|
268
|
+
}
|
|
269
|
+
sProperty = aPathParts[aPathParts.length - 1]; // last entry in array is a property
|
|
270
|
+
var oODataProperty = oMetaModel.getODataProperty(oEntityType, sProperty);
|
|
271
|
+
return oODataProperty;
|
|
272
|
+
},
|
|
273
|
+
|
|
254
274
|
hasPropertyInSideEffect: hasPropertyInSideEffect
|
|
255
275
|
};
|
|
256
276
|
|
|
@@ -136,17 +136,7 @@ sap.ui.define(["sap/ui/model/odata/AnnotationHelper",
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
function isPropertyPathBoolean(oMetaModel, sEntityTypeName, sPropertyPath) {
|
|
139
|
-
var
|
|
140
|
-
var oPathEntityType = oMetaModel.getODataEntityType(sEntityTypeName);
|
|
141
|
-
if (sProperty.indexOf("/") > -1) { // if it's a navigation path, we have to expand to find the right entity type
|
|
142
|
-
var aPathParts = sProperty.split("/");
|
|
143
|
-
for (var j = 0; j < aPathParts.length - 1; j++) { // go through the parts finding the last entity type;
|
|
144
|
-
var oAssociationEnd = oMetaModel.getODataAssociationEnd(oPathEntityType, aPathParts[j]);
|
|
145
|
-
oPathEntityType = oMetaModel.getODataEntityType(oAssociationEnd.type);
|
|
146
|
-
}
|
|
147
|
-
sProperty = aPathParts[aPathParts.length - 1]; // last entry in array is a property
|
|
148
|
-
}
|
|
149
|
-
var oODataProperty = oMetaModel.getODataProperty(oPathEntityType, sProperty);
|
|
139
|
+
var oODataProperty = metadataAnalyser.getPropertyMetadata(oMetaModel, sEntityTypeName, sPropertyPath);
|
|
150
140
|
return (!!oODataProperty && oODataProperty.type === "Edm.Boolean");
|
|
151
141
|
}
|
|
152
142
|
|
|
@@ -907,7 +907,7 @@ sap.ui.define([
|
|
|
907
907
|
* @extends sap.ui.core.UIComponent
|
|
908
908
|
* @abstract
|
|
909
909
|
* @author SAP SE
|
|
910
|
-
* @version 1.120.
|
|
910
|
+
* @version 1.120.9
|
|
911
911
|
* @name sap.suite.ui.generic.template.lib.AppComponent
|
|
912
912
|
*/
|
|
913
913
|
return UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
|
|
@@ -103,15 +103,15 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
103
103
|
return oEntityType;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
function fnReplaceFiltersWithGetDownloadUrl(sServiceUrl,
|
|
107
|
-
var
|
|
108
|
-
|
|
106
|
+
function fnReplaceFiltersWithGetDownloadUrl(sServiceUrl, sFilterParams) {
|
|
107
|
+
var aServiceURLSplit = sServiceUrl.split("?");
|
|
108
|
+
aServiceURLSplit[1] = aServiceURLSplit[1].split("&").map(function (params) {
|
|
109
109
|
if (params.startsWith("$filter")) {
|
|
110
|
-
return
|
|
110
|
+
return sFilterParams;
|
|
111
111
|
}
|
|
112
112
|
return params;
|
|
113
113
|
}).join("&");
|
|
114
|
-
sServiceUrl =
|
|
114
|
+
sServiceUrl = aServiceURLSplit.join("?");
|
|
115
115
|
return sServiceUrl;
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -3051,7 +3051,7 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
3051
3051
|
* @param {sap.suite.ui.generic.template.lib.AppComponent} oAppComponent The AppComponent instance
|
|
3052
3052
|
* @public
|
|
3053
3053
|
* @extends sap.ui.base.Object
|
|
3054
|
-
* @version 1.120.
|
|
3054
|
+
* @version 1.120.9
|
|
3055
3055
|
* @since 1.30.0
|
|
3056
3056
|
* @alias sap.suite.ui.generic.template.lib.NavigationController
|
|
3057
3057
|
*/
|