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

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 (28) 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 +12 -16
  7. package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +18 -2
  8. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n.properties +1 -4
  9. package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
  10. package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +1 -1
  11. package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
  12. package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
  13. package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
  14. package/src/sap/suite/ui/generic/template/fragments/EasyFilter.fragment.xml +0 -6
  15. package/src/sap/suite/ui/generic/template/fragments/SmartFormDataField.fragment.xml +3 -3
  16. package/src/sap/suite/ui/generic/template/genericUtilities/filterHelper.js +70 -2
  17. package/src/sap/suite/ui/generic/template/genericUtilities/polyFill.js +14 -0
  18. package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +3 -6
  19. package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
  20. package/src/sap/suite/ui/generic/template/lib/CRUDHelper.js +5 -3
  21. package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +4 -0
  22. package/src/sap/suite/ui/generic/template/lib/ContextBookkeeping.js +39 -23
  23. package/src/sap/suite/ui/generic/template/lib/SideEffectUtil.js +22 -7
  24. package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +94 -33
  25. package/src/sap/suite/ui/generic/template/lib/ai/FioriAIHandler.js +30 -35
  26. package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +0 -14
  27. package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +27 -13
  28. 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.4",
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.4</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.4"
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.4"
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,25 +689,25 @@ 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
  },
708
703
  onAfterSFBVariantLoad: function (oEvent) {
709
704
  oState.oIappStateHandler.onAfterSFBVariantLoad(oEvent);
705
+ oState.oEasyFilterBarHandler && oState.oEasyFilterBarHandler.handleVariantLoad(oEvent);
710
706
  },
711
707
  onSmartListDataReceived: function (oEvent) {
712
708
  var oSmartList = oEvent.getSource();
713
709
  fnOnDataReceived(oSmartList);
714
710
  },
715
- onEasyFilterExecuteSearch: function(oEvent) {
716
- oState.oEasyFilterBarHandler.onExecuteSearch(oEvent);
717
- },
718
711
  onEasyFilterClearFilters: function(oEvent) {
719
712
  oState.oEasyFilterBarHandler.onClearFilters(oEvent);
720
713
  },
