@sapui5/sap.suite.ui.generic.template 1.124.2 → 1.124.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 (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/manifest.json +1 -1
  4. package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
  5. package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +30 -3
  6. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n.properties +16 -0
  7. package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
  8. package/src/sap/suite/ui/generic/template/ListReport/view/fragments/DefaultVariant.fragment.xml +18 -3
  9. package/src/sap/suite/ui/generic/template/ListReport/view/fragments/FullscreenPage.fragment.xml +6 -1
  10. package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +17 -16
  11. package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
  12. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/Actions.fragment.xml +1 -1
  13. package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
  14. package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
  15. package/src/sap/suite/ui/generic/template/fragments/EasyFilter.fragment.xml +24 -0
  16. package/src/sap/suite/ui/generic/template/lib/AdaptiveCardHelper.js +62 -36
  17. package/src/sap/suite/ui/generic/template/lib/AppComponent.js +16 -15
  18. package/src/sap/suite/ui/generic/template/lib/Application.js +1 -4
  19. package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +43 -1
  20. package/src/sap/suite/ui/generic/template/lib/TemplateAssembler.js +1 -0
  21. package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +323 -0
  22. package/src/sap/suite/ui/generic/template/lib/ai/FioriAIHandler.js +77 -0
  23. package/src/sap/suite/ui/generic/template/lib/filterHelper.js +38 -1
  24. package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +13 -0
  25. package/src/sap/suite/ui/generic/template/lib/insights/InsightsCardHelper.js +1 -20
  26. package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
  27. package/src/sap/suite/ui/generic/template/library.js +1 -1
  28. package/src/sap/suite/ui/generic/template/themes/base/base.less +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.suite.ui.generic.template",
3
- "version": "1.124.2",
3
+ "version": "1.124.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.124.2</version>
10
+ <version>1.124.3</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.124.2"
11
+ "version": "1.124.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.124.2"
11
+ "version": "1.124.3"
12
12
  },
13
13
  "title": "Canvas",
14
14
  "description": "Canvas Page",
