@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.suite.ui.generic.template",
3
- "version": "1.120.22",
3
+ "version": "1.120.23",
4
4
  "description": "SAPUI5 Library sap.suite.ui.generic.template",
5
5
  "keywords": [
6
6
  "sapui5",
@@ -7,7 +7,7 @@
7
7
 
8
8
  (c) Copyright 2009-2015 SAP SE. All rights reserved
9
9
  </copyright>
10
- <version>1.120.22</version>
10
+ <version>1.120.23</version>
11
11
 
12
12
  <documentation>Library with generic Suite UI templates.</documentation>
13
13
 
@@ -8,7 +8,7 @@
8
8
  "i18n": "i18n/i18n.properties",
9
9
  "applicationVersion": {
10
10
  "__comment": "applicationVersion oder componentversion??",
11
- "version": "1.120.22"
11
+ "version": "1.120.23"
12
12
  },
13
13
  "title": "{{TITLE}}",
14
14
  "description": "{{DESCRIPTION}}",
@@ -8,7 +8,7 @@
8
8
  "i18n": "i18n/i18n.properties",
9
9
  "applicationVersion": {
10
10
  "__comment": "applicationVersion oder componentversion??",
11
- "version": "1.120.22"
11
+ "version": "1.120.23"
12
12
  },
13
13
  "title": "Canvas",
14
14
  "description": "Canvas Page",
@@ -8,7 +8,7 @@
8
8
  "i18n": "i18n/i18n.properties",
9
9
  "applicationVersion": {
10
10
  "__comment": "applicationVersion oder componentversion??",
11
- "version": "1.120.22"
11
+ "version": "1.120.23"
12
12
  },
13
13
  "title": "{{TITLE}}",
14
14
  "description": "{{DESCRIPTION}}",
@@ -6,7 +6,7 @@
6
6
  "type": "component",
7
7
  "i18n": "i18n/i18n.properties",
8
8
  "applicationVersion": {
9
- "version": "1.120.22"
9
+ "version": "1.120.23"
10
10
  },
11
11
  "title": "{{TITLE}}",
12
12
  "description": "{{DESCRIPTION}}",
@@ -6,7 +6,7 @@
6
6
  "type": "component",
7
7
  "i18n": "i18n/i18n.properties",
8
8
  "applicationVersion": {
9
- "version": "1.120.22"
9
+ "version": "1.120.23"
10
10
  },
11
11
  "title": "{{TITLE}}",
12
12
  "description": "{{DESCRIPTION}}",
@@ -6,7 +6,7 @@
6
6
  "type": "component",
7
7
  "i18n": "i18n/i18n.properties",
8
8
  "applicationVersion": {
9
- "version": "1.120.22"
9
+ "version": "1.120.23"
10
10
  },
11
11
  "title": "{{TITLE}}",
12
12
  "description": "{{DESCRIPTION}}",
@@ -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
- ], function (FilterOperator, DateFormat, encodeURL, DynamicDateUtil, metadataAnalyser, CalendarType, testableHelper) {
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.22
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
- MessageBox.warning(sWarningText, {
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 = Function.prototype;
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
- if (!mPath2ContextData[sReplacePath]){
135
- mPath2ContextData[sReplacePath] = {
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.22
3086
+ * @version 1.120.23
3087
3087
  * @since 1.30.0
3088
3088
  * @alias sap.suite.ui.generic.template.lib.NavigationController
3089
3089
  */
@@ -60,7 +60,7 @@ sap.ui.define([
60
60
  interfaces: [],
61
61
  controls: [],
62
62
  elements: [],
63
- version: "1.120.22",
63
+ version: "1.120.23",
64
64
  extensions: {
65
65
  //Configuration used for rule loading of Support Assistant
66
66
  "sap.ui.support": {