@sapui5/sap.suite.ui.generic.template 1.148.0 → 1.148.2
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/ControllerImplementation.js +6 -3
- 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/manifest.json +1 -1
- 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/genericUtilities/controlStateWrapperFactory/SmartFilterBarWrapper.js +20 -1
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/CRUDManager.js +0 -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 +216 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillApplyHandler.js +325 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillDialogController.js +358 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillFieldCollector.js +848 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillFormRenderer.js +292 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillHandler.js +652 -1071
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/EasyFillTableRenderer.js +940 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFill/fragments/EasyFillDialog.fragment.xml +41 -26
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +90 -73
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +35 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_US_saprigi.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +30 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +31 -9
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +30 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +30 -8
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +29 -7
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +29 -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 +30 -4
- 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,325 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/suite/ui/generic/template/genericUtilities/FeLogger",
|
|
3
|
+
"sap/suite/ui/generic/template/genericUtilities/FeError"
|
|
4
|
+
], function(FeLogger, FeError) {
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
var sClassName = "lib.ai.EasyFill.EasyFillApplyHandler";
|
|
8
|
+
var oLogger = new FeLogger(sClassName).getLogger();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* EasyFillApplyHandler
|
|
12
|
+
*
|
|
13
|
+
* Responsible for:
|
|
14
|
+
* 1. Applying AI-suggested field values from transient contexts back to the live ObjectPage context on Confirm.
|
|
15
|
+
* 2. Building and validating staged collection (table) row updates before allowing save.
|
|
16
|
+
* 3. Resetting the EasyFill dialog state (model, staged values, transient context) on cancel or clear.
|
|
17
|
+
*/
|
|
18
|
+
return {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Applies all AI-suggested scalar field values from the transient context to the live ObjectPage context.
|
|
22
|
+
* Called when the user clicks "Confirm" in the EasyFill dialog.
|
|
23
|
+
*
|
|
24
|
+
*
|
|
25
|
+
* Only properties present in the updatable lookup map are written back.
|
|
26
|
+
* Collection (table) row values are copied from transient staging contexts to the
|
|
27
|
+
* live row contexts only here, so the ObjectPage table updates only after confirm.
|
|
28
|
+
* New row creation is NOT done here — the caller must call createPendingNewRows separately
|
|
29
|
+
* because it requires CRUDManager access (draft-aware) that ApplyHandler does not hold.
|
|
30
|
+
*
|
|
31
|
+
* @param {object} oTransientContextForEasyFill - the transient OData context holding AI-suggested values
|
|
32
|
+
* @param {object} oObjectPageContext - the live ObjectPage binding context to write values into
|
|
33
|
+
* @param {object} mUpdatableLookupMap - map of { fieldName: value } for fields that are updatable
|
|
34
|
+
* @param {object} oTableStagingState - table staging state { mStagedRows, mPendingNewRowContexts }
|
|
35
|
+
* @param {object} mCollectionState - collection tracking state
|
|
36
|
+
*/
|
|
37
|
+
applyAndSave: function(oTransientContextForEasyFill, oObjectPageContext, mUpdatableLookupMap, oTableStagingState, mCollectionState) {
|
|
38
|
+
if (!oTransientContextForEasyFill || !oObjectPageContext) {
|
|
39
|
+
oLogger.warning("applyAndSave: missing transient or ObjectPage context — skipping apply");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var oTransientObject = oTransientContextForEasyFill.getObject();
|
|
44
|
+
var iApplied = 0;
|
|
45
|
+
|
|
46
|
+
// Copy each AI-suggested property value from the transient context to the live OP context
|
|
47
|
+
for (var sProp in oTransientObject) {
|
|
48
|
+
if (sProp !== "__metadata" && mUpdatableLookupMap[sProp]) {
|
|
49
|
+
oObjectPageContext.setProperty(sProp, oTransientObject[sProp]);
|
|
50
|
+
iApplied++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
oLogger.debug("applyAndSave: applied " + iApplied + " field(s) to ObjectPage context");
|
|
55
|
+
|
|
56
|
+
var mCollectionUpdates = this.buildStagedCollectionUpdates(oTableStagingState, mCollectionState);
|
|
57
|
+
var iCollectionApplied = 0;
|
|
58
|
+
|
|
59
|
+
Object.keys(mCollectionUpdates).forEach(function(sCollectionName) {
|
|
60
|
+
var aRowUpdates = mCollectionUpdates[sCollectionName] || [];
|
|
61
|
+
aRowUpdates.forEach(function(oRowUpdate) {
|
|
62
|
+
var oResolvedRow = this._resolveCollectionRowContext(sCollectionName, oRowUpdate, mCollectionState);
|
|
63
|
+
if (!oResolvedRow || !oResolvedRow.context) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
Object.keys(oRowUpdate).forEach(function(sPropertyName) {
|
|
68
|
+
if (sPropertyName === "_rowIndex" || sPropertyName === "_contextPath") {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
oResolvedRow.context.setProperty(sPropertyName, oRowUpdate[sPropertyName]);
|
|
72
|
+
iCollectionApplied++;
|
|
73
|
+
});
|
|
74
|
+
}, this);
|
|
75
|
+
}, this);
|
|
76
|
+
|
|
77
|
+
oLogger.debug("applyAndSave: applied " + iCollectionApplied + " staged table value(s) to ObjectPage context");
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Extracts user-reviewed values from the pending new-row transient contexts.
|
|
82
|
+
* Returns a map of { navProperty: predefinedValues } ready to pass to CRUDManager.addEntry.
|
|
83
|
+
* The caller is responsible for discarding the transient contexts afterwards.
|
|
84
|
+
*
|
|
85
|
+
* @param {object} oTableStagingState - table staging state { mPendingNewRowContexts }
|
|
86
|
+
* @param {object} mCollectionState - collection tracking state (mCollectionProperties)
|
|
87
|
+
* @returns {object} map of { navProperty: plainValuesObject }
|
|
88
|
+
*/
|
|
89
|
+
extractPendingNewRowValues: function(oTableStagingState, mCollectionState) {
|
|
90
|
+
var mNewRowValues = Object.create(null);
|
|
91
|
+
Object.keys((oTableStagingState && oTableStagingState.mPendingNewRowContexts) || {}).forEach(function(sCollectionName) {
|
|
92
|
+
var aNewContexts = oTableStagingState.mPendingNewRowContexts[sCollectionName] || [];
|
|
93
|
+
if (!aNewContexts.length) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
var mCollectionPropertyMap = (mCollectionState && mCollectionState.mCollectionProperties &&
|
|
97
|
+
mCollectionState.mCollectionProperties[sCollectionName]) || Object.create(null);
|
|
98
|
+
|
|
99
|
+
// Extract scalar values set by the user during the preview (first new row only — cap is 1)
|
|
100
|
+
var oNewContext = aNewContexts[0];
|
|
101
|
+
var oValues = Object.create(null);
|
|
102
|
+
Object.keys(mCollectionPropertyMap).forEach(function(sPropName) {
|
|
103
|
+
var vValue = oNewContext.getProperty && oNewContext.getProperty(sPropName);
|
|
104
|
+
if (vValue !== undefined && vValue !== null && typeof vValue !== "object") {
|
|
105
|
+
oValues[sPropName] = vValue;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
mNewRowValues[sCollectionName] = oValues;
|
|
109
|
+
oLogger.debug("extractPendingNewRowValues: extracted " + Object.keys(oValues).length +
|
|
110
|
+
" value(s) for new row in '" + sCollectionName + "'");
|
|
111
|
+
});
|
|
112
|
+
return mNewRowValues;
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Builds a collection updates map from the staged transient row contexts.
|
|
117
|
+
* Only editable scalar properties whose staged value differs from the live row value are included.
|
|
118
|
+
*
|
|
119
|
+
* @param {object} oTableStagingState - table staging state { mStagedRows }
|
|
120
|
+
* @param {object} mCollectionState - collection tracking state
|
|
121
|
+
* @returns {object} map of { navProperty: [ rowUpdate ] }
|
|
122
|
+
*/
|
|
123
|
+
buildStagedCollectionUpdates: function(oTableStagingState, mCollectionState) {
|
|
124
|
+
var mCollectionUpdates = Object.create(null);
|
|
125
|
+
var mStagedRowsByCollection = oTableStagingState && oTableStagingState.mStagedRows;
|
|
126
|
+
|
|
127
|
+
Object.keys(mStagedRowsByCollection || {}).forEach(function(sCollectionName) {
|
|
128
|
+
var aStagedRows = mStagedRowsByCollection[sCollectionName] || [];
|
|
129
|
+
var mCollectionPropertyMap = mCollectionState.mCollectionProperties[sCollectionName] || Object.create(null);
|
|
130
|
+
|
|
131
|
+
aStagedRows.forEach(function(oStagedRow) {
|
|
132
|
+
var oRealContext = oStagedRow.realContext;
|
|
133
|
+
var oTransientContext = oStagedRow.transientContext;
|
|
134
|
+
if (!oRealContext || !oTransientContext) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var oRealRowObject = oRealContext.getObject && oRealContext.getObject();
|
|
139
|
+
var oRowUpdate = {
|
|
140
|
+
_rowIndex: oStagedRow.rowIndex,
|
|
141
|
+
_contextPath: oRealContext.getPath && oRealContext.getPath()
|
|
142
|
+
};
|
|
143
|
+
var bHasChanges = false;
|
|
144
|
+
|
|
145
|
+
(oStagedRow.propertyNames || []).forEach(function(sPropertyName) {
|
|
146
|
+
var oPropertyMeta = mCollectionPropertyMap[sPropertyName];
|
|
147
|
+
if (!oPropertyMeta || !this._isEditableProperty(oPropertyMeta, oRealRowObject)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
var vLiveValue = oRealContext.getProperty(sPropertyName);
|
|
152
|
+
var vStagedValue = oTransientContext.getProperty(sPropertyName);
|
|
153
|
+
if (!this._isSupportedStagedValue(vStagedValue)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!this._areValuesEqual(vLiveValue, vStagedValue)) {
|
|
158
|
+
oRowUpdate[sPropertyName] = vStagedValue;
|
|
159
|
+
bHasChanges = true;
|
|
160
|
+
}
|
|
161
|
+
}, this);
|
|
162
|
+
|
|
163
|
+
if (bHasChanges) {
|
|
164
|
+
if (!mCollectionUpdates[sCollectionName]) {
|
|
165
|
+
mCollectionUpdates[sCollectionName] = [];
|
|
166
|
+
}
|
|
167
|
+
mCollectionUpdates[sCollectionName].push(oRowUpdate);
|
|
168
|
+
}
|
|
169
|
+
}, this);
|
|
170
|
+
}, this);
|
|
171
|
+
|
|
172
|
+
return mCollectionUpdates;
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Returns whether any staged collection row currently differs from the live ObjectPage rows,
|
|
177
|
+
* or whether any new rows are pending creation.
|
|
178
|
+
*
|
|
179
|
+
* @param {object} oTableStagingState - table staging state { mStagedRows, mPendingNewRowContexts }
|
|
180
|
+
* @param {object} mCollectionState - collection tracking state
|
|
181
|
+
* @returns {boolean}
|
|
182
|
+
*/
|
|
183
|
+
hasStagedCollectionChanges: function(oTableStagingState, mCollectionState) {
|
|
184
|
+
var mCollectionUpdates = this.buildStagedCollectionUpdates(oTableStagingState, mCollectionState);
|
|
185
|
+
var bHasUpdates = Object.keys(mCollectionUpdates).some(function(sCollectionName) {
|
|
186
|
+
return (mCollectionUpdates[sCollectionName] || []).length > 0;
|
|
187
|
+
});
|
|
188
|
+
if (bHasUpdates) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
// Also return true if there are pending new row contexts
|
|
192
|
+
return Object.keys((oTableStagingState && oTableStagingState.mPendingNewRowContexts) || {}).some(function(sCollectionName) {
|
|
193
|
+
return ((oTableStagingState.mPendingNewRowContexts[sCollectionName]) || []).length > 0;
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Resets the EasyFill dialog to its initial empty state.
|
|
199
|
+
* Clears the dialog model properties, destroys table preview items,
|
|
200
|
+
* and optionally clears the text area value.
|
|
201
|
+
*
|
|
202
|
+
* @param {boolean} bRemoveTextAreaValue - if true, also clears the user input text area
|
|
203
|
+
* @param {object} oDialogModel - the easyFillDialogModel JSONModel
|
|
204
|
+
* @param {object} oController - MVC controller (used to byId controls)
|
|
205
|
+
* @param {object} mCollectionUpdates - mutable collection updates map (cleared in place)
|
|
206
|
+
* @param {object} oEasyFillLayoutMode - EasyFillLayoutMode enum
|
|
207
|
+
* @param {function} fnRevertStagedUpdates - EasyFillTableRenderer.revertStagedCollectionUpdates
|
|
208
|
+
* @param {function} fnResetTransientContext - EasyFillFormRenderer.resetTransientContext
|
|
209
|
+
*/
|
|
210
|
+
resetEasyFill: function(bRemoveTextAreaValue, oDialogModel, oController, mCollectionUpdates, oEasyFillLayoutMode, fnRevertStagedUpdates, fnResetTransientContext) {
|
|
211
|
+
// Remove dynamically-added table ObjectPageSections from the shared OPL
|
|
212
|
+
var sTableSectionMarker = "easyfillTableSection";
|
|
213
|
+
var oObjectPageLayout = oController.byId("EasyFillObjectPageLayout");
|
|
214
|
+
if (oObjectPageLayout) {
|
|
215
|
+
oObjectPageLayout.getSections().filter(function(oSection) {
|
|
216
|
+
return oSection.getCustomData().some(function(oData) {
|
|
217
|
+
return oData.getKey() === sTableSectionMarker;
|
|
218
|
+
});
|
|
219
|
+
}).forEach(function(oSection) {
|
|
220
|
+
oObjectPageLayout.removeSection(oSection);
|
|
221
|
+
oSection.destroy();
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Revert any staged table row values back to original
|
|
226
|
+
fnRevertStagedUpdates();
|
|
227
|
+
|
|
228
|
+
// Reset the transient context (discard all staged scalar AI values)
|
|
229
|
+
fnResetTransientContext();
|
|
230
|
+
|
|
231
|
+
// Reset all dialog model properties to their initial state
|
|
232
|
+
oDialogModel.setProperty("/isFormVisible", false);
|
|
233
|
+
oDialogModel.setProperty("/isIllustrationVisible", true);
|
|
234
|
+
oDialogModel.setProperty("/isSaveEnabled", false);
|
|
235
|
+
oDialogModel.setProperty("/stateType", "Initial");
|
|
236
|
+
oDialogModel.setProperty("/feedbackEnabled", true);
|
|
237
|
+
oDialogModel.setProperty("/feedbackPressedUp", false);
|
|
238
|
+
oDialogModel.setProperty("/feedbackPressedDown", false);
|
|
239
|
+
oDialogModel.setProperty("/isFullScreen", true);
|
|
240
|
+
oDialogModel.setProperty("/hasTableUpdates", false);
|
|
241
|
+
oDialogModel.setProperty("/attemptedMultipleNewRows", false);
|
|
242
|
+
oDialogModel.setProperty("/easyFillMode", oEasyFillLayoutMode.CondensedMode);
|
|
243
|
+
oDialogModel.setProperty("/llmData", {});
|
|
244
|
+
oDialogModel.setProperty("/sections", []);
|
|
245
|
+
oDialogModel.setProperty("/updatableFields", {});
|
|
246
|
+
oDialogModel.setProperty("/nonUpdatableFields", {});
|
|
247
|
+
oDialogModel.setProperty("/hasNonUpdatableFields", false);
|
|
248
|
+
|
|
249
|
+
// Clear the mutable collection updates map in place
|
|
250
|
+
Object.keys(mCollectionUpdates).forEach(function(sKey) {
|
|
251
|
+
delete mCollectionUpdates[sKey];
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
if (bRemoveTextAreaValue) {
|
|
255
|
+
var oTextArea = oController.byId("EasyFillInputTextArea");
|
|
256
|
+
if (oTextArea) {
|
|
257
|
+
oTextArea.setValue("");
|
|
258
|
+
}
|
|
259
|
+
oDialogModel.setProperty("/isEasyFillButtonEnabled", false);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
oLogger.debug("resetEasyFill: dialog state reset" + (bRemoveTextAreaValue ? " (including text area)" : ""));
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
// ─── Private Helpers ─────────────────────────────────────────────────────
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Resolves an OData row context for a collection row update.
|
|
269
|
+
* Prefers context path; falls back to row index.
|
|
270
|
+
* (Mirrors EasyFillTableRenderer._resolveCollectionRowContext to keep this module independent.)
|
|
271
|
+
*
|
|
272
|
+
* @param {string} sCollectionName
|
|
273
|
+
* @param {object} oRowUpdate
|
|
274
|
+
* @param {object} mCollectionState
|
|
275
|
+
* @returns {{ context, rowIndex }|null}
|
|
276
|
+
*/
|
|
277
|
+
_resolveCollectionRowContext: function(sCollectionName, oRowUpdate, mCollectionState) {
|
|
278
|
+
var mByPath = mCollectionState.mCollectionRowContextsByPath[sCollectionName] || Object.create(null);
|
|
279
|
+
var sContextPath = oRowUpdate && oRowUpdate._contextPath;
|
|
280
|
+
if (typeof sContextPath === "string" && mByPath[sContextPath]) {
|
|
281
|
+
return mByPath[sContextPath];
|
|
282
|
+
}
|
|
283
|
+
var iRowIndex = oRowUpdate && oRowUpdate._rowIndex;
|
|
284
|
+
var aRowContexts = mCollectionState.mCollectionRowContexts[sCollectionName] || [];
|
|
285
|
+
if (typeof iRowIndex === "number" && aRowContexts[iRowIndex]) {
|
|
286
|
+
return { context: aRowContexts[iRowIndex], rowIndex: iRowIndex };
|
|
287
|
+
}
|
|
288
|
+
return null;
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
_isEditableProperty: function(oPropertyMeta, oRowObject) {
|
|
292
|
+
if (!oPropertyMeta) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
var sUpdatable = oPropertyMeta["sap:updatable"];
|
|
296
|
+
if (sUpdatable) {
|
|
297
|
+
return sUpdatable !== "false";
|
|
298
|
+
}
|
|
299
|
+
var oAnnotation = oPropertyMeta["com.sap.vocabularies.Common.v1.FieldControl"];
|
|
300
|
+
if (oAnnotation && oAnnotation["EnumMember"]) {
|
|
301
|
+
return oAnnotation["EnumMember"] !== "com.sap.vocabularies.Common.v1.FieldControlType/ReadOnly";
|
|
302
|
+
}
|
|
303
|
+
var sFieldControl = oPropertyMeta["sap:field-control"];
|
|
304
|
+
if (sFieldControl) {
|
|
305
|
+
var iFieldControlValue = oRowObject && oRowObject[sFieldControl];
|
|
306
|
+
return iFieldControlValue !== 1;
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
_isSupportedStagedValue: function(vValue) {
|
|
312
|
+
return vValue === null ||
|
|
313
|
+
vValue === undefined ||
|
|
314
|
+
typeof vValue !== "object" ||
|
|
315
|
+
vValue instanceof Date;
|
|
316
|
+
},
|
|
317
|
+
|
|
318
|
+
_areValuesEqual: function(vLeft, vRight) {
|
|
319
|
+
if (vLeft instanceof Date && vRight instanceof Date) {
|
|
320
|
+
return vLeft.getTime() === vRight.getTime();
|
|
321
|
+
}
|
|
322
|
+
return vLeft === vRight;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
});
|