@sapui5/sap.suite.ui.generic.template 1.108.48 → 1.108.50
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_bg.properties +3 -3
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_da.properties +3 -3
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_id.properties +2 -2
- package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +15 -9
- package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +18 -8
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_id.properties +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartChart.fragment.xml +3 -2
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +2 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +4 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/RelatedAppsHandler.js +28 -26
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_pt.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sh.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sl.properties +3 -3
- package/src/sap/suite/ui/generic/template/ObjectPage/i18n/i18n_sr.properties +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartChart.fragment.xml +1 -0
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +2 -1
- package/src/sap/suite/ui/generic/template/genericUtilities/ControlStateWrapperFactory.js +109 -68
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/DynamicPageWrapper.js +19 -51
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/ObjectPageLayoutWrapper.js +10 -32
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/PreliminaryWrapper.js +151 -0
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SearchFieldWrapper.js +8 -30
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartFilterBarWrapper.js +76 -99
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon.js +105 -91
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableWrapper.js +10 -2
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper.js +98 -81
- package/src/sap/suite/ui/generic/template/js/AnnotationHelperStreamSupport.js +25 -6
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +5 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +2 -2
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +2 -2
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +5 -5
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +1 -1
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +7 -7
- package/src/sap/suite/ui/generic/template/library.js +1 -1
|
@@ -4,12 +4,12 @@ sap.ui.define([
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Constructor for SmartFilterBarWrapper
|
|
7
|
-
* @param {sap.ui.comp.smartfilterbar.SmartFilterBar} vTarget - The SmartFilterBar control
|
|
7
|
+
* @param {sap.ui.comp.smartfilterbar.SmartFilterBar} vTarget - The SmartFilterBar control
|
|
8
8
|
* or the Id of control for which this wrapper is created
|
|
9
9
|
* @param {object} oFactory - the controlStateWrapperFactory
|
|
10
|
-
* @param {object} mParams
|
|
10
|
+
* @param {object} mParams
|
|
11
11
|
* @param mParams.oCustomFiltersWrapper - wrapper for custom filters (from SFB point of view)
|
|
12
|
-
* (currently containing: generic (currently only editState), app extension, and adaptation extension - but this is knowledge of LR, i.e. of iAppStateHandler, not of SFB)
|
|
12
|
+
* (currently containing: generic (currently only editState), app extension, and adaptation extension - but this is knowledge of LR, i.e. of iAppStateHandler, not of SFB)
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
|
|
@@ -20,29 +20,36 @@ sap.ui.define([
|
|
|
20
20
|
var dataPropertyNameCustom = "sap.suite.ui.generic.template.customData",
|
|
21
21
|
dataPropertyNameExtension = "sap.suite.ui.generic.template.extensionData",
|
|
22
22
|
dataPropertyNameGeneric = "sap.suite.ui.generic.template.genericData";
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Constructor for SmartFilterBarWrapper
|
|
26
|
+
* @param {sap.ui.comp.smartfilterbar.SmartFilterBar} vTarget - The SmartFilterBar control
|
|
27
|
+
* or the Id of control for which this wrapper is created
|
|
28
|
+
* @param {object} oFactory - the controlStateWrapperFactory
|
|
29
|
+
* @param {object} mParams
|
|
30
|
+
* @param {Object} mParams.oCustomFiltersWrapper - wrapper for custom filters (from SFB point of view)
|
|
31
|
+
* (currently containing: generic (currently only editState), app extension, and adaptation extension - but this is knowledge of LR, i.e. of iAppStateHandler, not of SFB)
|
|
32
|
+
* @returns {object}
|
|
33
|
+
* @alias sap.suite.ui.generic.template.genericUtilities.controlStateWrapperFactory.SmartFilterBarWrapper
|
|
34
|
+
*/
|
|
35
|
+
function SmartFilterBarWrapper(oControl, oFactory, mParams) {
|
|
25
36
|
var bIsApplying = false;
|
|
26
37
|
var aBasicFilters = [];
|
|
27
|
-
var oSmartFilterBar
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
38
|
+
var oSmartFilterBar = oControl;
|
|
39
|
+
|
|
40
|
+
var oVariantManagementInitializedPromise;
|
|
31
41
|
|
|
32
42
|
function fnInitialize() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Filters visible initially (after initialization). Stored here to be
|
|
38
|
-
// able to compare with currently visible ones to identify added and
|
|
39
|
-
// removed ones without need to instantiate all possible filter items
|
|
43
|
+
// Filters visible initially (after initialization). Stored here to be
|
|
44
|
+
// able to compare with currently visible ones to identify added and
|
|
45
|
+
// removed ones without need to instantiate all possible filter items
|
|
40
46
|
// (which would harm performance). Can only be retrieved in initialized event.
|
|
41
|
-
|
|
42
|
-
oSmartFilterBar.
|
|
43
|
-
aBasicFilters = oSmartFilterBar.getAllFilterItems(true);
|
|
44
|
-
});
|
|
47
|
+
oSmartFilterBar.getInitializedPromise().then(function () {
|
|
48
|
+
aBasicFilters = oSmartFilterBar.getAllFilterItems(true);
|
|
45
49
|
});
|
|
50
|
+
|
|
51
|
+
// Initialize variant management promise
|
|
52
|
+
oVariantManagementInitializedPromise = oSmartFilterBar.getInitializedPromise();
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
// Attach to variantFetch and variantLoad events to be able to store and restore also custom filters and state of other controls (in case of page VM) with variant.
|
|
@@ -53,7 +60,7 @@ sap.ui.define([
|
|
|
53
60
|
function setSVMWrapperCallbacks(oSVMWrapperCallbacks){
|
|
54
61
|
// Before saving the current state as a new variant, we need to provide all state data of controls controlled by VM, but not known to it with setCustomFilterData. From a
|
|
55
62
|
// logical point of view, the event (beforeVariantFetch) as well as the method to store the extension data (setCustomFilterData) belong to SVM, but both are implemented
|
|
56
|
-
// in SFB. Additionally, beforeVariantSave would actually be the name more logical to the consumer, however that name had been used earlier and was deprecated and
|
|
63
|
+
// in SFB. Additionally, beforeVariantSave would actually be the name more logical to the consumer, however that name had been used earlier and was deprecated and
|
|
57
64
|
// replaced by the given one. Fetch actually does not mean to fetch variant content from the place variants are stored, but to get the current state from the controls!
|
|
58
65
|
oSmartFilterBar.attachBeforeVariantFetch(function(){
|
|
59
66
|
var oCustomData = Object.create(null);
|
|
@@ -61,14 +68,14 @@ sap.ui.define([
|
|
|
61
68
|
oCustomData[dataPropertyNameGeneric].customFilters = mParams.oCustomFiltersWrapper.getState();
|
|
62
69
|
oSmartFilterBar.setCustomFilterData(oCustomData);
|
|
63
70
|
});
|
|
64
|
-
|
|
71
|
+
|
|
65
72
|
// When a variant is loaded, correspondingly we have to get the customData and apply the states to the controls not known to SVM. Again, event and method are implemented
|
|
66
73
|
// in SFB instead of SVM where it would make more sense.
|
|
67
74
|
// Here the event is afterVariantLoad, as the variant content known to SVM/SFB has first to be applied to the SFB, which will also pass the custom data accordingly. Only
|
|
68
|
-
// after this has happened, we can get the custom data from SFB.
|
|
69
|
-
oSmartFilterBar.attachAfterVariantLoad(function(
|
|
75
|
+
// after this has happened, we can get the custom data from SFB.
|
|
76
|
+
oSmartFilterBar.attachAfterVariantLoad(function(){
|
|
70
77
|
var oCustomData = oSmartFilterBar.getCustomFilterData();
|
|
71
|
-
// variant stored with 1.103 or later: all customFilter data stored in property customFilters
|
|
78
|
+
// variant stored with 1.103 or later: all customFilter data stored in property customFilters
|
|
72
79
|
// legacy variant stored with 1.102 or earlier: customFilters (from storing point of view) separated according to their origin
|
|
73
80
|
var oCustomFiltersState = oCustomData[dataPropertyNameGeneric].customFilters || {
|
|
74
81
|
editState: oCustomData[dataPropertyNameGeneric].editStateFilter,
|
|
@@ -78,18 +85,10 @@ sap.ui.define([
|
|
|
78
85
|
aBasicFilters = oSmartFilterBar.getAllFilterItems(true);
|
|
79
86
|
mParams.oCustomFiltersWrapper.setState(oCustomFiltersState);
|
|
80
87
|
oSVMWrapperCallbacks.setManagedControlStates(oCustomData[dataPropertyNameGeneric]);
|
|
81
|
-
/* SFB header state of a variant (standard or custom) gets determined by the Apply Automatically checkbox's value of the corresponding
|
|
82
|
-
variant i.e. if the checkbox is checked, then the header should be collapsed and vice versa. */
|
|
83
|
-
oSVMWrapperCallbacks.setHeaderState(!oEvent.getParameter("executeOnSelect"));
|
|
84
88
|
});
|
|
85
89
|
|
|
86
90
|
}
|
|
87
|
-
|
|
88
91
|
function fnGetState() {
|
|
89
|
-
if (!oSmartFilterBar) {
|
|
90
|
-
return oPreliminaryState;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
92
|
var oUiState = oSmartFilterBar.getUiState();
|
|
94
93
|
// UiState is not Serializable, but a managed object, containing information only partly relevant
|
|
95
94
|
// relevant information are
|
|
@@ -100,14 +99,14 @@ sap.ui.define([
|
|
|
100
99
|
// added/removedFilterItems: selectOptions only contains values/ranges, not the information, whether the filter should be shown directly ("visibleInFilterBar"). SFB just assumes any items to
|
|
101
100
|
// be shown that contain values (plus those shown per default), which is wrong in two directions: items made visible but without a value are missed, items with a value, but not shown are
|
|
102
101
|
// added additionally
|
|
103
|
-
// Remark:
|
|
102
|
+
// Remark:
|
|
104
103
|
// - When saving as variant, the information seems to be passed to VM directly - but for appState, it would still be missing
|
|
105
104
|
// - Storing added (not in BASIC group but made visible by user) and removed (the other way round) separately to not disconnect the user (using e.g. a saved tile) from future changes
|
|
106
105
|
// in the application (e.g. adding a new property to selection fields)
|
|
107
106
|
// (Remark: old logic (see iAppStateHandler.getByDefaultNonVisibleCustomFilterNames) seems to provide this data only for custom fields. Assumption: Even in VM it was only available for
|
|
108
107
|
// standard fields some time back - now, this seems to be solved from SFB/SVM, but still it's missing for appState)
|
|
109
108
|
var oSelectOptions = oUiState.getSelectionVariant().SelectOptions; // again, data contained in SelectionVaraint is only partly relevant
|
|
110
|
-
// In beforeVariantFetch we need to provide the custom (from SVMs point of view) control's state data to the SFB. However, SFB also tries to interpret this data as
|
|
109
|
+
// In beforeVariantFetch we need to provide the custom (from SVMs point of view) control's state data to the SFB. However, SFB also tries to interpret this data as
|
|
111
110
|
// name-value pairs (implicitly stringifying them and assuming name to be a name of a filter), thus whenever the beforeVariantFetch has occured before getting the state
|
|
112
111
|
// here, the selectionVariant contains a superfluous select option for the property sap.suite.ui.generic.template.genericData (filtering for the value [object Object]).
|
|
113
112
|
// Note: beforeVariantFetch is even called on initial startup, i.e. without explicetly removing it, the superfluous select option would always be there.
|
|
@@ -154,49 +153,46 @@ sap.ui.define([
|
|
|
154
153
|
|
|
155
154
|
function fnSetState(oState) {
|
|
156
155
|
// Don't cause side effects (filter change event), if setting state is no real change.
|
|
157
|
-
// If this comparison fails for state that actually are identically, maybe it needs to be enhanced (e.g. ignoring order in some arrays might be needed)
|
|
156
|
+
// If this comparison fails for state that actually are identically, maybe it needs to be enhanced (e.g. ignoring order in some arrays might be needed)
|
|
158
157
|
if (JSON.stringify(oState) === JSON.stringify(fnGetState())){
|
|
159
158
|
return;
|
|
160
159
|
}
|
|
161
|
-
|
|
160
|
+
|
|
162
161
|
bIsApplying = true;
|
|
163
|
-
oPreliminaryState = oState;
|
|
164
162
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
bIsCurrentVariantModifiedBeforeSetState = oSmartVariant.currentVariantGetModified();
|
|
163
|
+
// SFB expects a UIState object - not serializable, but a managed object, actually containing also information not belonging to SFBs state
|
|
164
|
+
// => get current UIState object from SFB, replace only relevant information, and set it again
|
|
165
|
+
var oUiState = oSmartFilterBar.getUiState(),
|
|
166
|
+
oSmartVariant = oSmartFilterBar.getSmartVariant(),
|
|
167
|
+
bIsCurrentVariantModifiedBeforeSetState = oSmartVariant.currentVariantGetModified();
|
|
171
168
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
169
|
+
oUiState.getSelectionVariant().SelectOptions = oState && oState.selectOptions;
|
|
170
|
+
oUiState.getSelectionVariant().Parameters = oState && oState.parameters;
|
|
171
|
+
oUiState.setSemanticDates(oState && oState.semanticDates);
|
|
172
|
+
// setState is meant to set the state absolutely, no merge needed => replace and strictMode can be set to true.
|
|
173
|
+
// (replace=false can be used to set additional selectOptions but keeping the existing ones. strictMode=false is used to map filters to parameters. Both might make sense in navigation
|
|
174
|
+
// scenarios (navigation parameter to be merged with defaults, property used in source app as filter but in target as parameter), but not when just restoring to a state (provided from the
|
|
175
|
+
// same control))
|
|
176
|
+
oSmartFilterBar.setUiState(oUiState, {replace: true, strictMode: true});
|
|
180
177
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
// set visibility
|
|
184
|
-
// TODO:
|
|
185
|
-
// - How to deal with old states (not containing all information about visibility) -> legacy state handler?
|
|
186
|
-
// - restoring from old state when annotation has changed (new selection fields)?
|
|
187
|
-
oSmartFilterBar.getAllFilterItems().forEach(function(oFilterItem){
|
|
188
|
-
if (oPreliminaryState && oPreliminaryState.addedFilterItems && oPreliminaryState.addedFilterItems.includes(oFilterItem.getName())){
|
|
189
|
-
oFilterItem.setVisibleInFilterBar();
|
|
190
|
-
}
|
|
191
|
-
if (oPreliminaryState && oPreliminaryState.removedFilterItems && oPreliminaryState.removedFilterItems.includes(oFilterItem.getName())){
|
|
192
|
-
oFilterItem.setVisibleInFilterBar(false);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
178
|
+
mParams.oCustomFiltersWrapper.setState(oState && oState.customFilters);
|
|
195
179
|
|
|
196
|
-
|
|
197
|
-
|
|
180
|
+
// set visibility
|
|
181
|
+
// TODO:
|
|
182
|
+
// - How to deal with old states (not containing all information about visibility) -> legacy state handler?
|
|
183
|
+
// - restoring from old state when annotation has changed (new selection fields)?
|
|
184
|
+
oSmartFilterBar.getAllFilterItems().forEach(function(oFilterItem){
|
|
185
|
+
if (oState && oState.addedFilterItems && oState.addedFilterItems.includes(oFilterItem.getName())){
|
|
186
|
+
oFilterItem.setVisibleInFilterBar();
|
|
187
|
+
}
|
|
188
|
+
if (oState && oState.removedFilterItems && oState.removedFilterItems.includes(oFilterItem.getName())){
|
|
189
|
+
oFilterItem.setVisibleInFilterBar(false);
|
|
190
|
+
}
|
|
198
191
|
});
|
|
199
192
|
|
|
193
|
+
// Retaining the old value of "modified" flag in the smart variant
|
|
194
|
+
oSmartVariant.currentVariantSetModified(bIsCurrentVariantModifiedBeforeSetState);
|
|
195
|
+
|
|
200
196
|
// Apparently, SFB does not always correctly adapt the adapt filters count automatically. The following method has been provided espacially to trigger the same.
|
|
201
197
|
// TODO: Verify, whether this is really needed (or was rather an artifact of old structure) - if yes, this API should be made public, if no, we should remove the call.
|
|
202
198
|
oSmartFilterBar.refreshFiltersCount();
|
|
@@ -211,29 +207,15 @@ sap.ui.define([
|
|
|
211
207
|
}
|
|
212
208
|
}
|
|
213
209
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
// unclear, whether this is needed, or filterChange event is anyway raised again (after dialog is closed)
|
|
222
|
-
oSmartFilterBar.attachFiltersDialogClosed(handleStateChanged);
|
|
223
|
-
|
|
224
|
-
// do we need to provide and handle change events from custom filters?
|
|
225
|
-
// contra:
|
|
226
|
-
// - SFB raises filteChange event also for custom filters
|
|
227
|
-
// - maybe also needed to be suppressed while dialog is open
|
|
228
|
-
// pro:
|
|
229
|
-
// - cleaner from architectural perspective
|
|
230
|
-
// - SFB cannot deal correctly with unknown custom controls
|
|
231
|
-
// - existing method in extensionAPI (onCustomAppStateChange)
|
|
232
|
-
mParams.oCustomFiltersWrapper.attachStateChanged(handleStateChanged);
|
|
210
|
+
oSmartFilterBar.attachFilterChange(function () {
|
|
211
|
+
// Don't forward filter change event while dialog is open - changes should only be registered when dialog is closed
|
|
212
|
+
if (!oSmartFilterBar.isDialogOpen()) {
|
|
213
|
+
handleStateChanged();
|
|
214
|
+
}
|
|
233
215
|
});
|
|
234
216
|
// unclear, whether this is needed, or filterChange event is anyway raised again (after dialog is closed)
|
|
235
217
|
oSmartFilterBar.attachFiltersDialogClosed(handleStateChanged);
|
|
236
|
-
|
|
218
|
+
|
|
237
219
|
// do we need to provide and handle change events from custom filters?
|
|
238
220
|
// contra:
|
|
239
221
|
// - SFB raises filteChange event also for custom filters
|
|
@@ -244,7 +226,7 @@ sap.ui.define([
|
|
|
244
226
|
// - existing method in extensionAPI (onCustomAppStateChange)
|
|
245
227
|
mParams.oCustomFiltersWrapper.attachStateChanged(function(){
|
|
246
228
|
handleStateChanged();
|
|
247
|
-
// When a custom filter value is changed by the user, not only the appState changes, but also the variant needs to be marked as dirty. For some known controls, this is
|
|
229
|
+
// When a custom filter value is changed by the user, not only the appState changes, but also the variant needs to be marked as dirty. For some known controls, this is
|
|
248
230
|
// handled from the SFB (which informs the SVM directly). This logic is broken from architectural point of view, as it does not allow to use arbitrary own controls for
|
|
249
231
|
// extension filters (which is the general idea of an extension).
|
|
250
232
|
// However, when user selects a variant, custom filters also have to be restored, but that must not mark the selected variant as dirty. Ideally, this should be handled
|
|
@@ -257,27 +239,22 @@ sap.ui.define([
|
|
|
257
239
|
});
|
|
258
240
|
}
|
|
259
241
|
|
|
260
|
-
function fnSetControl(oControl) {
|
|
261
|
-
oSmartFilterBar = oControl;
|
|
262
|
-
oControlAssignedResolve(oSmartFilterBar);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
242
|
// check waiting for initialization (like in SmartTableWrapper/SmartChartWrapper)
|
|
266
243
|
// currently, whole appState restoring is waiting for initialized event from sfb - but probably it would be enough to wait for it here
|
|
267
244
|
fnInitialize();
|
|
268
|
-
|
|
245
|
+
|
|
269
246
|
return {
|
|
270
|
-
// generic properties (provided by all state wrappers)
|
|
247
|
+
// generic properties (provided by all state wrappers)
|
|
271
248
|
getState: fnGetState,
|
|
272
249
|
setState: fnSetState,
|
|
273
|
-
setControl: fnSetControl,
|
|
274
250
|
attachStateChanged: fnAttachStateChanged,
|
|
275
251
|
// specific properties (needed to workaround direct connection between SFB and SVM)
|
|
276
252
|
setSVMWrapperCallbacks: setSVMWrapperCallbacks,
|
|
277
253
|
bVMConnection: oSmartFilterBar.getSmartVariant(),
|
|
278
|
-
suppressSelection: oSmartFilterBar.setSuppressSelection.bind(oSmartFilterBar) // if multiple reasons for suppressing overlap, a counter (to avoid to early resume) could be implemented here
|
|
254
|
+
suppressSelection: oSmartFilterBar.setSuppressSelection.bind(oSmartFilterBar), // if multiple reasons for suppressing overlap, a counter (to avoid to early resume) could be implemented here
|
|
255
|
+
oVariantManagementInitializedPromise: oVariantManagementInitializedPromise
|
|
279
256
|
};
|
|
280
257
|
}
|
|
281
258
|
|
|
282
259
|
return SmartFilterBarWrapper;
|
|
283
|
-
});
|
|
260
|
+
});
|
|
@@ -4,47 +4,71 @@ sap.ui.define([
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Constructor for SmartTableChartCommon
|
|
7
|
-
*
|
|
8
|
-
* @param {object}
|
|
9
|
-
* @param
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
7
|
+
* @param {sap.ui.core.Control} oControl - The SmartTable or SmartChart control
|
|
8
|
+
* @param {object} oController - The controller instance
|
|
9
|
+
* @param {object} oFactory - The ControlStateWrapperFactory instance
|
|
10
|
+
* @param {string} sInitializationEvent - The initialization event name (e.g., "initialise")
|
|
11
|
+
* @param {object} [mExtensions] - Optional extension functions for control-specific state handling
|
|
12
|
+
* @param {function} [mExtensions.fnExtendGetUiState] - Function to extend UiState during getState
|
|
13
|
+
* Called with (oStateUiState, oControlUiState) where modifications to oStateUiState add to the state
|
|
14
|
+
* @param {function} [mExtensions.fnExtendSetUiState] - Function to extend UiState during setState
|
|
15
|
+
* Called with (oStateUiState, oControlUiState) where oStateUiState contains the state to apply
|
|
16
|
+
* @returns {object}
|
|
12
17
|
*/
|
|
13
18
|
|
|
14
|
-
// deals with state of SFB itself, without SVM (see SmartVariantManagementWrapper) and go-button
|
|
19
|
+
// deals with state of SFB itself, without SVM (see SmartVariantManagementWrapper) and go-button
|
|
15
20
|
// (does not contain a state from SFB point of view - however, we remember whether it was pressed once
|
|
16
21
|
// to restore data - this information is not considered being part of SFB)
|
|
17
|
-
function SmartTableChartCommon(
|
|
18
|
-
var oSmartControl
|
|
19
|
-
var
|
|
22
|
+
function SmartTableChartCommon(oControl, oController, oFactory, sInitializationEvent, mExtensions) {
|
|
23
|
+
var oSmartControl = oControl;
|
|
24
|
+
var oVariantManagementControl, bVariantManagementActive;
|
|
20
25
|
var oSmartControlStateWrapper;
|
|
21
26
|
var oVariantManagementStateWrapper;
|
|
27
|
+
var oVariantManagementInitializedResolve;
|
|
28
|
+
var fnResolveReady;
|
|
22
29
|
|
|
23
|
-
var
|
|
24
|
-
|
|
30
|
+
var oVariantManagementInitializedPromise = new Promise(function(resolve){
|
|
31
|
+
oVariantManagementInitializedResolve = resolve;
|
|
25
32
|
});
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
var oReadyPromise = new Promise(function(resolve) {
|
|
35
|
+
fnResolveReady = resolve;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Initialize control state wrapper and check if control is already initialized
|
|
39
|
+
oSmartControlStateWrapper = getControlWrapper(oSmartControl);
|
|
40
|
+
if (!oSmartControl.isInitialised()) {
|
|
41
|
+
// In case Smart Chart/Table is not yet initialized
|
|
42
|
+
// listen to the initialize event & then initialize the wrapper
|
|
43
|
+
oSmartControl.attachEvent(sInitializationEvent, fnControlInitialized);
|
|
44
|
+
} else {
|
|
45
|
+
fnControlInitialized();
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
// creates a simple wrapper for a SmartTable or SmartChart (a control using UIState) (ignoring initialization and vm)
|
|
32
49
|
function getControlWrapper(oControl) {
|
|
33
50
|
var bIsApplying = false; // avoid forwarding change event when caused by us applying a state
|
|
34
51
|
function fnGetState() {
|
|
35
|
-
var
|
|
52
|
+
var oControlUiState = oControl.getUiState(); // unfortunately not serializable, but a managed object
|
|
53
|
+
var oStateUiState = {
|
|
54
|
+
oPresentationVariant: oControlUiState.getPresentationVariant(),
|
|
55
|
+
oSelectionVariant: oControlUiState.getSelectionVariant()
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Allow extension to add control-specific properties (e.g., tableSettings for SmartTable)
|
|
59
|
+
if (mExtensions && mExtensions.fnExtendGetUiState) {
|
|
60
|
+
mExtensions.fnExtendGetUiState(oStateUiState, oControlUiState);
|
|
61
|
+
}
|
|
62
|
+
|
|
36
63
|
return {
|
|
37
|
-
oUiState:
|
|
38
|
-
oPresentationVariant: oUiState.getPresentationVariant(),
|
|
39
|
-
oSelectionVariant: oUiState.getSelectionVariant()
|
|
40
|
-
}
|
|
64
|
+
oUiState: oStateUiState
|
|
41
65
|
};
|
|
42
66
|
}
|
|
43
67
|
|
|
44
68
|
function fnSetState(oState) {
|
|
45
69
|
if (oState) {
|
|
46
70
|
if (!oState.oUiState) {
|
|
47
|
-
// Legacy handling for state without additional level oUiState (created with 1.99.0 - 1.99.3). Could be relevant on LR and OP, and independent of VM
|
|
71
|
+
// Legacy handling for state without additional level oUiState (created with 1.99.0 - 1.99.3). Could be relevant on LR and OP, and independent of VM
|
|
48
72
|
oState = {
|
|
49
73
|
oUiState: oState
|
|
50
74
|
};
|
|
@@ -52,11 +76,17 @@ sap.ui.define([
|
|
|
52
76
|
bIsApplying = true;
|
|
53
77
|
// don't create UiState (managed object) from scratch, but fetch it from control and only apply known properties from state - thus, if any other properties would be added, we don't
|
|
54
78
|
// interfere with them
|
|
55
|
-
var
|
|
56
|
-
if (!
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
var oControlUiState = oControl.getUiState();
|
|
80
|
+
if (!oControlUiState.getProperty("variantName")){
|
|
81
|
+
oControlUiState.setPresentationVariant(oState.oUiState.oPresentationVariant);
|
|
82
|
+
oControlUiState.setSelectionVariant(oState.oUiState.oSelectionVariant);
|
|
83
|
+
|
|
84
|
+
// Allow extension to set control-specific properties (e.g., tableSettings for SmartTable)
|
|
85
|
+
if (mExtensions && mExtensions.fnExtendSetUiState) {
|
|
86
|
+
mExtensions.fnExtendSetUiState(oState.oUiState, oControlUiState);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
oControl.setUiState(oControlUiState);
|
|
60
90
|
}
|
|
61
91
|
bIsApplying = false;
|
|
62
92
|
} else {
|
|
@@ -82,71 +112,59 @@ sap.ui.define([
|
|
|
82
112
|
getState: fnGetState,
|
|
83
113
|
setState: fnSetState,
|
|
84
114
|
getLocalId: fnGetLocalId,
|
|
85
|
-
bVMConnection:
|
|
86
|
-
attachStateChanged: fnAttachStateChanged
|
|
115
|
+
bVMConnection: oControl && oControl.getSmartVariant && !!oControl.getSmartVariant(),
|
|
116
|
+
attachStateChanged: fnAttachStateChanged,
|
|
117
|
+
onAfterVariantInitialise: oVariantManagementInitializedResolve
|
|
87
118
|
};
|
|
88
119
|
}
|
|
89
120
|
|
|
90
121
|
function fnGetState() {
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// or VariantManagement is not enabled.
|
|
95
|
-
return oVariantManagementStateWrapper.getState();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (oSmartControlStateWrapper && !bVariantManagementActive) {
|
|
99
|
-
// VariantManagement is not turned on & SmartControlStateWrapper instance
|
|
100
|
-
return oSmartControlStateWrapper.getState();
|
|
101
|
-
}
|
|
122
|
+
if (oVariantManagementStateWrapper) {
|
|
123
|
+
// Variant management is active
|
|
124
|
+
return oVariantManagementStateWrapper.getState();
|
|
102
125
|
}
|
|
103
|
-
|
|
104
|
-
//
|
|
105
|
-
return
|
|
126
|
+
|
|
127
|
+
// No variant management - return control state directly
|
|
128
|
+
return oSmartControlStateWrapper.getState();
|
|
106
129
|
}
|
|
107
130
|
|
|
108
131
|
function fnSetState(oState) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// map legacy states - before separating VM state from state of managed control, inner state information
|
|
112
|
-
// (presentation variant and selection variant) were put as oUiState on the same level as VM state
|
|
113
|
-
// information (variant id and dirty indicator), now they are contained in map managedControlStates
|
|
114
|
-
if (oState && oState.oUiState && !oState.managedControlStates){
|
|
115
|
-
oState.managedControlStates = Object.create(null);
|
|
116
|
-
oState.managedControlStates[oSmartControlStateWrapper.getLocalId()] = {oUiState: oState.oUiState};
|
|
117
|
-
oState.modified = oState.bVariantModified;
|
|
118
|
-
oState.variantId = oState.sVariantId;
|
|
119
|
-
}
|
|
120
|
-
|
|
132
|
+
if (!oState) {
|
|
133
|
+
// If no state provided, set standard variant on control
|
|
121
134
|
if (bVariantManagementActive) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
oVariantManagementStateWrapper.setState(oState);
|
|
136
|
+
} else {
|
|
137
|
+
oSmartControlStateWrapper.setState(oState);
|
|
125
138
|
}
|
|
126
|
-
|
|
127
|
-
// SmartTable/Chart shall be used
|
|
128
|
-
oSmartControlStateWrapper.setState(oPreliminaryState);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function fnSetControl(oControl) {
|
|
133
|
-
oSmartControl = oControl;
|
|
134
|
-
oSmartControlStateWrapper = getControlWrapper(oSmartControl);
|
|
135
|
-
if (!oSmartControl.isInitialised()) {
|
|
136
|
-
// In case Smart Chart/Table is not yet initialized
|
|
137
|
-
// listen to the initialize event & then resolve the control
|
|
138
|
-
oSmartControl.attachEvent(sInitializationEvent, fnControlInitialized);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
// Map legacy states - before separating VM state from state of managed control, inner state information
|
|
143
|
+
// (presentation variant and selection variant) were put as oUiState on the same level as VM state
|
|
144
|
+
// information (variant id and dirty indicator), now they are contained in map managedControlStates
|
|
145
|
+
if (oState.oUiState && !oState.managedControlStates) {
|
|
146
|
+
oState.managedControlStates = Object.create(null);
|
|
147
|
+
oState.managedControlStates[oSmartControlStateWrapper.getLocalId()] = {oUiState: oState.oUiState};
|
|
148
|
+
}
|
|
149
|
+
if (oState.bVariantModified !== undefined) {
|
|
150
|
+
oState.modified = oState.bVariantModified;
|
|
151
|
+
}
|
|
152
|
+
if (oState.sVariantId !== undefined) {
|
|
153
|
+
oState.variantId = oState.sVariantId;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (bVariantManagementActive) {
|
|
157
|
+
// In case VariantManagement is configured
|
|
158
|
+
oVariantManagementStateWrapper.setState(oState);
|
|
159
|
+
} else {
|
|
160
|
+
// SmartTable/Chart shall be used
|
|
161
|
+
oSmartControlStateWrapper.setState(oState);
|
|
162
|
+
}
|
|
143
163
|
}
|
|
144
164
|
|
|
145
165
|
function fnControlInitialized() {
|
|
146
|
-
bSmartControlInitialized = true;
|
|
147
|
-
|
|
148
166
|
// deal with VM
|
|
149
|
-
// 3
|
|
167
|
+
// 3 possibilities with respect to VM
|
|
150
168
|
// a) no VM (relevant for this control) at all
|
|
151
169
|
// b) control managed as part of page wide variant management
|
|
152
170
|
// c) control creates own VM
|
|
@@ -155,7 +173,7 @@ sap.ui.define([
|
|
|
155
173
|
// in each case) -thus, we better create and return a vm wrapper here, passing the inner wrapper (the same, we would create in the other cases).
|
|
156
174
|
// Additionally, this simplifies the adaptation to the change of format (formerly, variant data and control data were mixed on same level)
|
|
157
175
|
|
|
158
|
-
// to identify the situation, check properties smartVariant and useVariantManagement. (In LR/ALP, we could directly check component settings controlling these properties, but not
|
|
176
|
+
// to identify the situation, check properties smartVariant and useVariantManagement. (In LR/ALP, we could directly check component settings controlling these properties, but not
|
|
159
177
|
// in OP, as they could be different per section. Checking control's properties would also incorporate UI changes, however, these properties are anyway not allowed to be changed.)
|
|
160
178
|
// values: smartVariant useVariantManagement
|
|
161
179
|
// a) null false on LR currently: truthy (id of VM) and true - but PageVM is not created, and thus being ignored => adapt how properties are set in xml
|
|
@@ -170,39 +188,35 @@ sap.ui.define([
|
|
|
170
188
|
oVariantManagementStateWrapper = oFactory.getControlStateWrapper(oVariantManagementControl, {
|
|
171
189
|
managedControlWrappers: [ oSmartControlStateWrapper ]
|
|
172
190
|
});
|
|
173
|
-
|
|
191
|
+
fnResolveReady();
|
|
174
192
|
} else {
|
|
175
|
-
//
|
|
176
|
-
// also initialized
|
|
193
|
+
// Wait for VariantManagement to be initialized
|
|
177
194
|
oSmartControl.attachAfterVariantInitialise(fnControlInitialized);
|
|
178
195
|
}
|
|
179
|
-
|
|
180
|
-
|
|
196
|
+
} else {
|
|
197
|
+
// No variant management or page-level variant management - ready immediately
|
|
198
|
+
fnResolveReady();
|
|
181
199
|
}
|
|
182
|
-
// There is no VariantManagement configured for this SmartChart/SmartTable
|
|
183
|
-
oControlAssignedResolve(oSmartControl);
|
|
184
200
|
}
|
|
185
201
|
|
|
186
202
|
function fnAttachStateChanged(fnHandler) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
203
|
+
if (bVariantManagementActive) {
|
|
204
|
+
oVariantManagementStateWrapper.attachStateChanged(fnHandler);
|
|
205
|
+
} else {
|
|
193
206
|
oSmartControlStateWrapper.attachStateChanged(fnHandler);
|
|
194
|
-
|
|
195
|
-
});
|
|
207
|
+
}
|
|
196
208
|
}
|
|
197
209
|
|
|
198
210
|
return {
|
|
199
211
|
getState: fnGetState,
|
|
200
212
|
setState: fnSetState,
|
|
201
|
-
setControl: fnSetControl,
|
|
202
213
|
attachStateChanged: fnAttachStateChanged,
|
|
203
|
-
bVMConnection: oSmartControl && oSmartControl.getSmartVariant && !!oSmartControl.getSmartVariant()
|
|
214
|
+
bVMConnection: oSmartControl && oSmartControl.getSmartVariant && !!oSmartControl.getSmartVariant(),
|
|
215
|
+
oVariantManagementInitializedPromise: oVariantManagementInitializedPromise,
|
|
216
|
+
onAfterVariantInitialise: oVariantManagementInitializedResolve,
|
|
217
|
+
oReadyPromise: oReadyPromise
|
|
204
218
|
};
|
|
205
219
|
}
|
|
206
220
|
|
|
207
221
|
return SmartTableChartCommon;
|
|
208
|
-
});
|
|
222
|
+
});
|
|
@@ -2,10 +2,18 @@ sap.ui.define([
|
|
|
2
2
|
"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon"
|
|
3
3
|
], function(SmartTableChartCommon) {
|
|
4
4
|
"use strict";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Constructor for SmartTableWrapper
|
|
8
|
+
* @param {sap.ui.comp.smarttable.SmartTable} oSmartTable - The SmartTable control
|
|
9
|
+
* @param {object} oController - The controller instance
|
|
10
|
+
* @param {object} oFactory - The ControlStateWrapperFactory instance
|
|
11
|
+
* @returns {object} Wrapper object for SmartTable
|
|
12
|
+
*/
|
|
6
13
|
function SmartTableWrapper(oSmartTable, oController, oFactory){
|
|
14
|
+
// SmartTable extends SmartTableChartCommon with tableSettings support
|
|
7
15
|
return new SmartTableChartCommon(oSmartTable, oController, oFactory, "initialise");
|
|
8
16
|
}
|
|
9
17
|
|
|
10
18
|
return SmartTableWrapper;
|
|
11
|
-
});
|
|
19
|
+
});
|