@sapui5/sap.suite.ui.generic.template 1.108.46 → 1.108.49
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_en_US_saprigi.properties +1 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/i18n/i18n_zh_CN.properties +1 -1
- 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 -9
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_ko.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/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_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/fragments/DeterminingButton.fragment.xml +1 -0
- package/src/sap/suite/ui/generic/template/genericUtilities/ControlStateWrapperFactory.js +102 -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 +144 -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 +83 -76
- 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/CRUDManager.js +2 -1
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +7 -6
- 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 +4 -4
- 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,144 @@
|
|
|
1
|
+
sap.ui.define([
|
|
2
|
+
], function() {
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* PreliminaryWrapper - Acts as a proxy wrapper before the real control is available.
|
|
7
|
+
*
|
|
8
|
+
* This wrapper is created when a control state wrapper is requested by ID and type,
|
|
9
|
+
* but the actual control instance doesn't exist yet (e.g., due to lazy loading on ObjectPage).
|
|
10
|
+
* It stores state operations and event handler registrations, then transfers them to the
|
|
11
|
+
* real wrapper once the control is assigned via setControl().
|
|
12
|
+
*
|
|
13
|
+
* @param {string} sId - The local ID of the control
|
|
14
|
+
* @param {string} sType - The type of the control (e.g., "SmartTable", "SmartChart")
|
|
15
|
+
* @param {function} fnCreateRealWrapper - Function to create the real wrapper, injected by factory
|
|
16
|
+
* @param {object} oController - The controller instance
|
|
17
|
+
* @param {object} mParams - Additional parameters to pass to the real wrapper constructor
|
|
18
|
+
* @returns {object} Preliminary wrapper object that will delegate to real wrapper once control is set
|
|
19
|
+
*/
|
|
20
|
+
function PreliminaryWrapper(sId, sType, fnCreateRealWrapper, oController, mParams) {
|
|
21
|
+
var oLatestState;
|
|
22
|
+
var oRealWrapper;
|
|
23
|
+
var fnResolveRealWrapperReady;
|
|
24
|
+
var oRealWrapperReadyPromise = new Promise(function(resolve) {
|
|
25
|
+
fnResolveRealWrapperReady = resolve;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
/**
|
|
30
|
+
* Get the current state. Returns stored state before control is set,
|
|
31
|
+
* delegates to real wrapper afterwards.
|
|
32
|
+
* @returns {object} The current state
|
|
33
|
+
*/
|
|
34
|
+
getState: function() {
|
|
35
|
+
return oRealWrapper ? oRealWrapper.getState() : oLatestState;
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Set the state. Stores state before control is set,
|
|
40
|
+
* delegates to real wrapper afterwards.
|
|
41
|
+
* @param {object} oState - The state to set
|
|
42
|
+
*/
|
|
43
|
+
setState: function(oState) {
|
|
44
|
+
if (oRealWrapper) {
|
|
45
|
+
oRealWrapper.setState(oState);
|
|
46
|
+
} else {
|
|
47
|
+
oLatestState = oState;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Assign the actual control and create the real wrapper.
|
|
53
|
+
* This triggers the creation of the real wrapper, applies any stored state,
|
|
54
|
+
* and resolves the promise that queues event handler attachments.
|
|
55
|
+
* @param {sap.ui.core.Control} oControl - The control instance
|
|
56
|
+
*/
|
|
57
|
+
setControl: function(oControl) {
|
|
58
|
+
// Create the real wrapper using injected function
|
|
59
|
+
var oCreatedWrapper = fnCreateRealWrapper(oControl, sType, mParams);
|
|
60
|
+
|
|
61
|
+
// Check if wrapper needs time to initialize
|
|
62
|
+
var oWrapperReadyPromise = oCreatedWrapper.oReadyPromise || Promise.resolve();
|
|
63
|
+
|
|
64
|
+
// Wait for wrapper to be ready before setting oRealWrapper
|
|
65
|
+
oWrapperReadyPromise.then(function() {
|
|
66
|
+
oRealWrapper = oCreatedWrapper;
|
|
67
|
+
|
|
68
|
+
// Apply stored state if any
|
|
69
|
+
if (oLatestState !== undefined) {
|
|
70
|
+
oRealWrapper.setState(oLatestState);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Resolve the promise - this triggers all queued attachStateChanged calls
|
|
74
|
+
fnResolveRealWrapperReady(oRealWrapper);
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Attach a state change handler. Uses promise to queue attachment
|
|
80
|
+
* until the real wrapper is available and ready.
|
|
81
|
+
* @param {function} fnHandler - The event handler function
|
|
82
|
+
*/
|
|
83
|
+
attachStateChanged: function(fnHandler) {
|
|
84
|
+
// Use promise to defer attachment until real wrapper is available and ready
|
|
85
|
+
oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
86
|
+
oWrapper.attachStateChanged(fnHandler);
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Detach a state change handler. Forwards to real wrapper once available and ready.
|
|
92
|
+
* @param {function} fnHandler - The event handler function to detach
|
|
93
|
+
*/
|
|
94
|
+
detachStateChanged: function(fnHandler) {
|
|
95
|
+
// Forward to real wrapper once available and ready
|
|
96
|
+
oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
97
|
+
oWrapper.detachStateChanged(fnHandler);
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get the local ID of the control.
|
|
103
|
+
* @returns {string} The local ID
|
|
104
|
+
*/
|
|
105
|
+
getLocalId: function() {
|
|
106
|
+
return sId;
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Check if the provided state matches the current state.
|
|
111
|
+
* @param {object} oState - The state to compare
|
|
112
|
+
* @returns {boolean} True if states match
|
|
113
|
+
*/
|
|
114
|
+
isCurrentState: function(oState) {
|
|
115
|
+
return oRealWrapper ? oRealWrapper.isCurrentState(oState) :
|
|
116
|
+
JSON.stringify(oState) === JSON.stringify(oLatestState);
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Called after variant is initialized (for SmartTable/SmartChart wrappers).
|
|
121
|
+
* Delegates to real wrapper once control is set and ready.
|
|
122
|
+
* Note: When this is called, the control always exists (event fired by control),
|
|
123
|
+
* so the promise will already be resolved.
|
|
124
|
+
*/
|
|
125
|
+
onAfterVariantInitialise: function() {
|
|
126
|
+
oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
127
|
+
if (oWrapper.onAfterVariantInitialise) {
|
|
128
|
+
oWrapper.onAfterVariantInitialise();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Promise that resolves to the bVMConnection flag value once the real wrapper is ready.
|
|
135
|
+
* This indicates whether the control is connected to page-wide variant management.
|
|
136
|
+
*/
|
|
137
|
+
oVMConnectionPromise: oRealWrapperReadyPromise.then(function(oWrapper) {
|
|
138
|
+
return oWrapper.bVMConnection;
|
|
139
|
+
})
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return PreliminaryWrapper;
|
|
144
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -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
|
+
});
|