@sapui5/sap.suite.ui.generic.template 1.141.3 → 1.142.1
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 +3 -4
- package/src/sap/suite/ui/generic/template/.library +3 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_kk.properties +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/Component.js +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +61 -12
- package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +2 -2
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n.properties +5 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ar.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_bg.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ca.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_cnr.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_cs.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_cy.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_da.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_de.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_el.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_en.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_en_GB.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_es.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_es_MX.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_et.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fi.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fr.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fr_CA.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hi.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hr.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hu.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_id.properties +5 -2
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_it.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_iw.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ja.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_kk.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ko.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_lt.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_lv.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_mk.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ms.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_nl.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_no.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_pl.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_pt.properties +4 -1
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_pt_PT.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ro.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ru.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sh.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sk.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sl.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sr.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_sv.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_th.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_tr.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_uk.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_vi.properties +5 -2
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_zh_CN.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_zh_TW.properties +3 -0
- package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +29 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/annotationHelpers/AnnotationHelperActionButtons.js +8 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +85 -21
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/RelatedAppsHandler.js +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controllerFrameworkExtensions.js +8 -7
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ar.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_pt.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_vi.properties +2 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/templateSpecificPreparationHelper.js +2 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/Actions.fragment.xml +2 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +0 -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/MessagePopover.fragment.xml +1 -1
- package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +0 -5
- package/src/sap/suite/ui/generic/template/js/AnnotationHelperStreamSupport.js +2 -1
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +20 -2
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +47 -1
- package/src/sap/suite/ui/generic/template/lib/TableNoDataHandler.js +107 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillHandler.js +58 -6
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillDialog.fragment.xml +6 -4
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +44 -199
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterDataFetcherHelper.js +334 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +49 -13
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +34 -10
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +31 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +32 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +32 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +33 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +33 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_US_saprigi.properties +14 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +33 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +33 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +32 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +31 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +28 -4
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +26 -2
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +38 -14
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +31 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +31 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +31 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +33 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +31 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +28 -4
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +31 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +29 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +33 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +32 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +30 -6
- package/src/sap/suite/ui/generic/template/lib/insights/InsightsCardHelper.js +10 -0
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +6 -1
- package/src/sap/suite/ui/generic/template/lib/presentationControl/SmartChartHandler.js +10 -5
- package/src/sap/suite/ui/generic/template/lib/presentationControl/SmartListHandler.js +6 -1
- package/src/sap/suite/ui/generic/template/lib/presentationControl/SmartTableHandler.js +36 -31
- package/src/sap/suite/ui/generic/template/library.js +1 -1
- package/src/sap/suite/ui/generic/template/listTemplates/fragments/DetailSmartTable.fragment.xml +29 -28
|
@@ -5,8 +5,9 @@ sap.ui.define([
|
|
|
5
5
|
"sap/suite/ui/generic/template/genericUtilities/FeLogger",
|
|
6
6
|
"sap/ui/model/FilterOperator",
|
|
7
7
|
'sap/ui/model/Filter',
|
|
8
|
-
'sap/suite/ui/generic/template/js/AnnotationHelper'
|
|
9
|
-
|
|
8
|
+
'sap/suite/ui/generic/template/js/AnnotationHelper',
|
|
9
|
+
"./EasyFilterDataFetcherHelper"
|
|
10
|
+
], function(BaseObject, extend, filterHelper, FeLogger, FilterOperator,Filter,AnnotationHelper,EasyFilterDataFetcherHelper) {
|
|
10
11
|
'use strict';
|
|
11
12
|
|
|
12
13
|
/*
|
|
@@ -333,24 +334,28 @@ sap.ui.define([
|
|
|
333
334
|
// keySpecificSelectedValues will have one selectedValues object for each operator
|
|
334
335
|
// ex : [{operator: "EQ", selectedValues: ["HT-1010","HT-10001","1097"]}, {operator: "Contains", selectedValues: ["HT-100"]}]
|
|
335
336
|
oFilterItem.keySpecificSelectedValues.forEach(function (oSelectedValues) {
|
|
336
|
-
var oRange = {
|
|
337
|
-
Sign: "I", // currently not considering "E"
|
|
338
|
-
High: ""
|
|
339
|
-
};
|
|
340
|
-
|
|
341
337
|
if ((oSelectedValues.operator === "BT" || oSelectedValues.operator === "NB")) {
|
|
338
|
+
var oRange = {
|
|
339
|
+
Sign: oSelectedValues.operator === "NB" ? "E" : "I",
|
|
340
|
+
High: ""
|
|
341
|
+
};
|
|
342
342
|
oRange.Low = oSelectedValues.selectedValues[0];
|
|
343
343
|
oRange.High = oSelectedValues.selectedValues[1];
|
|
344
|
-
oRange.Option =
|
|
344
|
+
oRange.Option = "BT";
|
|
345
345
|
oFilter.Ranges.push(oRange);
|
|
346
346
|
} else {
|
|
347
|
-
oSelectedValues.selectedValues.forEach(function (
|
|
348
|
-
|
|
347
|
+
oSelectedValues.selectedValues.forEach(function (sValue) {
|
|
348
|
+
var oRange = {
|
|
349
|
+
Sign: EasyFilterDataFetcherHelper.isNegationOperator(oSelectedValues.operator) ? "E" : "I",
|
|
350
|
+
High: ""
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
if (isCPOperator(oSelectedValues.operator)) {
|
|
349
354
|
oRange.Option = "CP";
|
|
350
|
-
oRange.Low =
|
|
355
|
+
oRange.Low = getValueForCPOperator(sValue,oSelectedValues.operator);
|
|
351
356
|
} else {
|
|
352
|
-
oRange.Option = oSelectedValues.operator;
|
|
353
|
-
oRange.Low =
|
|
357
|
+
oRange.Option = EasyFilterDataFetcherHelper.isNegationOperator(oSelectedValues.operator) ? EasyFilterDataFetcherHelper.getReverseOperator(oSelectedValues.operator) : oSelectedValues.operator;
|
|
358
|
+
oRange.Low = sValue;
|
|
354
359
|
}
|
|
355
360
|
oFilter.Ranges.push(oRange);
|
|
356
361
|
});
|
|
@@ -366,6 +371,29 @@ sap.ui.define([
|
|
|
366
371
|
};
|
|
367
372
|
}
|
|
368
373
|
|
|
374
|
+
function getValueForCPOperator(sValue,sOperator) {
|
|
375
|
+
sOperator = EasyFilterDataFetcherHelper.isNegationOperator(sOperator) ? EasyFilterDataFetcherHelper.getReverseOperator(sOperator) : sOperator;
|
|
376
|
+
switch (sOperator) {
|
|
377
|
+
case FilterOperator.Contains:
|
|
378
|
+
sValue = `*${sValue}*`;
|
|
379
|
+
break;
|
|
380
|
+
case FilterOperator.EndsWith:
|
|
381
|
+
sValue = `*${sValue}`;
|
|
382
|
+
break;
|
|
383
|
+
case FilterOperator.StartsWith:
|
|
384
|
+
sValue = `${sValue}*`;
|
|
385
|
+
break;
|
|
386
|
+
default:
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
return sValue;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function isCPOperator(sOperator) {
|
|
393
|
+
return sOperator === FilterOperator.Contains || sOperator === FilterOperator.EndsWith || sOperator === FilterOperator.NotContains || sOperator === FilterOperator.NotEndsWith
|
|
394
|
+
|| sOperator === FilterOperator.NotStartsWith || sOperator === FilterOperator.StartsWith;
|
|
395
|
+
}
|
|
396
|
+
|
|
369
397
|
/**
|
|
370
398
|
* This method is used to get the EasyFilter control from the floorplan
|
|
371
399
|
* @returns EasyFilter control
|
|
@@ -431,7 +459,6 @@ sap.ui.define([
|
|
|
431
459
|
if (oSmartFilterBarVariant.semanticDates) {
|
|
432
460
|
var { Low: value1, High: value2 } = oVariantDataFromAI.aSelectOptions[0].Ranges[0];
|
|
433
461
|
var dateData = oSmartFilterBarVariant.semanticDates.Dates[0].Data;
|
|
434
|
-
|
|
435
462
|
dateData.operation = "DATERANGE";
|
|
436
463
|
dateData.value1 = value1;
|
|
437
464
|
dateData.value2 = value2 || value1;
|
|
@@ -541,191 +568,10 @@ sap.ui.define([
|
|
|
541
568
|
}
|
|
542
569
|
}
|
|
543
570
|
|
|
544
|
-
function getFiltersForDataFetching(key,keySpecificSelectedResult) {
|
|
545
|
-
const aFilters = [];
|
|
546
|
-
|
|
547
|
-
for (var i = 0; i < keySpecificSelectedResult.length;++i) {
|
|
548
|
-
const result = keySpecificSelectedResult[i];
|
|
549
|
-
if (result.operator === FilterOperator.BT || result.operator === FilterOperator.NB) {
|
|
550
|
-
aFilters.push(new Filter({
|
|
551
|
-
path: key,
|
|
552
|
-
operator: result.operator,
|
|
553
|
-
value1: result.selectedValues[0],
|
|
554
|
-
value2: result.selectedValues[1]
|
|
555
|
-
}));
|
|
556
|
-
} else {
|
|
557
|
-
for (var j = 0; j < result.selectedValues.length; ++j) {
|
|
558
|
-
aFilters.push(new Filter({
|
|
559
|
-
path: key,
|
|
560
|
-
operator: result.operator,
|
|
561
|
-
value1: result.selectedValues[j]
|
|
562
|
-
}));
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
return aFilters;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
571
|
function onDataFetcher(key,keySpecificSelectedResult,totalAIResponse) {
|
|
570
|
-
return
|
|
571
|
-
|
|
572
|
-
var aFinalResponse = [];
|
|
573
|
-
var oOwnerFilterControl = oState.oSmartFilterbar;
|
|
574
|
-
var sKey = key;
|
|
575
|
-
var sEntitySet = oController.getOwnerComponent().getEntitySet();
|
|
576
|
-
var oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(sEntitySet);
|
|
577
|
-
var oSFBModel = oOwnerFilterControl.getModel();
|
|
578
|
-
var oSFBMetaModel = oSFBModel.getMetaModel();
|
|
579
|
-
var aFilters = getFiltersForDataFetching(key,keySpecificSelectedResult);
|
|
580
|
-
var oProperty = oSFBMetaModel.getODataProperty(oEntityType, key);
|
|
581
|
-
var sPropertyPath = oSFBMetaModel.getODataProperty(oEntityType, key,true);
|
|
582
|
-
var isValueHelpTableAvailable = AnnotationHelper.isValueHelpTableAvailable(oProperty);
|
|
583
|
-
|
|
584
|
-
if (isValueHelpTableAvailable) {
|
|
585
|
-
var oPropertyContext = oSFBMetaModel.createBindingContext(sPropertyPath);
|
|
586
|
-
var oVHPromise = oSFBMetaModel.getODataValueLists(oPropertyContext);
|
|
587
|
-
var filtersLength = aFilters.length;
|
|
588
|
-
// //Every Search on a value, create a seperate call to backend,but they are grouped into one batch
|
|
589
|
-
// //We need to ensure that once all calls are completed inside the batch to resolve the promise, else the system would be waiting indefenitely
|
|
590
|
-
var ctr = 0;
|
|
591
|
-
let fnForDescription = (oResponse,aMatchedFilterResults,sTextArrangementPath,sTextArrangement) => {
|
|
592
|
-
++ctr;
|
|
593
|
-
var aResults = oResponse.results;
|
|
594
|
-
|
|
595
|
-
//Check the description is present and follow the textArrangement annotation as well
|
|
596
|
-
//If the value is not present ,make the ID and Description same
|
|
597
|
-
aMatchedFilterResults.forEach((oFilter)=>{
|
|
598
|
-
var result = aResults.find((res)=>res[key] === oFilter.getValue1());
|
|
599
|
-
if (result) {
|
|
600
|
-
aFinalResponse.push({
|
|
601
|
-
operator: FilterOperator.EQ,
|
|
602
|
-
selectedValues: [{
|
|
603
|
-
value: result[key],
|
|
604
|
-
description: AnnotationHelper.getTextArrangementFinalString(result,key,sTextArrangementPath.split("/")[1],sTextArrangement)
|
|
605
|
-
}]
|
|
606
|
-
});
|
|
607
|
-
} else {
|
|
608
|
-
//Ideally description should be present, if in case its not present we will fallback to our default case where value and description would be same
|
|
609
|
-
aFinalResponse.push(getkeySpecifiedResultFromFilters(oFilter));
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
if (ctr === filtersLength) {
|
|
614
|
-
resolve(aFinalResponse);
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
let fnSuccessForValueList = (oResponse,oFilter,sValueListEntity) => {
|
|
621
|
-
var oValueHelpEntity = oTemplateUtils.oCommonUtils.getMetaModelEntityType(sValueListEntity);
|
|
622
|
-
var oValueHelpProperty = oSFBMetaModel.getODataProperty(oValueHelpEntity, key);
|
|
623
|
-
var aResults = oResponse.results;
|
|
624
|
-
var sTextArrangementPath = AnnotationHelper.getTextArrangementPath(oValueHelpProperty);
|
|
625
|
-
var sTextArrangement = AnnotationHelper.getTextArrangementForEasyFilter(oValueHelpEntity,oValueHelpProperty);
|
|
626
|
-
var navigationProperty = null;
|
|
627
|
-
var sEntityForTextDescription = null;
|
|
628
|
-
|
|
629
|
-
if (sTextArrangementPath && sTextArrangementPath.split("/").length > 1) {
|
|
630
|
-
navigationProperty = sTextArrangementPath.split("/")[0];
|
|
631
|
-
sEntityForTextDescription = oSFBMetaModel.getODataAssociationSetEnd(oValueHelpEntity,navigationProperty).entitySet;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
//We are triggering the below call, only for fetching of the TextDescription.If its a different entity than ValueList only then trigger it
|
|
635
|
-
if (aResults.length === 0) {
|
|
636
|
-
++ctr;
|
|
637
|
-
aFinalResponse.push(getkeySpecifiedResultFromFilters(oFilter));
|
|
638
|
-
} else if (aResults.length !== 0 && sEntityForTextDescription && sValueListEntity !== sEntityForTextDescription) {
|
|
639
|
-
var aAllMatchedResults = aResults.map((result)=>{
|
|
640
|
-
return result[key];
|
|
641
|
-
});
|
|
642
|
-
var aMatchedFilterResults = aAllMatchedResults.map((matchedResult)=>{
|
|
643
|
-
return new Filter({
|
|
644
|
-
path: key,
|
|
645
|
-
operator: FilterOperator.EQ,
|
|
646
|
-
value1:matchedResult
|
|
647
|
-
});
|
|
648
|
-
});
|
|
649
|
-
// The below code only be executed when the textDescription and ValueList entities are different
|
|
650
|
-
oSFBModel.read("/" + sEntityForTextDescription, {
|
|
651
|
-
filters: aMatchedFilterResults,
|
|
652
|
-
success : function(response) {
|
|
653
|
-
fnForDescription(response,aMatchedFilterResults);
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
} else {
|
|
657
|
-
//The below condition is when valueList entity and navigation property entity are same
|
|
658
|
-
++ctr;
|
|
659
|
-
aResults.forEach((result)=>{
|
|
660
|
-
aFinalResponse.push({
|
|
661
|
-
operator: FilterOperator.EQ,
|
|
662
|
-
selectedValues: [{
|
|
663
|
-
value: result[key],
|
|
664
|
-
description: AnnotationHelper.getTextArrangementFinalString(result,key,
|
|
665
|
-
sTextArrangementPath,sTextArrangement)
|
|
666
|
-
}]
|
|
667
|
-
});
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
if (ctr === filtersLength) {
|
|
672
|
-
resolve(aFinalResponse);
|
|
673
|
-
}
|
|
674
|
-
};
|
|
675
|
-
|
|
676
|
-
oVHPromise.then((oValueList)=>{
|
|
677
|
-
var oValueListDefaultBinding = oValueList[""];
|
|
678
|
-
var sValueListEntity = oValueListDefaultBinding.CollectionPath.String;
|
|
679
|
-
if (Array.isArray(oValueListDefaultBinding.Parameters)) {
|
|
680
|
-
var oParameter = oValueListDefaultBinding.Parameters.find(oParam => (oParam.RecordType === "com.sap.vocabularies.Common.v1.ValueListParameterInOut" && oParam.LocalDataProperty.PropertyPath === sKey));
|
|
681
|
-
if (oParameter) {
|
|
682
|
-
key = oParameter.ValueListProperty.String;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
//Get All Records using $search
|
|
686
|
-
aFilters.forEach((oFilter)=>{
|
|
687
|
-
oSFBModel.read("/" + sValueListEntity, {
|
|
688
|
-
urlParameters : {
|
|
689
|
-
search: oFilter.getValue1()
|
|
690
|
-
},
|
|
691
|
-
success : function(response) {
|
|
692
|
-
fnSuccessForValueList(response,oFilter,sValueListEntity);
|
|
693
|
-
}
|
|
694
|
-
});
|
|
695
|
-
});
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
} else {
|
|
699
|
-
//When there is no valueList associate, just return the original value in CodeList type
|
|
700
|
-
aFilters.forEach((oFilter)=>aFinalResponse.push(getkeySpecifiedResultFromFilters(oFilter)));
|
|
701
|
-
resolve(aFinalResponse);
|
|
702
|
-
}
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
function getkeySpecifiedResultFromFilters(oFilter) {
|
|
707
|
-
var values = [];
|
|
708
|
-
if (oFilter.getOperator() === FilterOperator.BT || oFilter.getOperator() === FilterOperator.NB) {
|
|
709
|
-
var values = [{
|
|
710
|
-
value: oFilter.getValue1(),
|
|
711
|
-
description: oFilter.getValue1()
|
|
712
|
-
},{
|
|
713
|
-
value: oFilter.getValue2(),
|
|
714
|
-
description: oFilter.getValue2()
|
|
715
|
-
}];
|
|
716
|
-
} else {
|
|
717
|
-
values.push({
|
|
718
|
-
value: oFilter.getValue1(),
|
|
719
|
-
description: oFilter.getValue1()
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
return {
|
|
723
|
-
operator: oFilter.getOperator(),
|
|
724
|
-
selectedValues: values
|
|
725
|
-
};
|
|
572
|
+
return EasyFilterDataFetcherHelper.fetchDataForKey(key, keySpecificSelectedResult, oState, oController, oTemplateUtils);
|
|
726
573
|
}
|
|
727
574
|
|
|
728
|
-
|
|
729
575
|
return {
|
|
730
576
|
getEasyFilterBar : fnGetEasyFilterBar,
|
|
731
577
|
initialiseEasyFilterBar : fnInitialiseEasyFilterBar,
|
|
@@ -739,8 +585,7 @@ sap.ui.define([
|
|
|
739
585
|
onShowValueHelp: fnShowValueHelp,
|
|
740
586
|
onFilterChange : fnOnFilterChange,
|
|
741
587
|
handleVariantLoad : fnHandleVariantLoad,
|
|
742
|
-
onDataFetcher
|
|
743
|
-
getkeySpecifiedResultFromFilters
|
|
588
|
+
onDataFetcher
|
|
744
589
|
};
|
|
745
590
|
}
|
|
746
591
|
|
|
@@ -749,5 +594,5 @@ sap.ui.define([
|
|
|
749
594
|
extend(this, getMethods(oState, oController, oTemplateUtils));
|
|
750
595
|
}
|
|
751
596
|
});
|
|
752
|
-
|
|
597
|
+
|
|
753
598
|
});
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
'sap/ui/model/FilterOperator',
|
|
3
|
+
'sap/ui/model/Filter',
|
|
4
|
+
'sap/suite/ui/generic/template/js/AnnotationHelper'
|
|
5
|
+
], function(FilterOperator, Filter, AnnotationHelper) {
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const mReverseOperator = {};
|
|
9
|
+
fillReverseOperator();
|
|
10
|
+
|
|
11
|
+
function fillReverseOperator() {
|
|
12
|
+
mReverseOperator[FilterOperator.EQ] = FilterOperator.NE;
|
|
13
|
+
mReverseOperator[FilterOperator.Contains] = FilterOperator.NotContains;
|
|
14
|
+
mReverseOperator[FilterOperator.EndsWith] = FilterOperator.NotEndsWith;
|
|
15
|
+
mReverseOperator[FilterOperator.StartsWith] = FilterOperator.NotStartsWith;
|
|
16
|
+
mReverseOperator[FilterOperator.BT] = FilterOperator.NB;
|
|
17
|
+
|
|
18
|
+
mReverseOperator[FilterOperator.NE] = FilterOperator.EQ;
|
|
19
|
+
mReverseOperator[FilterOperator.NotContains] = FilterOperator.Contains;
|
|
20
|
+
mReverseOperator[FilterOperator.NotEndsWith] = FilterOperator.EndsWith;
|
|
21
|
+
mReverseOperator[FilterOperator.NotStartsWith] = FilterOperator.StartsWith;
|
|
22
|
+
mReverseOperator[FilterOperator.NB] = FilterOperator.BT;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getFiltersForDataFetching(sKey, keySpecificSelectedResult) {
|
|
26
|
+
const aFilters = [];
|
|
27
|
+
|
|
28
|
+
for (let i = 0; i < keySpecificSelectedResult.length; ++i) {
|
|
29
|
+
const result = keySpecificSelectedResult[i];
|
|
30
|
+
if (result.operator === FilterOperator.BT || result.operator === FilterOperator.NB) {
|
|
31
|
+
aFilters.push(new Filter({
|
|
32
|
+
path: sKey,
|
|
33
|
+
operator: result.operator,
|
|
34
|
+
value1: result.selectedValues[0],
|
|
35
|
+
value2: result.selectedValues[1]
|
|
36
|
+
}));
|
|
37
|
+
} else {
|
|
38
|
+
for (let j = 0; j < result.selectedValues.length; ++j) {
|
|
39
|
+
aFilters.push(new Filter({
|
|
40
|
+
path: sKey,
|
|
41
|
+
operator: result.operator,
|
|
42
|
+
value1: result.selectedValues[j]
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return aFilters;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isComparitveOperator(sFilter) {
|
|
51
|
+
return sFilter === FilterOperator.BT || sFilter === FilterOperator.NB ||
|
|
52
|
+
sFilter === FilterOperator.GT || sFilter === FilterOperator.LT ||
|
|
53
|
+
sFilter === FilterOperator.GE || sFilter === FilterOperator.LE;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function isNegationOperator(sOperator) {
|
|
57
|
+
return sOperator === FilterOperator.NE || sOperator === FilterOperator.NotContains ||
|
|
58
|
+
sOperator === FilterOperator.NotEndsWith || sOperator === FilterOperator.NotStartsWith ||
|
|
59
|
+
sOperator === FilterOperator.NB;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getkeySpecifiedResultFromFilters(oFilter) {
|
|
63
|
+
let values = [];
|
|
64
|
+
if (oFilter.getOperator() === FilterOperator.BT || oFilter.getOperator() === FilterOperator.NB) {
|
|
65
|
+
values = [{
|
|
66
|
+
value: oFilter.getValue1(),
|
|
67
|
+
description: oFilter.getValue1()
|
|
68
|
+
},{
|
|
69
|
+
value: oFilter.getValue2(),
|
|
70
|
+
description: oFilter.getValue2()
|
|
71
|
+
}];
|
|
72
|
+
} else {
|
|
73
|
+
values.push({
|
|
74
|
+
value: oFilter.getValue1(),
|
|
75
|
+
description: oFilter.getValue1()
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
operator: oFilter.getOperator(),
|
|
80
|
+
selectedValues: values
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function fetchRecordsFromValueList(oValueList, oFilter, sKey, oSFBModel,oTemplateUtils) {
|
|
85
|
+
return new Promise((resolve, reject) => {
|
|
86
|
+
let oValueListDefaultBinding = oValueList[""];
|
|
87
|
+
let sValueListEntity = oValueListDefaultBinding.CollectionPath.String;
|
|
88
|
+
|
|
89
|
+
if (Array.isArray(oValueListDefaultBinding.Parameters)) {
|
|
90
|
+
let oParameter = oValueListDefaultBinding.Parameters.find(oParam => (oParam.RecordType === "com.sap.vocabularies.Common.v1.ValueListParameterInOut" && oParam.LocalDataProperty.PropertyPath === sKey));
|
|
91
|
+
if (oParameter) {
|
|
92
|
+
sKey = oParameter.ValueListProperty.String;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let bIsNotOperator = isNegationOperator(oFilter.getOperator());
|
|
97
|
+
if (bIsNotOperator) {
|
|
98
|
+
oFilter = new Filter({
|
|
99
|
+
path: sKey,
|
|
100
|
+
operator: mReverseOperator[oFilter.getOperator()],
|
|
101
|
+
value1: oFilter.getValue1()
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
oFilter = new Filter({
|
|
105
|
+
path: sKey,
|
|
106
|
+
operator: oFilter.getOperator(),
|
|
107
|
+
value1: oFilter.getValue1()
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
oSFBModel.read("/" + sValueListEntity, {
|
|
112
|
+
filters: [oFilter],
|
|
113
|
+
success: async function(oResponse) {
|
|
114
|
+
const aResults = oResponse.results;
|
|
115
|
+
let aResponse;
|
|
116
|
+
try {
|
|
117
|
+
if (aResults.length > 0) {
|
|
118
|
+
aResponse = await getDescriptionForResponse(oResponse.results, sValueListEntity, sKey, oSFBModel,oTemplateUtils,oFilter);
|
|
119
|
+
} else {
|
|
120
|
+
aResponse = await fetchRecordsFromValueListUsingFuzzySearch(sValueListEntity, oFilter, sKey, oSFBModel,oTemplateUtils);
|
|
121
|
+
}
|
|
122
|
+
resolve({
|
|
123
|
+
operator: (bIsNotOperator) ? mReverseOperator[oFilter.getOperator()] : oFilter.getOperator(),
|
|
124
|
+
selectedValues: aResponse
|
|
125
|
+
});
|
|
126
|
+
} catch (error) {
|
|
127
|
+
reject(error);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
error: async function(oError) {
|
|
131
|
+
//If the error is because of some property validation, we can try to do a fuzzy search
|
|
132
|
+
try {
|
|
133
|
+
const aResponse = await fetchRecordsFromValueListUsingFuzzySearch(sValueListEntity, oFilter, sKey, oSFBModel,oTemplateUtils);
|
|
134
|
+
resolve({
|
|
135
|
+
operator: (bIsNotOperator) ? mReverseOperator[oFilter.getOperator()] : oFilter.getOperator(),
|
|
136
|
+
selectedValues: aResponse
|
|
137
|
+
});
|
|
138
|
+
} catch (error) {
|
|
139
|
+
reject(error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async function fetchRecordsFromValueListUsingFuzzySearch(sValueListEntity, oFilter, sKey, oSFBModel,oTemplateUtils) {
|
|
147
|
+
return new Promise((resolve, reject) => {
|
|
148
|
+
oSFBModel.read("/" + sValueListEntity, {
|
|
149
|
+
urlParameters: {
|
|
150
|
+
search: oFilter.getValue1()
|
|
151
|
+
},
|
|
152
|
+
success: async function(oResponse) {
|
|
153
|
+
let aResults = oResponse.results;
|
|
154
|
+
if (aResults.length == 0) {
|
|
155
|
+
//If it dosent have any records, the return the original value
|
|
156
|
+
resolve([{
|
|
157
|
+
value: oFilter.getValue1(),
|
|
158
|
+
description: oFilter.getValue1()
|
|
159
|
+
}]);
|
|
160
|
+
} else {
|
|
161
|
+
try {
|
|
162
|
+
aResults = await getDescriptionForResponse(aResults, sValueListEntity, sKey, oSFBModel,oTemplateUtils,oFilter);
|
|
163
|
+
resolve(aResults);
|
|
164
|
+
} catch (oError) {
|
|
165
|
+
reject(oError);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
error: function(oError) {
|
|
170
|
+
reject(oError);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function performClientSideSearch(aResults, oFilter,sKey,sDescriptionField) {
|
|
177
|
+
if (!sKey || !sDescriptionField) {
|
|
178
|
+
return aResults;
|
|
179
|
+
}
|
|
180
|
+
if (oFilter.getOperator() === FilterOperator.EQ || oFilter.getOperator() === FilterOperator.NE) {
|
|
181
|
+
const aFilteredResults = aResults.filter(result => result[sKey].toString().toLowerCase() === oFilter.getValue1().toString().toLowerCase() || result[sDescriptionField].toString().toLowerCase() === oFilter.getValue1().toString().toLowerCase());
|
|
182
|
+
return aFilteredResults.length > 0 ? aFilteredResults : aResults;
|
|
183
|
+
}
|
|
184
|
+
return aResults;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async function getDescriptionForResponse(aResults, sValueListEntity, sKey, oSFBModel, oTemplateUtils,oFilter) {
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
const aResultsWithTextArrangement = [];
|
|
190
|
+
|
|
191
|
+
let oSFBMetaModel = oSFBModel.getMetaModel();
|
|
192
|
+
let oValueHelpEntity = oTemplateUtils.oCommonUtils.getMetaModelEntityType(sValueListEntity);
|
|
193
|
+
let oValueHelpProperty = oSFBMetaModel.getODataProperty(oValueHelpEntity, sKey);
|
|
194
|
+
let sTextArrangementPath = AnnotationHelper.getTextArrangementPath(oValueHelpProperty);
|
|
195
|
+
let sTextArrangement = AnnotationHelper.getTextArrangementForEasyFilter(oValueHelpEntity, oValueHelpProperty);
|
|
196
|
+
let navigationProperty = null;
|
|
197
|
+
let sEntityForTextDescription = sValueListEntity;
|
|
198
|
+
|
|
199
|
+
if (sTextArrangementPath && sTextArrangementPath.split("/").length > 1) {
|
|
200
|
+
navigationProperty = sTextArrangementPath.split("/")[0];
|
|
201
|
+
sEntityForTextDescription = oSFBMetaModel.getODataAssociationSetEnd(oValueHelpEntity, navigationProperty).entitySet;
|
|
202
|
+
sTextArrangementPath = sTextArrangementPath.split("/")[1];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
aResults = performClientSideSearch(aResults, oFilter,sKey,sTextArrangementPath);
|
|
206
|
+
|
|
207
|
+
if (sValueListEntity === sEntityForTextDescription) {
|
|
208
|
+
aResults.forEach((result) => {
|
|
209
|
+
aResultsWithTextArrangement.push({
|
|
210
|
+
value: result[sKey],
|
|
211
|
+
description: AnnotationHelper.getTextArrangementFinalString(result, sKey, sTextArrangementPath, sTextArrangement)
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
resolve(aResultsWithTextArrangement);
|
|
215
|
+
} else {
|
|
216
|
+
let aAllMatchedResults = aResults.map((result) => {
|
|
217
|
+
return result[sKey];
|
|
218
|
+
});
|
|
219
|
+
let aMatchedFilterResults = aAllMatchedResults.map((matchedResult) => {
|
|
220
|
+
return new Filter({
|
|
221
|
+
path: sKey,
|
|
222
|
+
operator: FilterOperator.EQ,
|
|
223
|
+
value1: matchedResult
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// The below code only be executed when the textDescription and ValueList entities are different
|
|
228
|
+
oSFBModel.read("/" + sEntityForTextDescription, {
|
|
229
|
+
filters: aMatchedFilterResults,
|
|
230
|
+
success: function(oResponse) {
|
|
231
|
+
let aResults = oResponse.results;
|
|
232
|
+
|
|
233
|
+
aMatchedFilterResults.forEach((oFilter) => {
|
|
234
|
+
let result = aResults.find((res) => res[sKey] === oFilter.getValue1());
|
|
235
|
+
aResultsWithTextArrangement.push({
|
|
236
|
+
value: oFilter.getValue1(),
|
|
237
|
+
description: (result) ? AnnotationHelper.getTextArrangementFinalString(result, sKey, sTextArrangementPath, sTextArrangement) : oFilter.getValue1()
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
resolve(aResultsWithTextArrangement);
|
|
241
|
+
},
|
|
242
|
+
error: function(oError) {
|
|
243
|
+
reject(oError);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The primary responsibility of this function is to convert the given values into their corresponding
|
|
252
|
+
* IDs and Descriptions, respecting the defined TextArrangement.
|
|
253
|
+
*
|
|
254
|
+
* This process is carried out in two phases:
|
|
255
|
+
*
|
|
256
|
+
* Fetching the ID:
|
|
257
|
+
* 1) Make a $filter call using the provided value and operator.
|
|
258
|
+
* - If this returns results, we proceed to fetch the corresponding descriptions for these IDs.
|
|
259
|
+
* 2) If no results are returned, make a $search (fuzzy search) call instead.
|
|
260
|
+
*
|
|
261
|
+
* Fetching the Description:
|
|
262
|
+
* 1) The description is determined by the sap:text/com.sap.vocabularies.UI.v1.TextArrangement
|
|
263
|
+
* annotation of the ValueHelp entity, not from the main entity.
|
|
264
|
+
* 2) To fetch the description, we use a $filter call, since the IDs were already retrieved in the first step.
|
|
265
|
+
*
|
|
266
|
+
* Edge cases with negation operators:
|
|
267
|
+
* 1) For negation operators such as NB, NotStartsWith, etc., we make a batch call using the
|
|
268
|
+
* positive equivalent of these operators (e.g., BT, StartsWith).
|
|
269
|
+
* 2) After receiving the results, we return them with the original negation operator
|
|
270
|
+
* (e.g., NB, NotStartsWith).
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
function fetchDataForKey(sKey, keySpecificSelectedResult, oState, oController, oTemplateUtils) {
|
|
274
|
+
return new Promise(async(resolve, reject) => {
|
|
275
|
+
try {
|
|
276
|
+
const aFinalResponse = [];
|
|
277
|
+
const oOwnerFilterControl = oState.oSmartFilterbar;
|
|
278
|
+
const sEntitySet = oController.getOwnerComponent().getEntitySet();
|
|
279
|
+
const oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(sEntitySet);
|
|
280
|
+
const oSFBModel = oOwnerFilterControl.getModel();
|
|
281
|
+
const oSFBMetaModel = oSFBModel.getMetaModel();
|
|
282
|
+
const aFilters = getFiltersForDataFetching(sKey, keySpecificSelectedResult);
|
|
283
|
+
const oProperty = oSFBMetaModel.getODataProperty(oEntityType, sKey);
|
|
284
|
+
const sPropertyPath = oSFBMetaModel.getODataProperty(oEntityType, sKey, true);
|
|
285
|
+
const isValueHelpTableAvailable = AnnotationHelper.isValueHelpTableAvailable(oProperty);
|
|
286
|
+
|
|
287
|
+
if (!isValueHelpTableAvailable) {
|
|
288
|
+
// When there is no valueList associate, just return the original value in CodeList type
|
|
289
|
+
aFilters.forEach(oFilter => aFinalResponse.push(getkeySpecifiedResultFromFilters(oFilter)));
|
|
290
|
+
resolve(aFinalResponse);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Get value help lists from metadata
|
|
294
|
+
const oPropertyContext = oSFBMetaModel.createBindingContext(sPropertyPath);
|
|
295
|
+
const oValueList = await oSFBMetaModel.getODataValueLists(oPropertyContext);
|
|
296
|
+
|
|
297
|
+
// Process each filter in parallel
|
|
298
|
+
const pPromises = [];
|
|
299
|
+
|
|
300
|
+
for (const oFilter of aFilters) {
|
|
301
|
+
if (isComparitveOperator(oFilter.getOperator())) {
|
|
302
|
+
// For comparative operators, just add the original values
|
|
303
|
+
aFinalResponse.push(getkeySpecifiedResultFromFilters(oFilter));
|
|
304
|
+
} else {
|
|
305
|
+
// For other operators, fetch records from value list
|
|
306
|
+
pPromises.push(fetchRecordsFromValueList(oValueList, oFilter, sKey, oSFBModel, oTemplateUtils));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Wait for all promises to resolve
|
|
311
|
+
if (pPromises.length > 0) {
|
|
312
|
+
const aResponses = await Promise.all(pPromises);
|
|
313
|
+
aResponses.forEach(aResponse => {
|
|
314
|
+
aFinalResponse.push(aResponse);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
resolve(aFinalResponse);
|
|
319
|
+
} catch (error) {
|
|
320
|
+
reject(error); // Re-throw to allow caller to handle
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return {
|
|
326
|
+
fetchDataForKey: fetchDataForKey,
|
|
327
|
+
getFiltersForDataFetching: getFiltersForDataFetching,
|
|
328
|
+
isComparitveOperator: isComparitveOperator,
|
|
329
|
+
isNegationOperator: isNegationOperator,
|
|
330
|
+
getReverseOperator: function(operator) {
|
|
331
|
+
return mReverseOperator[operator];
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
});
|