@sapui5/sap.suite.ui.generic.template 1.139.0 → 1.140.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/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/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/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 +26 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +65 -23
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/RelatedAppsHandler.js +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/SectionTitleHandler.js +16 -12
- 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/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/genericUtilities/polyFill.js +6 -7
- package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +61 -0
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +3 -2
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +2 -2
- 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/library.js +1 -1
- package/src/sap/suite/ui/generic/template/themes/base/ObjectPage.less +51 -0
|
@@ -136,7 +136,7 @@ sap.ui.define([
|
|
|
136
136
|
* @returns {DesigntimeSetting[]}
|
|
137
137
|
*/
|
|
138
138
|
let getAllDesigntimeSettings = function getAllDesigntimeSettings(oControl) {
|
|
139
|
-
let oResourceBundle =
|
|
139
|
+
let oResourceBundle = designtimeUtils.getResourceBundle(oControl);
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* Retrieves the enums for the SmartFilterBar control.
|
|
@@ -328,7 +328,7 @@ sap.ui.define([
|
|
|
328
328
|
actions: {
|
|
329
329
|
settings: {
|
|
330
330
|
fe: {
|
|
331
|
-
name: "
|
|
331
|
+
name: designtimeUtils.getResourceBundle(oControl).getText("RTA_CONTEXT_MENU_CONFIG"),
|
|
332
332
|
icon: "sap-icon://developer-settings",
|
|
333
333
|
handler: fnOpenTableConfigurationDialog
|
|
334
334
|
}
|
|
@@ -322,7 +322,7 @@ sap.ui.define([
|
|
|
322
322
|
* @returns {DesigntimeSetting[]} - The designtime settings for the SmartTable.
|
|
323
323
|
*/
|
|
324
324
|
let getAllDesigntimeSettings = function getAllDesigntimeSettings(oSmartTable, oControl) {
|
|
325
|
-
let oResourceBundle =
|
|
325
|
+
let oResourceBundle = designtimeUtils.getResourceBundle(oControl);
|
|
326
326
|
|
|
327
327
|
/**
|
|
328
328
|
* @type {DesigntimeSetting}
|
|
@@ -518,7 +518,7 @@ sap.ui.define([
|
|
|
518
518
|
actions: {
|
|
519
519
|
settings: {
|
|
520
520
|
fe: {
|
|
521
|
-
name: "
|
|
521
|
+
name: designtimeUtils.getResourceBundle(oSmartTable).getText("RTA_CONTEXT_MENU_CONFIG"),
|
|
522
522
|
icon: "sap-icon://developer-settings",
|
|
523
523
|
handler: fnOpenTableConfigurationDialog
|
|
524
524
|
}
|
|
@@ -509,6 +509,10 @@ sap.ui.define([
|
|
|
509
509
|
return aDesigntimeSettings;
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
+
function getResourceBundle(oControl) {
|
|
513
|
+
return oControl.getModel("i18n").getResourceBundle();
|
|
514
|
+
}
|
|
515
|
+
|
|
512
516
|
return {
|
|
513
517
|
openAdaptionDialog: fnOpenAdaptionDialog,
|
|
514
518
|
getSettings,
|
|
@@ -522,6 +526,7 @@ sap.ui.define([
|
|
|
522
526
|
filterDesigntimeSettingsByFloorPlan,
|
|
523
527
|
getRtaModeValue,
|
|
524
528
|
FioriToolsRtaMode,
|
|
525
|
-
getAllowedDesigntimeSettingsBasedOnAdaptationMode
|
|
529
|
+
getAllowedDesigntimeSettingsBasedOnAdaptationMode,
|
|
530
|
+
getResourceBundle
|
|
526
531
|
};
|
|
527
532
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
|
|
2
|
+
<Popover
|
|
3
|
+
showArrow="true"
|
|
4
|
+
showHeader="true"
|
|
5
|
+
placement="Auto"
|
|
6
|
+
class="sapSmartTemplatesObjectPageEasyFillAINoticePopover"
|
|
7
|
+
title="{i18n>EASY_FILL_POPOVER_AI_TITLE}"
|
|
8
|
+
>
|
|
9
|
+
<content>
|
|
10
|
+
<VBox>
|
|
11
|
+
<Text text="{i18n>EASY_FILL_POPOVER_AI_TEXT_1}" class="sapSmartTemplatesObjectPageEasyFillAINotice"/>
|
|
12
|
+
<Text text="{i18n>EASY_FILL_POPOVER_AI_TEXT_2}" class="sapSmartTemplatesObjectPageEasyFillAINotice"/>
|
|
13
|
+
</VBox>
|
|
14
|
+
</content>
|
|
15
|
+
<footer>
|
|
16
|
+
<OverflowToolbar>
|
|
17
|
+
<ToolbarSpacer />
|
|
18
|
+
<Button
|
|
19
|
+
text="{i18n>ST_GENERIC_DIALOG_CLOSE_BUT}"
|
|
20
|
+
press="onCloseAiPopover" />
|
|
21
|
+
</OverflowToolbar>
|
|
22
|
+
</footer>
|
|
23
|
+
</Popover>
|
|
24
|
+
</core:FragmentDefinition>
|
|
@@ -33,13 +33,12 @@ sap.ui.define([
|
|
|
33
33
|
*/
|
|
34
34
|
if (!Promise.withResolvers) {
|
|
35
35
|
Promise.withResolvers = function() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return promise;
|
|
36
|
+
var result = {};
|
|
37
|
+
result.promise = new Promise(function(resolve, reject) {
|
|
38
|
+
result.resolve = resolve;
|
|
39
|
+
result.reject = reject;
|
|
40
|
+
});
|
|
41
|
+
return result;
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
@@ -734,6 +734,7 @@ sap.ui.define(["sap/ui/model/odata/AnnotationHelper",
|
|
|
734
734
|
}
|
|
735
735
|
},
|
|
736
736
|
|
|
737
|
+
|
|
737
738
|
getShareOptionVisibility: function(bFlexibleColumnLayout) {
|
|
738
739
|
if (bFlexibleColumnLayout) {
|
|
739
740
|
return "{= !(" + fnGetCommonShareVisibilityPath() + " || ${_templPrivGlobal>/generic/FCL/highestViewLevel})}";
|
|
@@ -4523,6 +4524,65 @@ sap.ui.define(["sap/ui/model/odata/AnnotationHelper",
|
|
|
4523
4524
|
break;
|
|
4524
4525
|
}
|
|
4525
4526
|
return sPriority;
|
|
4527
|
+
},
|
|
4528
|
+
|
|
4529
|
+
getModelData: function(oInterface, sBaseAnnotationPath, sEntitySetName) {
|
|
4530
|
+
var oModel = oInterface.getModel() ? oInterface.getModel() : oInterface.getInterface(0).getModel(),
|
|
4531
|
+
oBaseEntityType = oModel.getODataEntityType(oModel.getODataEntitySet(sEntitySetName).entityType);
|
|
4532
|
+
|
|
4533
|
+
if (sBaseAnnotationPath.indexOf("/") > -1) {
|
|
4534
|
+
var oRelevantData = oAnnotationHelper.getRelevantDataForAnnotationRecord(oModel, sBaseAnnotationPath, oBaseEntityType);
|
|
4535
|
+
return {
|
|
4536
|
+
sAnnotationPath: oRelevantData.dataFieldValuePath[0] === '@' ? oRelevantData.dataFieldValuePath.substring(1) : oRelevantData.dataFieldValuePath,
|
|
4537
|
+
oEntityType: oRelevantData.entityType
|
|
4538
|
+
};
|
|
4539
|
+
}
|
|
4540
|
+
return {
|
|
4541
|
+
sAnnotationPath: sBaseAnnotationPath[0] === '@' ? sBaseAnnotationPath.substring(1) : sBaseAnnotationPath,
|
|
4542
|
+
oEntityType: oBaseEntityType
|
|
4543
|
+
};
|
|
4544
|
+
},
|
|
4545
|
+
|
|
4546
|
+
getSmartFormTitle: function(oInterface, oFacet, sEntitySetName) {
|
|
4547
|
+
if (!oFacet) {
|
|
4548
|
+
return;
|
|
4549
|
+
}
|
|
4550
|
+
if (oFacet.Target && oFacet.Target.AnnotationPath && oFacet.Target.AnnotationPath.indexOf("com.sap.vocabularies.UI.v1.DataPoint") > -1) {
|
|
4551
|
+
// Process DataPoint case
|
|
4552
|
+
var { sAnnotationPath, oEntityType } = oAnnotationHelper.getModelData(oInterface, oFacet.Target.AnnotationPath, sEntitySetName);
|
|
4553
|
+
if (oEntityType[sAnnotationPath] && oEntityType[sAnnotationPath].Title && oEntityType[sAnnotationPath].Title.String) {
|
|
4554
|
+
return oEntityType[sAnnotationPath].Title.String;
|
|
4555
|
+
}
|
|
4556
|
+
// As DataPoint don't have title -> try to get property name as SmartForm title
|
|
4557
|
+
if (!oEntityType[sAnnotationPath] || !oEntityType[sAnnotationPath].Value || !oEntityType[sAnnotationPath].Value.Path || !oEntityType.property) {
|
|
4558
|
+
return;
|
|
4559
|
+
}
|
|
4560
|
+
var aProperty = oEntityType.property.filter(function(entry) {
|
|
4561
|
+
return entry.name === oEntityType[sAnnotationPath].Value.Path;
|
|
4562
|
+
});
|
|
4563
|
+
if (aProperty.length && aProperty[0]['sap:label']) {
|
|
4564
|
+
// Property name found
|
|
4565
|
+
return aProperty[0]['sap:label'];
|
|
4566
|
+
}
|
|
4567
|
+
return;
|
|
4568
|
+
}
|
|
4569
|
+
// It's Identification or FieldGroup case
|
|
4570
|
+
if (oFacet.Label && oFacet.Label.String) {
|
|
4571
|
+
return oFacet.Label.String;
|
|
4572
|
+
}
|
|
4573
|
+
if (!oFacet.Target || !oFacet.Target.AnnotationPath) {
|
|
4574
|
+
return;
|
|
4575
|
+
}
|
|
4576
|
+
if (oFacet.Target.AnnotationPath.indexOf("com.sap.vocabularies.UI.v1.Identification") > -1) {
|
|
4577
|
+
// Identification entry don't have any data which we can use as SmartForm title.
|
|
4578
|
+
return;
|
|
4579
|
+
}
|
|
4580
|
+
var { sAnnotationPath, oEntityType } = oAnnotationHelper.getModelData(oInterface, oFacet.Target.AnnotationPath, sEntitySetName);
|
|
4581
|
+
if (oEntityType[sAnnotationPath] && oEntityType[sAnnotationPath].Label && oEntityType[sAnnotationPath].Label.String) {
|
|
4582
|
+
// Use FieldGroup.Label.String as SmartForm title
|
|
4583
|
+
return oEntityType[sAnnotationPath].Label.String;
|
|
4584
|
+
}
|
|
4585
|
+
return;
|
|
4526
4586
|
}
|
|
4527
4587
|
};
|
|
4528
4588
|
oAnnotationHelper.getBlockForEditableHeaderFacet.requiresIContext = true;
|
|
@@ -4593,6 +4653,7 @@ sap.ui.define(["sap/ui/model/odata/AnnotationHelper",
|
|
|
4593
4653
|
oAnnotationHelper.getTextArrangementPath.requiresIContext = true;
|
|
4594
4654
|
oAnnotationHelper.isValueHelpTableAvailable.requiresIContext = true;
|
|
4595
4655
|
oAnnotationHelper.getTextArrangementFinalString.requiresIContext = true;
|
|
4656
|
+
oAnnotationHelper.getSmartFormTitle.requiresIContext = true;
|
|
4596
4657
|
|
|
4597
4658
|
return oAnnotationHelper;
|
|
4598
4659
|
}, /* bExport= */ true);
|
|
@@ -302,7 +302,8 @@ sap.ui.define([
|
|
|
302
302
|
"fioriAI": {
|
|
303
303
|
isSummarizationEnabled : false,
|
|
304
304
|
isEasyFilterEnabled : false,
|
|
305
|
-
isErrorExplanationEnabled : false
|
|
305
|
+
isErrorExplanationEnabled : false,
|
|
306
|
+
isEasyFillEnabled: false
|
|
306
307
|
}
|
|
307
308
|
});
|
|
308
309
|
oAppComponent.setModel(oTemplateContract.oTemplatePrivateGlobalModel, "_templPrivGlobal");
|
|
@@ -944,7 +945,7 @@ sap.ui.define([
|
|
|
944
945
|
* @public
|
|
945
946
|
* @extends sap.ui.core.UIComponent
|
|
946
947
|
* @author SAP SE
|
|
947
|
-
* @version 1.
|
|
948
|
+
* @version 1.140.0
|
|
948
949
|
* @name sap.suite.ui.generic.template.lib.AppComponent
|
|
949
950
|
*/
|
|
950
951
|
var oAppComponent = UIComponent.extend("sap.suite.ui.generic.template.lib.AppComponent", {
|
|
@@ -212,8 +212,8 @@ sap.ui.define(["sap/ui/base/Object",
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// sap.suite.ui.generic.template.lib.CommonUtils.prototype.getSelectedContexts.getDialogFragment below
|
|
215
|
-
function getDialogFragmentAsync(sName, oFragmentController, sModel, fnOnFragmentCreated, bAlwaysGetNew) {
|
|
216
|
-
return oServices.oApplication.getDialogFragmentForViewAsync(oController.getView(), sName, oFragmentController, sModel, fnOnFragmentCreated, bAlwaysGetNew);
|
|
215
|
+
function getDialogFragmentAsync(sName, oFragmentController, sModel, fnOnFragmentCreated, bAlwaysGetNew,bNoBusyAware) {
|
|
216
|
+
return oServices.oApplication.getDialogFragmentForViewAsync(oController.getView(), sName, oFragmentController, sModel, fnOnFragmentCreated, bAlwaysGetNew,bNoBusyAware);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
var oResourceBundle; // initialized on first use
|
|
@@ -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
|
+
});
|