@sapui5/sap.suite.ui.generic.template 1.124.2 → 1.124.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.
- package/package.json +1 -1
- package/src/sap/suite/ui/generic/template/.library +1 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +38 -3
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n.properties +16 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ar.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_bg.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ca.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_cnr.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_cs.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_cy.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_da.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_de.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_el.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_en.properties +5 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_en_GB.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_es.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_es_MX.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_et.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fi.properties +9 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fr.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fr_CA.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hi.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hr.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hu.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_id.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_it.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_iw.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ja.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_kk.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ko.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_lt.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_lv.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_mk.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ms.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_nl.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_no.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_pl.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_pt.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_pt_PT.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ro.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ru.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sh.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sk.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sl.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sr.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sv.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_th.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_tr.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_uk.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_vi.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_zh_CN.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_zh_TW.properties +10 -0
- package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/DefaultVariant.fragment.xml +18 -3
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/FullscreenPage.fragment.xml +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +17 -16
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/Actions.fragment.xml +1 -1
- package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/fragments/EasyFilter.fragment.xml +24 -0
- package/src/sap/suite/ui/generic/template/genericUtilities/filterHelper.js +6 -6
- package/src/sap/suite/ui/generic/template/lib/AdaptiveCardHelper.js +62 -36
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +16 -15
- package/src/sap/suite/ui/generic/template/lib/Application.js +1 -4
- package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +43 -1
- package/src/sap/suite/ui/generic/template/lib/TemplateAssembler.js +1 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +323 -0
- package/src/sap/suite/ui/generic/template/lib/ai/FioriAIHandler.js +77 -0
- package/src/sap/suite/ui/generic/template/lib/filterHelper.js +38 -1
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +13 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +8 -0
- package/src/sap/suite/ui/generic/template/lib/insights/InsightsCardHelper.js +1 -20
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
- package/src/sap/suite/ui/generic/template/library.js +1 -1
- package/src/sap/suite/ui/generic/template/themes/base/base.less +4 -0
|
@@ -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) + " ? '
|
|
325
|
+
return fnGetNullishPathCheckString(sPath) + " ? '−' : " + 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 + " + ' ' + '−' : " + "";
|
|
344
360
|
} else if (oField.semantic === oSapSemantics.currencyCode) {
|
|
345
|
-
sSapUnitConditionalPath = "(" + fnGetNullishPathCheckString(oField.sapUnit) + ")" + ' ? ' + " '
|
|
361
|
+
sSapUnitConditionalPath = "(" + fnGetNullishPathCheckString(oField.sapUnit) + ")" + ' ? ' + " '−' : " + "";
|
|
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
|
-
|
|
612
|
+
oColumnSetClone.columns.push(oColumnClone);
|
|
597
613
|
continue;
|
|
598
614
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
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
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
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
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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
|
-
//
|
|
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
|
|
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
|
|
289
|
-
|
|
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
|
|
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.
|
|
923
|
+
* @version 1.124.4
|
|
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
|
+
});
|