@sapui5/sap.suite.ui.generic.template 1.148.0 → 1.148.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/package.json +1 -1
  2. package/src/sap/suite/ui/generic/template/.library +1 -1
  3. package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_fr_CA.properties +2 -2
  4. package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
  5. package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
  6. package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_fr.properties +1 -1
  7. package/src/sap/suite/ui/generic/template/ListReport/manifest.json +1 -1
  8. package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
  9. package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/Actions.fragment.xml +13 -13
  10. package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
  11. package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
  12. package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
  13. package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +57 -6
  14. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillAIOrchestrator.js +185 -0
  15. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillApplyHandler.js +476 -0
  16. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillDialogController.js +311 -0
  17. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillFieldCollector.js +669 -0
  18. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillFormRenderer.js +217 -0
  19. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillHandler.js +323 -1120
  20. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillTableRenderer.js +491 -0
  21. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillDialog.fragment.xml +14 -10
  22. package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +11 -8
  23. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +14 -0
  24. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +14 -0
  25. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +14 -0
  26. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +14 -0
  27. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +14 -0
  28. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +14 -0
  29. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +14 -0
  30. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +14 -0
  31. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +14 -0
  32. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +14 -0
  33. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +14 -0
  34. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_US_saprigi.properties +14 -0
  35. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +14 -0
  36. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +14 -0
  37. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +14 -0
  38. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +14 -0
  39. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +15 -1
  40. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +15 -1
  41. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +14 -0
  42. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +15 -1
  43. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +14 -0
  44. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +14 -0
  45. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +14 -0
  46. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +14 -0
  47. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +14 -0
  48. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +14 -0
  49. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +14 -0
  50. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +14 -0
  51. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +14 -0
  52. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +14 -0
  53. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +14 -0
  54. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +15 -1
  55. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +14 -0
  56. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +14 -0
  57. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +14 -0
  58. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +14 -0
  59. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +14 -0
  60. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +14 -0
  61. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +14 -0
  62. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +14 -0
  63. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +14 -0
  64. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +14 -0
  65. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +14 -0
  66. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +14 -0
  67. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +14 -0
  68. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +14 -0
  69. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +14 -0
  70. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +14 -0
  71. package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +14 -0
  72. package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
  73. package/src/sap/suite/ui/generic/template/library.js +1 -1
  74. package/src/sap/suite/ui/generic/template/themes/base/ObjectPage.less +8 -3
  75. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/ObjectPageSectionHandler.js +0 -282
  76. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillNonUpdatableSmartForm.fragment.xml +0 -18
  77. package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillUpdatebleSmartForm.fragment.xml +0 -15
