@sapui5/sap.suite.ui.generic.template 1.130.2 → 1.130.3

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.
Files changed (21) hide show
  1. package/package.json +1 -1
  2. package/src/sap/suite/ui/generic/template/.library +1 -1
  3. package/src/sap/suite/ui/generic/template/AnalyticalListPage/controller/ControllerImplementation.js +5 -1
  4. package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
  5. package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
  6. package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +8 -13
  7. package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +18 -2
  8. package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
  9. package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +1 -1
  10. package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
  11. package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
  12. package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
  13. package/src/sap/suite/ui/generic/template/fragments/SmartFormDataField.fragment.xml +3 -3
  14. package/src/sap/suite/ui/generic/template/genericUtilities/polyFill.js +14 -0
  15. package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +3 -6
  16. package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
  17. package/src/sap/suite/ui/generic/template/lib/SideEffectUtil.js +22 -7
  18. package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +62 -22
  19. package/src/sap/suite/ui/generic/template/lib/ai/FioriAIHandler.js +30 -35
  20. package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +27 -13
  21. package/src/sap/suite/ui/generic/template/library.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.suite.ui.generic.template",
3
- "version": "1.130.2",
3
+ "version": "1.130.3",
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.130.2</version>
10
+ <version>1.130.3</version>
11
11
 
12
12
  <documentation>Library with generic Suite UI templates.</documentation>
13
13
 
