@sapui5/sap.suite.ui.generic.template 1.120.22 → 1.120.23
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/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
- 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 +70 -2
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/CRUDHelper.js +5 -3
- package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +4 -0
- package/src/sap/suite/ui/generic/template/lib/ContextBookkeeping.js +39 -23
- 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
|
@@ -5,8 +5,9 @@ sap.ui.define([
|
|
|
5
5
|
"sap/m/DynamicDateUtil",
|
|
6
6
|
"sap/suite/ui/generic/template/genericUtilities/metadataAnalyser",
|
|
7
7
|
"sap/base/i18n/date/CalendarType",
|
|
8
|
-
"sap/suite/ui/generic/template/genericUtilities/testableHelper"
|
|
9
|
-
|
|
8
|
+
"sap/suite/ui/generic/template/genericUtilities/testableHelper",
|
|
9
|
+
"sap/ui/model/Filter"
|
|
10
|
+
], function (FilterOperator, DateFormat, encodeURL, DynamicDateUtil, metadataAnalyser, CalendarType, testableHelper,Filter) {
|
|
10
11
|
"use strict";
|
|
11
12
|
|
|
12
13
|
function getInfoForFilters(aFilters, getFilterInfoForPropertyFilters, bAnd){
|
|
@@ -260,6 +261,71 @@ sap.ui.define([
|
|
|
260
261
|
};
|
|
261
262
|
}
|
|
262
263
|
|
|
264
|
+
/**
|
|
265
|
+
* function wraps the table level filters into single filter object
|
|
266
|
+
* This is done to follow the same format as SFB and chart filters
|
|
267
|
+
* returns the updated aFilters
|
|
268
|
+
* @param {Array} aFilters - It contains all the filters applied (in SFB , chart or table level filters)
|
|
269
|
+
* @returns {Array} - returns array containing all the filters applied including the table filters wrapped as single filter object similar to SFB and chart filters
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
function fnNormaliseControlFilters(aFilters) {
|
|
273
|
+
var aTableFilters = [];
|
|
274
|
+
|
|
275
|
+
var aChartAndSFBFilters = [];
|
|
276
|
+
|
|
277
|
+
aFilters.forEach(function(oFilter){
|
|
278
|
+
if (oFilter.aFilters) {
|
|
279
|
+
aChartAndSFBFilters.push(oFilter);
|
|
280
|
+
} else {
|
|
281
|
+
aTableFilters.push(oFilter);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
if (aTableFilters && aTableFilters.length > 1) {
|
|
286
|
+
//Grouping the table level filters based on sPath
|
|
287
|
+
var aGroupedTableFilters = aTableFilters.reduce(function
|
|
288
|
+
(aGroupedFilters, oCurrentfilter){
|
|
289
|
+
var path = oCurrentfilter.sPath;
|
|
290
|
+
|
|
291
|
+
if (!aGroupedFilters[path]) {
|
|
292
|
+
aGroupedFilters[path] = [];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
aGroupedFilters[path].push(oCurrentfilter);
|
|
296
|
+
|
|
297
|
+
return aGroupedFilters;
|
|
298
|
+
},
|
|
299
|
+
{}
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
// Convert grouped table filters into nested filter groups
|
|
303
|
+
|
|
304
|
+
var aTableFilterGroups = Object.keys(aGroupedTableFilters).map(
|
|
305
|
+
function(sPath){
|
|
306
|
+
return new Filter({
|
|
307
|
+
filters: aGroupedTableFilters[sPath],
|
|
308
|
+
|
|
309
|
+
and: false // OR logic within each group
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
// Forming a single top-level table filter
|
|
315
|
+
|
|
316
|
+
aTableFilters = new Filter({
|
|
317
|
+
filters: aTableFilterGroups,
|
|
318
|
+
|
|
319
|
+
and: true // AND logic for combining everything
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// combining filters from chart , SFB , and table
|
|
323
|
+
aChartAndSFBFilters.push(aTableFilters);
|
|
324
|
+
return aChartAndSFBFilters;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return aFilters;
|
|
328
|
+
}
|
|
263
329
|
/**
|
|
264
330
|
* Function returns filter params for service url
|
|
265
331
|
* @param {object} sEntityTypeName
|
|
@@ -274,6 +340,7 @@ sap.ui.define([
|
|
|
274
340
|
oFilterData: oFilterData,
|
|
275
341
|
bIsStatic: false
|
|
276
342
|
};
|
|
343
|
+
aApplicationFilters = fnNormaliseControlFilters(aApplicationFilters);
|
|
277
344
|
// Here oParams.bIsStrict will change if SFB have custom semantic-date filter.
|
|
278
345
|
var sFilterParams = "$filter=" + getFilterString(aApplicationFilters, getFilterInfoForPropertyFilters.bind(null, oParams));
|
|
279
346
|
sFilterParams = oParams.bIsStatic ? "" : sFilterParams;
|
|
@@ -281,6 +348,7 @@ sap.ui.define([
|
|
|
281
348
|
}
|
|
282
349
|
testableHelper.testableStatic(getFilterInfoForPropertyFilters, "filterHelper_getFilterInfoForPropertyFilters");
|
|
283
350
|
testableHelper.testableStatic(getFilterString, "filterHelper_getFilterString");
|
|
351
|
+
testableHelper.testableStatic(fnNormaliseControlFilters, "filterHelper_fnNormaliseControlFilters");
|
|
284
352
|
return {
|
|
285
353
|
getFilterParams: getFilterParams
|
|
286
354
|
};
|
|
@@ -922,7 +922,7 @@ sap.ui.define([
|
|
|
922
922
|
* @extends sap.ui.core.UIComponent
|
|
923
923
|
* @abstract
|
|
924
924
|
* @author SAP SE
|
|
925
|
-
* @version 1.120.
|
|
925
|
+
* @version 1.120.23
|
|
926
926
|
* @name sap.suite.ui.generic.template.lib.AppComponent
|
|
927
927
|
*/
|
|
928
928
|
return UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
|
|
@@ -216,7 +216,7 @@ sap.ui.define(["sap/ui/model/Context", "sap/suite/ui/generic/template/lib/Messag
|
|
|
216
216
|
]);
|
|
217
217
|
var sEdit = oResourceObject.getText("Edit");
|
|
218
218
|
var sCancel = oResourceObject.getText("CANCEL");
|
|
219
|
-
|
|
219
|
+
MessageBox.warning(sWarningText, {
|
|
220
220
|
title: oResourceObject.getText("ST_UNSAVED_CHANGES_TITLE"),
|
|
221
221
|
actions: [sEdit, sCancel],
|
|
222
222
|
emphasizedAction: sEdit,
|
|
@@ -224,7 +224,7 @@ sap.ui.define(["sap/ui/model/Context", "sap/suite/ui/generic/template/lib/Messag
|
|
|
224
224
|
if (sAction === sEdit) {
|
|
225
225
|
resolve();
|
|
226
226
|
} else if (sAction === sCancel) {
|
|
227
|
-
if (bOpenInEditMode) {
|
|
227
|
+
if (bOpenInEditMode && oViewProxy && oViewProxy.navigateUp) {
|
|
228
228
|
oViewProxy.navigateUp();
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -368,7 +368,9 @@ sap.ui.define(["sap/ui/model/Context", "sap/suite/ui/generic/template/lib/Messag
|
|
|
368
368
|
});
|
|
369
369
|
oApplication.getBusyHelper().setBusy(oUnsavedChangesEditPromise, true);
|
|
370
370
|
};
|
|
371
|
-
var editRejection =
|
|
371
|
+
var editRejection = reject({
|
|
372
|
+
cancelled: true
|
|
373
|
+
});
|
|
372
374
|
var unSavedChangesDialogPromise = fnUnsavedChangesDialog(undefined, oResponse.DraftAdministrativeData,oCommonUtils, oViewProxy, bOpenInEditMode);
|
|
373
375
|
unSavedChangesDialogPromise.then(editConfirmation,editRejection);
|
|
374
376
|
}
|
|
@@ -1589,6 +1589,10 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
1589
1589
|
if (oError.lockedByUser) {
|
|
1590
1590
|
var sLockText = oCommonUtils.getText("ST_GENERIC_DRAFT_LOCKED_BY_USER", [" ", oError.lockedByUser]);
|
|
1591
1591
|
MessageBox.error(sLockText);
|
|
1592
|
+
} else if (oError.cancelled) {
|
|
1593
|
+
if (oViewProxy && oViewProxy.navigateUp){
|
|
1594
|
+
oViewProxy.navigateUp();
|
|
1595
|
+
}
|
|
1592
1596
|
} else {
|
|
1593
1597
|
MessageUtils.handleError(MessageUtils.operations.editEntity, oController, oServices, oError);
|
|
1594
1598
|
if (oViewProxy && oViewProxy.navigateUp){
|
|
@@ -126,13 +126,17 @@ sap.ui.define(["sap/ui/base/Object", "sap/base/util/each", "sap/base/util/extend
|
|
|
126
126
|
var oTreeNode = oTemplateContract.mEntityTree[sEntitySet];
|
|
127
127
|
if (oTreeNode && !oTreeNode.noOData){
|
|
128
128
|
if (aKeysFromIdentity){
|
|
129
|
+
// Get the root context's info for the current draft context
|
|
130
|
+
oRootContextInfo = getRootContextInfo(oTreeNode, aKeysFromIdentity);
|
|
131
|
+
// If the current context is a draft, register context info for the active sibling as well
|
|
129
132
|
if (oContextInfo.bIsDraft){
|
|
130
133
|
var aActiveKeys = [];
|
|
131
134
|
var oActiveFoundPromise = oTemplateContract.oApplicationProxy.fillSiblingKeyPromise(oTreeNode, aKeysFromIdentity, aActiveKeys);
|
|
132
135
|
oActiveFoundPromise.then(function(oReplaceNode){
|
|
133
136
|
var sReplacePath = oReplaceNode.getPath(3, aActiveKeys);
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
var oActiveContextData = mPath2ContextData[sReplacePath];
|
|
138
|
+
if (!oActiveContextData){
|
|
139
|
+
oActiveContextData = {
|
|
136
140
|
oContextInfo: {
|
|
137
141
|
bIsDraft: false,
|
|
138
142
|
bIsDraftSupported: true,
|
|
@@ -142,30 +146,18 @@ sap.ui.define(["sap/ui/base/Object", "sap/base/util/each", "sap/base/util/extend
|
|
|
142
146
|
},
|
|
143
147
|
aKeysFromIdentity: aActiveKeys
|
|
144
148
|
};
|
|
149
|
+
// Finally add the active context data to the cache
|
|
150
|
+
mPath2ContextData[sReplacePath] = oActiveContextData;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Fill rootContextInfo for the active context's data
|
|
154
|
+
if (!oActiveContextData.oRootContextInfo) {
|
|
155
|
+
oActiveContextData.oRootContextInfo = getRootContextInfo(oReplaceNode, aActiveKeys);
|
|
156
|
+
// Add the active context's data to root context info's children
|
|
157
|
+
oActiveContextData.oRootContextInfo.childContexts[sReplacePath] = oActiveContextData;
|
|
145
158
|
}
|
|
146
159
|
});
|
|
147
160
|
}
|
|
148
|
-
if (oTreeNode && !oTreeNode.noOData){
|
|
149
|
-
var oMainObjectNode = oTemplateContract.oApplicationProxy.getAncestralNode(oTreeNode, 1);
|
|
150
|
-
var oActiveDraftInfoForDraftRoot = mActiveDraftRoots[oMainObjectNode.entitySet];
|
|
151
|
-
if (!oActiveDraftInfoForDraftRoot){
|
|
152
|
-
oActiveDraftInfoForDraftRoot = {
|
|
153
|
-
treeNode: oMainObjectNode,
|
|
154
|
-
draftRoots: Object.create(null)
|
|
155
|
-
};
|
|
156
|
-
mActiveDraftRoots[oMainObjectNode.entitySet] = oActiveDraftInfoForDraftRoot;
|
|
157
|
-
}
|
|
158
|
-
var sRootKey = aKeysFromIdentity[1];
|
|
159
|
-
oRootContextInfo = oActiveDraftInfoForDraftRoot[sRootKey];
|
|
160
|
-
if (!oRootContextInfo){
|
|
161
|
-
oRootContextInfo = {
|
|
162
|
-
treeNode: oMainObjectNode,
|
|
163
|
-
key: sRootKey,
|
|
164
|
-
childContexts: Object.create(null)
|
|
165
|
-
};
|
|
166
|
-
oActiveDraftInfoForDraftRoot[sRootKey] = oRootContextInfo;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
161
|
}
|
|
170
162
|
var oModel = oContext.getModel();
|
|
171
163
|
var oMetaModel = oModel.getMetaModel();
|
|
@@ -201,6 +193,30 @@ sap.ui.define(["sap/ui/base/Object", "sap/base/util/each", "sap/base/util/extend
|
|
|
201
193
|
return oContextInfo;
|
|
202
194
|
}
|
|
203
195
|
|
|
196
|
+
// Gets the root context's info for the given tree node
|
|
197
|
+
function getRootContextInfo(oTreeNode, aKeysFromIdentity) {
|
|
198
|
+
var oMainObjectNode = oTemplateContract.oApplicationProxy.getAncestralNode(oTreeNode, 1);
|
|
199
|
+
var oActiveDraftInfoForDraftRoot = mActiveDraftRoots[oMainObjectNode.entitySet];
|
|
200
|
+
if (!oActiveDraftInfoForDraftRoot){
|
|
201
|
+
oActiveDraftInfoForDraftRoot = {
|
|
202
|
+
treeNode: oMainObjectNode,
|
|
203
|
+
draftRoots: Object.create(null)
|
|
204
|
+
};
|
|
205
|
+
mActiveDraftRoots[oMainObjectNode.entitySet] = oActiveDraftInfoForDraftRoot;
|
|
206
|
+
}
|
|
207
|
+
var sRootKey = aKeysFromIdentity[1];
|
|
208
|
+
var oRootContextInfo = oActiveDraftInfoForDraftRoot[sRootKey];
|
|
209
|
+
if (!oRootContextInfo){
|
|
210
|
+
oRootContextInfo = {
|
|
211
|
+
treeNode: oMainObjectNode,
|
|
212
|
+
key: sRootKey,
|
|
213
|
+
childContexts: Object.create(null)
|
|
214
|
+
};
|
|
215
|
+
oActiveDraftInfoForDraftRoot[sRootKey] = oRootContextInfo;
|
|
216
|
+
}
|
|
217
|
+
return oRootContextInfo;
|
|
218
|
+
}
|
|
219
|
+
|
|
204
220
|
function getPathOfLastShownDraftRoot() {
|
|
205
221
|
for (var i = aPathOfLastShownDraftRoots.length - 1; i >= 0; i--) {
|
|
206
222
|
var oContext = mPath2ContextData[aPathOfLastShownDraftRoots[i]].oContext;
|
|
@@ -3083,7 +3083,7 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
3083
3083
|
* @param {sap.suite.ui.generic.template.lib.AppComponent} oAppComponent The AppComponent instance
|
|
3084
3084
|
* @public
|
|
3085
3085
|
* @extends sap.ui.base.Object
|
|
3086
|
-
* @version 1.120.
|
|
3086
|
+
* @version 1.120.23
|
|
3087
3087
|
* @since 1.30.0
|
|
3088
3088
|
* @alias sap.suite.ui.generic.template.lib.NavigationController
|
|
3089
3089
|
*/
|