@sapui5/sap.suite.ui.generic.template 1.142.6 → 1.142.8
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 +94 -11
- 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 +2 -1
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/SmartTable.fragment.xml +3 -2
- package/src/sap/suite/ui/generic/template/ObjectPage/controller/ControllerImplementation.js +5 -2
- 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/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/ai/EasyFilterBarHandler.js +21 -8
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +1 -1
- package/src/sap/suite/ui/generic/template/library.js +1 -1
|
@@ -2,67 +2,35 @@ sap.ui.define([
|
|
|
2
2
|
], function() {
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
function DynamicPageWrapper(
|
|
6
|
-
var oDynamicPage;
|
|
7
|
-
var oPreliminaryState;
|
|
8
|
-
var oControlAssignedResolve;
|
|
9
|
-
var oControlAssignedPromise = new Promise(function(resolve) {
|
|
10
|
-
oControlAssignedResolve = resolve;
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
if (typeof vTarget !== "string") {
|
|
14
|
-
fnSetControl(vTarget);
|
|
15
|
-
}
|
|
16
|
-
|
|
5
|
+
function DynamicPageWrapper(oDynamicPage) {
|
|
17
6
|
// Returns the state of the dynamic page
|
|
18
|
-
// Right now we only consider the pinned status of the dynamic page header
|
|
7
|
+
// Right now we only consider the pinned status of the dynamic page header
|
|
19
8
|
function fnGetState() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return oControlState;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return oPreliminaryState;
|
|
9
|
+
var oControlState = {};
|
|
10
|
+
oControlState.headerPinned = oDynamicPage.getHeaderPinned();
|
|
11
|
+
return oControlState;
|
|
27
12
|
}
|
|
28
13
|
|
|
29
14
|
function fnSetState(oState) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} else {
|
|
38
|
-
oDynamicPage.setHeaderPinned(false);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
15
|
+
if (oState && oState.headerPinned) {
|
|
16
|
+
// There is a possibility that the header is collapsed at this point. Make sure it is expanded if we know the header is to be pinned.
|
|
17
|
+
oDynamicPage.setHeaderExpanded(true);
|
|
18
|
+
oDynamicPage.setHeaderPinned(true);
|
|
19
|
+
} else {
|
|
20
|
+
oDynamicPage.setHeaderPinned(false);
|
|
21
|
+
}
|
|
41
22
|
}
|
|
42
23
|
|
|
43
24
|
function fnAttachStateChanged(fnHandler) {
|
|
44
|
-
|
|
45
|
-
oDynamicPage.attachPinnedStateChange(fnHandler);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function fnSetControl(oControl) {
|
|
50
|
-
oDynamicPage = oControl;
|
|
51
|
-
oControlAssignedResolve(oDynamicPage);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function fnSetHeaderState(oController, bHeaderToBeExpanded) {
|
|
55
|
-
oController.getOwnerComponent().getModel("_templPriv").setProperty("/listReport/isHeaderExpanded", bHeaderToBeExpanded);
|
|
25
|
+
oDynamicPage.attachPinnedStateChange(fnHandler);
|
|
56
26
|
}
|
|
57
27
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
setHeaderState: fnSetHeaderState
|
|
64
|
-
};
|
|
28
|
+
return {
|
|
29
|
+
getState: fnGetState,
|
|
30
|
+
setState: fnSetState,
|
|
31
|
+
attachStateChanged: fnAttachStateChanged
|
|
32
|
+
};
|
|
65
33
|
}
|
|
66
34
|
|
|
67
35
|
return DynamicPageWrapper;
|
|
68
|
-
});
|
|
36
|
+
});
|
|
@@ -2,57 +2,35 @@ sap.ui.define([
|
|
|
2
2
|
], function() {
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
function ObjectPageLayoutWrapper(
|
|
6
|
-
var oObjectPageLayout
|
|
7
|
-
var oControlAssignedPromise = new Promise(function(resolve) {
|
|
8
|
-
oControlAssignedResolve = resolve;
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
if (typeof vTarget !== "string") {
|
|
12
|
-
fnSetControl(vTarget);
|
|
13
|
-
}
|
|
5
|
+
function ObjectPageLayoutWrapper(oControl) {
|
|
6
|
+
var oObjectPageLayout = oControl;
|
|
14
7
|
|
|
15
8
|
// Returns the state of the ObjectPageLayout
|
|
16
|
-
// Right now we only consider the pinned status of the ObjectPageLayout
|
|
9
|
+
// Right now we only consider the pinned status of the ObjectPageLayout
|
|
17
10
|
function fnGetObjectPageLayoutState() {
|
|
18
|
-
if (!oObjectPageLayout) {
|
|
19
|
-
return oPreliminaryState;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
11
|
var oControlState = {};
|
|
23
12
|
oControlState.headerPinned = oObjectPageLayout.getHeaderContentPinned();
|
|
24
13
|
return oControlState;
|
|
25
14
|
}
|
|
26
15
|
|
|
27
16
|
function fnSetObjectPageLayoutState(oState) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
oObjectPageLayout.setHeaderContentPinned(false);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
17
|
+
if (oState && oState.headerPinned) {
|
|
18
|
+
oObjectPageLayout.setHeaderContentPinned(true);
|
|
19
|
+
} else {
|
|
20
|
+
oObjectPageLayout.setHeaderContentPinned(false);
|
|
21
|
+
}
|
|
36
22
|
}
|
|
37
23
|
|
|
38
24
|
function fnAttachStateChanged(fnHandler) {
|
|
39
|
-
|
|
40
|
-
oObjectPageLayout.attachHeaderContentPinnedStateChange(fnHandler);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function fnSetControl(oControl) {
|
|
45
|
-
oObjectPageLayout = oControl;
|
|
46
|
-
oControlAssignedResolve(oObjectPageLayout);
|
|
25
|
+
oObjectPageLayout.attachHeaderContentPinnedStateChange(fnHandler);
|
|
47
26
|
}
|
|
48
27
|
|
|
49
28
|
return {
|
|
50
29
|
getState: fnGetObjectPageLayoutState,
|
|
51
30
|
setState: fnSetObjectPageLayoutState,
|
|
52
|
-
setControl: fnSetControl,
|
|
53
31
|
attachStateChanged: fnAttachStateChanged
|
|
54
32
|
};
|
|
55
33
|
}
|
|
56
34
|
|
|
57
35
|
return ObjectPageLayoutWrapper;
|
|
58
|
-
});
|
|
36
|
+
});
|
|
@@ -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
|
|
|
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
|
|
@@ -217,43 +131,40 @@ sap.ui.define([
|
|
|
217
131
|
}
|
|
218
132
|
|
|
219
133
|
bIsApplying = true;
|
|
220
|
-
oPreliminaryState = oState;
|
|
221
134
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
// Retaining the old value of "modified" flag in the smart variant
|
|
254
|
-
oSmartVariant.currentVariantSetModified(bIsCurrentVariantModifiedBeforeSetState);
|
|
135
|
+
// SFB expects a UIState object - not serializable, but a managed object, actually containing also information not belonging to SFBs state
|
|
136
|
+
// => get current UIState object from SFB, replace only relevant information, and set it again
|
|
137
|
+
var oUiState = oSmartFilterBar.getUiState(),
|
|
138
|
+
oSmartVariant = oSmartFilterBar.getSmartVariant(),
|
|
139
|
+
bIsCurrentVariantModifiedBeforeSetState = oSmartVariant.currentVariantGetModified();
|
|
140
|
+
|
|
141
|
+
oUiState.getSelectionVariant().SelectOptions = oState && oState.selectOptions;
|
|
142
|
+
oUiState.getSelectionVariant().Parameters = oState && oState.parameters;
|
|
143
|
+
oUiState.setSemanticDates(oState && oState.semanticDates);
|
|
144
|
+
// setState is meant to set the state absolutely, no merge needed => replace and strictMode can be set to true.
|
|
145
|
+
// (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
|
|
146
|
+
// 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
|
|
147
|
+
// same control))
|
|
148
|
+
oSmartFilterBar.setUiState(oUiState, {replace: true, strictMode: true});
|
|
149
|
+
|
|
150
|
+
mParams.oCustomFiltersWrapper.setState(oState && oState.customFilters);
|
|
151
|
+
|
|
152
|
+
// set visibility
|
|
153
|
+
// TODO:
|
|
154
|
+
// - How to deal with old states (not containing all information about visibility) -> legacy state handler?
|
|
155
|
+
// - restoring from old state when annotation has changed (new selection fields)?
|
|
156
|
+
oSmartFilterBar.getAllFilterItems().forEach(function(oFilterItem){
|
|
157
|
+
if (oState && oState.addedFilterItems && oState.addedFilterItems.includes(oFilterItem.getName())){
|
|
158
|
+
oFilterItem.setVisibleInFilterBar();
|
|
159
|
+
}
|
|
160
|
+
if (oState && oState.removedFilterItems && oState.removedFilterItems.includes(oFilterItem.getName())){
|
|
161
|
+
oFilterItem.setVisibleInFilterBar(false);
|
|
162
|
+
}
|
|
255
163
|
});
|
|
256
164
|
|
|
165
|
+
// Retaining the old value of "modified" flag in the smart variant
|
|
166
|
+
oSmartVariant.currentVariantSetModified(bIsCurrentVariantModifiedBeforeSetState);
|
|
167
|
+
|
|
257
168
|
// Apparently, SFB does not always correctly adapt the adapt filters count automatically. The following method has been provided espacially to trigger the same.
|
|
258
169
|
// 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.
|
|
259
170
|
oSmartFilterBar.refreshFiltersCount();
|
|
@@ -268,25 +179,11 @@ sap.ui.define([
|
|
|
268
179
|
}
|
|
269
180
|
}
|
|
270
181
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
// unclear, whether this is needed, or filterChange event is anyway raised again (after dialog is closed)
|
|
279
|
-
oSmartFilterBar.attachFiltersDialogClosed(handleStateChanged);
|
|
280
|
-
|
|
281
|
-
// do we need to provide and handle change events from custom filters?
|
|
282
|
-
// contra:
|
|
283
|
-
// - SFB raises filteChange event also for custom filters
|
|
284
|
-
// - maybe also needed to be suppressed while dialog is open
|
|
285
|
-
// pro:
|
|
286
|
-
// - cleaner from architectural perspective
|
|
287
|
-
// - SFB cannot deal correctly with unknown custom controls
|
|
288
|
-
// - existing method in extensionAPI (onCustomAppStateChange)
|
|
289
|
-
mParams.oCustomFiltersWrapper.attachStateChanged(handleStateChanged);
|
|
182
|
+
oSmartFilterBar.attachFilterChange(function () {
|
|
183
|
+
// Don't forward filter change event while dialog is open - changes should only be registered when dialog is closed
|
|
184
|
+
if (!oSmartFilterBar.isDialogOpen()) {
|
|
185
|
+
handleStateChanged();
|
|
186
|
+
}
|
|
290
187
|
});
|
|
291
188
|
// unclear, whether this is needed, or filterChange event is anyway raised again (after dialog is closed)
|
|
292
189
|
oSmartFilterBar.attachFiltersDialogClosed(handleStateChanged);
|
|
@@ -314,15 +211,6 @@ sap.ui.define([
|
|
|
314
211
|
});
|
|
315
212
|
}
|
|
316
213
|
|
|
317
|
-
function fnSetControl(oControl) {
|
|
318
|
-
oSmartFilterBar = oControl;
|
|
319
|
-
oControlAssignedResolve(oSmartFilterBar);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function fnGetMissingNavProperties() {
|
|
323
|
-
return aMissingNavFilters;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
214
|
// check waiting for initialization (like in SmartTableWrapper/SmartChartWrapper)
|
|
327
215
|
// currently, whole appState restoring is waiting for initialized event from sfb - but probably it would be enough to wait for it here
|
|
328
216
|
fnInitialize();
|
|
@@ -331,15 +219,14 @@ sap.ui.define([
|
|
|
331
219
|
// generic properties (provided by all state wrappers)
|
|
332
220
|
getState: fnGetState,
|
|
333
221
|
setState: fnSetState,
|
|
334
|
-
setControl: fnSetControl,
|
|
335
222
|
attachStateChanged: fnAttachStateChanged,
|
|
336
223
|
// specific properties (needed to workaround direct connection between SFB and SVM)
|
|
337
224
|
setSVMWrapperCallbacks: setSVMWrapperCallbacks,
|
|
338
225
|
bVMConnection: oSmartFilterBar.getSmartVariant(),
|
|
339
226
|
suppressSelection: oSmartFilterBar.setSuppressSelection.bind(oSmartFilterBar), // if multiple reasons for suppressing overlap, a counter (to avoid to early resume) could be implemented here
|
|
340
|
-
|
|
227
|
+
oVariantManagementInitializedPromise: oVariantManagementInitializedPromise
|
|
341
228
|
};
|
|
342
229
|
}
|
|
343
230
|
|
|
344
231
|
return SmartFilterBarWrapper;
|
|
345
|
-
});
|
|
232
|
+
});
|