@sapui5/sap.suite.ui.generic.template 1.148.0 → 1.149.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/i18n/i18n_fr_CA.properties +2 -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 +254 -224
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_de.properties +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fr.properties +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/inlineCreationRows/InlineCreationRowsHelper.js +76 -33
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ar.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_bg.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ca.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_cnr.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_cs.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_cy.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_da.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_de.properties +6 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_el.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_en.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_en_GB.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_es.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_es_MX.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_et.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_fi.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_fr.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_fr_CA.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_hi.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_hr.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_hu.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_id.properties +5 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_it.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_iw.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ja.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_kk.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ko.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_lt.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_lv.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_mk.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ms.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_nl.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_no.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_pl.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_pt.properties +5 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_pt_PT.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ro.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_ru.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sh.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sk.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sl.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sr.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sv.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_th.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_tr.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_uk.properties +5 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_vi.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_zh_CN.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_zh_TW.properties +4 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/Details.view.xml +1 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/Actions.fragment.xml +13 -13
- 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/detailTemplates/DiscardEditHandler.js +9 -0
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper.js +43 -35
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/CRUDManager.js +9 -7
- package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +57 -6
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillAIOrchestrator.js +182 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillApplyHandler.js +476 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillDialogController.js +311 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillFieldCollector.js +669 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillFormRenderer.js +217 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillHandler.js +326 -1120
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillTableRenderer.js +491 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillDialog.fragment.xml +14 -10
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +11 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_US_saprigi.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +24 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +25 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +24 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +24 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +23 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +23 -7
- 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 +8 -3
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/ObjectPageSectionHandler.js +0 -282
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillNonUpdatableSmartForm.fragment.xml +0 -18
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillUpdatebleSmartForm.fragment.xml +0 -15
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/ui/model/json/JSONModel",
|
|
3
|
+
"sap/m/MessageToast",
|
|
4
|
+
"sap/suite/ui/generic/template/genericUtilities/FeLogger",
|
|
5
|
+
"sap/suite/ui/generic/template/genericUtilities/FeError"
|
|
6
|
+
], function(JSONModel, MessageToast, FeLogger, FeError) {
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
var sClassName = "lib.ai.EasyFill.EasyFillDialogController";
|
|
10
|
+
var oLogger = new FeLogger(sClassName).getLogger();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* EasyFillDialogController
|
|
14
|
+
*
|
|
15
|
+
* Responsible for all EasyFill dialog lifecycle concerns:
|
|
16
|
+
* 1. Initializing and registering the easyFillDialogModel on the view (once per view lifetime).
|
|
17
|
+
* 2. Loading and opening the EasyFillDialog fragment with all event handler and formatter bindings.
|
|
18
|
+
* 3. Handling pure UI events: mode toggle, fullscreen, feedback, cancel, clear, AI Notice popover.
|
|
19
|
+
* 4. Providing formatter functions used by XML bindings in the dialog fragment.
|
|
20
|
+
*
|
|
21
|
+
* This module contains no OData, field collection, or AI call logic.
|
|
22
|
+
* All data operations are delegated to EasyFillAIOrchestrator, EasyFillFormRenderer,
|
|
23
|
+
* EasyFillTableRenderer, and EasyFillApplyHandler.
|
|
24
|
+
*/
|
|
25
|
+
return {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Initializes the easyFillDialogModel on the view if it has not already been created.
|
|
29
|
+
* Also registers the "EasyFillFETransientChanges" deferred group on the OData model
|
|
30
|
+
* so that no batch calls are triggered until the user explicitly confirms.
|
|
31
|
+
*
|
|
32
|
+
* Should be called once before the dialog is opened for the first time.
|
|
33
|
+
*
|
|
34
|
+
* @param {object} oController - MVC controller (used to get the view and set the model)
|
|
35
|
+
* @param {object} oObjectPageModel - the OData model (used to register the deferred group)
|
|
36
|
+
* @param {object} oEasyFillLayoutMode - EasyFillLayoutMode enum
|
|
37
|
+
*/
|
|
38
|
+
initDialogModel: function(oController, oObjectPageModel, oEasyFillLayoutMode) {
|
|
39
|
+
var bIsModelCreated = !!oController.getView().getModel("easyFillDialogModel");
|
|
40
|
+
if (bIsModelCreated) {
|
|
41
|
+
return; // Already initialized — nothing to do
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Register a deferred group so AI-staged changes are not submitted until confirmaton
|
|
45
|
+
var aDeferredGroups = oObjectPageModel.getDeferredGroups();
|
|
46
|
+
aDeferredGroups.push("EasyFillFETransientChanges");
|
|
47
|
+
oObjectPageModel.setDeferredGroups(aDeferredGroups);
|
|
48
|
+
|
|
49
|
+
// Initial model state — all fields set to their "empty / waiting for AI" defaults
|
|
50
|
+
var oData = {
|
|
51
|
+
isBusy: false,
|
|
52
|
+
isFormVisible: false,
|
|
53
|
+
isIllustrationVisible: true,
|
|
54
|
+
isSaveEnabled: false,
|
|
55
|
+
stateType: "Initial",
|
|
56
|
+
feedbackEnabled: true,
|
|
57
|
+
feedbackPressedUp: false,
|
|
58
|
+
feedbackPressedDown: false,
|
|
59
|
+
isEasyFillButtonEnabled: false,
|
|
60
|
+
llmData: {},
|
|
61
|
+
easyFillMode: oEasyFillLayoutMode.CondensedMode,
|
|
62
|
+
sections: [],
|
|
63
|
+
isFullScreen: true,
|
|
64
|
+
hasTableUpdates: false,
|
|
65
|
+
hasTableValidationErrors: false,
|
|
66
|
+
tableValidationMessage: ""
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
oController.getView().setModel(new JSONModel(oData), "easyFillDialogModel");
|
|
70
|
+
oLogger.debug("initDialogModel: easyFillDialogModel created and registered on view");
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Loads the EasyFillDialog fragment (if not already loaded) and opens it.
|
|
75
|
+
* Registers all event handlers and formatters on the fragment controller object.
|
|
76
|
+
*
|
|
77
|
+
* The dialog is kept alive after first open (not destroyed on close) so that the
|
|
78
|
+
* ObjectPageLayout and SmartForm structures are preserved between invocations.
|
|
79
|
+
*
|
|
80
|
+
* @param {object} oController - MVC controller
|
|
81
|
+
* @param {object} oTemplateUtils - FE template utilities (used for getDialogFragmentAsync)
|
|
82
|
+
* @param {object} oHandlers - map of event handler and formatter functions to bind to the fragment
|
|
83
|
+
* @returns {Promise<void>}
|
|
84
|
+
*/
|
|
85
|
+
openDialog: function(oController, oTemplateUtils, oHandlers) {
|
|
86
|
+
var sFragmentName = "sap.suite.ui.generic.template.lib.ai.EasyFill.fragments.EasyFillDialog";
|
|
87
|
+
|
|
88
|
+
return oTemplateUtils.oCommonUtils.getDialogFragmentAsync(
|
|
89
|
+
sFragmentName,
|
|
90
|
+
oHandlers,
|
|
91
|
+
"easyFillPopup",
|
|
92
|
+
undefined,
|
|
93
|
+
true, // keep alive — do not destroy on close
|
|
94
|
+
true // use view as parent
|
|
95
|
+
).then(function(oDialog) {
|
|
96
|
+
oDialog.open();
|
|
97
|
+
oLogger.debug("openDialog: EasyFillDialog opened");
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Closes the EasyFill dialog if it is currently open.
|
|
103
|
+
*
|
|
104
|
+
* @param {object} oController - MVC controller
|
|
105
|
+
*/
|
|
106
|
+
closeDialog: function(oController) {
|
|
107
|
+
var oDialog = oController.byId("EasyFillDialog");
|
|
108
|
+
if (oDialog && oDialog.isOpen()) {
|
|
109
|
+
oDialog.close();
|
|
110
|
+
oLogger.debug("closeDialog: EasyFillDialog closed");
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
// ─── Event Handlers (bound to the fragment controller object) ────────────
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Handles the layout mode SegmentedButton selection change (Condensed ↔ ObjectPage view).
|
|
118
|
+
* Re-builds the sections array in the dialog model for the selected mode.
|
|
119
|
+
*
|
|
120
|
+
* @param {sap.ui.base.Event} oEvent
|
|
121
|
+
* @param {object} oController - MVC controller
|
|
122
|
+
* @param {object} oTemplateUtils - FE template utilities (for entity type lookup)
|
|
123
|
+
* @param {object} oRb - i18n resource bundle
|
|
124
|
+
* @param {object} oFieldCollector - EasyFillFieldCollector
|
|
125
|
+
* @param {object} oEasyFillLayoutMode - EasyFillLayoutMode enum
|
|
126
|
+
*/
|
|
127
|
+
onSelectionChange: function(oEvent, oController, oTemplateUtils, oRb, oFieldCollector, oEasyFillLayoutMode) {
|
|
128
|
+
var sSelectedKey = oEvent.getSource().getSelectedKey();
|
|
129
|
+
var oDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
130
|
+
var oEntityType = oTemplateUtils.oCommonUtils.getMetaModelEntityType(
|
|
131
|
+
oController.getOwnerComponent().getEntitySet()
|
|
132
|
+
);
|
|
133
|
+
oDialogModel.setProperty("/easyFillMode", sSelectedKey);
|
|
134
|
+
var oLLMResult = oDialogModel.getProperty("/llmData");
|
|
135
|
+
var aData = (sSelectedKey === oEasyFillLayoutMode.CondensedMode)
|
|
136
|
+
? oFieldCollector.getSectionsForCondensedView(oLLMResult)
|
|
137
|
+
: oFieldCollector.getSectionsForObjectPageView(oEntityType, oLLMResult, oRb);
|
|
138
|
+
oDialogModel.setProperty("/sections", aData);
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Handles the feedback button press.
|
|
143
|
+
* Disables the feedback buttons and shows a thank-you toast.
|
|
144
|
+
*
|
|
145
|
+
* @param {object} oController - MVC controller
|
|
146
|
+
* @param {object} oRb - i18n resource bundle
|
|
147
|
+
*/
|
|
148
|
+
onFeedbackPress: function(oController, oRb) {
|
|
149
|
+
var oDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
150
|
+
oDialogModel.setProperty("/feedbackEnabled", false);
|
|
151
|
+
MessageToast.show(oRb.getText("EASYFILL_RESULT_FEEDBACK"));
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Handles the live change event on the input text area.
|
|
156
|
+
* Enforces the 2000 character limit by truncating excess input.
|
|
157
|
+
* Enables/disables the "Easy Fill" submit button based on whether there is any input.
|
|
158
|
+
*
|
|
159
|
+
* @param {sap.ui.base.Event} oEvent
|
|
160
|
+
* @param {object} oController - MVC controller
|
|
161
|
+
*/
|
|
162
|
+
onLiveChange: function(oEvent, oController) {
|
|
163
|
+
var oTextArea = oEvent.getSource();
|
|
164
|
+
var sValue = oTextArea.getValue();
|
|
165
|
+
var iMaxLength = 2000;
|
|
166
|
+
|
|
167
|
+
// Enforce character limit by truncating excess input
|
|
168
|
+
if (sValue && sValue.length > iMaxLength) {
|
|
169
|
+
sValue = sValue.substring(0, iMaxLength);
|
|
170
|
+
oTextArea.setValue(sValue);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var oDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
174
|
+
oDialogModel.setProperty("/isEasyFillButtonEnabled", !!sValue);
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Handles the fullscreen toggle button press.
|
|
179
|
+
* Adjusts the SplitPane layout data sizes to show only the review area or both panes.
|
|
180
|
+
*
|
|
181
|
+
* @param {object} oController - MVC controller
|
|
182
|
+
*/
|
|
183
|
+
onToggleFullScreen: function(oController) {
|
|
184
|
+
var oDialogModel = oController.getView().getModel("easyFillDialogModel");
|
|
185
|
+
var bIsFullScreen = oDialogModel.getProperty("/isFullScreen");
|
|
186
|
+
oDialogModel.setProperty("/isFullScreen", !bIsFullScreen);
|
|
187
|
+
|
|
188
|
+
if (bIsFullScreen) {
|
|
189
|
+
// Collapse input pane to show only the review area
|
|
190
|
+
oController.byId("inputAreaSplitPane").getLayoutData().setSize("0%");
|
|
191
|
+
oController.byId("reviewAreaSplitPane").getLayoutData().setSize("100%");
|
|
192
|
+
} else {
|
|
193
|
+
// Restore split view
|
|
194
|
+
oController.byId("inputAreaSplitPane").getLayoutData().setSize("40%");
|
|
195
|
+
oController.byId("reviewAreaSplitPane").getLayoutData().setSize("60%");
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Handles the "AI Notice" link press by lazily loading and opening the AINotice popover.
|
|
201
|
+
*
|
|
202
|
+
* @param {sap.ui.base.Event} oEvent
|
|
203
|
+
* @param {object} oTemplateUtils - FE template utilities (for fragment loading)
|
|
204
|
+
* @param {object} oAIPopoverRef - mutable ref object: { popover: null } — used to cache the popover
|
|
205
|
+
* @returns {Promise<void>}
|
|
206
|
+
*/
|
|
207
|
+
onLinkPress: async function(oEvent, oTemplateUtils, oAIPopoverRef) {
|
|
208
|
+
if (!oAIPopoverRef.popover) {
|
|
209
|
+
oAIPopoverRef.popover = await this.getAIPopover(oTemplateUtils);
|
|
210
|
+
}
|
|
211
|
+
oAIPopoverRef.popover.openBy(oEvent.getSource());
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
// ─── Fragment / Popover Loading ───────────────────────────────────────────
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Lazily loads the AINotice popover fragment and returns it.
|
|
218
|
+
* The popover is kept alive after first creation.
|
|
219
|
+
*
|
|
220
|
+
* @param {object} oTemplateUtils - FE template utilities (for getDialogFragmentAsync)
|
|
221
|
+
* @returns {Promise<sap.m.Popover>}
|
|
222
|
+
*/
|
|
223
|
+
getAIPopover: function(oTemplateUtils) {
|
|
224
|
+
return oTemplateUtils.oCommonUtils.getDialogFragmentAsync(
|
|
225
|
+
"sap.suite.ui.generic.template.fragments.AINotice",
|
|
226
|
+
{
|
|
227
|
+
onCloseAiPopover: function(oEvent) {
|
|
228
|
+
var oControl = oEvent && oEvent.getSource && oEvent.getSource();
|
|
229
|
+
while (oControl && !(oControl.isA && oControl.isA("sap.m.Popover"))) {
|
|
230
|
+
oControl = oControl.getParent && oControl.getParent();
|
|
231
|
+
}
|
|
232
|
+
if (oControl && oControl.close) {
|
|
233
|
+
oControl.close();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"aiPopover",
|
|
238
|
+
undefined,
|
|
239
|
+
true // keep alive
|
|
240
|
+
);
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// ─── Formatters (used in XML fragment bindings) ───────────────────────────
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Resolves an i18n key pattern in a section title string.
|
|
247
|
+
* Matches {@i18n>SomeKey} or {i18n>SomeKey} patterns and replaces them with the translated text.
|
|
248
|
+
* Returns the title as-is if no i18n pattern is found.
|
|
249
|
+
*
|
|
250
|
+
* @param {string} sTitle - raw title string (may contain i18n pattern)
|
|
251
|
+
* @param {object} oController - MVC controller (used to access the i18n model)
|
|
252
|
+
* @returns {string}
|
|
253
|
+
*/
|
|
254
|
+
formatSectionTitle: function(sTitle, oController) {
|
|
255
|
+
if (!sTitle) { return ""; }
|
|
256
|
+
var oMatch = sTitle.match(/\{@?i18n>([^}]+)\}/);
|
|
257
|
+
if (oMatch) {
|
|
258
|
+
var sKey = oMatch[1];
|
|
259
|
+
return oController.getView().getModel("i18n").getResourceBundle().getText(sKey);
|
|
260
|
+
}
|
|
261
|
+
return sTitle;
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Returns the IllustratedMessage illustration type string for a given dialog state.
|
|
266
|
+
*
|
|
267
|
+
* @param {string} sState - one of "Initial" | "NoEntries" | "Error"
|
|
268
|
+
* @returns {string} SAP illustration type string
|
|
269
|
+
*/
|
|
270
|
+
formatIllustrationType: function(sState) {
|
|
271
|
+
switch (sState) {
|
|
272
|
+
case "Initial": return "sapIllus-NoSearchResults";
|
|
273
|
+
case "NoEntries": return "sapIllus-NoEntries";
|
|
274
|
+
case "Error": return "sapIllus-UnableToLoad";
|
|
275
|
+
default: return "sapIllus-NoSearchResults";
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Returns the IllustratedMessage title i18n text for a given dialog state.
|
|
281
|
+
*
|
|
282
|
+
* @param {string} sState - one of "Initial" | "NoEntries" | "Error"
|
|
283
|
+
* @param {object} oRb - i18n resource bundle
|
|
284
|
+
* @returns {string}
|
|
285
|
+
*/
|
|
286
|
+
formatIllustrationTitle: function(sState, oRb) {
|
|
287
|
+
switch (sState) {
|
|
288
|
+
case "Initial": return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_INITIAL");
|
|
289
|
+
case "NoEntries": return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_NO_ENTRIES");
|
|
290
|
+
case "Error": return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_ERROR");
|
|
291
|
+
default: return oRb.getText("EASY_FILL_ILLUSTRATION_TITLE_INITIAL");
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Returns the IllustratedMessage description i18n text for a given dialog state.
|
|
297
|
+
*
|
|
298
|
+
* @param {string} sState - one of "Initial" | "NoEntries" | "Error"
|
|
299
|
+
* @param {object} oRb - i18n resource bundle
|
|
300
|
+
* @returns {string}
|
|
301
|
+
*/
|
|
302
|
+
formatIllustrationDescription: function(sState, oRb) {
|
|
303
|
+
switch (sState) {
|
|
304
|
+
case "Initial": return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_INITIAL");
|
|
305
|
+
case "NoEntries": return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_NO_ENTRIES");
|
|
306
|
+
case "Error": return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_ERROR");
|
|
307
|
+
default: return oRb.getText("EASY_FILL_ILLUSTRATION_DESCRIPTION_INITIAL");
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
});
|