@@ -0,0 +1,217 @@
1
+ sap.ui.define([
2
+ "sap/ui/comp/smartform/GroupElement",
3
+ "sap/ui/comp/smartfield/SmartField",
4
+ "sap/m/Text",
5
+ "sap/ui/layout/form/ColumnElementData",
6
+ "sap/suite/ui/generic/template/genericUtilities/FeLogger",
7
+ "sap/suite/ui/generic/template/genericUtilities/FeError"
8
+ ], function(GroupElement, SmartField, Text, ColumnElementData, FeLogger, FeError) {
9
+ "use strict";
10
+
11
+ var sClassName = "lib.ai.EasyFill.EasyFillFormRenderer";
12
+ var oLogger = new FeLogger(sClassName).getLogger();
13
+
14
+ /**
15
+ * EasyFillFormRenderer
16
+ *
17
+ * Responsible for:
18
+ * 1. Programmatically populating SmartForm groups with SmartField controls based on LLM response data.
19
+ * 2. Managing the transient OData context used to stage AI-suggested values before the user confirms.
20
+ *
21
+ * Each SmartForm group in the EasyFill dialog receives:
22
+ * - An editable SmartField bound to the transient context (shows the AI-suggested value)
23
+ * - A read-only SmartField ("Previously:") bound to the original ObjectPage context (shows current value)
24
+ *
25
+ * The SmartForm shell containers (EasyFillUpdatableSmartForm, EasyFillNonUpdatableSmartForm) are
26
+ * created in XML fragments and populated here dynamically — no fields are declared in the XML.
27
+ */
28
+ return {
29
+
30
+ /**
31
+ * Populates a target SmartForm group with GroupElements for the given list of field names.
32
+ * For each field:
33
+ * - Creates an editable SmartField bound to the transient context (if updatable)
34
+ * alongside a read-only "Previously:" SmartField bound to the original OP context.
35
+ * - Creates a display-only SmartField bound to the OP context (if non-updatable).
36
+ *
37
+ * This function is called asynchronously (via setTimeout) to allow the SmartForm DOM to render
38
+ * before GroupElements are injected.
39
+ *
40
+ * @param {string} sId - the CustomData "id" value identifying the target SmartForm group
41
+ * @param {Array<string>} aFields - array of property names to render as SmartFields
42
+ * @param {string} sEasyFillMode - current layout mode (Condensed / ObjectPage) — for future use
43
+ * @param {object} oController - MVC controller (used to byId the ObjectPageLayout)
44
+ * @param {object} oTransientContextForEasyFill - transient OData context for AI-suggested values
45
+ * @param {object} oObjectPageContext - original ObjectPage binding context (current values)
46
+ * @param {object} mUpdatableLookupMap - map of { fieldName: value } for updatable fields only
47
+ * @param {object} oLLMData - flat map of { fieldName: aiValue } from the LLM response
48
+ * @returns {boolean} always returns true (used as a formatter return value in XML)
49
+ */
50
+ populateSmartFields: function(sId, aFields, sEasyFillMode, oController, oTransientContextForEasyFill, oObjectPageContext, mUpdatableLookupMap, oLLMData) {
51
+ var oObjectPageLayout = oController.byId("EasyFillObjectPageLayout");
52
+ if (!oObjectPageLayout || !Array.isArray(aFields) || aFields.length === 0) {
53
+ return true;
54
+ }
55
+
56
+ // Defer injection until after the SmartForm has rendered into the DOM
57
+ setTimeout(function() {
58
+ var oTargetGroup = null;
59
+
60
+ // Walk the ObjectPageLayout section hierarchy to find the group
61
+ // matching the given CustomData "id" value
62
+ oObjectPageLayout.getSections().forEach(function(oSection) {
63
+ oSection.getSubSections().forEach(function(oSubSection) {
64
+ oSubSection.getBlocks().forEach(function(oBlock) {
65
+ if (oBlock.isA("sap.ui.comp.smartform.SmartForm")) {
66
+ oBlock.getGroups().forEach(function(oGroup) {
67
+ var oMatchedCustomData = oGroup.getCustomData().find(function(oData) {
68
+ return oData.getKey() === "id" && oData.getValue() === sId;
69
+ });
70
+ if (oMatchedCustomData) {
71
+ oTargetGroup = oGroup;
72
+ }
73
+ });
74
+ }
75
+ });
76
+ });
77
+ });
78
+
79
+ if (!oTargetGroup) {
80
+ oLogger.warning("populateSmartFields: no group found with id '" + sId + "'");
81
+ return;
82
+ }
83
+
84
+ // Clear any previously rendered GroupElements before re-populating
85
+ oTargetGroup.destroyGroupElements();
86
+
87
+ aFields.forEach(function(sKey) {
88
+ var bIsEditable = mUpdatableLookupMap && !!mUpdatableLookupMap[sKey];
89
+
90
+ var oGroupElement = new GroupElement({
91
+ useHorizontalLayout: false
92
+ });
93
+
94
+ /**
95
+ * Primary SmartField:
96
+ * - If editable: bound to transient context, shows AI-suggested value
97
+ * - If non-editable: bound to OP context, display-only
98
+ */
99
+ var oSmartField = new SmartField({
100
+ value: "{" + sKey + "}",
101
+ editable: bIsEditable,
102
+ enabled: bIsEditable,
103
+ contextEditable: bIsEditable,
104
+ layoutData: new ColumnElementData({
105
+ cellsSmall: 12,
106
+ cellsLarge: 12
107
+ }),
108
+ editableChanged: function(oEvent) {
109
+ // Prevent the SmartField from toggling its own editability;
110
+ // editability is controlled exclusively by EasyFill logic
111
+ if (oEvent.getParameter("editable") !== bIsEditable) {
112
+ oEvent.getSource().setEditable(bIsEditable);
113
+ }
114
+ }
115
+ });
116
+
117
+ /**
118
+ * "Previously:" SmartField (read-only):
119
+ * - Only shown for editable fields to display the current OP value for comparison
120
+ * - Bound to the original ObjectPage context
121
+ */
122
+ var oSmartFieldPrev = new SmartField({
123
+ value: "{" + sKey + "}",
124
+ editable: false,
125
+ enabled: false,
126
+ contextEditable: false,
127
+ showLabel: false,
128
+ visible: bIsEditable,
129
+ layoutData: new ColumnElementData({
130
+ cellsSmall: 9,
131
+ cellsLarge: 10
132
+ }),
133
+ editableChanged: function(oEvent) {
134
+ // Always keep the "previously" field read-only
135
+ if (oEvent.getParameter("editable") !== false) {
136
+ oEvent.getSource().setEditable(false);
137
+ }
138
+ }
139
+ });
140
+
141
+ if (bIsEditable) {
142
+ // Editable fields: primary field uses transient context (AI value),
143
+ // preview field uses original OP context (current value)
144
+ oSmartField.setBindingContext(oTransientContextForEasyFill);
145
+ oSmartFieldPrev.setBindingContext(oObjectPageContext);
146
+
147
+ // Set the AI-suggested value on the transient context for this field
148
+ oTransientContextForEasyFill.setProperty(sKey, oLLMData[sKey]);
149
+ } else {
150
+ // Non-editable fields: bound to the original OP context, display only
151
+ oSmartField.setBindingContext(oObjectPageContext);
152
+ }
153
+
154
+ // Build the GroupElement: [label+primary SmartField] [Previously: label] [preview SmartField]
155
+ oGroupElement.addElement(oSmartField); // SmartField provides the label
156
+ oGroupElement.addElement(new Text({
157
+ text: "Previously:",
158
+ visible: bIsEditable,
159
+ layoutData: new ColumnElementData({
160
+ cellsSmall: 3,
161
+ cellsLarge: 2
162
+ })
163
+ }));
164
+ oGroupElement.addElement(oSmartFieldPrev);
165
+ oTargetGroup.addGroupElement(oGroupElement);
166
+ });
167
+
168
+ oLogger.debug("populateSmartFields: populated " + aFields.length + " fields for group '" + sId + "'");
169
+ }, 0);
170
+
171
+ return true;
172
+ },
173
+
174
+ /**
175
+ * Creates a new transient OData context for staging AI-suggested values.
176
+ * If a previous transient context exists, it is reset first.
177
+ *
178
+ * The transient context is created using a dedicated deferred group ("EasyFillFETransientChanges")
179
+ * so that no batch request is triggered to the backend until the user confirms via the dialog.
180
+ *
181
+ * @param {object} oTransientContextForEasyFill - current transient context (may be null)
182
+ * @param {object} oObjectPageModel - the OData model of the ObjectPage
183
+ * @param {object} oController - MVC controller (used to get the entity set name)
184
+ * @returns {object} the new transient OData context
185
+ */
186
+ makeTransientContext: function(oTransientContextForEasyFill, oObjectPageModel, oController) {
187
+ // Reset any existing transient context before creating a new one
188
+ if (oTransientContextForEasyFill) {
189
+ this.resetTransientContext(oTransientContextForEasyFill, oObjectPageModel);
190
+ }
191
+
192
+ var sEntitySet = oController.getOwnerComponent().getEntitySet();
193
+ var oNewContext = oObjectPageModel.createEntry("/" + sEntitySet, {
194
+ groupId: "EasyFillFETransientChanges",
195
+ changeSetId: "EasyFillFETransientChanges"
196
+ });
197
+
198
+ oLogger.debug("makeTransientContext: created transient context for entity set '" + sEntitySet + "'");
199
+ return oNewContext;
200
+ },
201
+
202
+ /**
203
+ * Rolls back the transient context, discarding all staged AI values without triggering a backend call.
204
+ * Called on dialog cancel or when a new AI submission replaces the previous result.
205
+ *
206
+ * @param {object} oTransientContextForEasyFill - the transient context to reset
207
+ * @param {object} oObjectPageModel - the OData model of the ObjectPage
208
+ */
209
+ resetTransientContext: function(oTransientContextForEasyFill, oObjectPageModel) {
210
+ if (oTransientContextForEasyFill) {
211
+ // Reset changes for the transient context path only, without triggering side effects
212
+ oObjectPageModel.resetChanges([oTransientContextForEasyFill.getPath()], false, true);
213
+ oLogger.debug("resetTransientContext: transient context reset");
214
+ }
215
+ }
216
+ };
217
+ });