@@ -22,9 +22,11 @@ sap.ui.define([
22
22
  "sap/suite/ui/generic/template/listTemplates/filterSettingsPreparationHelper",
23
23
  "sap/m/table/Util",
24
24
  "sap/suite/ui/generic/template/genericUtilities/filterHelper",
25
- "sap/suite/ui/generic/template/js/AnnotationHelperHiddenTermSupport"
25
+ "sap/suite/ui/generic/template/js/AnnotationHelperHiddenTermSupport",
26
+ "sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler"
26
27
  ], function (Filter, ExtensionAPI, listUtils, MessageStripHelper, IappStateHandler, MultipleViewsHandler,
27
- WorklistHandler, ShareUtils, controlHelper, FeLogger, testableHelper, ObjectPath, StableIdHelper, deepExtend, CreateWithDialogHandler, CtxMenuHandler, MultiEditHandler, SelectionVariant, InsightsHandler, filterSettingsPreparationHelper, TableUtil, filterHelper, AnnotationHelperHiddenTermSupport) {
28
+ WorklistHandler, ShareUtils, controlHelper, FeLogger, testableHelper, ObjectPath, StableIdHelper, deepExtend, CreateWithDialogHandler, CtxMenuHandler, MultiEditHandler, SelectionVariant, InsightsHandler, filterSettingsPreparationHelper, TableUtil, filterHelper, AnnotationHelperHiddenTermSupport,
29
+ EasyFilterBarHandler) {
28
30
  "use strict";
29
31
 
30
32
  var oLogger = new FeLogger("ListReport.controller.ControllerImplementation").getLogger();
@@ -529,6 +531,12 @@ sap.ui.define([
529
531
  oState.oMultiEditHandler = new MultiEditHandler(oState, oController, oTemplateUtils);
530
532
  oState.oInsightsHandler = new InsightsHandler(oState, oController, oTemplateUtils);
531
533
 
534
+ oTemplateUtils.oServices.oFioriAIHandler && oTemplateUtils.oServices.oFioriAIHandler.getFioriAIEnabledPromise().then(function() {
535
+ oState.oEasyFilterBarHandler = new EasyFilterBarHandler(oState, oController, oTemplateUtils);
536
+ });
537
+
538
+
539
+
532
540
  var oTemplatePrivateModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
533
541
 
534
542
  oTemplatePrivateModel.setProperty("/generic/bDataAreShownInTable", false);
@@ -537,6 +545,8 @@ sap.ui.define([
537
545
 
538
546
  // Initialise headerExpanded property to true as a fix for incident 1770402849. Text of toggle filter button depends on this value.
539
547
  oTemplatePrivateModel.setProperty("/listReport/isHeaderExpanded", true);
548
+ // Default SFB should be rendered. Only in AI enabled cases EasyFilter should be rendered
549
+ oTemplatePrivateModel.setProperty("/listReport/filterMode", "classic");
540
550
 
541
551
  // set property for enable/disable of the Delete button
542
552
  oTemplatePrivateModel.setProperty("/listReport/deleteEnabled", false);
@@ -667,6 +677,11 @@ sap.ui.define([
667
677
 
668
678
  onSmartFilterBarInitialized: function () {
669
679
  oState.oIappStateHandler.onSmartFilterBarInitialized();
680
+ // oTemplateUtils.oServices.oFioriAIHandler && oTemplateUtils.oServices.oFioriAIHandler.getFioriAIEnabledPromise().then(function() {
681
+ // // oEasyFilterBarHandler is already initialized in the controller onInit
682
+ // // Prepare the metadats upfront so that it is not triggered for each search
683
+ // oState.oEasyFilterBarHandler && oState.oEasyFilterBarHandler.getEasyFilterSearchMetadata();
684
+ // });
670
685
  },
671
686
 
672
687
  onAfterSFBVariantLoad: function (oEvent) {
@@ -677,7 +692,19 @@ sap.ui.define([
677
692
  var oSmartList = oEvent.getSource();
678
693
  fnOnDataReceived(oSmartList);
679
694
  },
680
-
695
+ // Check if a new control can be created for the AI Input field so that the event handler can be removed from here
696
+ onEasyFilterEnterPress : function (oEvent) {
697
+ var oEasyFilter = oEvent.getSource();
698
+ oTemplateUtils.oCommonEventHandlers.onEasyFilterChange(oEasyFilter, oState);
699
+ },
700
+ onEasyFilterGoButtonPress : function() {
701
+ var oEasyFilter = oController.byId("easyFilter");
702
+ oTemplateUtils.oCommonEventHandlers.onEasyFilterChange(oEasyFilter, oState);
703
+ },
704
+ onEasyFilterChange : function(oEvent) {
705
+ var oEasyFilter = oEvent.getSource();
706
+ oEasyFilter.setValueState(sap.ui.core.ValueState.None);
707
+ },
681
708
  onBeforeRebindTable: function (oEvent) {
682
709
  var oSmartTable = oEvent.getSource();
683
710
  setNoDataTextIfRequired(oSmartTable);
@@ -157,6 +157,22 @@ ST_CREATE_WITH_FILTERS=Create with filters
157
157
 
158
158
  #------------End of: template controller reuse texts-----------------------
159
159
 
160
+ #------------Easy filter related text-----------------------
161
+ # All the easy filter and filter mode related texts are defined here
162
+
163
+ # XTIT,30: Title of the Filter modes in List Report
164
+ ST_EASY_FILTER_TITLE=Filter Mode :
165
+
166
+ # XBUT: Manual filter segmented button text
167
+ ST_MANUAL_FILTER=Classic
168
+
169
+ # XBUT: Easy filter segmented button text
170
+ ST_EASY_FILTER=SAP Business AI
171
+
172
+ #------------End of: Easy filter related text-----------------------
173
+
174
+
175
+
160
176
  #---Final block: texts to be redefined by the application ----------------------------------------
161
177
 
162
178
  # XTOL: shown as tooltip on plus or create sign; ; "object" to be redefined. example: Create New Product
@@ -8,7 +8,7 @@
8
8
  "i18n": "i18n/i18n.properties",
9
9
  "applicationVersion": {
10
10
  "__comment": "applicationVersion oder componentversion??",
11
- "version": "1.124.2"
11
+ "version": "1.124.3"
12
12
  },
13
13
  "title": "{{TITLE}}",
14
14
  "description": "{{DESCRIPTION}}",
@@ -4,11 +4,26 @@
4
4
  template:require="{AH: 'sap/suite/ui/generic/template/js/AnnotationHelper'}">
5
5
 
6
6
  <f:heading>
7
- <!--if worklist, then hide execute on select/apply automatically option in variant management-->
8
- <variants:SmartVariantManagement id="template::PageVariant" persistencyKey="{= ${parameter>/settings/smartVariantManagement} ? '_ST_SmartVariantManagement' : 'searchListReportVariant'}"
9
- showShare="true" showExecuteOnSelection="{= !${parameter>/settings/isWorklist} }" displayTextForExecuteOnSelectionForStandardVariant="{= (${parameter>/settings/dataLoadSettings/loadDataOnAppLaunch} === 'ifAnyFilterExist' || ${parameter>/settings/dataLoadSettings/loadDataOnAppLaunch} === undefined) ? '{i18n>ST_LIST_DISPLAY_TEXT_FOR_EXECUTE_ON_SELECTION}' : undefined}" headerLevel="H2"/>
7
+ <!--if worklist, then hide execute on select/apply automatically option in variant management-->
8
+ <variants:SmartVariantManagement id="template::PageVariant" persistencyKey="{= ${parameter>/settings/smartVariantManagement} ? '_ST_SmartVariantManagement' : 'searchListReportVariant'}"
9
+ showShare="true" showExecuteOnSelection="{= !${parameter>/settings/isWorklist} }" displayTextForExecuteOnSelectionForStandardVariant="{= (${parameter>/settings/dataLoadSettings/loadDataOnAppLaunch} === 'ifAnyFilterExist' || ${parameter>/settings/dataLoadSettings/loadDataOnAppLaunch} === undefined) ? '{i18n>ST_LIST_DISPLAY_TEXT_FOR_EXECUTE_ON_SELECTION}' : undefined}" headerLevel="H2"/>
10
10
  </f:heading>
11
11
  <f:actions>
12
+ <!--Enable the filter switch only if the easy filter is enabled-->
13
+ <FlexBox renderType="Bare" visible="{= ${_templPriv>/listReport/isHeaderExpanded} &amp;&amp; ${_templPrivGlobal>/generic/fioriAI/isEasyFilterEnabled} }">
14
+ <Label text="{i18n>ST_EASY_FILTER_TITLE}" class="sapSmartTemplateEasyFilterInputPadding"></Label>
15
+ <SegmentedButton id = "template::FilterSwitchButton"
16
+ selectedKey="{_templPriv>/listReport/filterMode}"
17
+ selectionChange="._templateEventHandlers.onEasyFilterSwitch">
18
+ <layoutData>
19
+ <OverflowToolbarLayoutData priority="NeverOverflow"/>
20
+ </layoutData>
21
+ <items>
22
+ <SegmentedButtonItem text="{i18n>ST_MANUAL_FILTER}" key="classic"/>
23
+ <SegmentedButtonItem text="{i18n>ST_EASY_FILTER}" key="easyFilter"/>
24
+ </items>
25
+ </SegmentedButton>
26
+ </FlexBox>
12
27
  <ToolbarSpacer/>
13
28
  <!-- global breakout actions-->
14
29
  <template:repeat list="{parameter>/manifest/sap.ui5/extends/extensions/sap.ui.controllerExtensions/sap.suite.ui.generic.template.ListReport.view.ListReport/sap.ui.generic.app}" var="tmpEntitySet">
@@ -38,6 +38,12 @@
38
38
  visible="{= !${parameter>/settings/isWorklist}}">
39
39
  <f:content>
40
40
  <core:Fragment fragmentName="sap.suite.ui.generic.template.ListReport.view.fragments.SmartFilterBar" type="XML"/>
41
+ <!-- <VBox visible="{= ${_templPriv>/listReport/filterMode} === 'classic'}">
42
+ <core:Fragment fragmentName="sap.suite.ui.generic.template.ListReport.view.fragments.SmartFilterBar" type="XML"/>
43
+ </VBox>
44
+ <VBox visible="{= ${_templPriv>/listReport/filterMode} === 'easyFilter'}">
45
+ <core:Fragment fragmentName="sap.suite.ui.generic.template.fragments.EasyFilter" type="XML"/>
46
+ </VBox> -->
41
47
  </f:content>
42
48
  </f:DynamicPageHeader>
43
49
  </f:header>
@@ -58,7 +64,6 @@
58
64
  </template:else>
59
65
  </template:if>
60
66
  </f:content>
61
-
62
67
  <f:footer>
63
68
  <OverflowToolbar id="template::FooterToolbar">
64
69
  <ToolbarSpacer/>
@@ -32,7 +32,6 @@ sap.ui.define([
32
32
  "sap/suite/ui/generic/template/ObjectPage/controller/CtxMenuHandler",
33
33
  "sap/suite/ui/generic/template/ObjectPage/controller/inlineCreationRows/InlineCreationRowsHelper",
34
34
  "sap/suite/ui/generic/template/ObjectPage/controller/RelatedAppsHandler",
35
- "sap/ui/core/Lib",
36
35
  "sap/suite/ui/generic/template/ObjectPage/controller/PasteHandler",
37
36
  "sap/suite/ui/generic/template/lib/insights/InsightsHandler",
38
37
  "sap/suite/ui/generic/template/lib/cards/DTCardHelper"
@@ -42,7 +41,7 @@ sap.ui.define([
42
41
  ResponsiveTable, ShareUtils, FeLogger, MultipleViewsHandler, MessageUtils, KeyCodes, merge, FilterProcessor,
43
42
  StableIdHelper, extend, isEmptyObject, FeError,
44
43
  CreateWithDialogHandler, Device, whitespaceReplacer, deepExtend, CtxMenuHandler,
45
- InlineCreationRowsHelper, RelatedAppsHandler, Lib, PasteHandler, InsightsHandler, DTCardHelper
44
+ InlineCreationRowsHelper, RelatedAppsHandler, PasteHandler, InsightsHandler, DTCardHelper
46
45
  ) {
47
46
  "use strict";
48
47
  var sClassName = "ObjectPage.controller.ControllerImplementation";
@@ -392,16 +391,23 @@ sap.ui.define([
392
391
  var oBindingParams = oEvent.getParameter("bindingParams");
393
392
  if (oBindingParams.filters && oBindingParams.filters.length) {
394
393
  /*
395
- * Add a new filter condition to always show all items that are just created. In case we are in a draft,
396
- * that just means to add "or HasActiveEntity = false". For active documents however, that condition
397
- * would always be true. Thus, we have to add
398
- * "or (HasActiveEntity = false and IsActiveEntity = false)".
399
- * However, this condition is not evaluated correctly by gateway, so we have to transform it to
400
- * (IsActiveEntity = true and x) or (Is ActiveEntity = false and (x or HasActiveEntity = false)),
401
- * where x is the condition provided by the user
394
+ *Handling of the filter condition during edit or display:
395
+ * Add a new filter condition to always show all items that are just created. In case we are in a draft,
396
+ * that just means to add "or HasActiveEntity = false". For active documents however, that condition
397
+ * would always be true. Thus, we have to add
398
+ * "or (HasActiveEntity = false and IsActiveEntity = false)".
399
+ * However, this condition is not evaluated correctly by gateway, so we have to transform it to
400
+ * (IsActiveEntity = true and x) or (Is ActiveEntity = false and (x or HasActiveEntity = false)),
401
+ * where x is the condition provided by the user
402
+
403
+ * Handling of the filter condition during create:
404
+ * checking the value of dispaly Mode , iDisplayMode = 4 for create
405
+ * if it is a create the filter condition evaluates to the user filter x
402
406
  */
403
407
  var oUserFilter = FilterProcessor.groupFilters(oBindingParams.filters);
404
- if (!oEvent.getParameter("messageFilterActive")) {
408
+ var oTemplatePrivateModel = oTemplateUtils.oComponentUtils.getTemplatePrivateModel();
409
+ var iDisplayMode = oTemplatePrivateModel.getProperty("/objectPage/displayMode");
410
+ if (!oEvent.getParameter("messageFilterActive") && !(iDisplayMode === 4) ){
405
411
  oBindingParams.filters = new Filter({
406
412
  filters: [
407
413
  new Filter({
@@ -2394,12 +2400,7 @@ sap.ui.define([
2394
2400
  },
2395
2401
 
2396
2402
  onSummarize: function () {
2397
- var sUrl = oTemplateUtils.oServices.oApplication.getSummarizationLibraryUrl();
2398
- Lib.load({name: "ux.eng.fioriai.reuse", url: sUrl}).then(function() {
2399
- sap.ui.require(["ux/eng/fioriai/reuse/library"], function(fioriaiLib) {
2400
- fioriaiLib.summarize({view: oController.getView()});
2401
- });
2402
- });
2403
+ oTemplateUtils.oServices.oFioriAIHandler.fioriaiLib.summarize({view: oController.getView()});
2403
2404
  },
2404
2405
 
2405
2406
  onEdit: function (oEvent) {
@@ -6,7 +6,7 @@
6
6
  "type": "component",
7
7
  "i18n": "i18n/i18n.properties",
8
8
  "applicationVersion": {
9
- "version": "1.124.2"
9
+ "version": "1.124.3"
10
10
  },
11
11
  "title": "{{TITLE}}",
12
12
  "description": "{{DESCRIPTION}}",
@@ -130,7 +130,7 @@
130
130
  ariaHasPopup="Dialog"
131
131
  fesr:press="fe:sum:summarize"
132
132
  type="Ghost"
133
- visible="{_templPrivGlobal>/generic/isSummarizationEnabled}" />
133
+ visible="{_templPrivGlobal>/generic/fioriAI/isSummarizationEnabled}" />
134
134
 
135
135
  <template:if test="{parameter>/settings/showRelatedApps}">
136
136
  <uxap:ObjectPageHeaderActionButton id="{:= ${parameter>/stableId}.getStableId({type: 'ObjectPageAction', subType: 'RelatedApps'}) }"
@@ -6,7 +6,7 @@
6
6
  "type": "component",
7
7
  "i18n": "i18n/i18n.properties",
8
8
  "applicationVersion": {
9
- "version": "1.124.2"
9
+ "version": "1.124.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.124.2"
9
+ "version": "1.124.3"
10
10
  },
11
11
  "title": "{{TITLE}}",
12
12
  "description": "{{DESCRIPTION}}",
@@ -0,0 +1,24 @@
1
+ <core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
2
+ <VBox >
3
+ <MessageStrip
4
+ text="{i18n>ST_EASY_FILTER_PROMPT_INFO}"
5
+ showIcon="true"
6
+ showCloseButton="true"
7
+ class="sapUiSmallMarginBottom"/>
8
+ <FlexBox renderType="Bare">
9
+ <Input id="easyFilter"
10
+ width="100%" class="sapUiSmallMarginEnd"
11
+ placeholder="{i18n>ST_EASY_FILTER_INPUT_PLACEHOLDER}"
12
+ change="._templateEventHandlers.onEasyFilterChange"
13
+ showClearIcon="true"
14
+ maxLength="100"
15
+ submit="._templateEventHandlers.onEasyFilterEnterPress">
16
+ </Input>
17
+ <Button text="{i18n>ST_EASY_FILTER_GO_BUTTON_TEXT}"
18
+ type="Emphasized"
19
+ icon="sap-icon://ai"
20
+ press="._templateEventHandlers.onEasyFilterGoButtonPress">
21
+ </Button>
22
+ </FlexBox>
23
+ </VBox>
24
+ </core:FragmentDefinition>
@@ -105,6 +105,17 @@ sap.ui.define([
105
105
  return { edmType: undefined, sSemantic: undefined, sSapUnit: undefined };
106
106
  };
107
107
 
108
+ var fnGetVisiblePathForFC = function (oControl) {
109
+ var visiblePathwithFormat = "";
110
+ var oParent = oControl.getParent();
111
+ if (oControl.getBindingPath("visible")) {
112
+ visiblePathwithFormat = "${" + oControl.getBindingPath("visible") + " !=0}";
113
+ } else if (oParent.getBindingPath("visible")) {
114
+ visiblePathwithFormat = "${(" + oParent.getBindingPath("visible") + " == false || " + oParent.getBindingPath("visible") + " == '' || " + oParent.getBindingPath("visible") + " == 0)}";
115
+ }
116
+ return visiblePathwithFormat;
117
+ };
118
+
108
119
  var fnExtractDataFromDataPoint = function (item, controller) {
109
120
  if (item.getItems().length > 1) {
110
121
  var oDataPointData = {
@@ -116,10 +127,12 @@ sap.ui.define([
116
127
  paths: {},
117
128
  objectStatus: "",
118
129
  color: "",
119
- edmType: ""
130
+ edmType: "",
131
+ visiblePath: ""
120
132
  };
121
133
  var aControls = item.getItems();
122
134
  oDataPointData.path = aControls[1].getBindingPath("value");
135
+ oDataPointData.visiblePath = fnGetVisiblePathForFC(aControls[1]);
123
136
  if (isPotentiallySensitive(oDataPointData.path, controller)) {
124
137
  return null;
125
138
  }
@@ -178,11 +191,13 @@ sap.ui.define([
178
191
  type: "PlainTextVBox",
179
192
  label: "",
180
193
  value: "",
181
- path: ""
194
+ path: "",
195
+ visiblePath: ""
182
196
  };
183
197
  var aControls = item.getItems();
184
198
  oPlainTextData.label = aControls[0].getText && aControls[0].getText();
185
199
  oPlainTextData.path = aControls[1].getBindingPath("text");
200
+ oPlainTextData.visiblePath = fnGetVisiblePathForFC(aControls[1]);
186
201
  // if (isPotentiallySensitive(oDataPointData.path, controller)) {
187
202
  // return;
188
203
  // }
@@ -218,11 +233,12 @@ sap.ui.define([
218
233
  expand: "",
219
234
  objectStatus: "",
220
235
  color: "",
221
- edmType: ""
236
+ edmType: "",
237
+ visiblePath: ""
222
238
  };
223
239
  var aFieldControls = element.getItems();
224
240
  oFieldData.label = aFieldControls[0].getText && aFieldControls[0].getText();
225
-
241
+ oFieldData.visiblePath = fnGetVisiblePathForFC(aFieldControls[1]);
226
242
  if (aFieldControls[1].getText) {
227
243
  oFieldData.path = aFieldControls[1].getBindingPath("text");
228
244
  oFieldData.value = aFieldControls[1].getText();
@@ -306,7 +322,7 @@ sap.ui.define([
306
322
  * @returns {string} String MS accepted conditional binding
307
323
  */
308
324
  var fnHandleDefaultValueForPath = function (sPath) {
309
- return fnGetNullishPathCheckString(sPath) + " ? '\\\\-' : " + sPath;
325
+ return fnGetNullishPathCheckString(sPath) + " ? '&minus;' : " + sPath;
310
326
  };
311
327
 
312
328
  /**
@@ -335,14 +351,14 @@ sap.ui.define([
335
351
  }
336
352
  var sValue = oField.edmType === "Edm.Decimal" ? "formatNumber(float(" + oField.path + "), 2)" : oField.path;
337
353
  var sDefaultPathValue = fnHandleDefaultValueForPath(oField.path);
338
- var sId = "";
339
- var sDescription = "";
354
+ var sId = null;
355
+ var sDescription = null;
340
356
  var sPath;
341
357
  var sSapUnitConditionalPath = "";
342
358
  if (oField.semantic === oSapSemantics.unitOfMeasure) {
343
- sSapUnitConditionalPath = "(" + fnGetNullishPathCheckString(oField.sapUnit) + ")" + ' ? ' + sValue + " + ' ' + '\\\\-' : " + "";
359
+ sSapUnitConditionalPath = "(" + fnGetNullishPathCheckString(oField.sapUnit) + ")" + ' ? ' + sValue + " + ' ' + '&minus;' : " + "";
344
360
  } else if (oField.semantic === oSapSemantics.currencyCode) {
345
- sSapUnitConditionalPath = "(" + fnGetNullishPathCheckString(oField.sapUnit) + ")" + ' ? ' + " '\\\\-' : " + "";
361
+ sSapUnitConditionalPath = "(" + fnGetNullishPathCheckString(oField.sapUnit) + ")" + ' ? ' + " '&minus;' : " + "";
346
362
  }
347
363
  if (aPaths.length > 1) {
348
364
  var aDescriptionText = aPaths.filter(function(oPath) {
@@ -593,43 +609,53 @@ sap.ui.define([
593
609
  var oField = aFields[j];
594
610
  oColumnClone = deepClone(oColumn);
595
611
  if (!oField) {
596
- oColumnSetClone.columns.push(oColumnClone);
612
+ oColumnSetClone.columns.push(oColumnClone);
597
613
  continue;
598
614
  }
599
- // console.log(oField);
600
- oFormFieldHeaderClone = deepClone(oFormFieldHeader);
601
- oFormFieldHeaderClone.text = oField.label;
602
- oColumnClone.items.push(oFormFieldHeaderClone);
603
- oFormFieldValueClone = deepClone(oFormFieldValue);
604
- oFormFieldValueClone.text = fnSetPath(oField);
605
- oFormFieldValueClone.color = oField.color ? oField.color : "Default";
606
- oColumnClone.items.push(oFormFieldValueClone);
607
- oColumnSetClone.columns.push(oColumnClone);
615
+ if (oField.label) {
616
+ // console.log(oField);
617
+ oFormFieldHeaderClone = deepClone(oFormFieldHeader);
618
+ oFormFieldHeaderClone.text = oField.label;
619
+ oColumnClone.items.push(oFormFieldHeaderClone);
620
+ oFormFieldValueClone = deepClone(oFormFieldValue);
621
+ oFormFieldValueClone.text = fnSetPath(oField);
622
+ oFormFieldValueClone.color = oField.color ? oField.color : "Default";
623
+ oColumnClone.items.push(oFormFieldValueClone);
624
+ oColumnClone["$when"] = oField.visiblePath;
625
+ oColumnSetClone.columns.push(oColumnClone);
626
+ }
608
627
  }
609
628
  oAdaptiveCardJSON.body.push(oColumnSetClone);
610
629
  }
611
630
  break;
612
631
  case "PlainTextVBox":
613
- oFormTitleClone = deepClone(oFormHeading);
614
- oFormTitleClone.text = element.label;
615
- oAdaptiveCardJSON.body.push(oFormTitleClone);
616
- oFormFieldValueClone = deepClone(oFormFieldValue);
617
- oFormFieldValueClone.text = fnSetPath(element);
618
- oAdaptiveCardJSON.body.push(oFormFieldValueClone);
632
+ if (element.label) {
633
+ oFormTitleClone = deepClone(oFormHeading);
634
+ oFormTitleClone.text = element.label;
635
+ oAdaptiveCardJSON.body.push(oFormTitleClone);
636
+ oFormFieldValueClone = deepClone(oFormFieldValue);
637
+ oFormFieldValueClone.text = fnSetPath(element);
638
+ oAdaptiveCardJSON.body.push(oFormFieldValueClone);
639
+ oFormTitleClone["$when"] = element.visiblePath;
640
+ oFormFieldValueClone["$when"] = element.visiblePath;
641
+ }
619
642
  break;
620
643
  case "DataPoint":
621
644
  if (!oDataPointColumnSet) {
622
645
  oDataPointColumnSet = deepClone(oColumSet);
623
646
  }
624
- oColumnClone = deepClone(oColumn);
625
- oFormTitleClone = deepClone(oFormHeading);
626
- oFormTitleClone.text = element.label;
627
- oColumnClone.items.push(oFormTitleClone);
628
- oFormFieldValueClone = deepClone(oFormFieldValue);
629
- oFormFieldValueClone.text = fnSetPath(element);
630
- oFormFieldValueClone.color = element.color ? element.color : "Default";
631
- oColumnClone.items.push(oFormFieldValueClone);
632
- oDataPointColumnSet.columns.push(oColumnClone);
647
+ if (element.label) {
648
+ oColumnClone = deepClone(oColumn);
649
+ oFormTitleClone = deepClone(oFormHeading);
650
+ oFormTitleClone.text = element.label;
651
+ oColumnClone.items.push(oFormTitleClone);
652
+ oFormFieldValueClone = deepClone(oFormFieldValue);
653
+ oFormFieldValueClone.text = fnSetPath(element);
654
+ oFormFieldValueClone.color = element.color ? element.color : "Default";
655
+ oColumnClone.items.push(oFormFieldValueClone);
656
+ oColumnClone["$when"] = element.visiblePath;
657
+ oDataPointColumnSet.columns.push(oColumnClone);
658
+ }
633
659
  break;
634
660
  default:
635
661
  break;
@@ -735,7 +761,7 @@ sap.ui.define([
735
761
  oAdaptiveCardJSON.body.push(oActionSetClone);
736
762
  }
737
763
 
738
- // console.log(oAdaptiveCardJSON);
764
+ //console.log(oAdaptiveCardJSON);
739
765
  return oAdaptiveCardJSON;
740
766
  };
741
767
 
@@ -1012,4 +1038,4 @@ sap.ui.define([
1012
1038
  };
1013
1039
 
1014
1040
  return AdaptiveCardHelper;
1015
- });
1041
+ });
@@ -54,6 +54,7 @@ sap.ui.define([
54
54
  "sap/suite/ui/generic/template/lib/insights/InsightsFECardProvider",
55
55
  "sap/ui/core/service/ServiceFactoryRegistry",
56
56
  "sap/ui/VersionInfo",
57
+ "sap/suite/ui/generic/template/lib/ai/FioriAIHandler",
57
58
  "sap/suite/ui/generic/template/js/RuntimeFormatters" // just to make sure that this class is loaded
58
59
  ], function(
59
60
  extend,
@@ -88,7 +89,8 @@ sap.ui.define([
88
89
  CardHelper,
89
90
  InsightsFECardProvider,
90
91
  ServiceFactoryRegistry,
91
- VersionInfo) {
92
+ VersionInfo,
93
+ FioriAIHandler) {
92
94
  "use strict";
93
95
  var sClassName = "lib.AppComponent";
94
96
 
@@ -175,8 +177,7 @@ sap.ui.define([
175
177
  // The implementation of this infrastructure is done in class BusyHelper.
176
178
  bEnablePlaceholder: bShellConfigPlaceholderEnabled, //holds the value of placeholder enablement shell and URL (URL enablement will be added in constructor code of NavigationController).
177
179
  bStateHandlingSuspended: false, // holds the RTA or Key user mode
178
- nDelayedDraftTimerInSeconds: 20, // holds the timer interval value for draft data save and by default, the value is 20 seconds
179
- sSummarizationLibraryUrl: "" // property hold the Url for the Summarization service library
180
+ nDelayedDraftTimerInSeconds: 20 // holds the timer interval value for draft data save and by default, the value is 20 seconds
180
181
  };
181
182
  oTemplateContract.oDataLossHandler = new DataLossHandler(oTemplateContract); // an object which expose methods that can be used to bring data loss popup at app level
182
183
  oTemplateContract.oPageLeaveHandler = new PageLeaveHandler(oTemplateContract);
@@ -285,8 +286,11 @@ sap.ui.define([
285
286
  shellServiceUnavailable: false,
286
287
  // experimental: not yet used
287
288
  forceFullscreenCreate: false,
288
- // Check Summarization is enabled
289
- isSummarizationEnabled: false
289
+ // Check FioriAI servce is enabled
290
+ "fioriAI": {
291
+ isSummarizationEnabled : false,
292
+ isEasyFilterEnabled : false
293
+ }
290
294
  });
291
295
  oAppComponent.setModel(oTemplateContract.oTemplatePrivateGlobalModel, "_templPrivGlobal");
292
296
  oTemplateContract.oShellServicePromise.catch(function(){
@@ -297,14 +301,6 @@ sap.ui.define([
297
301
  var oParsingServicePromise;
298
302
  if (UShellContainer) {
299
303
  oParsingServicePromise = UShellContainer.getServiceAsync("URLParsing");
300
- UShellContainer.getServiceAsync("Navigation").then(function(oNavigationService) {
301
- oNavigationService.resolveIntent("#IntelligentPrompt-summarize").then(function(sUrl) {
302
- oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/isSummarizationEnabled", !!sUrl);
303
- oTemplateContract.sSummarizationLibraryUrl = sUrl;
304
- }).catch(function() {
305
- oLogger.warning("No intelligent summarization capability enabled on the tenant");
306
- });
307
- });
308
304
  }
309
305
 
310
306
  Promise.allSettled([oCurrentUrlPromise, oParsingServicePromise]).then(function(aResult) {
@@ -323,8 +319,13 @@ sap.ui.define([
323
319
  CollaborationHelper.isTeamsModeActive().then(function(bIsActive) {
324
320
  oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/isTeamsModeActive", bIsActive);
325
321
  }).finally(function(bIsActive) {
326
- // If MSTeams mode is active and in ghostApp init scenario do not load the insights service
322
+ // If MSTeams mode is active and in ghostApp init scenario do not load
327
323
  if (!bIsActive && !oTemplateContract.ghostapp) {
324
+ // Load the FioriAI library
325
+ oTemplateContract.oFioriAIHandler = new FioriAIHandler(oTemplateContract);
326
+ oTemplateContract.oFioriAIHandler.loadAILibrary();
327
+
328
+ // Load the Insights library
328
329
  CardHelper.getServiceAsync("UIService").then(function(oInstance) {
329
330
  oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/insights", {
330
331
  "oInsightsInstance": oInstance,
@@ -919,7 +920,7 @@ sap.ui.define([
919
920
  * @extends sap.ui.core.UIComponent
920
921
  * @abstract
921
922
  * @author SAP SE
922
- * @version 1.124.2
923
+ * @version 1.124.3
923
924
  * @name sap.suite.ui.generic.template.lib.AppComponent
924
925
  */
925
926
  var oAppComponent = UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
@@ -925,10 +925,7 @@ sap.ui.define(["sap/ui/base/Object",
925
925
  setNextFocus: oFocusHelper.setNextFocus,
926
926
  getIntentPromise: getIntentPromise,
927
927
  getComponentUtilsIfLoaded: getComponentUtilsIfLoaded,
928
- preloadComponent: fnPreloadComponent,
929
- getSummarizationLibraryUrl : function() {
930
- return oTemplateContract.sSummarizationLibraryUrl;
931
- }
928
+ preloadComponent: fnPreloadComponent
932
929
  };
933
930
  }
934
931
 
@@ -2644,6 +2644,47 @@ sap.ui.define(["sap/ui/base/Object",
2644
2644
  oController.onBeforeExportTableExtension(oExportParams);
2645
2645
  }
2646
2646
 
2647
+ /**
2648
+ * This method is called when the user interacts with EasyFilter field (Enter on the input field or Go button press).
2649
+ * The AI easy filter is triggered and the result filters are applied to the SmartFilterBar.
2650
+ * @param {object} oEasyFilterInputField - The EasyFilter input field which has the value entered by the user
2651
+ * @param {object} oState - oState of the component
2652
+ */
2653
+ function fnHandleEasyFilterChange(oEasyFilterInputField, oState) {
2654
+
2655
+ var oSmartFilterbar = oState.oSmartFilterbar;
2656
+ FESRHelper.setSemanticStepname(oEasyFilterInputField, "press", "fe2:ai:search");
2657
+ var oAIFilterQueryHandlerPromise = oState.oEasyFilterBarHandler.triggerEasyFilterQuery(oEasyFilterInputField, oSmartFilterbar);
2658
+
2659
+ oAIFilterQueryHandlerPromise.then(function(oFiltersFromAI) {
2660
+
2661
+ var sSmartFilterBarId = oSmartFilterbar.getId();
2662
+ var oSmartFilterBarWrapper = oCommonUtils.getControlStateWrapperById(sSmartFilterBarId, "SmartFilterBar");
2663
+ var oSmartFilterBarVariant = oSmartFilterBarWrapper.getState();
2664
+ var oVariantDataFromAI = oState.oEasyFilterBarHandler.getSFBVariantData(oFiltersFromAI);
2665
+
2666
+ // restore the custom filters to the initial state for now
2667
+ // To check if other objects in oSmartFilterBarVariant needs to be modified
2668
+ var aAppExtension = Object.keys(oSmartFilterBarVariant.customFilters.appExtension);
2669
+ if ( aAppExtension.length > 0 ) {
2670
+ aAppExtension.forEach(function(sKey) {
2671
+ oSmartFilterBarVariant.customFilters.appExtension[sKey] = "";
2672
+ });
2673
+ }
2674
+ oSmartFilterBarVariant.selectOptions = oVariantDataFromAI.aSelectOptions;
2675
+ if (oComponentUtils.isDraftEnabled()) {
2676
+ oSmartFilterBarVariant.customFilters.editState = oVariantDataFromAI.oEditStateFilter;
2677
+ }
2678
+
2679
+ oSmartFilterBarWrapper.setState(oSmartFilterBarVariant);
2680
+ oSmartFilterbar.getSmartVariant() && oSmartFilterbar.getSmartVariant().currentVariantSetModified(true);
2681
+ oSmartFilterbar.search();
2682
+ }, function(oError) {
2683
+ oLogger.error("Error occurred while applying the AI filters", oError);
2684
+ });
2685
+ oComponentUtils.getBusyHelper().setBusy(oAIFilterQueryHandlerPromise);
2686
+ }
2687
+
2647
2688
  /* eslint-disable */
2648
2689
  var fnBuildSelectionVariantForNavigation = testableHelper.testable(fnBuildSelectionVariantForNavigation, "fnBuildSelectionVariantForNavigation");
2649
2690
  var fnEvaluateParameters = testableHelper.testable(fnEvaluateParameters, "fnEvaluateParameters");
@@ -2694,7 +2735,8 @@ sap.ui.define(["sap/ui/base/Object",
2694
2735
  handleSideEffectForField: fnHandleSideEffectForField,
2695
2736
  onSmartFieldModeToggled: onSmartFieldModeToggled,
2696
2737
  onRenderTeamsContactCollabOptions: fnRenderTeamsContactCollabOptions,
2697
- hideTableCells: fnHideTableCells
2738
+ hideTableCells: fnHideTableCells,
2739
+ onEasyFilterChange: fnHandleEasyFilterChange
2698
2740
  };
2699
2741
  }
2700
2742
 
@@ -272,6 +272,7 @@ sap.ui.define(["sap/ui/core/mvc/ControllerExtension",
272
272
  oTemplateUtils.oServices.oApplicationController.registerView(oView);
273
273
  oTemplateUtils.oServices.oDataLossHandler = oAppRegistryEntry.oTemplateContract.oDataLossHandler;
274
274
  oTemplateUtils.oServices.oInsightsFECardProvider = oAppRegistryEntry.oTemplateContract.oInsightsFECardProvider;
275
+ oTemplateUtils.oServices.oFioriAIHandler = oAppRegistryEntry.oTemplateContract.oFioriAIHandler;
275
276
  oTemplateUtils.oCommonUtils = new CommonUtils(oRet, oTemplateUtils.oServices, oTemplateUtils.oComponentUtils);
276
277
  oTemplateUtils.oInfoObjectHandler = new InfoObjectHandler(oRet, oTemplateUtils);
277
278
  oTemplateUtils.oServices.oCRUDManager = new CRUDManager(oRet,
@@ -0,0 +1,323 @@
1
+ sap.ui.define([
2
+ "sap/ui/base/Object",
3
+ "sap/base/util/extend",
4
+ "sap/suite/ui/generic/template/lib/filterHelper",
5
+ "sap/ui/core/library"
6
+ ], function(BaseObject, extend, filterHelper, SapCoreLibrary) {
7
+ 'use strict';
8
+
9
+ /*
10
+ * This is a handler class for EasyFilterBar.
11
+ * It gets initialized when the Fiori AI is enabled and provides the EasyFilterBar capabilities to the floorplan.
12
+ *
13
+ */
14
+ var oEasyFilterMetadata;
15
+
16
+ function getMethods(oState, oController, oTemplateUtils) {
17
+ var ValueState = SapCoreLibrary.ValueState;
18
+ var mCodeList = {};
19
+
20
+ /**
21
+ * This method prepares the metadata calculation after the smart filter bar is initialized
22
+ * @returns A promise which returns the prepared metadata
23
+ */
24
+ function fnGetEasyFilterSearchMetadata() {
25
+ if (oEasyFilterMetadata) {
26
+ return Promise.resolve(oEasyFilterMetadata);
27
+ } else {
28
+ return new Promise(function(fnResolve) {
29
+ // In case the smart filter bar is already initialized then do not use "attachInitialized" as this event will never get triggered again
30
+ if (oState.oSmartFilterbar.isInitialised()) {
31
+ fnPrepareSearchMetadata().then(function(oMetadata){
32
+ fnResolve(oMetadata);
33
+ }
34
+ );
35
+ } else {
36
+ oState.oSmartFilterbar.attachInitialized(function() {
37
+ fnPrepareSearchMetadata().then(function(oMetadata) {
38
+ fnResolve(oMetadata);
39
+ });
40
+ },this);
41
+ }
42
+ });
43
+ }
44
+ }
45
+ /**
46
+ * This method prepares the metadata for each filterable field from the smart filter bar
47
+ *
48
+ * @returns Filterbar metadata which is required for the EasyFilter search
49
+ */
50
+ function fnPrepareSearchMetadata() {
51
+
52
+ var aPromise = [];
53
+ var oOwnerFilterControl = oState.oSmartFilterbar;
54
+ var oSFBModel = oOwnerFilterControl.getModel();
55
+ var oSFBMetaModel = oSFBModel.getMetaModel();
56
+ var oEditStateFilterItem;
57
+ var sEntitySet = oController.getOwnerComponent().getEntitySet();
58
+
59
+ var mFilterProperties = {}; // todo : Add the properties from navigation entites
60
+ var oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(sEntitySet);
61
+ oEntityType.property.map(function (oProperty) {
62
+ if (filterHelper.isPropertyFilterable(oProperty)) {
63
+ var bIsCodeListRequired = "";
64
+ oProperty.extensions && oProperty.extensions.forEach(function(oExtension) {
65
+ if (oExtension.name === "value-list" && oExtension.value === "fixed-values") {
66
+ bIsCodeListRequired = true;
67
+ }
68
+ });
69
+ mFilterProperties[oProperty.name] = {
70
+ name: oProperty.name,
71
+ //label: oProperty.label, Name is added from the filter item control
72
+ dataType: oProperty.type,
73
+ filterable: true,
74
+ sortable: false,
75
+ codeList : bIsCodeListRequired
76
+ //,required: oProperty.required (TO-DO)
77
+ };
78
+ }
79
+ });
80
+
81
+ oEasyFilterMetadata = {
82
+ version: 1,
83
+ entitySet: sEntitySet,
84
+ fields : []
85
+ };
86
+
87
+ oOwnerFilterControl.getAllFilterItems().forEach(function (oFilterItem) {
88
+ //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
89
+ // todo : Add the properties from navigation entites
90
+ var oFilterItemForQuery = mFilterProperties[oFilterItem.getName()];
91
+ if (oFilterItemForQuery) {
92
+ oFilterItemForQuery.label = oFilterItem.getLabel();
93
+ // codeList is set to true for fixed value list and codelist is fetched
94
+ if (oFilterItemForQuery.codeList) {
95
+ var oProperty = oSFBMetaModel.getODataProperty(oEntityType, oFilterItemForQuery.name , true);
96
+ var oPropertyContext = oSFBMetaModel.createBindingContext(oProperty);
97
+ var oVHPromise = oSFBMetaModel.getODataValueLists(oPropertyContext);
98
+ aPromise.push(oVHPromise);
99
+ oVHPromise.then(function(oValueList) {
100
+ if (mCodeList[oFilterItemForQuery.name]) {
101
+ oFilterItemForQuery.codeList = mCodeList[oFilterItemForQuery.name];
102
+ } else {
103
+ oFilterItemForQuery.codeList = function() {
104
+ return fnGetValueListValues(oFilterItemForQuery, oValueList, oSFBModel);
105
+ };
106
+ }
107
+ oEasyFilterMetadata.fields.push(oFilterItemForQuery);
108
+ });
109
+ } else {
110
+ oEasyFilterMetadata.fields.push(oFilterItemForQuery);
111
+ }
112
+ } else if (oFilterItem.getName() === "EditState") {// For draft scenarios
113
+ oEditStateFilterItem = oFilterItem;
114
+ }
115
+ });
116
+
117
+ // Adding Editing status filter
118
+ if (oTemplateUtils.oComponentUtils.isDraftEnabled()) {
119
+ var oEditStateControl = oController.byId("editStateFilter");
120
+ if (oEditStateControl) {
121
+ var oEditingStatusCodeList = oEditStateControl.getItems().map(function(oItem) {
122
+ return {
123
+ value : oItem.getKey(),
124
+ description : oItem.getText()
125
+ };
126
+ });
127
+ var oEditStateFilterMetadata = {
128
+ name: oEditStateFilterItem.getName(),
129
+ label: oEditStateFilterItem.getLabel(),
130
+ dataType: "Edm.String",
131
+ filterable: true,
132
+ required: false,
133
+ sortable: false,
134
+ codeList : oEditingStatusCodeList
135
+ };
136
+ oEasyFilterMetadata.fields.push(oEditStateFilterMetadata);
137
+ }
138
+ }
139
+
140
+ return Promise.allSettled(aPromise).then(function() {
141
+ return oEasyFilterMetadata;
142
+ });
143
+ }
144
+
145
+ /**
146
+ * This method is used to trigger the EasyFilter search of the fiori AI reuse library
147
+ * @param {*} oEasyFilterControl EasyFilter control of the floorplan
148
+ * @returns Promise which resolves to AI filters
149
+ */
150
+ function fnTriggerEasyFilterQuery(oEasyFilterControl) {
151
+
152
+ var sEasyFilterQuery = oEasyFilterControl.getValue();
153
+ if (sEasyFilterQuery.length === 0) {
154
+ // Resolving with an empty array will reset the SFB filters and trigger a fresh GET call
155
+ return Promise.resolve([]);
156
+ } else {
157
+ var oEasyFilterMetadataPromise = fnGetEasyFilterSearchMetadata();
158
+ var oResultPromise = new Promise(function(fnResolve, fnReject) {
159
+ oEasyFilterMetadataPromise.then(function(oEasyFilterMetadata) {
160
+ var oFioriAIFilterQueryPromise = oTemplateUtils.oServices.oFioriAIHandler.fioriaiLib.EasyFilter.easyFilter(sEasyFilterQuery, oEasyFilterMetadata);
161
+ oFioriAIFilterQueryPromise.then(function(oResponse) {
162
+ if (oResponse.success) {
163
+ if (oResponse.data.version === 1) {
164
+ // In cases where user filters with some random string and the no valuable filter is availabel then simply reject
165
+ if (oResponse.data.unclear || !oResponse.data.filter) {
166
+ var sUnclearInputMessage = oResponse.data.unclear ? "Unclear input: " + oResponse.data.unclear : "Unclear input";
167
+ oEasyFilterControl.setValueStateText(sUnclearInputMessage);
168
+ oEasyFilterControl.setValueState(ValueState.Warning);
169
+ fnReject(oResponse);
170
+ } else if (oResponse.data.filter) {
171
+ // Commenting out for v4 parity
172
+ //oEasyFilterControl.setValueState(ValueState.Success);
173
+ fnResolve(oResponse.data.filter);
174
+ }
175
+ } else if (oResponse.data.version === 2) {
176
+ // to-do for version 2
177
+ }
178
+ } else {
179
+ oEasyFilterControl.setValueStateText(oResponse.message);
180
+ oEasyFilterControl.setValueState(ValueState.Warning);
181
+ fnReject(oResponse);
182
+ }
183
+ },fnReject);
184
+ });
185
+ });
186
+ return oResultPromise;
187
+ }
188
+ }
189
+
190
+ /**
191
+ * This method reads the values of the valuehelp entity from the backend and fills the code list of each property.
192
+ * Once the values are filled then the fioriAI uses it for getting the ID of the user entered description in the search field
193
+ * Later the key field is set in the SFB and table is filtered with the same. Description cannot be used for filtering.
194
+ * @param {*} oFilterItemForQuery A Property from the easy filter metadata
195
+ * @param {*} oValueList Value list object of the filter item
196
+ * @returns
197
+ */
198
+ function fnGetValueListValues(oFilterItemForQuery, oValueList, oSFBModel) {
199
+
200
+ if (mCodeList[oFilterItemForQuery.name]) {
201
+ return mCodeList[oFilterItemForQuery.name];
202
+ }
203
+
204
+ return new Promise(function(fnResolve, fnReject) {
205
+
206
+ var oValueListDefaultBinding = oValueList[""];
207
+ // Cases where the default binding is not available ignore for now
208
+ if (oValueListDefaultBinding) {
209
+ var sSelect = oValueListDefaultBinding.Parameters && oValueListDefaultBinding.Parameters.map(function(oParam) {
210
+ return oParam.ValueListProperty.String;
211
+ }).join(",");
212
+
213
+ var fnSuccess = function(oResponse) {
214
+ var mValueListData = [];
215
+ oResponse.results && oResponse.results.forEach(function(oItem) {
216
+ mValueListData.push({
217
+ value : oItem[sValueProperty],
218
+ description : sDescriptionProperty ? oItem[sDescriptionProperty] : undefined
219
+ });
220
+ });
221
+ mCodeList[oFilterItemForQuery.name] = mValueListData;
222
+ oEasyFilterMetadata.fields.forEach(function (oField) {
223
+ if (oField.name === oFilterItemForQuery.name) {
224
+ oField.codeList = mValueListData;
225
+ }
226
+ });
227
+ fnResolve(mValueListData);
228
+ };
229
+
230
+ oSFBModel.read("/" + oValueListDefaultBinding.CollectionPath.String, {
231
+ $select : sSelect,
232
+ success : fnSuccess,
233
+ error : fnReject
234
+ });
235
+
236
+ var sValueProperty;
237
+ var sDescriptionProperty;
238
+
239
+ oValueListDefaultBinding.Parameters && oValueListDefaultBinding.Parameters.forEach(function(oParam) {
240
+ if (oParam.LocalDataProperty && (oParam.LocalDataProperty.PropertyPath === oFilterItemForQuery.name)) {
241
+ sValueProperty = oParam.ValueListProperty.String;
242
+ } else {
243
+ sDescriptionProperty = oParam.ValueListProperty.String;
244
+ }
245
+ });
246
+ }
247
+ });
248
+ }
249
+
250
+ /**
251
+ * This method is used to convert the AI filters to the selectOptions for the SmartFilterBar
252
+ * It also identifies the values of edit state filter in case of draft
253
+ * @param {*} oAIFilters
254
+ * @returns array of selectOptions
255
+ */
256
+ function fnGetSFBVariantData(oAIFilters) {
257
+
258
+ // Each filter from AI will be converted to a selectOption and added to the SmartVariantManagement state
259
+ // Case 1 : AI Query "Show P1 = a"
260
+ // ------- AI response "P1 = Ranges [a]" .
261
+ // ------- Converted to selectOptions [ {Property = P1, Ranges = [ a ] } ].
262
+ // ------- Filtered as P1 = a.
263
+ // Case 1.a : AI Query "Show P1 = a , b"
264
+ // ------- AI response "P1 = Ranges [a, b]" .
265
+ // ------- Converted to selectOptions [ {Property = P1, Ranges = [ a, b ] } ] .
266
+ // ------- FE filters as "a or b".
267
+ // Case 1.b : AI Query "Show P1 between a and b"
268
+ // ------- AI response " [P1 = Ranges [a] , P1 = Ranges [b]]".
269
+ // ------- Converted to selectOptions [ {Property = P1, Ranges = [ a ] } , {Property = P2, Ranges = [ b ] } ] .
270
+ // ------- FE filters as "a and b" but (todo) currently it is "a or b".
271
+ // Case 2 : AI Query "Show P1 = a and P2 = b"
272
+ // ------- AI response "[P1 = Ranges [a] , P2 = Ranges [b]]"
273
+ // ------- Convert to selectOptions [ {Property = P1, Ranges = [ a ] } , {Property = P2, Ranges = [ b ] } ].
274
+ // ------- FE filters as "a and b".
275
+
276
+ var aSelectOptions = [];
277
+ var oEditStateFilter = 0;
278
+ oAIFilters.forEach(function(oFilterItem) {
279
+
280
+ if ( oFilterItem.name === "EditState") {
281
+ oEditStateFilter = oFilterItem.values[0]; // Edit state generally should not have more than one filter value
282
+ } else {
283
+ var oFilter = {
284
+ PropertyName : oFilterItem.name,
285
+ Ranges : []
286
+ };
287
+ oFilterItem.values.forEach(function (oValue) {
288
+ var oRange = {
289
+ Sign : "I", // currently not considering "E"
290
+ High : "" // Usually for "BT" High is required, but AI provides two separate filters (LT and GT) and FE converts it to two separate selectOptions
291
+ // But this results in OR condition
292
+ // todo : check if AI can provide BT filter or FE should handle it
293
+ };
294
+ if (oFilterItem.operator === "Contains") { // need to check for other operators if special handling is required
295
+ oRange.Option = "CP";
296
+ } else {
297
+ oRange.Option = oFilterItem.operator;
298
+ }
299
+ oRange.Low = oValue;
300
+ oFilter.Ranges.push(oRange);
301
+ });
302
+ aSelectOptions.push(oFilter);
303
+ }
304
+ });
305
+ return {
306
+ aSelectOptions: aSelectOptions,
307
+ oEditStateFilter : oEditStateFilter
308
+ };
309
+ }
310
+ return {
311
+ triggerEasyFilterQuery : fnTriggerEasyFilterQuery,
312
+ getSFBVariantData : fnGetSFBVariantData,
313
+ getEasyFilterSearchMetadata : fnGetEasyFilterSearchMetadata
314
+ };
315
+ }
316
+
317
+ return BaseObject.extend("sap.suite.ui.generic.template.lib.ai.EasyFilterBarHandler", {
318
+ constructor: function (oState, oController, oTemplateUtils) {
319
+ extend(this, getMethods(oState, oController, oTemplateUtils));
320
+ }
321
+ });
322
+
323
+ });
@@ -0,0 +1,77 @@
1
+ sap.ui.define([
2
+ "sap/ui/base/Object",
3
+ "sap/base/util/extend",
4
+ "sap/ui/core/Lib",
5
+ "sap/suite/ui/generic/template/genericUtilities/FeLogger"
6
+ ], function(BaseObject, extend, Lib, FeLogger) {
7
+ 'use strict';
8
+ var sAIIntent = "#IntelligentPrompt-summarize"; // For now the intent is common for all the AI scenarios
9
+ var sFioriAILibrary = "ux.eng.fioriai.reuse";
10
+ var UShellContainer = sap.ui.require("sap/ushell/Container");
11
+ var oLogger = new FeLogger("js.FioriAIHandler").getLogger();
12
+ /*
13
+ * This is a handler class for Fiori AI. It is used to load the Fiori AI library and provide it to the template for template consumption.
14
+ *
15
+ */
16
+
17
+ function getMethods(oTemplateContract) {
18
+
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
+ /**
27
+ * This method is used to load the Fiori AI library and make the available AI capabilities to the template contract
28
+ */
29
+ function fnLoadAILibrary() {
30
+ var that = this;
31
+ 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", "ux/eng/fioriai/reuse/easyfilter/EasyFilter"], function(fioriaiLib, EasyFilter) {
36
+ that.fioriaiLib.summarize = fioriaiLib.summarize;
37
+ that.fioriaiLib.EasyFilter = EasyFilter;
38
+ that.isFioriAIEnabled = true;
39
+ // Each AI capability will be enabled separately. Currently there is no separation for beta , but in future it will be
40
+ oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/fioriAI/isSummarizationEnabled", !!sUrl);
41
+ // isEasyFilterEnabled property controls the visibility of the EasyFilterBar
42
+ oTemplateContract.oTemplatePrivateGlobalModel.setProperty("/generic/fioriAI/isEasyFilterEnabled", false);
43
+ fnResolveInit();
44
+ });
45
+ });
46
+ }).catch(function() {
47
+ oLogger.warning("No intelligent capability enabled on the tenant");
48
+ fnRejectInit();
49
+ });
50
+ }, fnRejectInit);
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @returns Promise which resolves to true if the AI is enabled
56
+ */
57
+ function fnGetFioriAIEnabledPromise() {
58
+ return this.isFioriAIEnabled ? Promise.resolve() : oFioriAILoaderPromise;
59
+ }
60
+
61
+ return {
62
+ loadAILibrary: fnLoadAILibrary,
63
+ getFioriAIEnabledPromise: fnGetFioriAIEnabledPromise
64
+ };
65
+ }
66
+ return BaseObject.extend("sap.suite.ui.generic.template.lib.ai.FioriAIHandler", {
67
+ constructor: function (oTemplateContract) {
68
+ // If the AI intent is available then later the library will be loaded
69
+ this.fioriaiLib = {
70
+ summarize: null,
71
+ EasyFilter: null
72
+ };
73
+ this.isFioriAIEnabled = false;
74
+ extend(this, getMethods(oTemplateContract));
75
+ }
76
+ });
77
+ });
@@ -606,6 +606,40 @@ sap.ui.define([
606
606
  }
607
607
  }
608
608
 
609
+ function getCommonFilterProperties(aEntityProp, aParameters) {
610
+ var aCommonPropKeys = aEntityProp.filter(function(oProperty) {
611
+ return isPropertyFilterable(oProperty);
612
+ }) || [];
613
+ if (aParameters && aParameters.length > 0) {
614
+ aEntityProp.forEach(function(oEntityProp){
615
+ var sPropertyNameWithPrefix = "P_" + oEntityProp.name;
616
+ if (aParameters.includes(sPropertyNameWithPrefix)) {
617
+ aCommonPropKeys.push(oEntityProp);
618
+ }
619
+ });
620
+ }
621
+ return aCommonPropKeys;
622
+ }
623
+
624
+ function isPropertyFilterable(oProperty) {
625
+ return oProperty["sap:filterable"] ? oProperty["sap:filterable"] !== "false" : true;
626
+ }
627
+
628
+ /**
629
+ * This function will create a selection variant object from the filter object
630
+ * @param {*} aFilters
631
+ * @returns {object} oSelectionVariant
632
+ */
633
+ function fnCreateSVFromFilter(aFilters) {
634
+ var oSelectionVariant = new SelectionVariant();
635
+ aFilters && aFilters.forEach(function(oFilter) {
636
+ // to-do: handle multiple values
637
+ var aFilters = oFilter.values;
638
+ oSelectionVariant.addSelectOption(oFilter.name, "I", oFilter.operator, aFilters[0].toString(), "");
639
+ });
640
+ return oSelectionVariant;
641
+ }
642
+
609
643
  return {
610
644
  enhanceVariant: enhanceVariant,
611
645
  updateRangeValue: updateRangeValue,
@@ -621,6 +655,9 @@ sap.ui.define([
621
655
  getRelatedTextToRange: getRelatedTextToRange,
622
656
  setFilterRestrictionToSemanticDateRange: setFilterRestrictionToSemanticDateRange,
623
657
  addDateRangeValueToSV: addDateRangeValueToSV,
624
- getDateRangeDefaultValue: getDateRangeDefaultValue
658
+ getDateRangeDefaultValue: getDateRangeDefaultValue,
659
+ getCommonFilterProperties: getCommonFilterProperties,
660
+ isPropertyFilterable: isPropertyFilterable,
661
+ createSVFromFilter : fnCreateSVFromFilter
625
662
  };
626
663
  });
@@ -302,6 +302,19 @@ ST_CARD_CREATION_FAILURE_REASON_SEMANTIC_DATE_FILTERS=Card creation isn\u2019t p
302
302
  ST_CARD_NAVIGATION_FAILURE_INFO=Direct navigation to the object details isn’t possible from this insights card.
303
303
 
304
304
 
305
+ #------------Easy filter related text-----------------------
306
+
307
+ # YMSG, 200: Message shown when the user switches to Easy filter mode
308
+ 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.
309
+
310
+ # YMSG, 100: Placeholder text for the Easy Filter input field
311
+ ST_EASY_FILTER_INPUT_PLACEHOLDER=Enter your query in natural language to filter the list
312
+
313
+ # XBUT, 20: Text for the Go button in Easy Filter mode
314
+ ST_EASY_FILTER_GO_BUTTON_TEXT=Go
315
+
316
+ #------------End of: Easy filter related text-----------------------
317
+
305
318
  #---Final block: texts to be redefined by the application ----------------------------------------------
306
319
 
307
320
  #--- a) Texts that are only relevant for the object page of the root object
@@ -246,7 +246,7 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/metadataAnalyser"
246
246
  return !aParameterKeys.includes(key);
247
247
  });
248
248
  if (oEntityType && oEntityType.property) {
249
- aCommonFilterProperties = getCommonFilterProperties(oEntityType.property, aParameterProperties);
249
+ aCommonFilterProperties = filterHelper.getCommonFilterProperties(oEntityType.property, aParameterProperties);
250
250
  }
251
251
  for (var i = 0; i < aCommonFilterProperties.length; i++) {
252
252
  var oFilterProp = aCommonFilterProperties[i],
@@ -359,25 +359,6 @@ sap.ui.define(["sap/suite/ui/generic/template/genericUtilities/metadataAnalyser"
359
359
  });
360
360
  };
361
361
 
362
- var getCommonFilterProperties = function (aEntityProp, aParameters) {
363
- var aCommonPropKeys = aEntityProp.filter(function(oProperty) {
364
- return isPropertyFilterable(oProperty);
365
- }) || [];
366
- if (aParameters && aParameters.length > 0) {
367
- aEntityProp.forEach(function(oEntityProp){
368
- var sPropertyNameWithPrefix = "P_" + oEntityProp.name;
369
- if (aParameters.includes(sPropertyNameWithPrefix)) {
370
- aCommonPropKeys.push(oEntityProp);
371
- }
372
- });
373
- }
374
- return aCommonPropKeys;
375
- };
376
-
377
- var isPropertyFilterable = function (oProperty) {
378
- return oProperty["sap:filterable"] ? oProperty["sap:filterable"] !== "false" : true;
379
- };
380
-
381
362
  var getRelatedEntityProperty = function(oFilterProp, aEntityProperties) {
382
363
  if (aEntityProperties && aEntityProperties.length) {
383
364
  var aEntityProperty = aEntityProperties.filter(function(oEntityProperty) {
@@ -3055,7 +3055,7 @@ sap.ui.define(["sap/ui/base/Object",
3055
3055
  * @param {sap.suite.ui.generic.template.lib.AppComponent} oAppComponent The AppComponent instance
3056
3056
  * @public
3057
3057
  * @extends sap.ui.base.Object
3058
- * @version 1.124.2
3058
+ * @version 1.124.3
3059
3059
  * @since 1.30.0
3060
3060
  * @alias sap.suite.ui.generic.template.lib.NavigationController
3061
3061
  */
@@ -62,7 +62,7 @@ sap.ui.define([
62
62
  interfaces: [],
63
63
  controls: [],
64
64
  elements: [],
65
- version: "1.124.2",
65
+ version: "1.124.3",
66
66
  extensions: {
67
67
  //Configuration used for rule loading of Support Assistant
68
68
  "sap.ui.support": {
@@ -5,3 +5,7 @@
5
5
  .sapSmartTemplatesCreateDialog {
6
6
  max-width: fit-content;
7
7
  }
8
+
9
+ .sapSmartTemplateEasyFilterInputPadding {
10
+ padding: 0.5rem 1rem;
11
+ }