@sapui5/sap.suite.ui.generic.template 1.145.0 → 1.145.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/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 +92 -9
- package/src/sap/suite/ui/generic/template/ListReport/controller/IappStateHandler.js +19 -8
- package/src/sap/suite/ui/generic/template/ListReport/manifest.json +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 +5 -4
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +7 -4
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartChart.fragment.xml +3 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/SmartTable.fragment.xml +3 -2
- 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.js +108 -67
- package/src/sap/suite/ui/generic/template/genericUtilities/controlHelper.js +29 -29
- 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 +49 -162
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon.js +100 -94
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableWrapper.js +22 -3
- package/src/sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartVariantManagementWrapper.js +90 -81
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
- package/src/sap/suite/ui/generic/template/library.js +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
"sap/base/util/extend"
|
|
3
|
+
], function(extend) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* PreliminaryWrapper - Acts as a proxy wrapper before the real control is available.
|
|
8
|
+
*
|
|
9
|
+
* This wrapper is created when a control state wrapper is requested by ID and type,
|
|
10
|
+
* but the actual control instance doesn't exist yet (e.g., due to lazy loading on ObjectPage).
|
|
11
|
+
* It stores state operations and event handler registrations, then transfers them to the
|
|
12
|
+
* real wrapper once the control is assigned via setControl().
|
|
13
|
+
*
|
|
14
|
+
* @param {string} sId - The local ID of the control
|
|
15
|
+
* @param {function} fnCreateRealWrapper - Function to create the real wrapper, bound with type and params
|
|
16
|
+
* @returns {object} Preliminary wrapper object that will delegate to real wrapper once control is set
|
|
17
|
+
*/
|
|
18
|
+
function PreliminaryWrapper(sId, fnCreateRealWrapper) {
|
|
19
|
+
var oLatestState;
|
|
20
|
+
var oRealWrapper;
|
|
21
|
+
var fnResolveRealWrapperReady;
|
|
22
|
+
var oRealWrapperReadyPromise = new Promise(function(resolve) {
|
|
23
|
+
fnResolveRealWrapperReady = resolve;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
var oPublicInterface = {
|
|
27
|
+
/**
|
|
28
|
+
* Get the current state. Returns stored state before control is set,
|
|
29
|
+
* delegates to real wrapper afterwards.
|
|
30
|
+
* @returns {object} The current state
|
|
31
|
+
*/
|
|
32
|
+
getState: function() {
|
|
33
|
+
return oRealWrapper ? oRealWrapper.getState() : oLatestState;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Set the state. Stores state before control is set,
|
|
38
|
+
* delegates to real wrapper afterwards.
|
|
39
|
+
* @param {object} oState - The state to set
|
|
40
|
+
*/
|
|
41
|
+
setState: function(oState) {
|
|
42
|
+
if (oRealWrapper) {
|
|
43
|
+
oRealWrapper.setState(oState);
|
|
44
|
+
} else {
|
|
45
|
+
oLatestState = oState;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Assign the actual control and create the real wrapper.
|
|
51
|
+
* This triggers the creation of the real wrapper, applies any stored state,
|
|
52
|
+
* extends the preliminary wrapper with all methods from the real wrapper,
|
|
53
|
+
* and resolves the promise that queues event handler attachments.
|
|
54
|
+
* @param {sap.ui.core.Control} oControl - The control instance
|
|
55
|
+
*/
|
|
56
|
+
setControl: function(oControl) {
|
|
57
|
+
// Create the real wrapper using bound function (already has type and params bound)
|
|
58
|
+
var oCreatedWrapper = fnCreateRealWrapper(oControl);
|
|
59
|
+
|
|
60
|
+
// Check if wrapper needs time to initialize
|
|
61
|
+
var oWrapperReadyPromise = oCreatedWrapper.oReadyPromise || Promise.resolve();
|
|
62
|
+
|
|
63
|
+
// Wait for wrapper to be ready before setting oRealWrapper
|
|
64
|
+
oWrapperReadyPromise.then(function() {
|
|
65
|
+
oRealWrapper = oCreatedWrapper;
|
|
66
|
+
|
|
67
|
+
// Apply stored state if any
|
|
68
|
+
if (oLatestState !== undefined) {
|
|
69
|
+
oRealWrapper.setState(oLatestState);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Extend the preliminary wrapper with all properties from the real wrapper
|
|
73
|
+
// This makes any additional methods (like setSVMWrapperCallbacks) available
|
|
74
|
+
// The nested extend ensures we keep our proxy methods (getState, setState, etc.)
|
|
75
|
+
// while adding new methods from the real wrapper
|
|
76
|
+
extend(oPublicInterface, extend({}, oRealWrapper, oPublicInterface));
|
|
77
|
+
|
|
78
|
+
// Resolve the promise - this triggers all queued attachStateChanged calls
|
|
79
|
+
fnResolveRealWrapperReady(oRealWrapper);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Attach a state change handler. Uses promise to queue attachment
|
|
85
|
+
* until the real wrapper is available and ready.
|
|
86
|
+
* @param {function} fnHandler - The event handler function
|
|
87
|
+
*/
|
|
88
|
+
attachStateChanged: function(fnHandler) {
|
|
89
|
+
// Use promise to defer attachment until real wrapper is available and ready
|
|
90
|
+
oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
91
|
+
oWrapper.attachStateChanged(fnHandler);
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Detach a state change handler. Forwards to real wrapper once available and ready.
|
|
97
|
+
* @param {function} fnHandler - The event handler function to detach
|
|
98
|
+
*/
|
|
99
|
+
detachStateChanged: function(fnHandler) {
|
|
100
|
+
// Forward to real wrapper once available and ready
|
|
101
|
+
oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
102
|
+
oWrapper.detachStateChanged(fnHandler);
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get the local ID of the control.
|
|
108
|
+
* @returns {string} The local ID
|
|
109
|
+
*/
|
|
110
|
+
getLocalId: function() {
|
|
111
|
+
return sId;
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Check if the provided state matches the current state.
|
|
116
|
+
* @param {object} oState - The state to compare
|
|
117
|
+
* @returns {boolean} True if states match
|
|
118
|
+
*/
|
|
119
|
+
isCurrentState: function(oState) {
|
|
120
|
+
return oRealWrapper ? oRealWrapper.isCurrentState(oState) :
|
|
121
|
+
JSON.stringify(oState) === JSON.stringify(oLatestState);
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Called after variant is initialized (for SmartTable/SmartChart wrappers).
|
|
126
|
+
* Delegates to real wrapper once control is set and ready.
|
|
127
|
+
* Note: When this is called, the control always exists (event fired by control),
|
|
128
|
+
* so the promise will already be resolved.
|
|
129
|
+
*/
|
|
130
|
+
onAfterVariantInitialise: function() {
|
|
131
|
+
oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
132
|
+
if (oWrapper.onAfterVariantInitialise) {
|
|
133
|
+
oWrapper.onAfterVariantInitialise();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Promise that resolves to the bVMConnection flag value once the real wrapper is ready.
|
|
140
|
+
* This indicates whether the control is connected to page-wide variant management.
|
|
141
|
+
*/
|
|
142
|
+
oVMConnectionPromise: oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
143
|
+
return oWrapper.bVMConnection;
|
|
144
|
+
})
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
return oPublicInterface;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return PreliminaryWrapper;
|
|
151
|
+
});
|
|
@@ -2,54 +2,32 @@ sap.ui.define([
|
|
|
2
2
|
], function() {
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
function SearchFieldWrapper(
|
|
6
|
-
var oSearchField
|
|
7
|
-
var oControlAssignedPromise = new Promise(function(resolve) {
|
|
8
|
-
oControlAssignedResolve = resolve;
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
if (typeof vTarget !== "string") {
|
|
12
|
-
fnSetControl(vTarget);
|
|
13
|
-
}
|
|
5
|
+
function SearchFieldWrapper(oControl) {
|
|
6
|
+
var oSearchField = oControl;
|
|
14
7
|
|
|
15
8
|
function fnGetState() {
|
|
16
|
-
if (!oSearchField) {
|
|
17
|
-
return oPreliminaryState;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
9
|
return {
|
|
21
10
|
searchString: oSearchField.getValue()
|
|
22
11
|
};
|
|
23
12
|
}
|
|
24
13
|
|
|
25
14
|
function fnSetState(oState) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// when restoring from an appState of a worklist, always data should be shown at time of saving the state and thus automatically search would be triggered again
|
|
31
|
-
// oSearchField.fireSearch();
|
|
32
|
-
});
|
|
15
|
+
oSearchField.setValue(oState.searchString);
|
|
16
|
+
// original implementation also called fireSearch. Seems to be superfluous (would fire the search event, on which worklisthandler is registered and finally calls rebindTable
|
|
17
|
+
// when restoring from an appState of a worklist, always data should be shown at time of saving the state and thus automatically search would be triggered again
|
|
18
|
+
// oSearchField.fireSearch();
|
|
33
19
|
}
|
|
34
20
|
|
|
35
21
|
function fnAttachStateChanged(fnHandler) {
|
|
36
|
-
|
|
37
|
-
oSearchField.attachLiveChange(fnHandler);
|
|
38
|
-
});
|
|
22
|
+
oSearchField.attachLiveChange(fnHandler);
|
|
39
23
|
}
|
|
40
24
|
|
|
41
|
-
function fnSetControl(oControl) {
|
|
42
|
-
oSearchField = oControl;
|
|
43
|
-
oControlAssignedResolve(oSearchField);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
25
|
return {
|
|
47
26
|
getState: fnGetState,
|
|
48
27
|
setState: fnSetState,
|
|
49
|
-
setControl: fnSetControl,
|
|
50
28
|
attachStateChanged: fnAttachStateChanged
|
|
51
29
|
};
|
|
52
30
|
}
|
|
53
31
|
|
|
54
32
|
return SearchFieldWrapper;
|
|
55
|
-
});
|
|
33
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
sap.ui.define([
|
|
2
|
-
|
|
3
|
-
], function (FilterOperator) {
|
|
2
|
+
], function () {
|
|
4
3
|
"use strict";
|
|
5
4
|
|
|
6
5
|
|
|
@@ -23,29 +22,24 @@ sap.ui.define([
|
|
|
23
22
|
* @returns {object}
|
|
24
23
|
* @alias sap.suite.ui.generic.template.genericUtilities.controlStateWrapperFactory.SmartFilterBarWrapper
|
|
25
24
|
*/
|
|
26
|
-
function SmartFilterBarWrapper(
|
|
25
|
+
function SmartFilterBarWrapper(oControl, oFactory, mParams) {
|
|
27
26
|
var bIsApplying = false;
|
|
28
27
|
var aBasicFilters = [];
|
|
29
|
-
var
|
|
30
|
-
var oSmartFilterBar, oControlAssignedResolve, oPreliminaryState;
|
|
31
|
-
var oControlAssignedPromise = new Promise(function (resolve) {
|
|
32
|
-
oControlAssignedResolve = resolve;
|
|
33
|
-
});
|
|
28
|
+
var oSmartFilterBar = oControl;
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
if (typeof vTarget !== "string") {
|
|
37
|
-
fnSetControl(vTarget);
|
|
38
|
-
}
|
|
30
|
+
var oVariantManagementInitializedPromise;
|
|
39
31
|
|
|
32
|
+
function fnInitialize() {
|
|
40
33
|
// Filters visible initially (after initialization). Stored here to be
|
|
41
34
|
// able to compare with currently visible ones to identify added and
|
|
42
35
|
// removed ones without need to instantiate all possible filter items
|
|
43
36
|
// (which would harm performance). Can only be retrieved in initialized event.
|
|
44
|
-
|
|
45
|
-
oSmartFilterBar.
|
|
46
|
-
aBasicFilters = oSmartFilterBar.getAllFilterItems(true);
|
|
47
|
-
});
|
|
37
|
+
oSmartFilterBar.getInitializedPromise().then(function () {
|
|
38
|
+
aBasicFilters = oSmartFilterBar.getAllFilterItems(true);
|
|
48
39
|
});
|
|
40
|
+
|
|
41
|
+
// Initialize variant management promise
|
|
42
|
+
oVariantManagementInitializedPromise = oSmartFilterBar.getInitializedPromise();
|
|
49
43
|
}
|
|
50
44
|
|
|
51
45
|
// 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.
|
|
@@ -69,7 +63,7 @@ sap.ui.define([
|
|
|
69
63
|
// in SFB instead of SVM where it would make more sense.
|
|
70
64
|
// 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
|
|
71
65
|
// after this has happened, we can get the custom data from SFB.
|
|
72
|
-
oSmartFilterBar.attachAfterVariantLoad(function(
|
|
66
|
+
oSmartFilterBar.attachAfterVariantLoad(function(){
|
|
73
67
|
var oCustomData = oSmartFilterBar.getCustomFilterData();
|
|
74
68
|
// variant stored with 1.103 or later: all customFilter data stored in property customFilters
|
|
75
69
|
// legacy variant stored with 1.102 or earlier: customFilters (from storing point of view) separated according to their origin
|
|
@@ -81,91 +75,11 @@ sap.ui.define([
|
|
|
81
75
|
aBasicFilters = oSmartFilterBar.getAllFilterItems(true);
|
|
82
76
|
mParams.oCustomFiltersWrapper.setState(oCustomFiltersState);
|
|
83
77
|
oSVMWrapperCallbacks.setManagedControlStates(oCustomData[dataPropertyNameGeneric]);
|
|
84
|
-
/* SFB header state of a variant (standard or custom) gets determined by the Apply Automatically checkbox's value of the corresponding
|
|
85
|
-
variant i.e. if the checkbox is checked, then the header should be collapsed and vice versa. */
|
|
86
|
-
oSVMWrapperCallbacks.setHeaderState(!oEvent.getParameter("executeOnSelect"));
|
|
87
|
-
aMissingNavFilters = fnGetNavigationProperties();
|
|
88
78
|
});
|
|
89
79
|
|
|
90
80
|
}
|
|
91
81
|
|
|
92
|
-
function fnGetNavigationProperties() {
|
|
93
|
-
//Fetch the navigation properties
|
|
94
|
-
const oMetaModel = oSmartFilterBar.getModel().getMetaModel(),
|
|
95
|
-
sEntitySet = oSmartFilterBar.getEntitySet(),
|
|
96
|
-
oDataEntitySet = oMetaModel.getODataEntitySet(sEntitySet),
|
|
97
|
-
oDataEntityType = oMetaModel.getODataEntityType(oDataEntitySet.entityType),
|
|
98
|
-
aNavigationProperties = oDataEntityType['navigationProperty'];
|
|
99
|
-
//Fetch the added filters in the current variant
|
|
100
|
-
const sCurrentVariantID = oSmartFilterBar.getVariantManagement().getCurrentVariantId(),
|
|
101
|
-
oCurrentVariant = oSmartFilterBar.getVariantManagement().getAllVariants().find(function(variant) {
|
|
102
|
-
return variant.getId() === sCurrentVariantID;
|
|
103
|
-
});
|
|
104
|
-
if (!oCurrentVariant
|
|
105
|
-
|| !oCurrentVariant.getContent()
|
|
106
|
-
|| !oCurrentVariant.getContent().searchListReportVariant
|
|
107
|
-
|| !oCurrentVariant.getContent().searchListReportVariant.filterBarVariant
|
|
108
|
-
|| !aNavigationProperties
|
|
109
|
-
|| !aNavigationProperties.length
|
|
110
|
-
) {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
const oManifestNavigationProperties = oSmartFilterBar.getNavigationProperties() ?
|
|
114
|
-
oSmartFilterBar.getNavigationProperties().split(",").reduce(function(accumulator, currentValue){
|
|
115
|
-
accumulator[currentValue] = true;
|
|
116
|
-
return accumulator;
|
|
117
|
-
}, {}) : {},
|
|
118
|
-
oNavigationProperties = aNavigationProperties.reduce(function(accumulator, currentValue){
|
|
119
|
-
accumulator[currentValue.name] = true;
|
|
120
|
-
return accumulator;
|
|
121
|
-
}, {}),
|
|
122
|
-
oSmartFilterBarVariant = JSON.parse(oCurrentVariant.getContent().searchListReportVariant.filterBarVariant),
|
|
123
|
-
aMissing = [];
|
|
124
|
-
delete oSmartFilterBarVariant["_CUSTOM"];
|
|
125
|
-
|
|
126
|
-
// Compare the filter source and navigation properties
|
|
127
|
-
// Take into account if parameter is already specified in page setting in manifest.json - settings->filterSettings->navigationProperties
|
|
128
|
-
// If parameter exist in navigationProperties -> SFB will handle specific parameter and code ignore it
|
|
129
|
-
for (const sFilterKey in oSmartFilterBarVariant) {
|
|
130
|
-
const sParamName = sFilterKey.split(".")[0]; // take first part from navigation parameter. Example: to_Currency.Currency_Code -> to_Currency
|
|
131
|
-
if (!oNavigationProperties[sParamName] || oManifestNavigationProperties[sParamName]
|
|
132
|
-
) {
|
|
133
|
-
// Parameter is
|
|
134
|
-
// 1) not navigation property -> we don't process it
|
|
135
|
-
// 2) is defined in manifest.json - settings->filterSettings->navigationProperties -> value will be handled by SFB
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (oSmartFilterBarVariant[sFilterKey].items && oSmartFilterBarVariant[sFilterKey].items.length) {
|
|
139
|
-
aMissing.push(oSmartFilterBarVariant[sFilterKey].items.map(function(entry) {
|
|
140
|
-
return {
|
|
141
|
-
exclude: false,
|
|
142
|
-
field: sFilterKey,
|
|
143
|
-
operation: FilterOperator.EQ,
|
|
144
|
-
value1: entry.key
|
|
145
|
-
};
|
|
146
|
-
}));
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (oSmartFilterBarVariant[sFilterKey].ranges && oSmartFilterBarVariant[sFilterKey].ranges.length) {
|
|
150
|
-
aMissing.push(oSmartFilterBarVariant[sFilterKey].ranges.map(function(entry) {
|
|
151
|
-
return {
|
|
152
|
-
exclude: entry.exclude,
|
|
153
|
-
field: entry.keyField,
|
|
154
|
-
operation: entry.operation,
|
|
155
|
-
value1: entry.value1,
|
|
156
|
-
value2: entry.value2
|
|
157
|
-
};
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return aMissing;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
82
|
function fnGetState() {
|
|
165
|
-
if (!oSmartFilterBar) {
|
|
166
|
-
return oPreliminaryState;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
83
|
var oUiState = oSmartFilterBar.getUiState();
|
|
170
84
|
// UiState is not Serializable, but a managed object, containing information only partly relevant
|
|
171
85
|
// relevant information are
|
|
@@ -224,43 +138,40 @@ sap.ui.define([
|
|
|
224
138
|
}
|
|
225
139
|
|
|
226
140
|
bIsApplying = true;
|
|
227
|
-
oPreliminaryState = oState;
|
|
228
|
-
|
|
229
|
-
oControlAssignedPromise.then(function() {
|
|
230
|
-
// SFB expects a UIState object - not serializable, but a managed object, actually containing also information not belonging to SFBs state
|
|
231
|
-
// => get current UIState object from SFB, replace only relevant information, and set it again
|
|
232
|
-
var oUiState = oSmartFilterBar.getUiState(),
|
|
233
|
-
oSmartVariant = oSmartFilterBar.getSmartVariant(),
|
|
234
|
-
bIsCurrentVariantModifiedBeforeSetState = oSmartVariant.currentVariantGetModified();
|
|
235
|
-
|
|
236
|
-
oUiState.getSelectionVariant().SelectOptions = oPreliminaryState && oPreliminaryState.selectOptions;
|
|
237
|
-
oUiState.getSelectionVariant().Parameters = oPreliminaryState && oPreliminaryState.parameters;
|
|
238
|
-
oUiState.setSemanticDates(oPreliminaryState && oPreliminaryState.semanticDates);
|
|
239
|
-
// setState is meant to set the state absolutely, no merge needed => replace and strictMode can be set to true.
|
|
240
|
-
// (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
|
|
241
|
-
// 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
|
|
242
|
-
// same control))
|
|
243
|
-
oSmartFilterBar.setUiState(oUiState, {replace: true, strictMode: true});
|
|
244
|
-
|
|
245
|
-
mParams.oCustomFiltersWrapper.setState(oPreliminaryState && oPreliminaryState.customFilters);
|
|
246
141
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
142
|
+
// SFB expects a UIState object - not serializable, but a managed object, actually containing also information not belonging to SFBs state
|
|
143
|
+
// => get current UIState object from SFB, replace only relevant information, and set it again
|
|
144
|
+
var oUiState = oSmartFilterBar.getUiState(),
|
|
145
|
+
oSmartVariant = oSmartFilterBar.getSmartVariant(),
|
|
146
|
+
bIsCurrentVariantModifiedBeforeSetState = oSmartVariant.currentVariantGetModified();
|
|
147
|
+
|
|
148
|
+
oUiState.getSelectionVariant().SelectOptions = oState && oState.selectOptions;
|
|
149
|
+
oUiState.getSelectionVariant().Parameters = oState && oState.parameters;
|
|
150
|
+
oUiState.setSemanticDates(oState && oState.semanticDates);
|
|
151
|
+
// setState is meant to set the state absolutely, no merge needed => replace and strictMode can be set to true.
|
|
152
|
+
// (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
|
|
153
|
+
// 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
|
|
154
|
+
// same control))
|
|
155
|
+
oSmartFilterBar.setUiState(oUiState, {replace: true, strictMode: true});
|
|
156
|
+
|
|
157
|
+
mParams.oCustomFiltersWrapper.setState(oState && oState.customFilters);
|
|
158
|
+
|
|
159
|
+
// set visibility
|
|
160
|
+
// TODO:
|
|
161
|
+
// - How to deal with old states (not containing all information about visibility) -> legacy state handler?
|
|
162
|
+
// - restoring from old state when annotation has changed (new selection fields)?
|
|
163
|
+
oSmartFilterBar.getAllFilterItems().forEach(function(oFilterItem){
|
|
164
|
+
if (oState && oState.addedFilterItems && oState.addedFilterItems.includes(oFilterItem.getName())){
|
|
165
|
+
oFilterItem.setVisibleInFilterBar();
|
|
166
|
+
}
|
|
167
|
+
if (oState && oState.removedFilterItems && oState.removedFilterItems.includes(oFilterItem.getName())){
|
|
168
|
+
oFilterItem.setVisibleInFilterBar(false);
|
|
169
|
+
}
|
|
262
170
|
});
|
|
263
171
|
|
|
172
|
+
// Retaining the old value of "modified" flag in the smart variant
|
|
173
|
+
oSmartVariant.currentVariantSetModified(bIsCurrentVariantModifiedBeforeSetState);
|
|
174
|
+
|
|
264
175
|
// Apparently, SFB does not always correctly adapt the adapt filters count automatically. The following method has been provided espacially to trigger the same.
|
|
265
176
|
// 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.
|
|
266
177
|
oSmartFilterBar.refreshFiltersCount();
|
|
@@ -275,25 +186,11 @@ sap.ui.define([
|
|
|
275
186
|
}
|
|
276
187
|
}
|
|
277
188
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
// unclear, whether this is needed, or filterChange event is anyway raised again (after dialog is closed)
|
|
286
|
-
oSmartFilterBar.attachFiltersDialogClosed(handleStateChanged);
|
|
287
|
-
|
|
288
|
-
// do we need to provide and handle change events from custom filters?
|
|
289
|
-
// contra:
|
|
290
|
-
// - SFB raises filteChange event also for custom filters
|
|
291
|
-
// - maybe also needed to be suppressed while dialog is open
|
|
292
|
-
// pro:
|
|
293
|
-
// - cleaner from architectural perspective
|
|
294
|
-
// - SFB cannot deal correctly with unknown custom controls
|
|
295
|
-
// - existing method in extensionAPI (onCustomAppStateChange)
|
|
296
|
-
mParams.oCustomFiltersWrapper.attachStateChanged(handleStateChanged);
|
|
189
|
+
oSmartFilterBar.attachFilterChange(function () {
|
|
190
|
+
// Don't forward filter change event while dialog is open - changes should only be registered when dialog is closed
|
|
191
|
+
if (!oSmartFilterBar.isDialogOpen()) {
|
|
192
|
+
handleStateChanged();
|
|
193
|
+
}
|
|
297
194
|
});
|
|
298
195
|
// unclear, whether this is needed, or filterChange event is anyway raised again (after dialog is closed)
|
|
299
196
|
oSmartFilterBar.attachFiltersDialogClosed(handleStateChanged);
|
|
@@ -321,15 +218,6 @@ sap.ui.define([
|
|
|
321
218
|
});
|
|
322
219
|
}
|
|
323
220
|
|
|
324
|
-
function fnSetControl(oControl) {
|
|
325
|
-
oSmartFilterBar = oControl;
|
|
326
|
-
oControlAssignedResolve(oSmartFilterBar);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function fnGetMissingNavProperties() {
|
|
330
|
-
return aMissingNavFilters;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
221
|
// check waiting for initialization (like in SmartTableWrapper/SmartChartWrapper)
|
|
334
222
|
// currently, whole appState restoring is waiting for initialized event from sfb - but probably it would be enough to wait for it here
|
|
335
223
|
fnInitialize();
|
|
@@ -338,15 +226,14 @@ sap.ui.define([
|
|
|
338
226
|
// generic properties (provided by all state wrappers)
|
|
339
227
|
getState: fnGetState,
|
|
340
228
|
setState: fnSetState,
|
|
341
|
-
setControl: fnSetControl,
|
|
342
229
|
attachStateChanged: fnAttachStateChanged,
|
|
343
230
|
// specific properties (needed to workaround direct connection between SFB and SVM)
|
|
344
231
|
setSVMWrapperCallbacks: setSVMWrapperCallbacks,
|
|
345
232
|
bVMConnection: oSmartFilterBar.getSmartVariant(),
|
|
346
233
|
suppressSelection: oSmartFilterBar.setSuppressSelection.bind(oSmartFilterBar), // if multiple reasons for suppressing overlap, a counter (to avoid to early resume) could be implemented here
|
|
347
|
-
|
|
234
|
+
oVariantManagementInitializedPromise: oVariantManagementInitializedPromise
|
|
348
235
|
};
|
|
349
236
|
}
|
|
350
237
|
|
|
351
238
|
return SmartFilterBarWrapper;
|
|
352
|
-
});
|
|
239
|
+
});
|