@sapui5/sap.suite.ui.generic.template 1.139.0 → 1.141.0
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/controller/ControllerImplementation.js +7 -9
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/extensionAPI/ExtensionAPI.js +4 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ar.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_bg.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ca.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_cnr.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_cs.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_cy.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_da.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_de.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_el.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_en.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_en_GB.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_en_US_saprigi.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_es.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_es_MX.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_et.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_fi.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_fr.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_fr_CA.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_hi.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_hr.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_hu.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_id.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_it.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_iw.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ja.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_kk.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ko.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_lt.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_lv.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_mk.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ms.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_nl.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_no.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_pl.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_pt.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_pt_PT.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ro.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_ru.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_sh.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_sk.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_sl.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_sr.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_sv.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_th.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_tr.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_uk.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_vi.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_zh_CN.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_zh_TW.properties +0 -2
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/Canvas/extensionAPI/ExtensionAPI.js +4 -1
- package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +34 -33
- package/src/sap/suite/ui/generic/template/ListReport/extensionAPI/ExtensionAPI.js +4 -1
- 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 +1 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/annotationHelpers/AnnotationHelperActionButtons.js +49 -5
- package/src/sap/suite/ui/generic/template/ObjectPage/annotationHelpers/AnnotationHelperActionButtons.qunit.js +27 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +65 -23
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/RelatedAppsHandler.js +3 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/SectionTitleHandler.js +17 -13
- package/src/sap/suite/ui/generic/template/ObjectPage/controllerFrameworkExtensions.js +285 -270
- package/src/sap/suite/ui/generic/template/ObjectPage/extensionAPI/ExtensionAPI.js +4 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/Details.view.xml +2 -3
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/Actions.fragment.xml +18 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/CRUDActionButtons.fragment.xml +31 -24
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartForm.fragment.xml +1 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +1 -0
- 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/designtime/controls/DynamicPage.designtime.js +2 -2
- package/src/sap/suite/ui/generic/template/designtime/controls/ObjectPageLayout.designtime.js +2 -2
- package/src/sap/suite/ui/generic/template/designtime/controls/SmartFilterBar.designtime.js +2 -2
- package/src/sap/suite/ui/generic/template/designtime/controls/SmartTable.designtime.js +2 -2
- package/src/sap/suite/ui/generic/template/designtime/utils/designtimeUtils.js +6 -1
- package/src/sap/suite/ui/generic/template/fragments/AINotice.fragment.xml +24 -0
- package/src/sap/suite/ui/generic/template/fragments/ToolbarButton.fragment.xml +1 -0
- package/src/sap/suite/ui/generic/template/genericUtilities/polyFill.js +6 -7
- package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +120 -0
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +3 -2
- package/src/sap/suite/ui/generic/template/lib/CRUDManager.js +97 -14
- package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +4 -2
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +23 -14
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillHandler.js +407 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillDialog.fragment.xml +82 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillNonUpdatableSmartForm.fragment.xml +18 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillUpdatebleSmartForm.fragment.xml +15 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +40 -5
- package/src/sap/suite/ui/generic/template/lib/ai/FioriAIHandler.js +2 -1
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +72 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_US_saprigi.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +51 -3
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +49 -1
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +48 -0
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/presentationControl/SmartTableHandler.js +1 -1
- package/src/sap/suite/ui/generic/template/library.js +1 -1
- package/src/sap/suite/ui/generic/template/listTemplates/controller/SmartChartController.js +5 -3
- package/src/sap/suite/ui/generic/template/themes/base/ObjectPage.less +51 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/ui/base/Object",
|
|
3
|
+
"sap/base/util/extend",
|
|
4
|
+
"sap/ui/comp/smartform/Group",
|
|
5
|
+
"sap/ui/comp/smartform/GroupElement",
|
|
6
|
+
"sap/ui/comp/smartfield/SmartField",
|
|
7
|
+
"sap/ui/comp/smartfield/SmartLabel",
|
|
8
|
+
"sap/m/MessageToast",
|
|
9
|
+
"sap/ui/model/json/JSONModel",
|
|
10
|
+
"sap/ui/model/odata/AnnotationHelper"
|
|
11
|
+
], function(BaseObject, extend, Group, GroupElement, SmartField, SmartLabel,MessageToast,JSONModel,AnnotationHelperModel) {
|
|
12
|
+
'use strict';
|
|
13
|
+
/*
|
|
14
|
+
* This is a handler class for EasyFill.
|
|
15
|
+
* It gets initialized when the Fiori AI EasyFill is enabled
|
|
16
|
+
* Below things are handled in this class:
|
|
17
|
+
* 1. Prepare Field metadata
|
|
18
|
+
* 2. Prepare EasyFill Dialog
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
function getMethods(oState, oController, oTemplateUtils, oObjectPage) {
|
|
22
|
+
let oTransientContextForEasyFill;
|
|
23
|
+
let oObjectPageContext;
|
|
24
|
+
let oObjectPageModel;
|
|
25
|
+
let mUpdatableLookupMap;
|
|
26
|
+
let oRb;
|
|
27
|
+
let oAIPopover;
|
|
28
|
+
|
|
29
|
+
async function openEasyFillDialog(oEvent,oContext) {
|
|
30
|
+
let oEasyFillDialog;
|
|
31
|
+
oRb = oController.getView().getModel("i18n").getResourceBundle();
|
|
32
|
+
const bIsModelCreated = !!oController.getView().getModel("easyFillDialogModel");
|
|
33
|
+
if (!bIsModelCreated) {
|
|
34
|
+
oObjectPageModel = oObjectPage.getModel();
|
|
35
|
+
const aDeferredGroups = oObjectPageModel.getDeferredGroups();
|
|
36
|
+
//Adding a defferred group will make sure that no batch call would get triggered to backend until submitChanges() is invoked
|
|
37
|
+
aDeferredGroups.push("EasyFillFETransientChanges");
|
|
38
|
+
oObjectPageModel.setDeferredGroups(aDeferredGroups);
|
|
39
|
+
|
|
40
|
+
//Creating a JSON model for the dialog
|
|
41
|
+
|
|
42
|
+
const oData = {
|
|
43
|
+
isBusy: false,
|
|
44
|
+
isUpdatableVisible: false,
|
|
45
|
+
isNonUpdatableVisible: false,
|
|
46
|
+
isIllustrationVisible: true,
|
|
47
|
+
isSaveEnabled: false,
|
|
48
|
+
stateType: "Initial",
|
|
49
|
+
feedbackEnabled: true,
|
|
50
|
+
isEasyFillButtonEnabled: false
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
let oModel = new JSONModel(oData);
|
|
54
|
+
oController.getView().setModel(oModel, "easyFillDialogModel");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
oObjectPageContext = (oContext) ? oContext : oObjectPage.getBindingContext();
|
|
58
|
+
|
|
59
|
+
// cannot use OP path to create a list binding as it is a individual entry
|
|
60
|
+
var sFragmentname = "sap.suite.ui.generic.template.lib.ai.EasyFill.fragments.EasyFillDialog";
|
|
61
|
+
oTemplateUtils.oCommonUtils.getDialogFragmentAsync(sFragmentname, {
|
|
62
|
+
onFeedbackPress: function() {
|
|
63
|
+
const easyFillDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
64
|
+
easyFillDialogModel.setProperty("/feedbackEnabled",false);
|
|
65
|
+
MessageToast.show(oRb.getText("EASYFILL_RESULT_FEEDBACK"));
|
|
66
|
+
},
|
|
67
|
+
formatIllustrationType: function (sState) {
|
|
68
|
+
switch (sState) {
|
|
69
|
+
case "Initial":
|
|
70
|
+
return "sapIllus-NoSearchResults";
|
|
71
|
+
case "NoEntries":
|
|
72
|
+
return "sapIllus-NoEntries";
|
|
73
|
+
case "Error":
|
|
74
|
+
return "sapIllus-UnableToLoad";
|
|
75
|
+
default:
|
|
76
|
+
return "sapIllus-NoSearchResults";
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
formatIllustrationTitle: function (sState) {
|
|
80
|
+
switch (sState) {
|
|
81
|
+
case "Initial":
|
|
82
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_INITIAL");
|
|
83
|
+
case "NoEntries":
|
|
84
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_NO_ENTRIES");
|
|
85
|
+
case "Error":
|
|
86
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_ERROR");
|
|
87
|
+
default:
|
|
88
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_INITIAL");
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
formatIllustrationDescription: function (sState) {
|
|
92
|
+
switch (sState) {
|
|
93
|
+
case "Initial":
|
|
94
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_INITIAL");
|
|
95
|
+
case "NoEntries":
|
|
96
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_NO_ENTRIES");
|
|
97
|
+
case "Error":
|
|
98
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_ERROR");
|
|
99
|
+
default:
|
|
100
|
+
return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_INITIAL");
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
onSaveFromEasyFillDialog : async function (oEvent) {
|
|
104
|
+
var oTransientObject = oTransientContextForEasyFill.getObject();
|
|
105
|
+
for (const oProp in oTransientObject) {
|
|
106
|
+
if (oProp !== "__metadata" && mUpdatableLookupMap[oProp]) {
|
|
107
|
+
oObjectPageContext.setProperty(oProp, oTransientObject[oProp]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
resetEasyFill(true);
|
|
111
|
+
oEasyFillDialog.close();
|
|
112
|
+
},
|
|
113
|
+
onLiveChange: function(oEvent) {
|
|
114
|
+
const easyFillDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
115
|
+
easyFillDialogModel.setProperty("/isEasyFillButtonEnabled",!!oEvent.getSource().getValue());
|
|
116
|
+
},
|
|
117
|
+
onCancelEasyFillDialog : function () {
|
|
118
|
+
resetEasyFill(true);
|
|
119
|
+
oEasyFillDialog.close();
|
|
120
|
+
},
|
|
121
|
+
onEasyFillSubmitInputToAI : async function (oEvent) {
|
|
122
|
+
resetEasyFill();
|
|
123
|
+
const easyFillDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
124
|
+
easyFillDialogModel.setProperty("/isBusy",true);
|
|
125
|
+
let mFieldMapping = getEntitySetMapForLLM();
|
|
126
|
+
let aiCallResult = await oTemplateUtils.oServices.oFioriAIHandler.fioriaiLib.EasyFill.extractFieldValuesFromText(oController.byId("EasyFillInputTextArea").getValue(), mFieldMapping);
|
|
127
|
+
easyFillDialogModel.setProperty("/isBusy",false);
|
|
128
|
+
formatDateValues(aiCallResult,mFieldMapping);
|
|
129
|
+
if (aiCallResult.success) {
|
|
130
|
+
const {updatableFields,nonUpdatableFields} = getUpdatableAndNonUpdatableFields(aiCallResult.data);
|
|
131
|
+
mUpdatableLookupMap = updatableFields;
|
|
132
|
+
if (Object.keys(updatableFields).length + Object.keys(nonUpdatableFields).length === 0) {
|
|
133
|
+
easyFillDialogModel.setProperty("/stateType","NoEntries");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
easyFillDialogModel.setProperty("/isIllustrationVisible",false);
|
|
137
|
+
//Fillable Fields
|
|
138
|
+
makeTransientContext();
|
|
139
|
+
easyFillDialogModel.setProperty("/isUpdatableVisible",Object.keys(updatableFields).length > 0);
|
|
140
|
+
if (Object.keys(updatableFields).length > 0) {
|
|
141
|
+
const oAIResponseReviewRegionSmartFormForUpdatableFields = oController.byId("EasyFillUpdatebleForm");
|
|
142
|
+
|
|
143
|
+
const oOldGroup = getGroupForSmartForm(updatableFields,false,oObjectPage.getBindingContext(),false);
|
|
144
|
+
const oNewGroup = getGroupForSmartForm(updatableFields,true,oTransientContextForEasyFill,true);
|
|
145
|
+
oAIResponseReviewRegionSmartFormForUpdatableFields.addGroup(oOldGroup);
|
|
146
|
+
oAIResponseReviewRegionSmartFormForUpdatableFields.addGroup(oNewGroup);
|
|
147
|
+
validateSmartForm();
|
|
148
|
+
}
|
|
149
|
+
//Non-Fillable Fields
|
|
150
|
+
easyFillDialogModel.setProperty("/isNonUpdatableVisible",Object.keys(nonUpdatableFields).length > 0);
|
|
151
|
+
if (Object.keys(nonUpdatableFields).length > 0) {
|
|
152
|
+
const oAIResponseReviewRegionSmartFormForNonUpdatableFields = oController.byId("EasyFillNonUpdatebleForm");
|
|
153
|
+
const oOldGroup = getGroupForSmartForm(nonUpdatableFields,false,oObjectPage.getBindingContext(),false);
|
|
154
|
+
const oNewGroup = getGroupForSmartForm(nonUpdatableFields,false,oTransientContextForEasyFill,true);
|
|
155
|
+
oAIResponseReviewRegionSmartFormForNonUpdatableFields.addGroup(oOldGroup);
|
|
156
|
+
oAIResponseReviewRegionSmartFormForNonUpdatableFields.addGroup(oNewGroup);
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
easyFillDialogModel.setProperty("/stateType","Error");
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
onEasyFillClearAll: function() {
|
|
163
|
+
resetEasyFill(true);
|
|
164
|
+
},
|
|
165
|
+
onLinkPress: async function(oEvent) {
|
|
166
|
+
if (!oAIPopover) {
|
|
167
|
+
oAIPopover = await getAIPopover();
|
|
168
|
+
}
|
|
169
|
+
oAIPopover.openBy(oEvent.getSource());
|
|
170
|
+
}
|
|
171
|
+
}, "easyFillPopup",undefined,true,true).then(function (oPopup) {
|
|
172
|
+
oEasyFillDialog = oPopup;
|
|
173
|
+
oPopup.open();
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getAIPopover() {
|
|
178
|
+
return new Promise(async(resolve,reject) => {
|
|
179
|
+
const sFragmentname = "sap.suite.ui.generic.template.fragments.AINotice";
|
|
180
|
+
const oPopover = await oTemplateUtils.oCommonUtils.getDialogFragmentAsync(sFragmentname,{
|
|
181
|
+
onCloseAiPopover: function() {
|
|
182
|
+
oAIPopover.close();
|
|
183
|
+
}
|
|
184
|
+
},"aiPopover",undefined,true);
|
|
185
|
+
resolve(oPopover);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function getEntitySetMapForLLM() {
|
|
190
|
+
const mPropertyMap = {};
|
|
191
|
+
const oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(oController.getOwnerComponent().getEntitySet());
|
|
192
|
+
oEntityType.property.forEach((oProperty)=>{
|
|
193
|
+
mPropertyMap[oProperty.name] = {
|
|
194
|
+
description: getLabel(oProperty),
|
|
195
|
+
dataType: oProperty.type
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
return mPropertyMap;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function getLabel(oProperty) {
|
|
202
|
+
return oProperty["com.sap.vocabularies.Common.v1.Label"] ? AnnotationHelperModel.format(oObjectPageContext,oProperty["com.sap.vocabularies.Common.v1.Label"]) : oProperty["sap:label"];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function formatDateValues(aiCallResult,mFieldMapping) {
|
|
206
|
+
if (aiCallResult.success) {
|
|
207
|
+
for (const key of Object.keys(aiCallResult.data)) {
|
|
208
|
+
const sDataType = mFieldMapping[key].dataType;
|
|
209
|
+
if (sDataType === "Edm.DateTimeOffset" || sDataType === "Edm.DateTime") {
|
|
210
|
+
aiCallResult.data[key] = new Date(aiCallResult.data[key]);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function validateSmartForm() {
|
|
217
|
+
setTimeout(async() => {
|
|
218
|
+
const easyFillDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
219
|
+
try {
|
|
220
|
+
const oAIResponseReviewRegionSmartFormForUpdatableFields = oController.byId("EasyFillUpdatebleForm");
|
|
221
|
+
const aIds = await oAIResponseReviewRegionSmartFormForUpdatableFields.check();
|
|
222
|
+
easyFillDialogModel.setProperty("/isSaveEnabled",aIds.length === 0);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
easyFillDialogModel.setProperty("/isSaveEnabled",false);
|
|
225
|
+
}
|
|
226
|
+
}, 0);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function resetEasyFill(bRemoveTextAreaValue) {
|
|
230
|
+
const easyFillDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
231
|
+
const oAIResponseReviewRegionSmartFormForNonUpdatableFields = oController.byId("EasyFillNonUpdatebleForm");
|
|
232
|
+
const oAIResponseReviewRegionSmartFormForUpdatableFields = oController.byId("EasyFillUpdatebleForm");
|
|
233
|
+
oAIResponseReviewRegionSmartFormForUpdatableFields.destroyGroups();
|
|
234
|
+
oAIResponseReviewRegionSmartFormForNonUpdatableFields.destroyGroups();
|
|
235
|
+
resetTransientContext();
|
|
236
|
+
easyFillDialogModel.setProperty("/isUpdatableVisible",false);
|
|
237
|
+
easyFillDialogModel.setProperty("/isNonUpdatableVisible",false);
|
|
238
|
+
easyFillDialogModel.setProperty("/isIllustrationVisible",true);
|
|
239
|
+
easyFillDialogModel.setProperty("/isSaveEnabled",false);
|
|
240
|
+
easyFillDialogModel.setProperty("/stateType","Initial");
|
|
241
|
+
easyFillDialogModel.setProperty("/feedbackEnabled",true);
|
|
242
|
+
if (bRemoveTextAreaValue) {
|
|
243
|
+
oController.byId("EasyFillInputTextArea").setValue("");
|
|
244
|
+
easyFillDialogModel.setProperty("/isEasyFillButtonEnabled",false);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function getUpdatableAndNonUpdatableFields(oAiCallResult) {
|
|
249
|
+
const oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(oController.getOwnerComponent().getEntitySet());
|
|
250
|
+
const updatableFields = {};
|
|
251
|
+
const nonUpdatableFields = {};
|
|
252
|
+
|
|
253
|
+
Object.keys(oAiCallResult).forEach((sKey)=>{
|
|
254
|
+
const oProperty = oEntityType.property.find((oProperty)=>oProperty.name === sKey);
|
|
255
|
+
const {bIsVisible,bIsEditable} = isEditable(oProperty);
|
|
256
|
+
if (bIsVisible) {
|
|
257
|
+
if (bIsEditable) {
|
|
258
|
+
updatableFields[sKey] = oAiCallResult[sKey];
|
|
259
|
+
} else {
|
|
260
|
+
nonUpdatableFields[sKey] = oAiCallResult[sKey];
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return {updatableFields,nonUpdatableFields};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
//Checks if the field is editable or not
|
|
268
|
+
|
|
269
|
+
// It can be set in 2 ways using field-control, it would be present when sap:updatable attribute is not present
|
|
270
|
+
// 1. By attaching to an existing metadata property, sap:field-control-> path for the property
|
|
271
|
+
//Below are the values by which the editable state would be defined
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Value Meaning
|
|
275
|
+
-----------------------------------------------
|
|
276
|
+
0 Hidden (field not shown at all)
|
|
277
|
+
1 Read-only (display only)
|
|
278
|
+
3 Editable
|
|
279
|
+
7 Mandatory (Still Editable)
|
|
280
|
+
*/
|
|
281
|
+
|
|
282
|
+
// 2. By Adding to an annotation "com.sap.vocabularies.Common.v1.FieldControl"
|
|
283
|
+
|
|
284
|
+
//Since "com.sap.vocabularies.Common.v1.FieldControl" is an V4 annotation, it would be given the first priority
|
|
285
|
+
|
|
286
|
+
function isEditable(oProperty) {
|
|
287
|
+
|
|
288
|
+
const oRes = {
|
|
289
|
+
bIsVisible: true,
|
|
290
|
+
bIsEditable: true
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
//Check for sap:updatable
|
|
294
|
+
const sUpdatable = oProperty["sap:updatable"];
|
|
295
|
+
if (sUpdatable) {
|
|
296
|
+
oRes.bIsEditable = (sUpdatable === "false") ? false : true;
|
|
297
|
+
return oRes;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
//Check for "com.sap.vocabularies.Common.v1.FieldControl"
|
|
301
|
+
const oAnnotation = oProperty["com.sap.vocabularies.Common.v1.FieldControl"];
|
|
302
|
+
|
|
303
|
+
if (oAnnotation && oAnnotation["EnumMember"]) {
|
|
304
|
+
const enumNumberType = oAnnotation["EnumMember"];
|
|
305
|
+
oRes.bIsVisible = (enumNumberType === 'com.sap.vocabularies.Common.v1.FieldControlType/Hidden') ? false : true;
|
|
306
|
+
oRes.bIsEditable = (enumNumberType === 'com.sap.vocabularies.Common.v1.FieldControlType/ReadOnly') ? false : true;
|
|
307
|
+
return oRes;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
//Check for Hidden annotation i.e com.sap.vocabularies.UI.v1.Hidden
|
|
311
|
+
const oHiddenAnnotation = oProperty["com.sap.vocabularies.UI.v1.Hidden"];
|
|
312
|
+
if (oHiddenAnnotation) {
|
|
313
|
+
oRes.bIsVisible = false; // <Annotation Term="UI.Hidden"/>
|
|
314
|
+
if (oHiddenAnnotation["Bool"]) {
|
|
315
|
+
oRes.bIsVisible = (oHiddenAnnotation["Bool"] === "true") ? false : true;
|
|
316
|
+
} else if (oHiddenAnnotation["Path"]) {
|
|
317
|
+
oRes.bIsVisible = !oObjectPageContext.getObject()[oHiddenAnnotation["Path"]];
|
|
318
|
+
}
|
|
319
|
+
return oRes;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
//Check for "sap:field-control"
|
|
323
|
+
const sFieldControl = oProperty["sap:field-control"];
|
|
324
|
+
|
|
325
|
+
if (sFieldControl) {
|
|
326
|
+
const iFieldControlValue = oObjectPageContext.getObject()[sFieldControl];
|
|
327
|
+
oRes.bIsVisible = (iFieldControlValue === 0) ? false : true;
|
|
328
|
+
oRes.bIsEditable = (iFieldControlValue === 1) ? false : true;
|
|
329
|
+
return oRes;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
//If no restriction is present then by default all fields are editable
|
|
333
|
+
return oRes;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function resetTransientContext() {
|
|
337
|
+
if (oTransientContextForEasyFill) {
|
|
338
|
+
oObjectPageModel.resetChanges([oTransientContextForEasyFill.getPath()],false,true);
|
|
339
|
+
oTransientContextForEasyFill = null;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function makeTransientContext() {
|
|
344
|
+
if (oTransientContextForEasyFill) {
|
|
345
|
+
resetTransientContext();
|
|
346
|
+
}
|
|
347
|
+
oTransientContextForEasyFill = oObjectPageModel.createEntry("/" + oController.getOwnerComponent().getEntitySet(), {
|
|
348
|
+
"groupId" : "EasyFillFETransientChanges",
|
|
349
|
+
"changeSetId":"EasyFillFETransientChanges"
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function onSmartFieldChange() {
|
|
354
|
+
validateSmartForm();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function getGroupForSmartForm(oDataFromLLM, isEditable,oContext,isTransient) {
|
|
358
|
+
var oGroup = new Group({
|
|
359
|
+
title: (isTransient) ? oRb.getText("EASY_FILL_PROPOSED_VALUES") : oRb.getText("EASY_FILL_PREVIOUS_VALUES")
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
for (const key of Object.keys(oDataFromLLM)) {
|
|
363
|
+
const oGroupElement = new GroupElement();
|
|
364
|
+
const oSmartField = new SmartField({
|
|
365
|
+
value: "{" + key + "}",
|
|
366
|
+
editable: isEditable,
|
|
367
|
+
enabled: isEditable,
|
|
368
|
+
contextEditable: isEditable,
|
|
369
|
+
change: onSmartFieldChange.bind(this)
|
|
370
|
+
});
|
|
371
|
+
const oSmartLabel = new SmartLabel();
|
|
372
|
+
oSmartLabel.setLabelFor(oSmartField);
|
|
373
|
+
oGroupElement.addElement(oSmartField);
|
|
374
|
+
//Update the field only if its transient
|
|
375
|
+
if (isTransient) {
|
|
376
|
+
oContext.setProperty(key,oDataFromLLM[key]);
|
|
377
|
+
}
|
|
378
|
+
oGroup.addGroupElement(oGroupElement);
|
|
379
|
+
}
|
|
380
|
+
oGroup.setBindingContext(oContext);
|
|
381
|
+
return oGroup;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return {
|
|
385
|
+
onEasyFillButtonClick: function(oEvent) {
|
|
386
|
+
// Once you click on the easyFill button the OP should be going to editable state, if its already in editState then directly open the dialog
|
|
387
|
+
//If its in non-editable state we should wait until the context switch, We need that context to finally save the data from the AI into the newly came editable context of the OP
|
|
388
|
+
const isEditable = oController.getView().getModel("ui").getProperty("/editable");
|
|
389
|
+
if (isEditable) {
|
|
390
|
+
openEasyFillDialog(oEvent);
|
|
391
|
+
} else {
|
|
392
|
+
oController._templateEventHandlers.onEditByEasyFill().then((oContext)=>{
|
|
393
|
+
oObjectPageContext = oContext;
|
|
394
|
+
openEasyFillDialog(oEvent,oContext);
|
|
395
|
+
}).catch(Function.prototype);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return BaseObject.extend("sap.suite.ui.generic.template.lib.ai.EasyFill.EasyFillHandler", {
|
|
402
|
+
constructor: function (oState, oController, oTemplateUtils, oObjectPage) {
|
|
403
|
+
extend(this, getMethods(oState, oController, oTemplateUtils, oObjectPage));
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
});
|
package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillDialog.fragment.xml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core"
|
|
2
|
+
xmlns:sfo="sap.ui.comp.smartform"
|
|
3
|
+
xmlns:sfi="sap.ui.comp.smartfield"
|
|
4
|
+
xmlns:fesr="http://schemas.sap.com/sapui5/extension/sap.ui.core.FESR/1"
|
|
5
|
+
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
|
|
6
|
+
>
|
|
7
|
+
|
|
8
|
+
<Dialog id="EasyFillDialog" class = "sapSmartTemplatesObjectPageEasyFill" contentHeight="49.3125rem" title="{i18n>EASY_FILL_TITLE}" titleAlignment="Start" horizontalScrolling="false" verticalScrolling="false">
|
|
9
|
+
<content>
|
|
10
|
+
<FlexBox id="EasyFillMainFlex" direction="Row" renderType="Bare" width="100%" height="100%">
|
|
11
|
+
<FlexBox
|
|
12
|
+
direction="Column" renderType="Bare" width="40%" class = "sapSmartTemplatesObjectPageEasyFillInputArea"
|
|
13
|
+
>
|
|
14
|
+
<FlexBox id="EasyFillInputArea" direction="Column" renderType="Bare" width="100%" gap="36px">
|
|
15
|
+
<VBox gap="22px" class="sapSmartTemplatesObjectPageEasyFillInputAreaLabel">
|
|
16
|
+
<Label text="{i18n>EASY_FILL_FIRST_LABEL_TEXT}" wrapping="true"/>
|
|
17
|
+
<Label text="{i18n>EASY_FILL_SECOND_LABEL_TEXT}" wrapping="true"/>
|
|
18
|
+
</VBox>
|
|
19
|
+
<TextArea
|
|
20
|
+
id="EasyFillInputTextArea"
|
|
21
|
+
growing = "true"
|
|
22
|
+
growingMaxLines = "30"
|
|
23
|
+
maxLength = "2000"
|
|
24
|
+
liveChange="onLiveChange"
|
|
25
|
+
placeholder = "{i18n>EASY_FILL_TEXTAREA_PLACEHOLDER}"
|
|
26
|
+
rows = "20"
|
|
27
|
+
width="100%"
|
|
28
|
+
height="17.5rem"
|
|
29
|
+
showExceededText = "true"
|
|
30
|
+
ariaLabelledBy="EasyFillInputArea">
|
|
31
|
+
</TextArea>
|
|
32
|
+
</FlexBox>
|
|
33
|
+
<FlexBox direction="Row" justifyContent="End" gap="1rem">
|
|
34
|
+
<Button
|
|
35
|
+
id="EasyFillSubmitButton"
|
|
36
|
+
text="Easy Fill"
|
|
37
|
+
type="Default"
|
|
38
|
+
icon="sap-icon://ai"
|
|
39
|
+
enabled="{easyFillDialogModel>/isEasyFillButtonEnabled}"
|
|
40
|
+
press="onEasyFillSubmitInputToAI">
|
|
41
|
+
</Button>
|
|
42
|
+
<Button
|
|
43
|
+
id="EasyFillClearAll"
|
|
44
|
+
type = "Transparent"
|
|
45
|
+
press="onEasyFillClearAll"
|
|
46
|
+
text="{i18n>EASYFILL_CLEAR_ALL}">
|
|
47
|
+
</Button>
|
|
48
|
+
</FlexBox>
|
|
49
|
+
</FlexBox>
|
|
50
|
+
<FlexBox id="EasyFillReviewArea" busy="{easyFillDialogModel>/isBusy}" class = "sapSmartTemplatesObjectPageEasyFillReviewArea" renderType="Bare" width="72%" direction="Column">
|
|
51
|
+
<IllustratedMessage
|
|
52
|
+
illustrationSize = "Large"
|
|
53
|
+
illustrationType="{path: 'easyFillDialogModel>/stateType', formatter: '.formatIllustrationType'}"
|
|
54
|
+
visible="{easyFillDialogModel>/isIllustrationVisible}"
|
|
55
|
+
title = "{path: 'easyFillDialogModel>/stateType', formatter: '.formatIllustrationTitle'}"
|
|
56
|
+
description = "{path: 'easyFillDialogModel>/stateType', formatter: '.formatIllustrationDescription'}"/>
|
|
57
|
+
<ScrollContainer vertical = "true" visible="{= ${easyFillDialogModel>/isUpdatableVisible} || ${easyFillDialogModel>/isNonUpdatableVisible} }">
|
|
58
|
+
<HBox gap="0.5rem" justifyContent = "End" alignItems = "Center" renderType="Bare" class="sapSmartTemplatesObjectPageEasyFillReviewAreaBanner">
|
|
59
|
+
<Link text="{i18n>AI_LINK_NOTICE_TITLE}" press="onLinkPress"/>
|
|
60
|
+
<Label text="{i18n>AI_WARNING_TEXT}"/>
|
|
61
|
+
<Button icon = "sap-icon://thumb-up" type = "Transparent" fesr:press="fe:ef:thumbsup" enabled="{easyFillDialogModel>/feedbackEnabled}" press="onFeedbackPress"/>
|
|
62
|
+
<Button icon = "sap-icon://thumb-down" type="Transparent" fesr:press="fe:ef:thumbsdown" enabled="{easyFillDialogModel>/feedbackEnabled}" press="onFeedbackPress"/>
|
|
63
|
+
</HBox>
|
|
64
|
+
<VBox class="sapSmartTemplatesObjectPageEasyFillReviewAreaSmartFormWrapper" renderType = "Bare" visible="{easyFillDialogModel>/isUpdatableVisible}">
|
|
65
|
+
<core:Fragment fragmentName="sap.suite.ui.generic.template.lib.ai.EasyFill.fragments.EasyFillUpdatebleSmartForm" type="XML"/>
|
|
66
|
+
</VBox>
|
|
67
|
+
|
|
68
|
+
<VBox renderType = "Bare" visible="{easyFillDialogModel>/isNonUpdatableVisible}">
|
|
69
|
+
<core:Fragment fragmentName="sap.suite.ui.generic.template.lib.ai.EasyFill.fragments.EasyFillNonUpdatableSmartForm" type="XML"/>
|
|
70
|
+
</VBox>
|
|
71
|
+
</ScrollContainer>
|
|
72
|
+
</FlexBox>
|
|
73
|
+
</FlexBox>
|
|
74
|
+
</content>
|
|
75
|
+
<beginButton>
|
|
76
|
+
<Button text="{i18n>EASY_FILL_SAVE}" enabled="{easyFillDialogModel>/isSaveEnabled}" press="onSaveFromEasyFillDialog" type="Emphasized"/>
|
|
77
|
+
</beginButton>
|
|
78
|
+
<endButton>
|
|
79
|
+
<Button text="{i18n>CANCEL}" press="onCancelEasyFillDialog"/>
|
|
80
|
+
</endButton>
|
|
81
|
+
</Dialog>
|
|
82
|
+
</core:FragmentDefinition>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:sfo="sap.ui.comp.smartform" xmlns:smartField="sap.ui.comp.smartfield"
|
|
2
|
+
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
|
|
3
|
+
template:require="{AH: 'sap/suite/ui/generic/template/js/AnnotationHelper'}">
|
|
4
|
+
<Title text="{i18n>EASY_FILL_UNABLE_FILL}" class="sapSmartTemplatesObjectPageEasyFillReviewAreaSmartFormNonUpdatableTitle"/>
|
|
5
|
+
<MessageStrip
|
|
6
|
+
text="{i18n>EASY_FILL_WARNING_MESSAGE}"
|
|
7
|
+
showIcon="true"
|
|
8
|
+
type="Warning">
|
|
9
|
+
</MessageStrip>
|
|
10
|
+
<sfo:SmartForm
|
|
11
|
+
id="EasyFillNonUpdatebleForm"
|
|
12
|
+
class = "sapSmartTemplatesObjectPageEasyFillReviewAreaSmartForm sapSmartTemplatesObjectPageEasyFillReviewAreaSmartFormNonUpdatable"
|
|
13
|
+
editable="false">
|
|
14
|
+
<sfo:layout>
|
|
15
|
+
<sfo:ColumnLayout columnsM="2" columnsL="3" columnsXL="4"/>
|
|
16
|
+
</sfo:layout>
|
|
17
|
+
</sfo:SmartForm>
|
|
18
|
+
</core:FragmentDefinition>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:sfo="sap.ui.comp.smartform" xmlns:smartField="sap.ui.comp.smartfield"
|
|
2
|
+
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
|
|
3
|
+
template:require="{AH: 'sap/suite/ui/generic/template/js/AnnotationHelper'}">
|
|
4
|
+
|
|
5
|
+
<Title class="sapSmartTemplatesObjectPageEasyFillReviewAreaTitleUpdatable" text="{i18n>EASY_FILL_FILLED_FIELDS}"></Title>
|
|
6
|
+
<sfo:SmartForm
|
|
7
|
+
id="EasyFillUpdatebleForm"
|
|
8
|
+
validationMode = "Async"
|
|
9
|
+
class="sapSmartTemplatesObjectPageEasyFillReviewAreaSmartForm"
|
|
10
|
+
editable="true">
|
|
11
|
+
<sfo:layout>
|
|
12
|
+
<sfo:ColumnLayout columnsM="2" columnsL="3" columnsXL="4"/>
|
|
13
|
+
</sfo:layout>
|
|
14
|
+
</sfo:SmartForm>
|
|
15
|
+
</core:FragmentDefinition>
|
|
@@ -62,11 +62,26 @@ sap.ui.define([
|
|
|
62
62
|
if (filterHelper.isPropertyFilterable(oProperty)) {
|
|
63
63
|
|
|
64
64
|
var bIsCodeListRequired;
|
|
65
|
+
var bIsHidden = false;
|
|
66
|
+
var bIsHiddenFilter = false;
|
|
67
|
+
var sFilterRestriction = "";
|
|
65
68
|
oProperty.extensions && oProperty.extensions.forEach(function(oExtension) {
|
|
66
69
|
if (oExtension.name === "value-list" && oExtension.value === "fixed-values") {
|
|
67
70
|
sTokenType = "MenuWithCheckBox";
|
|
68
71
|
bIsCodeListRequired = true;
|
|
69
72
|
}
|
|
73
|
+
// Check for hidden annotation
|
|
74
|
+
if (oExtension.name === "hidden") {
|
|
75
|
+
bIsHidden = oExtension.value === "true";
|
|
76
|
+
}
|
|
77
|
+
// Check for hidden-filter annotation
|
|
78
|
+
if (oExtension.name === "hidden-filter") {
|
|
79
|
+
bIsHiddenFilter = oExtension.value === "true";
|
|
80
|
+
}
|
|
81
|
+
// Check for filter-restriction annotation
|
|
82
|
+
if (oExtension.name === "filter-restriction") {
|
|
83
|
+
sFilterRestriction = oExtension.value;
|
|
84
|
+
}
|
|
70
85
|
});
|
|
71
86
|
|
|
72
87
|
// Calculate the token type based on the property type and display format
|
|
@@ -88,7 +103,10 @@ sap.ui.define([
|
|
|
88
103
|
codeList : bIsCodeListRequired,
|
|
89
104
|
type: sTokenType,
|
|
90
105
|
unit: oProperty["sap:unit"] || "",
|
|
91
|
-
required: oProperty["sap:required-in-filter"] === "true" ? true : false
|
|
106
|
+
required: oProperty["sap:required-in-filter"] === "true" ? true : false,
|
|
107
|
+
hidden: bIsHidden,
|
|
108
|
+
hiddenFilter: bIsHiddenFilter,
|
|
109
|
+
filterRestriction: sFilterRestriction || undefined // Only set if has value
|
|
92
110
|
};
|
|
93
111
|
}
|
|
94
112
|
});
|
|
@@ -410,6 +428,15 @@ sap.ui.define([
|
|
|
410
428
|
oSmartFilterBarVariant.customFilters.editState = oVariantDataFromAI.oEditStateFilter;
|
|
411
429
|
}
|
|
412
430
|
|
|
431
|
+
if (oSmartFilterBarVariant.semanticDates) {
|
|
432
|
+
var { Low: value1, High: value2 } = oVariantDataFromAI.aSelectOptions[0].Ranges[0];
|
|
433
|
+
var dateData = oSmartFilterBarVariant.semanticDates.Dates[0].Data;
|
|
434
|
+
|
|
435
|
+
dateData.operation = "DATERANGE";
|
|
436
|
+
dateData.value1 = value1;
|
|
437
|
+
dateData.value2 = value2 || value1;
|
|
438
|
+
}
|
|
439
|
+
|
|
413
440
|
oSmartFilterBarWrapper.setState(oSmartFilterBarVariant);
|
|
414
441
|
oSmartFilterbar.getSmartVariant() && oSmartFilterbar.getSmartVariant().currentVariantSetModified(true);
|
|
415
442
|
oSmartFilterbar.search();
|
|
@@ -435,7 +462,8 @@ sap.ui.define([
|
|
|
435
462
|
}
|
|
436
463
|
|
|
437
464
|
function fnQueryChanged() {
|
|
438
|
-
|
|
465
|
+
var oSmartFilterbar = oState.oSmartFilterbar;
|
|
466
|
+
oSmartFilterbar.fireFilterChange();
|
|
439
467
|
}
|
|
440
468
|
// function fnUpdateEasyFilterBarTokens() {
|
|
441
469
|
// // todo : update the easy filter bar tokens with new values from the SFB VHD
|
|
@@ -444,11 +472,18 @@ sap.ui.define([
|
|
|
444
472
|
// afterFilterDataUpdate
|
|
445
473
|
var mChangeParameters = oEvent.getParameters("mParameters");
|
|
446
474
|
var aEasyFilterTokens = [];
|
|
447
|
-
var sFilterChangeProperty;
|
|
475
|
+
var sFilterChangeProperty,filterData,filterDataMap,aItems;
|
|
448
476
|
// filter change will be triggered for each filter change even if the value help is opened from SFB
|
|
449
477
|
// fnValueHelpPromiseResolve will be set only if the valeu help is opened from EasyFilter
|
|
450
478
|
if (mChangeParameters.sId === "change" && fnValueHelpPromiseResolve) {
|
|
451
479
|
sFilterChangeProperty = mChangeParameters.getParameter("filterChangeReason");
|
|
480
|
+
filterData = oEvent.getSource().getFilterData();
|
|
481
|
+
filterDataMap = new Map();
|
|
482
|
+
aItems = filterData[sFilterChangeProperty]?.items || [];
|
|
483
|
+
|
|
484
|
+
aItems.forEach(function(item) {
|
|
485
|
+
filterDataMap.set(item.key, item.text);
|
|
486
|
+
});
|
|
452
487
|
// find an efficient way to get the filters from SFB to update the EasyFilter token
|
|
453
488
|
oEvent.getSource().getFilters().forEach(function(aFilters) {
|
|
454
489
|
aFilters.aFilters && aFilters.aFilters.forEach(function(oPropertyFilterItem) {
|
|
@@ -469,7 +504,7 @@ sap.ui.define([
|
|
|
469
504
|
if (oToken.operator === oFilterItem.sOperator) {
|
|
470
505
|
oToken.selectedValues.push({
|
|
471
506
|
value: oFilterItem.oValue1,
|
|
472
|
-
description: oFilterItem.oValue1
|
|
507
|
+
description: filterDataMap.get(oFilterItem.oValue1) || oFilterItem.oValue1
|
|
473
508
|
});
|
|
474
509
|
}
|
|
475
510
|
});
|
|
@@ -477,7 +512,7 @@ sap.ui.define([
|
|
|
477
512
|
oPropertyToken.operator = oFilterItem.sOperator;
|
|
478
513
|
oPropertyToken.selectedValues.push({
|
|
479
514
|
value: oFilterItem.oValue1,
|
|
480
|
-
description: oFilterItem.oValue1
|
|
515
|
+
description: filterDataMap.get(oFilterItem.oValue1) || oFilterItem.oValue1
|
|
481
516
|
});
|
|
482
517
|
aEasyFilterTokens.push(oPropertyToken);
|
|
483
518
|
}
|
|
@@ -10,7 +10,8 @@ sap.ui.define([
|
|
|
10
10
|
var aAIIntentMaster = [
|
|
11
11
|
{ name : "summarize", intent : "#IntelligentPrompt-summarize", importURL : "ux/eng/fioriai/reuse/library", localProperty : "isSummarizationEnabled", oEnabledPromise : Promise.withResolvers() },
|
|
12
12
|
{ name : "EasyFilter", intent : "#IntelligentPrompt-filter", importURL : "ux/eng/fioriai/reuse/easyfilter/EasyFilter", localProperty : "isEasyFilterEnabled", oEnabledPromise : Promise.withResolvers() },
|
|
13
|
-
{ name : "ErrorExplanation", intent : "#IntelligentPrompt-explain", importURL : "ux/eng/fioriai/reuse/errorexplanation/ErrorExplanation", localProperty : "isErrorExplanationEnabled", oEnabledPromise : Promise.withResolvers() }
|
|
13
|
+
{ name : "ErrorExplanation", intent : "#IntelligentPrompt-explain", importURL : "ux/eng/fioriai/reuse/errorexplanation/ErrorExplanation", localProperty : "isErrorExplanationEnabled", oEnabledPromise : Promise.withResolvers() },
|
|
14
|
+
{ name : "EasyFill", intent : "#IntelligentPrompt-fill", importURL : "ux/eng/fioriai/reuse/easyfill/EasyFill", localProperty : "isEasyFillEnabled", oEnabledPromise : Promise.withResolvers() }
|
|
14
15
|
];
|
|
15
16
|
var sFioriAILibrary = "ux.eng.fioriai.reuse";
|
|
16
17
|
var UShellContainer = sap.ui.require("sap/ushell/Container");
|