@@ -1050,7 +1050,11 @@ sap.ui.define(["sap/fe/navigation/SelectionVariant",
1050
1050
  oState.oIappStateHandler.fnStoreCurrentAppStateAndAdjustURL();
1051
1051
  },
1052
1052
  onAfterApplyTableVariant: function() {
1053
- oState.oIappStateHandler.fnStoreCurrentAppStateAndAdjustURL();
1053
+ // Wait until the previous invocation of storing the app state is completed.
1054
+ // Then, proceed with storing the current app state.
1055
+ setTimeout(function () {
1056
+ oState.oIappStateHandler.fnStoreCurrentAppStateAndAdjustURL();
1057
+ }, 0);
1054
1058
  },
1055
1059
  onAfterChartVariantSave: function(ev) {
1056
1060
  oState.oIappStateHandler.fnStoreCurrentAppStateAndAdjustURL();
@@ -8,7 +8,7 @@
8
8
  "i18n": "i18n/i18n.properties",
9
9
  "applicationVersion": {
10
10
  "__comment": "applicationVersion oder componentversion??",
11
- "version": "1.130.2"
11
+ "version": "1.130.3"
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.130.2"
11
+ "version": "1.130.3"
12
12
  },
13
13
  "title": "Canvas",
14
14
  "description": "Canvas Page",
@@ -547,13 +547,6 @@ sap.ui.define([
547
547
  oState.oMultiEditHandler = new MultiEditHandler(oState, oController, oTemplateUtils);
548
548
  oState.oInsightsHandler = new InsightsHandler(oState, oController, oTemplateUtils);
549
549
 
550
- oTemplateUtils.oServices.oFioriAIHandler && oTemplateUtils.oServices.oFioriAIHandler.getFioriAIEnabledPromise().then(function() {
551
- oState.oEasyFilterBarHandler = new EasyFilterBarHandler(oState, oController, oTemplateUtils);
552
- oState.oEasyFilterBarHandler.initialiseEasyFilterBar();
553
- });
554
-
555
-
556
-
557
550
  var oTemplatePrivateModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
558
551
 
559
552
  oTemplatePrivateModel.setProperty("/listReport/aMissingNavProperties", false);
@@ -696,12 +689,14 @@ sap.ui.define([
696
689
 
697
690
  onSmartFilterBarInitialized: function () {
698
691
  oState.oIappStateHandler.onSmartFilterBarInitialized();
699
- oTemplateUtils.oServices.oFioriAIHandler && oTemplateUtils.oServices.oFioriAIHandler.getFioriAIEnabledPromise().then(function() {
700
- // oEasyFilterBarHandler is already initialized in the controller onInit
701
- // Prepare the metadats upfront so that it is not triggered for each search
702
- oState.oEasyFilterBarHandler && oState.oEasyFilterBarHandler.getEasyFilterSearchMetadata();
703
- oState.oSmartFilterbar.attachFilterChange(function(oEvent) {
704
- oState.oEasyFilterBarHandler.onFilterChange(oEvent);
692
+ // After the SFB is initialized, FE sets default values from different sources. So initialising the EasyFilterBar after the SFB and FE init appState is initialized.
693
+ oTemplateUtils.oServices.oFioriAIHandler && oTemplateUtils.oServices.oFioriAIHandler.getFioriAIEnabledPromise("EasyFilter").then(function() {
694
+ oState.oIappStateHandler.onFEStartupInitialized().then(function() {
695
+ oState.oEasyFilterBarHandler = new EasyFilterBarHandler(oState, oController, oTemplateUtils);
696
+ oState.oEasyFilterBarHandler.initialiseEasyFilterBar();
697
+ oState.oSmartFilterbar.attachFilterChange(function(oEvent) {
698
+ oState.oEasyFilterBarHandler.onFilterChange(oEvent);
699
+ });
705
700
  });
706
701
  });
707
702
  },
@@ -64,6 +64,11 @@ sap.ui.define([
64
64
  onSmartFilterBarInitialized = fnResolve;
65
65
  });
66
66
 
67
+ // Resolve this only after the FE initializes all the filter values from different sources
68
+ var onFEStartupInitializedResolver;
69
+ var onFEStartupInitializedPromise = new Promise(function(fnResolve) {
70
+ onFEStartupInitializedResolver = fnResolve;
71
+ });
67
72
  // *** setup wrappers for control states (start)
68
73
 
69
74
 
@@ -805,7 +810,11 @@ sap.ui.define([
805
810
  // Remark: in case of an appState key in the URL, that could not be analyzed, we should NOT call navigationHandler to parse. In this case, we get an empty object
806
811
  // (in contrast to undefined when there's no appstate key)
807
812
 
808
- return oSmartFilterBarInitializedPromise.then(fnParseUrlAndApplyAppState); // return promise to inform controller, when startup is finished
813
+ return oSmartFilterBarInitializedPromise.then(function() {
814
+ var oStartupFinishedPromise = fnParseUrlAndApplyAppState();
815
+ oStartupFinishedPromise.then(onFEStartupInitializedResolver);
816
+ return oStartupFinishedPromise; // return promise to inform controller, when startup is finished
817
+ });
809
818
  }
810
819
 
811
820
  var sNavType;
@@ -824,6 +833,8 @@ sap.ui.define([
824
833
  oSmartFilterBarInitializedPromise.then(function(){
825
834
  // fallback to navType initial, if appState is given in URL, but could not be analyzed => oState is an empty Object
826
835
  fnAdaptToAppState(oAppData, {} /* URLparameter are irrelevant if restoring from iAppState */, sNavType);
836
+ // Once the FE is initialized, the promise is resolved so that the SFB contains the updated list of filters
837
+ onFEStartupInitializedResolver();
827
838
  });
828
839
  return oSmartFilterBarInitializedPromise; // to inform controller, when startup is finished
829
840
  }
@@ -1075,6 +1086,10 @@ sap.ui.define([
1075
1086
  oDataLoadedWrapper.setState(!!bShouldDataBeLoaded);
1076
1087
  }
1077
1088
 
1089
+ function onFEStartupInitialized(){
1090
+ return onFEStartupInitializedPromise;
1091
+ }
1092
+
1078
1093
  return {
1079
1094
  areDataShownInTable: areDataShownInTable,
1080
1095
  setDataShownInTable: fnSetDataShownInTable,
@@ -1085,7 +1100,8 @@ sap.ui.define([
1085
1100
  onAfterSFBVariantLoad: onAfterSFBVariantLoad,
1086
1101
  applyState: applyState,
1087
1102
  getCurrentAppState: getCurrentAppState, // separation of concerns - only provide state, statePreserver responsible for storing it
1088
- setFiltersUsingUIState : fnSetFiltersUsingUIState
1103
+ setFiltersUsingUIState : fnSetFiltersUsingUIState,
1104
+ onFEStartupInitialized : onFEStartupInitialized
1089
1105
  };
1090
1106
  }
1091
1107
 
@@ -8,7 +8,7 @@
8
8
  "i18n": "i18n/i18n.properties",
9
9
  "applicationVersion": {
10
10
  "__comment": "applicationVersion oder componentversion??",
11
- "version": "1.130.2"
11
+ "version": "1.130.3"
12
12
  },
13
13
  "title": "{{TITLE}}",
14
14
  "description": "{{DESCRIPTION}}",
@@ -2410,7 +2410,7 @@ sap.ui.define([
2410
2410
  },
2411
2411
 
2412
2412
  onSummarize: function () {
2413
- oTemplateUtils.oServices.oFioriAIHandler.fioriaiLib.summarize({view: oController.getView()});
2413
+ oTemplateUtils.oServices.oFioriAIHandler.fioriaiLib.summarize.summarize({view: oController.getView()});
2414
2414
  },
2415
2415
 
2416
2416
  onEdit: function (oEvent) {
@@ -6,7 +6,7 @@
6
6
  "type": "component",
7
7
  "i18n": "i18n/i18n.properties",
8
8
  "applicationVersion": {
9
- "version": "1.130.2"
9
+ "version": "1.130.3"
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.130.2"
9
+ "version": "1.130.3"
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.130.2"
9
+ "version": "1.130.3"
10
10
  },
11
11
  "title": "{{TITLE}}",
12
12
  "description": "{{DESCRIPTION}}",
@@ -2,7 +2,7 @@
2
2
  xmlns:sfo="sap.ui.comp.smartform" xmlns:smartMultiInput="sap.ui.comp.smartmultiinput" xmlns:layoutData="sap.ui.layout" xmlns:fe="sap.suite.ui.generic.template.genericUtilities"
3
3
  xmlns:custom="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
4
4
  xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
5
- template:require="{AH: 'sap/suite/ui/generic/template/js/AnnotationHelper', AHModel: 'sap/ui/model/odata/AnnotationHelper', StableIdHelper: 'sap/suite/ui/generic/template/js/StableIdHelper'}">
5
+ template:require="{AH: 'sap/suite/ui/generic/template/js/AnnotationHelper', AHModel: 'sap/ui/model/odata/AnnotationHelper', StableIdHelper: 'sap/suite/ui/generic/template/js/StableIdHelper', SideEffectUtil: 'sap/suite/ui/generic/template/lib/SideEffectUtil'}">
6
6
 
7
7
  <!-- @classdesc @name: Name: sap.suite.ui.generic.template.fragments.SmartFormDataField.fragment.xml
8
8
  @description: This fragment contains label value pairs for the smart form
@@ -35,7 +35,7 @@
35
35
  visible="{path: 'dataField>', formatter: 'AH.getVisibiltyBasedOnImportanceAndHidden'}"
36
36
  binding="{path: 'dataField>Target'}, formatter: 'AH.getNavigationPathWithExpand'}">
37
37
  <fe:customData>
38
- <core:CustomData key="SideEffects" value="{parts: [{path: 'entitySet>'}, {path: 'dataField>'}], formatter: 'AH.getPropsForLinkFields'}"/>
38
+ <core:CustomData key="SideEffects" value="{parts: [{path: 'entitySet>'}, {path: 'dataField>'}, {path: 'contact>fn/Path'}], formatter: 'SideEffectUtil.getPropsForLinkFields'}"/>
39
39
  <core:CustomData key="Location" value="Section" />
40
40
  <core:CustomData key="contactDetails" value="{= ${path: 'contact>', formatter: 'AH.getCustomDataForContactPopup'}}"/>
41
41
  </fe:customData>
@@ -121,7 +121,7 @@
121
121
  press="._templateEventHandlers.onDataFieldWithIntentBasedNavigation"
122
122
  wrapping="true">
123
123
  <fe:customData>
124
- <core:CustomData key="SideEffects" value="{parts: [{path: 'entitySet>'}, {path: 'dataField>'}], formatter: 'AH.getPropsForLinkFields'}"/>
124
+ <core:CustomData key="SideEffects" value="{parts: [{path: 'entitySet>'}, {path: 'dataField>'}], formatter: 'SideEffectUtil.getPropsForLinkFields'}"/>
125
125
  <core:CustomData key="SemanticObject" value="{path: 'dataField>SemanticObject', formatter: 'AHModel.format'}" />
126
126
  <core:CustomData key="Action" value="{path: 'dataField>Action', formatter: 'AHModel.format'}" />
127
127
  </fe:customData>
@@ -28,6 +28,20 @@ sap.ui.define([
28
28
  return null;
29
29
  };
30
30
  }
31
+ /**
32
+ * PolyFill for Promise.withResolvers
33
+ */
34
+ if (!Promise.withResolvers) {
35
+ Promise.withResolvers = function() {
36
+ var resolvers = {};
37
+ var promise = new Promise(function(resolve, reject) {
38
+ resolvers.resolve = resolve;
39
+ resolvers.reject = reject;
40
+ });
41
+ Object.assign(promise, resolvers);
42
+ return promise;
43
+ };
44
+ }
31
45
  /**
32
46
  * PolyFill for nextSiblingElement
33
47
  */
@@ -11,10 +11,10 @@ sap.ui.define(["sap/ui/model/odata/AnnotationHelper",
11
11
  "sap/ui/core/library",
12
12
  "sap/suite/ui/generic/template/genericUtilities/metadataAnalyser",
13
13
  "sap/ui/base/ManagedObject",
14
- "sap/suite/ui/generic/template/lib/SideEffectUtil",
15
- "sap/suite/ui/generic/template/js/RuntimeFormatters" // just to make sure that it is loaded
14
+ "sap/base/util/isEmptyObject",
15
+ "sap/suite/ui/generic/template/js/RuntimeFormatters"// just to make sure that it is loaded
16
16
  ], function (AnnotationHelperModel, AnnotationHelperModelBasics, SmartField, FeLogger, formatMessage, deepExtend, StableIdHelper, utils, Device,
17
- SapMLibrary, SapCoreLibrary, metadataAnalyser, ManagedObject, SideEffectUtil) {
17
+ SapMLibrary, SapCoreLibrary, metadataAnalyser, ManagedObject, isEmptyObject) {
18
18
  "use strict";
19
19
 
20
20
  // shortcut for sap.ui.core.ValueState
@@ -384,9 +384,6 @@ sap.ui.define(["sap/ui/model/odata/AnnotationHelper",
384
384
  getCustomDataForContactPopup: function (oContactDetails) {
385
385
  return ((JSON.stringify(oContactDetails)).replace(/\}/g, "\\}").replace(/\{/g, "\\{")); //check bindingParser.escape
386
386
  },
387
- getPropsForLinkFields: function(oEntitySet, oTarget) {
388
- return SideEffectUtil.getPropsForLinkFields(oEntitySet, oTarget);
389
- },
390
387
  checkIsEmailAddress: function (oInterface, sEntityType, oDataField) {
391
388
  var oMetaModel = oInterface.getInterface(1).getModel();
392
389
  var sPath = oInterface.getInterface(1).getPath() + '/Value';
@@ -938,7 +938,7 @@ sap.ui.define([
938
938
  * @public
939
939
  * @extends sap.ui.core.UIComponent
940
940
  * @author SAP SE
941
- * @version 1.130.2
941
+ * @version 1.130.3
942
942
  * @name sap.suite.ui.generic.template.lib.AppComponent
943
943
  */
944
944
  var oAppComponent = UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
@@ -138,11 +138,14 @@ sap.ui.define(["sap/suite/ui/generic/template/js/AnnotationHelper",
138
138
  * Returns the EntitySet name, EntityType name, PropertyName for a given link field
139
139
  * @param {sap.ui.model.odata.ODataMetaModel.EntitySet} oEntitySet
140
140
  * @param {object} oTarget
141
+ * @param {string} sFieldName
141
142
  */
142
- function fnGetPropsForLinkFields (oEntitySet, oTarget) {
143
- var sLinkProperty = oTarget && oTarget.Value && oTarget.Value.Path;
144
- if (!sLinkProperty) {
145
- return null;
143
+ function fnGetPropsForLinkFields (oEntitySet, oTarget, sFieldName) {
144
+ var sLinkProperty;
145
+ if (oTarget && oTarget.Value && oTarget.Value.Path){
146
+ sLinkProperty = oTarget.Value.Path;
147
+ } else {
148
+ sLinkProperty = oTarget.Target.AnnotationPath.split("/")[0] + "/" + sFieldName;
146
149
  }
147
150
  var oCustomData = {
148
151
  "sEntitySetName": oEntitySet.name,
@@ -174,6 +177,7 @@ sap.ui.define(["sap/suite/ui/generic/template/js/AnnotationHelper",
174
177
  return;
175
178
  }
176
179
 
180
+ var oControl = oLink;
177
181
  var oEntityType = oMetaModel.getODataEntityType(sEntityTypeName);
178
182
  var oEntitySet = oMetaModel.getODataEntitySet(sEntitySetName);
179
183
  var oProperty = metadataAnalyser.getPropertyMetadata(oMetaModel, sEntityTypeName, sLinkProperty);
@@ -186,9 +190,20 @@ sap.ui.define(["sap/suite/ui/generic/template/js/AnnotationHelper",
186
190
  }
187
191
  };
188
192
 
189
- //The method SharedUtil.applyFieldGroupIDs takes in the control and its metadata, reads the Side Effect annotations configured for it
190
- //and assigns the fieldGroupID accordingly.
191
- SharedUtil.applyFieldGroupIDs(oLink, oMetaData);
193
+ if (sLinkProperty.includes("/")){
194
+ while (!oControl.isA("sap.ui.comp.smartform.Group")) {
195
+ oControl = oControl.getParent();
196
+ }
197
+ //The method SharedUtil.applyFieldGroupIDs takes in the control and its metadata
198
+ //It then reads the Side Effect annotations configured for it, calculates fieldGroupIds and assigns them to the field
199
+
200
+ //For navigation path link fields, we pass the oLink's parent Group control's binding context when calculating the fieldGroupIds
201
+ //This makes sure the calculated fieldGroupIds are consistent with the other source fields
202
+ SharedUtil.applyFieldGroupIDs(oLink, oMetaData, null, oControl.getBindingContext());
203
+ } else {
204
+ //For non navigation path link fields, we just pass the oLink along with its metadata
205
+ SharedUtil.applyFieldGroupIDs(oLink, oMetaData);
206
+ }
192
207
  }
193
208
  }
194
209
 
@@ -2,8 +2,9 @@ sap.ui.define([
2
2
  "sap/ui/base/Object",
3
3
  "sap/base/util/extend",
4
4
  "sap/suite/ui/generic/template/lib/filterHelper",
5
- "sap/suite/ui/generic/template/genericUtilities/FeLogger"
6
- ], function(BaseObject, extend, filterHelper, FeLogger) {
5
+ "sap/suite/ui/generic/template/genericUtilities/FeLogger",
6
+ "sap/ui/model/FilterOperator"
7
+ ], function(BaseObject, extend, filterHelper, FeLogger, FilterOperator) {
7
8
  'use strict';
8
9
 
9
10
  /*
@@ -32,19 +33,11 @@ sap.ui.define([
32
33
  return Promise.resolve(oEasyFilterMetadata);
33
34
  } else {
34
35
  return new Promise(function(fnResolve) {
35
- // In case the smart filter bar is already initialized then do not use "attachInitialized" as this event will never get triggered again
36
- if (oState.oSmartFilterbar.isInitialised()) {
36
+ oState.oIappStateHandler.onFEStartupInitialized().then(function() {
37
37
  fnPrepareSearchMetadata().then(function(oMetadata){
38
- fnResolve(oMetadata);
39
- }
40
- );
41
- } else {
42
- oState.oSmartFilterbar.attachInitialized(function() {
43
- fnPrepareSearchMetadata().then(function(oMetadata) {
44
- fnResolve(oMetadata);
45
- });
46
- },this);
47
- }
38
+ fnResolve(oMetadata);
39
+ });
40
+ });
48
41
  });
49
42
  }
50
43
  }
@@ -56,34 +49,48 @@ sap.ui.define([
56
49
  function fnPrepareSearchMetadata() {
57
50
 
58
51
  var aPromise = [];
52
+ var oEditStateFilterItem;
53
+ var oDefaultValuesForEasyFilter = {};
59
54
  var oOwnerFilterControl = oState.oSmartFilterbar;
60
55
  var oSFBModel = oOwnerFilterControl.getModel();
61
56
  var oSFBMetaModel = oSFBModel.getMetaModel();
62
- var oEditStateFilterItem;
57
+
63
58
  var sEntitySet = oController.getOwnerComponent().getEntitySet();
64
- var sTokenType = "ValueHelp"; // Other values are "Calendar" | "Time" | "MenuWithCheckBox"
65
59
 
66
60
  var mFilterProperties = {}; // todo : Add the properties from navigation entites
67
61
  var oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(sEntitySet);
68
62
  oEntityType.property.map(function (oProperty) {
63
+ var sTokenType = "ValueHelp"; // Other values are "Calendar" | "Time" | "MenuWithCheckBox"
69
64
  if (filterHelper.isPropertyFilterable(oProperty)) {
70
- var bIsCodeListRequired = "";
65
+
66
+ var bIsCodeListRequired;
71
67
  oProperty.extensions && oProperty.extensions.forEach(function(oExtension) {
72
68
  if (oExtension.name === "value-list" && oExtension.value === "fixed-values") {
73
69
  sTokenType = "MenuWithCheckBox";
74
70
  bIsCodeListRequired = true;
75
71
  }
76
72
  });
73
+
74
+ // Calculate the token type based on the property type and display format
75
+ // It will be better if this is done at the control level
76
+ if ((oProperty.type === "Edm.DateTime" && oProperty["sap:display-format"] === "Date") ||
77
+ (oProperty.type === "Edm.String" && oProperty["com.sap.vocabularies.Common.v1.IsCalendarDate"] && oProperty["com.sap.vocabularies.Common.v1.IsCalendarDate"].Bool === "true")) {
78
+ sTokenType = "Calendar";
79
+ } else if (oProperty.type === "Edm.DateTimeOffset") {
80
+ sTokenType = "Time";
81
+ }
82
+
77
83
  mFilterProperties[oProperty.name] = {
78
84
  name: oProperty.name,
79
85
  //label: oProperty.label, Name is added from the filter item control
80
86
  dataType: oProperty.type,
87
+ defaultValue : {}, // Fill values from FLP user defaults , SV or other sources
81
88
  filterable: true,
82
89
  sortable: false,
83
90
  codeList : bIsCodeListRequired,
84
91
  type: sTokenType,
85
92
  unit: oProperty["sap:unit"] || "",
86
- required: oProperty["sap:required-in-filter"] ? true : false
93
+ required: oProperty["sap:required-in-filter"] === "true" ? true : false
87
94
  };
88
95
  }
89
96
  });
@@ -93,12 +100,46 @@ sap.ui.define([
93
100
  entitySet: sEntitySet,
94
101
  fields : []
95
102
  };
96
-
103
+ oDefaultValuesForEasyFilter = oOwnerFilterControl.getFilterData() || {};
97
104
  oOwnerFilterControl.getAllFilterItems().forEach(function (oFilterItem) {
98
105
  //check if the filter item from the filter control is a property of the entity type , if then push it to the easy filter metadata
99
106
  // todo : Add the properties from navigation entites
100
107
  var oFilterItemForQuery = mFilterProperties[oFilterItem.getName()];
101
108
  if (oFilterItemForQuery) {
109
+ var oDefaultFilterValue = oDefaultValuesForEasyFilter[oFilterItem.getName()];
110
+ if (oDefaultFilterValue) {
111
+ var aValues = [];
112
+ if (oDefaultFilterValue.ranges) {
113
+ aValues = oDefaultFilterValue.ranges.map(function(oRange) {
114
+ if (oRange.exclude === false) {
115
+ if (oRange.operation === "BT") {
116
+ return {
117
+ operator: FilterOperator.BT,
118
+ selectedValues: [{ value1: oRange.value1, value2: oRange.value2 }]
119
+ };
120
+ } else {
121
+ return {
122
+ operator: oRange.operation,
123
+ selectedValues: [oRange.value1]
124
+ };
125
+ }
126
+ } else {
127
+ return {
128
+ operator: FilterOperator.NE,
129
+ selectedValues: [oRange.value1]
130
+ };
131
+ }
132
+ });
133
+ } else { // In cases where the default value is coming from the FLP user defaults and does not have ranges and the value is a single value
134
+ aValues = [
135
+ {
136
+ operator: FilterOperator.EQ,
137
+ selectedValues: [oDefaultFilterValue]
138
+ }
139
+ ];
140
+ }
141
+ oFilterItemForQuery.defaultValue = aValues;
142
+ }
102
143
  oFilterItemForQuery.label = oFilterItem.getLabel();
103
144
  // codeList is set to true for fixed value list and codelist is fetched
104
145
  if (oFilterItemForQuery.codeList) {
@@ -128,7 +169,6 @@ sap.ui.define([
128
169
  if (oTemplateUtils.oComponentUtils.isDraftEnabled()) {
129
170
  var oEditStateControl = oController.byId("editStateFilter");
130
171
  if (oEditStateControl) {
131
- sTokenType = "MenuWithCheckBox";
132
172
  var oEditingStatusCodeList = oEditStateControl.getItems().map(function(oItem) {
133
173
  return {
134
174
  value : oItem.getKey(),
@@ -142,7 +182,7 @@ sap.ui.define([
142
182
  filterable: true,
143
183
  required: false,
144
184
  sortable: false,
145
- type: sTokenType,
185
+ type: "MenuWithCheckBox",
146
186
  codeList : oEditingStatusCodeList
147
187
  };
148
188
  oEasyFilterMetadata.fields.push(oEditStateFilterMetadata);
@@ -308,7 +348,7 @@ sap.ui.define([
308
348
  var sEntitySet = oController.getOwnerComponent().getEntitySet();
309
349
  oEasyFilterMetadataPromise.then((oEasyFilterMetadata) => {
310
350
  oEasyFilter.setContextPath(sEntitySet);
311
- oEasyFilter.setAppId(oController.getOwnerComponent().getAppComponent().getManifestEntry("sap.app")).id;
351
+ oEasyFilter.setAppId(oController.getOwnerComponent().getAppComponent().getManifestEntry("sap.app").id);
312
352
  oEasyFilter.setFilterBarMetadata(oEasyFilterMetadata.fields);
313
353
  oEasyFilter.easyfilter = oTemplateUtils.oServices.oFioriAIHandler.fioriaiLib.EasyFilter;
314
354
  });
@@ -2,10 +2,16 @@ sap.ui.define([
2
2
  "sap/ui/base/Object",
3
3
  "sap/base/util/extend",
4
4
  "sap/ui/core/Lib",
5
- "sap/suite/ui/generic/template/genericUtilities/FeLogger"
5
+ "sap/suite/ui/generic/template/genericUtilities/FeLogger",
6
+ "sap/suite/ui/generic/template/genericUtilities/polyFill"
6
7
  ], function(BaseObject, extend, Lib, FeLogger) {
7
8
  'use strict';
8
- var sAIIntent = "#IntelligentPrompt-summarize"; // For now the intent is common for all the AI scenarios
9
+ // List of AI capabilities that are available in the template
10
+ var aAIIntentMaster = [
11
+ { name : "summarize", intent : "#IntelligentPrompt-summarize", importURL : "ux/eng/fioriai/reuse/library", localProperty : "isSummarizationEnabled", oEnabledPromise : Promise.withResolvers() },
12
+ { name : "EasyFilter", intent : "#IntelligentPrompt-filter", importURL : "ux/eng/fioriai/reuse/easyfilter/EasyFilter", localProperty : "isEasyFilterEnabled", oEnabledPromise : Promise.withResolvers() },
13
+ { name : "ErrorExplanation", intent : "#IntelligentPrompt-explain", importURL : "ux/eng/fioriai/reuse/errorexplanation/ErrorExplanation", localProperty : "isErrorExplanationEnabled", oEnabledPromise : Promise.withResolvers() }
14
+ ];
9
15
  var sFioriAILibrary = "ux.eng.fioriai.reuse";
10
16
  var UShellContainer = sap.ui.require("sap/ushell/Container");
11
17
  var oLogger = new FeLogger("lib.ai.FioriAIHandler").getLogger();
@@ -16,52 +22,42 @@ sap.ui.define([
16
22
 
17
23
  function getMethods(oTemplateContract) {
18
24
 
19
- var fnResolveInit = null;
20
- var fnRejectInit = null;
21
- var oFioriAILoaderPromise = new Promise(function(fnResolve, fnReject) {
22
- fnResolveInit = fnResolve;
23
- fnRejectInit = fnReject;
24
- });
25
-
26
25
  /**
27
26
  * This method is used to load the Fiori AI library and make the available AI capabilities to the template contract
28
27
  */
29
28
  function fnLoadAILibrary() {
30
29
  var that = this;
31
30
  UShellContainer && UShellContainer.getServiceAsync("Navigation").then(function(oNavigationService) {
32
- oNavigationService.resolveIntent(sAIIntent).then(function(sUrl) {
33
- Lib.load({name: sFioriAILibrary, url: sUrl}).then(function() {
34
- // To-Do : load the summarize from reuse/summary
35
- sap.ui.require(["ux/eng/fioriai/reuse/library",
36
- "ux/eng/fioriai/reuse/easyfilter/EasyFilter",
37
- "ux/eng/fioriai/reuse/errorexplanation/ErrorExplanation"
38
- ], function(fioriaiLib, EasyFilter, ErrorExplanation) {
39
- that.fioriaiLib.summarize = fioriaiLib.summarize;
40
- that.fioriaiLib.EasyFilter = EasyFilter;
41
- that.fioriaiLib.ErrorExplanation = ErrorExplanation;
42
-
43
- that.isFioriAIEnabled = true;
44
- // Each AI capability will be enabled separately. Currently there is no separation for beta , but in future it will be
45
- oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/fioriAI/isSummarizationEnabled", !!sUrl);
46
- // isEasyFilterEnabled property controls the visibility of the filter bar switch from which the easyfilter can be accessed
47
- oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/fioriAI/isEasyFilterEnabled", !!sUrl);
48
- oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/fioriAI/isErrorExplanationEnabled", !!sUrl);
49
- fnResolveInit();
31
+ aAIIntentMaster.forEach(function(oAIIntent) {
32
+ oNavigationService.resolveIntent(oAIIntent.intent).then(function(sURL) {
33
+ Lib.load({name: sFioriAILibrary , url : sURL }).then(function() {
34
+ sap.ui.require([oAIIntent.importURL
35
+ ], function(fioriaiLibImport) {
36
+ oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/fioriAI/" + oAIIntent.localProperty , true);
37
+ that.fioriaiLib[oAIIntent.name] = fioriaiLibImport;
38
+ oAIIntent.oEnabledPromise.resolve();
39
+ });
50
40
  });
41
+ }, function() {
42
+ oLogger.warning(oAIIntent.intent + " capability not enabled on this tenant");
43
+ oAIIntent.oEnabledPromise.reject();
51
44
  });
52
- }).catch(function() {
53
- oLogger.warning("No intelligent capability enabled on the tenant");
54
- fnRejectInit();
55
45
  });
56
- }, fnRejectInit);
46
+ }).catch(function() {
47
+ oLogger.warning("No Navigation service enabled on the tenant");
48
+ });
57
49
  }
58
50
 
59
51
  /**
60
- *
52
+ * @param {*} sAIIntentName The name of the AI intent
61
53
  * @returns Promise which resolves to true if the AI is enabled
62
54
  */
63
- function fnGetFioriAIEnabledPromise() {
64
- return this.isFioriAIEnabled ? Promise.resolve() : oFioriAILoaderPromise;
55
+ function fnGetFioriAIEnabledPromise(sAIIntentName) {
56
+ var oAIIntent;
57
+ oAIIntent = aAIIntentMaster.find(function(oAIIntent) {
58
+ return oAIIntent.name === sAIIntentName;
59
+ });
60
+ return oAIIntent.oEnabledPromise.promise;
65
61
  }
66
62
 
67
63
  return {
@@ -77,7 +73,6 @@ sap.ui.define([
77
73
  EasyFilter: null,
78
74
  ErrorExplanation: null
79
75
  };
80
- this.isFioriAIEnabled = false;
81
76
  extend(this, getMethods(oTemplateContract));
82
77
  }
83
78
  });
@@ -2325,35 +2325,48 @@ sap.ui.define(["sap/ui/base/Object",
2325
2325
 
2326
2326
 
2327
2327
  var mRoutesToHostViews = Object.create(null);
2328
- function fnPrepareHostView(oTreeNode, isComponentPreloaded, bOnlyComponent){
2329
- if (oTreeNode.createComponent) {
2330
- if (bOnlyComponent || oTemplateContract.oAppComponent.isDestroyed()) {
2331
- return Promise.resolve();
2332
- }
2333
- oTreeNode.createComponent();
2334
- delete oTreeNode.createComponent;
2328
+ function fnPrepareHostView(oTreeNode, isComponentPreloaded, bOnlyComponent) {
2329
+ if (oTemplateContract.oAppComponent.isDestroyed()) {
2335
2330
  return Promise.resolve();
2336
2331
  }
2337
- if (mRoutesToHostViews[oTreeNode.sRouteName] || oTemplateContract.oAppComponent.isDestroyed()){
2338
- return Promise.resolve();
2332
+
2333
+ // Return oHostViewPromise from the routes cache if it exists
2334
+ if (mRoutesToHostViews[oTreeNode.sRouteName]) {
2335
+ return mRoutesToHostViews[oTreeNode.sRouteName].then(function(oHostView) {
2336
+ // if createComponent is available in oTreeNode, call the function and remove from oTreeNode
2337
+ if (oTreeNode.createComponent) {
2338
+ if (bOnlyComponent || oTemplateContract.oAppComponent.isDestroyed()) {
2339
+ return Promise.resolve();
2340
+ }
2341
+ oTreeNode.createComponent();
2342
+ delete oTreeNode.createComponent;
2343
+ return Promise.resolve();
2344
+ }
2345
+ return oHostView;
2346
+ });
2339
2347
  }
2340
-
2348
+
2341
2349
  oLogger.debug("Prepare host view for route " + oTreeNode.sRouteName);
2350
+
2342
2351
  var oHostViewPromise = oNavigationControllerProxy.createHostView();
2352
+ // Store the oHostViewPromise in the routes cache
2353
+ mRoutesToHostViews[oTreeNode.sRouteName] = oHostViewPromise;
2354
+
2343
2355
  var oViews = oNavigationControllerProxy.oRouter.getViews();
2344
2356
  // Temporarily add the oHostViewPromise to the view cache
2345
2357
  oViews.setView(oTreeNode.sRouteName, oHostViewPromise);
2346
2358
 
2347
2359
  return oHostViewPromise.then(function(oHostView) {
2348
- //Update the view cache with the actual view
2360
+ // Update the view cache with the actual view
2349
2361
  oViews.setView(oTreeNode.sRouteName, oHostView);
2350
- mRoutesToHostViews[oTreeNode.sRouteName] = oHostView;
2362
+
2351
2363
  var oComponentContainer = oHostView.byId("host");
2352
2364
  if (bOnlyComponent) {
2353
2365
  oTreeNode.createComponent = fnCreateTemplateComponent.bind(null, oComponentContainer, oTreeNode.sRouteName, isComponentPreloaded);
2354
2366
  } else {
2355
2367
  fnCreateTemplateComponent(oComponentContainer, oTreeNode.sRouteName, isComponentPreloaded);
2356
2368
  }
2369
+ return oHostView;
2357
2370
  });
2358
2371
  }
2359
2372
 
@@ -3067,6 +3080,7 @@ sap.ui.define(["sap/ui/base/Object",
3067
3080
  /* eslint-disable */
3068
3081
  var fnCreateTemplateComponent = testableHelper.testable(fnCreateTemplateComponent, "createTemplateComponent");
3069
3082
  var getParsedShellHashFromFLP = testableHelper.testable(getParsedShellHashFromFLP, "getParsedShellHashFromFLP");
3083
+ var fnPrepareHostView = testableHelper.testable(fnPrepareHostView, "prepareHostView");
3070
3084
  var fnPreloadComponent = testableHelper.testable(fnPreloadComponent, "preloadComponent");
3071
3085
  var fnGetRouteInfoByHash = testableHelper.testable(fnGetRouteInfoByHash, "getRouteInfoByHash");
3072
3086
  var fnGetIsStateChange = testableHelper.testable(fnGetIsStateChange, "getIsStateChange");
@@ -3167,7 +3181,7 @@ sap.ui.define(["sap/ui/base/Object",
3167
3181
  * @param {sap.suite.ui.generic.template.lib.AppComponent} oAppComponent The AppComponent instance
3168
3182
  * @public
3169
3183
  * @extends sap.ui.base.Object
3170
- * @version 1.130.2
3184
+ * @version 1.130.3
3171
3185
  * @since 1.30.0
3172
3186
  * @alias sap.suite.ui.generic.template.lib.NavigationController
3173
3187
  */
@@ -64,7 +64,7 @@ sap.ui.define([
64
64
  interfaces: [],
65
65
  controls: [],
66
66
  elements: [],
67
- version: "1.130.2",
67
+ version: "1.130.3",
68
68
  extensions: {
69
69
  //Configuration used for rule loading of Support Assistant
70
70
  "sap.ui.support": {