@@ -738,6 +731,9 @@ sap.ui.define([
738
731
  var oTempModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
739
732
  if (oTempModel.getProperty("/listReport/filterMode") === "easyFilter") {
740
733
  oSmartFilterbar.setVisible(false);
734
+ var oTemplatePrivateModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
735
+ oTemplatePrivateModel.setProperty("/listReport/firstSelection", true);
736
+ oTemplatePrivateModel.setProperty("/generic/bDataAreShownInTable", false);
741
737
  } else {
742
738
  oSmartFilterbar.setVisible(true);
743
739
  }
@@ -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
 
@@ -160,14 +160,11 @@ ST_CREATE_WITH_FILTERS=Create with filters
160
160
  #------------Easy filter related text-----------------------
161
161
  # All the easy filter and filter mode related texts are defined here
162
162
 
163
- # XTIT,30: Title of the Filter modes in List Report
164
- ST_EASY_FILTER_TITLE=Filter Mode :
165
-
166
163
  # XBUT: Manual filter segmented button text
167
164
  ST_MANUAL_FILTER=Classic
168
165
 
169
166
  # XBUT: Easy filter segmented button text
170
- ST_EASY_FILTER=SAP Business AI
167
+ ST_EASY_FILTER=Easy filter
171
168
 
172
169
  #------------End of: Easy filter related text-----------------------
173
170
 
@@ -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.4"
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.4"
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.4"
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.4"
10
10
  },
11
11
  "title": "{{TITLE}}",
12
12
  "description": "{{DESCRIPTION}}",
@@ -1,11 +1,6 @@
1
1
  <core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:feControls="sap.fe.controls.easyFilter">
2
2
  <!-- to check how to use a common model property instead of listReport/filterMode which is specific to LR-->
3
3
  <VBox visible="{= ${_templPriv>/listReport/filterMode} === 'easyFilter'}">
4
- <MessageStrip
5
- text="{i18n>ST_EASY_FILTER_PROMPT_INFO}"
6
- showIcon="true"
7
- showCloseButton="true"
8
- class="sapUiSmallMarginBottom"/>
9
4
  <feControls:EasyFilterBarContainer id="template::easyFilterContainer"
10
5
  showValueHelp="._templateEventHandlers.onEasyFilterShowValueHelp"
11
6
  queryChanged="._templateEventHandlers.onEasyFilterQueryChanged"
@@ -13,7 +8,6 @@
13
8
  beforeQueryProcessing="._templateEventHandlers.onEasyFilterBeforeQueryProcessing"
14
9
  afterQueryProcessing="._templateEventHandlers.onEasyFilterAfterQueryProcessing"
15
10
  clearFilters="._templateEventHandlers.onEasyFilterClearFilters"
16
- executeSearch="._templateEventHandlers.onEasyFilterExecuteSearch"
17
11
  />
18
12
  </VBox>
19
13
  </core:FragmentDefinition>
@@ -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>
@@ -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((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(
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
+ (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
  };
@@ -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.4
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", {
@@ -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
  }
@@ -1663,6 +1663,10 @@ sap.ui.define(["sap/ui/base/Object",
1663
1663
  if (oError.lockedByUser) {
1664
1664
  var sLockText = oCommonUtils.getText("ST_GENERIC_DRAFT_LOCKED_BY_USER", [" ", oError.lockedByUser]);
1665
1665
  MessageBox.error(sLockText);
1666
+ } else if (oError.cancelled) {
1667
+ if (oViewProxy && oViewProxy.navigateUp){
1668
+ oViewProxy.navigateUp();
1669
+ }
1666
1670
  } else {
1667
1671
  MessageUtils.handleError(MessageUtils.operations.editEntity, oController, oServices, oError);
1668
1672
  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;
@@ -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
  /*
@@ -28,25 +29,19 @@ sap.ui.define([
28
29
  * @returns A promise which returns the prepared metadata
29
30
  */
30
31
  function fnGetEasyFilterSearchMetadata() {
31
- if (oEasyFilterMetadata) {
32
- return Promise.resolve(oEasyFilterMetadata);
33
- } else {
32
+ // In a few cases the SFB is not properly initialized and the metadata available is not complete
33
+ // In such cases the metadata is prepared after the SFB is initialized
34
+ // if (oEasyFilterMetadata) {
35
+ // return Promise.resolve(oEasyFilterMetadata);
36
+ // } else {
34
37
  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()) {
38
+ oState.oIappStateHandler.onFEStartupInitialized().then(function() {
37
39
  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
- }
40
+ fnResolve(oMetadata);
41
+ });
42
+ });
48
43
  });
49
- }
44
+ //}
50
45
  }
51
46
  /**
52
47
  * This method prepares the metadata for each filterable field from the smart filter bar
@@ -56,34 +51,48 @@ sap.ui.define([
56
51
  function fnPrepareSearchMetadata() {
57
52
 
58
53
  var aPromise = [];
54
+ var oEditStateFilterItem;
55
+ var oDefaultValuesForEasyFilter = {};
59
56
  var oOwnerFilterControl = oState.oSmartFilterbar;
60
57
  var oSFBModel = oOwnerFilterControl.getModel();
61
58
  var oSFBMetaModel = oSFBModel.getMetaModel();
62
- var oEditStateFilterItem;
59
+
63
60
  var sEntitySet = oController.getOwnerComponent().getEntitySet();
64
- var sTokenType = "ValueHelp"; // Other values are "Calendar" | "Time" | "MenuWithCheckBox"
65
61
 
66
62
  var mFilterProperties = {}; // todo : Add the properties from navigation entites
67
63
  var oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(sEntitySet);
68
64
  oEntityType.property.map(function (oProperty) {
65
+ var sTokenType = "ValueHelp"; // Other values are "Calendar" | "Time" | "MenuWithCheckBox" | "MenuWithSingleSelect"
69
66
  if (filterHelper.isPropertyFilterable(oProperty)) {
70
- var bIsCodeListRequired = "";
67
+
68
+ var bIsCodeListRequired;
71
69
  oProperty.extensions && oProperty.extensions.forEach(function(oExtension) {
72
70
  if (oExtension.name === "value-list" && oExtension.value === "fixed-values") {
73
71
  sTokenType = "MenuWithCheckBox";
74
72
  bIsCodeListRequired = true;
75
73
  }
76
74
  });
75
+
76
+ // Calculate the token type based on the property type and display format
77
+ // It will be better if this is done at the control level
78
+ if ((oProperty.type === "Edm.DateTime" && oProperty["sap:display-format"] === "Date") ||
79
+ (oProperty.type === "Edm.String" && oProperty["com.sap.vocabularies.Common.v1.IsCalendarDate"] && oProperty["com.sap.vocabularies.Common.v1.IsCalendarDate"].Bool === "true")) {
80
+ sTokenType = "Calendar";
81
+ } else if (oProperty.type === "Edm.DateTimeOffset") {
82
+ sTokenType = "Time";
83
+ }
84
+
77
85
  mFilterProperties[oProperty.name] = {
78
86
  name: oProperty.name,
79
87
  //label: oProperty.label, Name is added from the filter item control
80
88
  dataType: oProperty.type,
89
+ defaultValue : [], // Fill values from FLP user defaults , SV or other sources
81
90
  filterable: true,
82
91
  sortable: false,
83
92
  codeList : bIsCodeListRequired,
84
93
  type: sTokenType,
85
94
  unit: oProperty["sap:unit"] || "",
86
- required: oProperty["sap:required-in-filter"] ? true : false
95
+ required: oProperty["sap:required-in-filter"] === "true" ? true : false
87
96
  };
88
97
  }
89
98
  });
@@ -93,12 +102,54 @@ sap.ui.define([
93
102
  entitySet: sEntitySet,
94
103
  fields : []
95
104
  };
96
-
105
+ oDefaultValuesForEasyFilter = oOwnerFilterControl.getFilterData() || {};
97
106
  oOwnerFilterControl.getAllFilterItems().forEach(function (oFilterItem) {
98
107
  //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
108
  // todo : Add the properties from navigation entites
100
109
  var oFilterItemForQuery = mFilterProperties[oFilterItem.getName()];
101
110
  if (oFilterItemForQuery) {
111
+ var oDefaultFilterValue = oDefaultValuesForEasyFilter[oFilterItem.getName()];
112
+ if (oDefaultFilterValue) {
113
+ var aValues = [];
114
+ // oDefaultFilterValue can have ranges or items or low or single value directly
115
+ if (oDefaultFilterValue.ranges && oDefaultFilterValue.ranges.length > 0) {
116
+ aValues = oDefaultFilterValue.ranges.map(function(oRange) {
117
+ if (oRange.exclude === false) {
118
+ if (oRange.operation === "BT") {
119
+ return {
120
+ operator: FilterOperator.BT,
121
+ selectedValues: [{ value1: oRange.value1, value2: oRange.value2 }]
122
+ };
123
+ } else {
124
+ return {
125
+ operator: oRange.operation,
126
+ selectedValues: [oRange.value1]
127
+ };
128
+ }
129
+ } else {
130
+ return {
131
+ operator: FilterOperator.NE,
132
+ selectedValues: [oRange.value1]
133
+ };
134
+ }
135
+ });
136
+ } else if (oDefaultFilterValue.items && oDefaultFilterValue.items.length > 0) { // unrestricted/multi-value
137
+ oDefaultFilterValue.items.forEach(function(oItem) {
138
+ aValues.push({
139
+ operator: FilterOperator.EQ,
140
+ selectedValues: [oItem.key]
141
+ });
142
+ });
143
+ } else if (oDefaultFilterValue) { // 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
144
+ aValues = [
145
+ {
146
+ operator: FilterOperator.EQ,
147
+ selectedValues: [oDefaultFilterValue]
148
+ }
149
+ ];
150
+ }
151
+ oFilterItemForQuery.defaultValue = aValues;
152
+ }
102
153
  oFilterItemForQuery.label = oFilterItem.getLabel();
103
154
  // codeList is set to true for fixed value list and codelist is fetched
104
155
  if (oFilterItemForQuery.codeList) {
@@ -128,7 +179,6 @@ sap.ui.define([
128
179
  if (oTemplateUtils.oComponentUtils.isDraftEnabled()) {
129
180
  var oEditStateControl = oController.byId("editStateFilter");
130
181
  if (oEditStateControl) {
131
- sTokenType = "MenuWithCheckBox";
132
182
  var oEditingStatusCodeList = oEditStateControl.getItems().map(function(oItem) {
133
183
  return {
134
184
  value : oItem.getKey(),
@@ -142,7 +192,7 @@ sap.ui.define([
142
192
  filterable: true,
143
193
  required: false,
144
194
  sortable: false,
145
- type: sTokenType,
195
+ type: "MenuWithSingleSelect",
146
196
  codeList : oEditingStatusCodeList
147
197
  };
148
198
  oEasyFilterMetadata.fields.push(oEditStateFilterMetadata);
@@ -308,17 +358,12 @@ sap.ui.define([
308
358
  var sEntitySet = oController.getOwnerComponent().getEntitySet();
309
359
  oEasyFilterMetadataPromise.then((oEasyFilterMetadata) => {
310
360
  oEasyFilter.setContextPath(sEntitySet);
311
- oEasyFilter.setAppId(oController.getOwnerComponent().getAppComponent().getManifestEntry("sap.app")).id;
361
+ oEasyFilter.setAppId(oController.getOwnerComponent().getAppComponent().getManifestEntry("sap.app").id);
312
362
  oEasyFilter.setFilterBarMetadata(oEasyFilterMetadata.fields);
313
363
  oEasyFilter.easyfilter = oTemplateUtils.oServices.oFioriAIHandler.fioriaiLib.EasyFilter;
314
364
  });
315
365
  }
316
366
 
317
- function fnExecuteSearch(oEvent) {
318
- var oSmartFilterbar = oState.oSmartFilterbar;
319
- oSmartFilterbar.search();
320
- }
321
-
322
367
  function fnClearFilters(oEvent) {
323
368
  var oSmartFilterbar = oState.oSmartFilterbar;
324
369
  oSmartFilterbar.search();
@@ -430,19 +475,35 @@ sap.ui.define([
430
475
  }
431
476
  }
432
477
 
478
+ /**
479
+ *
480
+ * This method is called when the variant is loaded in SFB
481
+ * Always set the filterMode to classic when the variant is loaded as the variant filters are not supported in the EasyFilter
482
+ * */
483
+ function fnHandleVariantLoad(oEvent) {
484
+ var oTempModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
485
+ // 'context' is undefined or null when the user switches variant , in this case switch to classic mode
486
+ // other values are "CANCEL" , "RESET" , "SET_VM_ID" , "DATA_SUITE" , "INIT" , "KEY_USER" etc : Do not switch filter mode in these cases
487
+ if (!oEvent.getParameter("context") && oTempModel.getProperty("/listReport/filterMode") !== "classic") {
488
+ var oSmartFilterbar = oState.oSmartFilterbar;
489
+ oTempModel.setProperty("/listReport/filterMode", "classic");
490
+ oSmartFilterbar.setVisible(true);
491
+ }
492
+ }
493
+
433
494
  return {
434
495
  getEasyFilterBar : fnGetEasyFilterBar,
435
496
  initialiseEasyFilterBar : fnInitialiseEasyFilterBar,
436
497
  getSFBVariantData : fnGetSFBVariantData,
437
498
  getEasyFilterSearchMetadata : fnGetEasyFilterSearchMetadata,
438
- onExecuteSearch: fnExecuteSearch,
439
499
  onClearFilters: fnClearFilters,
440
500
  onAfterQueryProcessing: fnAfterQueryProcessing,
441
501
  onBeforeQueryProcessing: fnBeforeQueryProcessing,
442
502
  onQueryChanged : fnQueryChanged,
443
503
  onTokensChanged: fnTokensChanged,
444
504
  onShowValueHelp: fnShowValueHelp,
445
- onFilterChange : fnOnFilterChange
505
+ onFilterChange : fnOnFilterChange,
506
+ handleVariantLoad : fnHandleVariantLoad
446
507
  };
447
508
  }
448
509
 
@@ -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
  });
@@ -304,20 +304,6 @@ ST_CARD_CREATION_FAILURE_REASON_SEMANTIC_DATE_FILTERS=Card creation isn\u2019t p
304
304
  #XMSG: Info text
305
305
  ST_CARD_NAVIGATION_FAILURE_INFO=Direct navigation to the object details isn’t possible from this insights card.
306
306
 
307
-
308
- #------------Easy filter related text-----------------------
309
-
310
- # YMSG, 200: Message shown when the user switches to Easy filter mode
311
- ST_EASY_FILTER_PROMPT_INFO=The Prompt-based filtering will create completely new filter criteria. Generated content may not always be accurate. Consider verifying it.
312
-
313
- # YMSG, 100: Placeholder text for the Easy Filter input field
314
- ST_EASY_FILTER_INPUT_PLACEHOLDER=Enter your query in natural language to filter the list
315
-
316
- # XBUT, 20: Text for the Go button in Easy Filter mode
317
- ST_EASY_FILTER_GO_BUTTON_TEXT=Go
318
-
319
- #------------End of: Easy filter related text-----------------------
320
-
321
307
  ST_AI_EE_BUTTON_LABEL=Generate Explanation
322
308
 
323
309
  #---Final block: texts to be redefined by the application ----------------------------------------------
@@ -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.4
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.4",
68
68
  extensions: {
69
69
  //Configuration used for rule loading of Support Assistant
70
70
  "sap.ui.support": {